Skip to content

Commit 5700faf

Browse files
Merge pull request #47 from anshss/ci
Migration to v7
2 parents 810f370 + 6e4fecd commit 5700faf

File tree

138 files changed

+179374
-155238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+179374
-155238
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
ignore:
8+
- dependency-name: "*"
9+
allow:
10+
- dependency-name: "@lit-protocol/lit-node-client"

.github/workflows/migrate-lit.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Package Migration
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
types: [opened]
7+
workflow_dispatch:
8+
9+
jobs:
10+
migrate-package:
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '20'
21+
22+
- name: Install dependencies
23+
run: yarn install
24+
25+
- name: Run package migration
26+
run: yarn upgrade:all
27+
28+
- name: Create
29+
id: commit-changes
30+
run: |
31+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
32+
git config --global user.name "GitHub Actions Bot"
33+
34+
if [ "${{ github.event_name }}" = "pull_request" ]; then
35+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
36+
else
37+
BRANCH_NAME="package-migration-branch-${{ github.sha }}"
38+
git checkout -b "$BRANCH_NAME"
39+
fi
40+
41+
git add .
42+
git commit -m "Automated package migration" || echo "No changes to commit"
43+
44+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
45+
46+
- name: Push changes
47+
if: success()
48+
run: |
49+
git push --set-upstream origin "${{ steps.commit-changes.outputs.branch_name }}"
50+
echo "Pushed to branch: ${{ steps.commit-changes.outputs.branch_name }}"

.github/workflows/test-lit.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Test Lit Examples
2+
3+
on:
4+
# schedule:
5+
# - cron: '0 0,12 * * *'
6+
pull_request:
7+
branches:
8+
- master
9+
workflow_dispatch:
10+
11+
jobs:
12+
setup-and-test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
24+
- name: Install root dependencies
25+
run: yarn install
26+
27+
- name: Create .env file for lit-action-using-fetch
28+
run: |
29+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/lit-action-using-fetch/nodejs/.env
30+
31+
- name: Create .env file for paying-for-lit
32+
run: |
33+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/paying-for-lit/nodejs/.env
34+
35+
- name: Create .env file for payment-delegation-db-relayer
36+
run: |
37+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/payment-delegation-db-relayer/nodejs/.env
38+
echo "LIT_NETWORK=${{ secrets.LIT_NETWORK }}" >> $GITHUB_WORKSPACE/payment-delegation-db-relayer/nodejs/.env
39+
echo "LIT_RELAYER_API_KEY=${{ secrets.LIT_RELAYER_API_KEY }}" >> $GITHUB_WORKSPACE/payment-delegation-db-relayer/nodejs/.env
40+
echo "LIT_PAYER_SECRET_KEY=${{ secrets.LIT_PAYER_SECRET_KEY }}" >> $GITHUB_WORKSPACE/payment-delegation-db-relayer/nodejs/.env
41+
42+
- name: Create .env file for pkp-migration
43+
run: |
44+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/pkp-migration/nodejs/.env
45+
echo "LIT_FROM_NETWORK=${{ secrets.LIT_FROM_NETWORK }}" >> $GITHUB_WORKSPACE/pkp-migration/nodejs/.env
46+
echo "LIT_TO_NETWORK=${{ secrets.LIT_TO_NETWORK }}" >> $GITHUB_WORKSPACE/pkp-migration/nodejs/.env
47+
echo "ADD_PKP_ETH_ADDRESS_AS_PERMITTED_ADDRESS=${{ secrets.ADD_PKP_ETH_ADDRESS_AS_PERMITTED_ADDRESS }}" >> $GITHUB_WORKSPACE/pkp-migration/nodejs/.env
48+
echo "SEND_PKP_TO_ITSELF=${{ secrets.SEND_PKP_TO_ITSELF }}" >> $GITHUB_WORKSPACE/pkp-migration/nodejs/.env
49+
50+
- name: Create .env file for session-signatures/getLitActionSessionSigs
51+
run: |
52+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/session-signatures/getLitActionSessionSigs/.env
53+
54+
- name: Create .env file for session-signatures/getPkpSessionSigs
55+
run: |
56+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/session-signatures/getPkpSessionSigs/.env
57+
58+
- name: Create .env file for session-signatures/getSessionSigs
59+
run: |
60+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/session-signatures/getSessionSigs/.env
61+
62+
- name: Create .env file for sign-and-combine-ecdsa
63+
run: |
64+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/sign-and-combine-ecdsa/nodejs/.env
65+
echo "CHAIN_TO_SEND_TX_ON=${{ secrets.CHAIN_TO_SEND_TX_ON }}" >> $GITHUB_WORKSPACE/sign-and-combine-ecdsa/nodejs/.env
66+
67+
- name: Create .env file for wrapped-keys
68+
run: |
69+
echo "ETHEREUM_PRIVATE_KEY=${{ secrets.ETHEREUM_PRIVATE_KEY }}" > $GITHUB_WORKSPACE/wrapped-keys/nodejs/.env
70+
echo "SOLANA_PRIVATE_KEY=${{ secrets.SOLANA_PRIVATE_KEY }}" >> $GITHUB_WORKSPACE/wrapped-keys/nodejs/.env
71+
72+
- name: Run Tests
73+
run: yarn test-lit
74+
continue-on-error: false

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
/**/*/node_modules
2-
/**/*/.env
2+
/**/*/.env
3+
/**/**/.yarn
4+
/**/*/.yarnrc.yml
5+
6+
node_modules
7+
.nx
8+
.secrets
9+
.pnp.*
10+

