Merge pull request #4 from andrei0x309/main-dev

chore: test workflow
This commit is contained in:
Andrei O 2024-07-09 17:04:29 +03:00 committed by GitHub
commit ed301a7be8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 317 additions and 38 deletions

32
.github/workflow.yaml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Bun Script Execution
on:
#push: # Trigger on push events to master branch (you can adjust this trigger)
workflow_dispatch: # Trigger on manual workflow dispatch
jobs:
run-bun-script:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Get Parameters (for push event)
if: github.event_name == 'push'
run: |
# No parameters are automatically provided on push events
echo "No parameters provided on push event."
- name: Get Parameters (for manual trigger)
if: github.event_name == 'workflow_dispatch'
run: |
PARAM_VALUE_1=${{ github.event.inputs.param1 }}
PARAM_VALUE_2=${{ github.event.inputs.param2 }}
# ... add more parameter retrieval as needed
# Use empty strings if parameters are not provided
- name: Run Bun Script
run: bun run index.ts --param1 $PARAM_VALUE_1 --param2 $PARAM_VALUE_2
# Adjust the command based on your parameter names and flags

175
CI/.gitignore vendored Normal file
View File

@ -0,0 +1,175 @@
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
# Logs
logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Caches
.cache
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# Runtime data
pids
_.pid
_.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

15
CI/README.md Normal file
View File

@ -0,0 +1,15 @@
# ci
To install dependencies:
```bash
bun install
```
To run:
```bash
bun run index.ts
```
This project was created using `bun init` in bun v1.1.7. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

BIN
CI/bun.lockb Normal file

Binary file not shown.

23
CI/index.ts Normal file
View File

@ -0,0 +1,23 @@
import { YupAPI } from 'yup-api-interact'
const args = Bun.argv.slice(3);
const secrets = JSON.parse(args[0]);
const githubEvvent = JSON.parse(args[1]);
const action = args[2]
const main = async () => {
const YUP_PK = secrets.YUP_PK;
const api = new YupAPI({ PK: YUP_PK, token: '' });
if(action === 'commit') {
console.log('Announcing commit')
console.log(secrets, githubEvvent)
}
}
main().catch(console.error);

15
CI/package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "ci",
"module": "index.ts",
"type": "module",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"yup-api-interact": "^0.1.4",
"farcaster-hub-utils": "https://github.com/andrei0x309/farcaster-hub-utils#main"
}
}

27
CI/tsconfig.json Normal file
View File

@ -0,0 +1,27 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

View File

@ -31,40 +31,38 @@ export default defineComponent({
if (chrome.runtime.lastError) { if (chrome.runtime.lastError) {
console.info("Error receiving message:", chrome.runtime.lastError); console.info("Error receiving message:", chrome.runtime.lastError);
} }
if (message?.type !== "CLWALLET_PAGE_MSG") { if (message?.type === "CLWALLET_PAGE_MSG") {
return true; console.info("page listener:", message);
}
console.info("page listener:", message); (async () => {
if (!message?.method) {
(async () => { sendResponse({
if (!message?.method) { code: 500,
sendResponse({ message: "Invalid request method",
code: 500, });
message: "Invalid request method", } else {
}); // ETH API
} else { switch (message.method) {
// ETH API case "paste": {
switch (message.method) { const currentAddress = (await getSelectedAddress()) as string[];
case "paste": { if (currentAddress.length > 0) {
const currentAddress = (await getSelectedAddress()) as string[]; document.execCommand("insertText", false, currentAddress[0]);
if (currentAddress.length > 0) { }
document.execCommand("insertText", false, currentAddress[0]); sendResponse(true);
break;
}
default: {
sendResponse({
error: true,
message:
"ClearWallet: Invalid PAGE request method " + (message?.method ?? ""),
});
break;
} }
sendResponse(true);
break;
}
default: {
sendResponse({
error: true,
message:
"ClearWallet: Invalid PAGE request method " + (message?.method ?? ""),
});
break;
} }
} }
} })();
})(); }
return true; return true;
}; };

View File

@ -66,7 +66,7 @@ window.addEventListener("message", (event) => {
}, },
} }
if(event?.data?.data?.data?.method !== 'eth_chainId') { if(event?.data?.data?.data?.method !== 'eth_chainId') {
// console.info('data out', data) console.info('data out', data)
} }
window.postMessage(data, "*"); window.postMessage(data, "*");

View File

@ -101,7 +101,7 @@ const sendMessage = (args: RequestArguments, ping = false, from = 'request'): Pr
data.type = 'CLWALLET_PING' data.type = 'CLWALLET_PING'
} }
if(method!== 'eth_chainId') { if(method!== 'eth_chainId') {
// console.info('data in', data) console.info('data in', data)
} }
window.postMessage(data, "*"); window.postMessage(data, "*");

View File

@ -630,12 +630,6 @@ const mainListner = (message: RequestArguments, sender:any, sendResponse: (a: an
sendResponse(false) sendResponse(false)
break break
} }
case 'net_version': {
const network = await getSelectedNetwork()
const chainId = String(network?.chainId ?? 1)
sendResponse(chainId)
break
}
case 'wallet_switchEthereumChain': { case 'wallet_switchEthereumChain': {
try { try {
const currentChainId = `0x${((await getSelectedNetwork())?.chainId ?? 0).toString(16)}` const currentChainId = `0x${((await getSelectedNetwork())?.chainId ?? 0).toString(16)}`