.secrets.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
LIT_NETWORK=datil-test
2+
LIT_FROM_NETWORK=cayenne
3+
LIT_TO_NETWORK=datil-dev
4+
ADD_PKP_ETH_ADDRESS_AS_PERMITTED_ADDRESS=false
5+
SEND_PKP_TO_ITSELF=false
6+
LIT_PKP_PUBLIC_KEY=
7+
LIT_CAPACITY_CREDIT_TOKEN_ID=
8+
CHAIN_TO_SEND_TX_ON=yellowstone
9+
10+
# private secrets
11+
SOLANA_PRIVATE_KEY=
12+
ETHEREUM_PRIVATE_KEY=
13+
LIT_RELAYER_API_KEY=
14+
LIT_PAYER_SECRET_KEY=

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodeLinker: node-modules
2+
yarnPath: "scripts/yarn-berry.cjs"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ These examples are designed to help you get started building with Lit!
44

55
Each example has instructions within its own README file!
66

7-
# Tools
7+
# Test
88

9-
Reports the versions of dependencies starting with `@lit-protocol`
9+
Test the examples
1010

1111
```
12-
node ./report.mjs --tag=latest
13-
node ./report.mjs --tag=datil-dev
12+
yarn
13+
yarn test-lit
1414
```

btc-trigger/nodejs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "btc-trigger-example",
2+
"name": "btc-trigger-nodejs",
33
"version": "0.1.0",
44
"description": "Example of triggering a Bitcoin transaction with Lit Protocol",
55
"type": "module",
66
"scripts": {
77
"test": "npx @dotenvx/dotenvx run -- mocha test/**/*.spec.ts"
88
},
99
"dependencies": {
10-
"@lit-protocol/constants": "^6.6.0",
11-
"@lit-protocol/lit-node-client": "^6.6.0",
10+
"@lit-protocol/constants": "^7.0.0-alpha.9",
11+
"@lit-protocol/lit-node-client": "^7.0.0-alpha.9",
1212
"@mempool/mempool.js": "^2.3.0",
1313
"@simplewebauthn/browser": "^10.0.0",
1414
"@types/elliptic": "^6.4.18",

btc-trigger/nodejs/project.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "btc-trigger-nodejs",
3+
"root": "btc-trigger/nodejs",
4+
"targets": {
5+
"test-lit": {
6+
"executor": "nx:run-commands",
7+
"options": {
8+
"command": "cd btc-trigger/nodejs && yarn && yarn test"
9+
}
10+
}
11+
}
12+
}

btc-trigger/nodejs/src/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { LitNodeClient } from "@lit-protocol/lit-node-client";
2-
import { LitNetwork, LIT_RPC, } from "@lit-protocol/constants";
2+
import { LIT_NETWORK, LIT_RPC, LIT_ABILITY } from "@lit-protocol/constants";
33
import {
44
createSiweMessageWithRecaps,
55
generateAuthSig,
6-
LitAbility,
76
LitActionResource,
87
LitPKPResource,
98
} from "@lit-protocol/auth-helpers";
@@ -26,7 +25,7 @@ const PKP_PUBLIC_KEY = getEnv("PKP_PUBLIC_KEY");
2625
const ETHEREUM_PRIVATE_KEY = getEnv("ETHEREUM_PRIVATE_KEY");
2726
const BTC_DESTINATION_ADDRESS = getEnv("BTC_DESTINATION_ADDRESS");
2827
const BROADCAST_URL = getEnv("BROADCAST_URL");
29-
const LIT_NETWORK = process.env["LIT_NETWORK"] as LIT_NETWORKS_KEYS || LitNetwork.Datil;
28+
const SELECTED_LIT_NETWORK = process.env["LIT_NETWORK"] as LIT_NETWORKS_KEYS || LIT_NETWORK.Datil;
3029
const LIT_CAPACITY_CREDIT_TOKEN_ID = process.env["LIT_CAPACITY_CREDIT_TOKEN_ID"];
3130

3231
const ethersWallet = new ethers.Wallet(
@@ -44,14 +43,14 @@ export const executeBtcSigning = async () => {
4443

4544
try {
4645
litNodeClient = new LitNodeClient({
47-
litNetwork: LIT_NETWORK,
46+
litNetwork: SELECTED_LIT_NETWORK,
4847
debug: false,
4948
});
5049
await litNodeClient.connect();
5150

5251
const litContracts = new LitContracts({
5352
signer: ethersWallet,
54-
network: LIT_NETWORK,
53+
network: SELECTED_LIT_NETWORK,
5554
debug: false,
5655
});
5756
await litContracts.connect();
@@ -87,11 +86,11 @@ export const executeBtcSigning = async () => {
8786
resourceAbilityRequests: [
8887
{
8988
resource: new LitPKPResource("*"),
90-
ability: LitAbility.PKPSigning,
89+
ability: LIT_ABILITY.PKPSigning,
9190
},
9291
{
9392
resource: new LitActionResource("*"),
94-
ability: LitAbility.LitActionExecution,
93+
ability: LIT_ABILITY.LitActionExecution,
9594
},
9695
],
9796
authNeededCallback: async ({

0 commit comments

Comments
 (0)