-
Notifications
You must be signed in to change notification settings - Fork 88
feat: build lit actions and update cids when building sdk #698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Ansonhkg
merged 11 commits into
master
from
feature/lit-3902-build-publish-pipeline-for-wk-las
Apr 16, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7c60ecf
feat: build lit actions and update cids when building sdk
FedericoAmura b37e08f
feat: publish lit actions code to ipfs automatically before publishin…
FedericoAmura f5550f7
Merge branch 'master' into feature/lit-3902-build-publish-pipeline-fo…
FedericoAmura c3ed484
fix: remove catch swallowing error on LA CID constants update script
FedericoAmura 8750d1d
feat: update CID generation script and storage to use independent jso…
FedericoAmura 61ef9fd
feat: make WKLA update and publish the LAs automatically on prepublis…
FedericoAmura eb7ed55
Merge branch 'refs/heads/master' into feature/lit-3902-build-publish-…
FedericoAmura 01e8dc4
feat: npm script missed on previous commit
FedericoAmura 4e97c6e
fix: prettier validation on json files
FedericoAmura 50acc36
Merge branch 'refs/heads/master' into feature/lit-3902-build-publish-…
FedericoAmura 16a4d33
fix: generic type in deepFreeze
FedericoAmura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| packages/wrapped-keys/update-ipfs-cids.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 31 additions & 18 deletions
49
packages/wrapped-keys/src/lib/lit-actions-client/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,39 @@ | ||
| import * as GENERATED_LIT_ACTION_CID_REPOSITORY_COMMON from './lit-action-cid-repository-common.json'; | ||
| import * as GENERATED_LIT_ACTION_CID_REPOSITORY from './lit-action-cid-repository.json'; | ||
| import { LitCidRepository, LitCidRepositoryCommon } from './types'; | ||
|
|
||
| const LIT_ACTION_CID_REPOSITORY: LitCidRepository = Object.freeze({ | ||
| signTransaction: Object.freeze({ | ||
| evm: 'QmRpAgGKEmgeBRhqdC2EH17QUt6puwsbm8Z2nNneVN4uJG', | ||
| solana: 'QmR1nPG2tnmC72zuCEMZUZrrMEkbDiMPNHW45Dsm2n7xnk', | ||
| }), | ||
| signMessage: Object.freeze({ | ||
| evm: 'QmXi9iqJvXrHoUGSo5WREonrruDhzQ7cFr7Cry3wX2hmue', | ||
| solana: 'QmcEJGVqRYtVukjm2prCPT7Fs66GpaqZwmZoxEHMHor6Jz', | ||
| }), | ||
| generateEncryptedKey: Object.freeze({ | ||
| evm: 'QmeD6NYCWhUCLgxgpkgSguaKjwnpCnJ6Yf8SdsyPpK4eKK', | ||
| solana: 'QmPkVD3hEjMi1T5zQuvdrFCXaGTEMHNdAhAL4WHkqxijrQ', | ||
| }), | ||
| exportPrivateKey: Object.freeze({ | ||
| evm: 'QmUJ74pTUqeeHzDGdfwCph1vJVNJ1rRzJdvMiTjS1BMwYj', | ||
| solana: 'QmUJ74pTUqeeHzDGdfwCph1vJVNJ1rRzJdvMiTjS1BMwYj', | ||
| }), | ||
| function deepFreeze<T extends Record<string, any>>(obj: T): T { | ||
| Object.freeze(obj); | ||
| for (const key in obj) { | ||
| if (key in obj && typeof obj[key] === 'object') { | ||
| deepFreeze(obj[key]); | ||
| } | ||
| } | ||
| return obj; | ||
| } | ||
|
|
||
| const LIT_ACTION_CID_REPOSITORY: LitCidRepository = deepFreeze({ | ||
| signTransaction: { | ||
| evm: GENERATED_LIT_ACTION_CID_REPOSITORY.signTransaction.evm, | ||
| solana: GENERATED_LIT_ACTION_CID_REPOSITORY.signTransaction.solana, | ||
| }, | ||
| signMessage: { | ||
| evm: GENERATED_LIT_ACTION_CID_REPOSITORY.signMessage.evm, | ||
| solana: GENERATED_LIT_ACTION_CID_REPOSITORY.signMessage.solana, | ||
| }, | ||
| generateEncryptedKey: { | ||
| evm: GENERATED_LIT_ACTION_CID_REPOSITORY.generateEncryptedKey.evm, | ||
| solana: GENERATED_LIT_ACTION_CID_REPOSITORY.generateEncryptedKey.solana, | ||
| }, | ||
| exportPrivateKey: { | ||
| evm: GENERATED_LIT_ACTION_CID_REPOSITORY.exportPrivateKey.evm, | ||
| solana: GENERATED_LIT_ACTION_CID_REPOSITORY.exportPrivateKey.solana, | ||
| }, | ||
| }); | ||
|
|
||
| const LIT_ACTION_CID_REPOSITORY_COMMON: LitCidRepositoryCommon = Object.freeze({ | ||
| batchGenerateEncryptedKeys: 'QmR8Zs7ctSEctxBrSnAYhMXFXCC1ub8K1xvMn5Js3NCSAA', | ||
| batchGenerateEncryptedKeys: | ||
| GENERATED_LIT_ACTION_CID_REPOSITORY_COMMON.batchGenerateEncryptedKeys, | ||
| }); | ||
|
|
||
| export { LIT_ACTION_CID_REPOSITORY, LIT_ACTION_CID_REPOSITORY_COMMON }; |
3 changes: 3 additions & 0 deletions
3
packages/wrapped-keys/src/lib/lit-actions-client/lit-action-cid-repository-common.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "batchGenerateEncryptedKeys": "QmQB1uSKwuzUWHiAgaGtTf3rFZf42AJWN1XKJSNNPuxKhB" | ||
| } |
18 changes: 18 additions & 0 deletions
18
packages/wrapped-keys/src/lib/lit-actions-client/lit-action-cid-repository.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "signTransaction": { | ||
| "evm": "QmYTEJyniRRkTxe3D9mmkURXCFBAXWK7TEGk5LxvWSETWn", | ||
| "solana": "QmWUozjthkrjEBGkkEvGTvCaxCaiPMTke6FUpiwhn28k8Z" | ||
| }, | ||
| "signMessage": { | ||
| "evm": "Qmdm4mGn6A8RmqeiDgRPXFt2yYEKCUMUVimSb5iPJfs31e", | ||
| "solana": "QmS4Y6f2zHriNzioxBbysbuXQbjX7ga468CCyYcuY2AeeH" | ||
| }, | ||
| "generateEncryptedKey": { | ||
| "evm": "QmfW6g5PJ8SVS56XwDVC5W4gcUnobEempNkR28bj2g99tk", | ||
| "solana": "QmWYcBCZqFmJJzsRfzVRHbPD5Hvuou45sbXPQcQzLbUgKd" | ||
| }, | ||
| "exportPrivateKey": { | ||
| "evm": "QmfZ8hYEmNFwHraNieSz25dAp65YBoNjAMC2tXm9oaQCt6", | ||
| "solana": "QmfZ8hYEmNFwHraNieSz25dAp65YBoNjAMC2tXm9oaQCt6" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const Hash = require('ipfs-only-hash'); | ||
|
|
||
| const { | ||
| code: batchGenerateEncryptedKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/common/batchGenerateEncryptedKeys'); | ||
| const { | ||
| code: exportPrivateKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/common/exportPrivateKey'); | ||
| const { | ||
| code: generateEncryptedEthereumPrivateKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/ethereum/generateEncryptedEthereumPrivateKey'); | ||
| const { | ||
| code: signMessageWithEncryptedEthereumKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/ethereum/signMessageWithEncryptedEthereumKey'); | ||
| const { | ||
| code: signTransactionWithEncryptedEthereumKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/ethereum/signTransactionWithEncryptedEthereumKey'); | ||
| const { | ||
| code: generateEncryptedSolanaPrivateKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/solana/generateEncryptedSolanaPrivateKey'); | ||
| const { | ||
| code: signMessageWithEncryptedSolanaKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/solana/signMessageWithEncryptedSolanaKey'); | ||
| const { | ||
| code: signTransactionWithEncryptedSolanaKey, | ||
| } = require('../wrapped-keys-lit-actions/src/generated/solana/signTransactionWithEncryptedSolanaKey'); | ||
|
|
||
| async function updateConstants() { | ||
| // Generate new CID hashes | ||
| const litActionCIDRepository = { | ||
| signTransaction: { | ||
| evm: await Hash.of(signTransactionWithEncryptedEthereumKey), | ||
| solana: await Hash.of(signTransactionWithEncryptedSolanaKey), | ||
| }, | ||
| signMessage: { | ||
| evm: await Hash.of(signMessageWithEncryptedEthereumKey), | ||
| solana: await Hash.of(signMessageWithEncryptedSolanaKey), | ||
| }, | ||
| generateEncryptedKey: { | ||
| evm: await Hash.of(generateEncryptedEthereumPrivateKey), | ||
| solana: await Hash.of(generateEncryptedSolanaPrivateKey), | ||
| }, | ||
| exportPrivateKey: { | ||
| evm: await Hash.of(exportPrivateKey), | ||
| solana: await Hash.of(exportPrivateKey), | ||
| }, | ||
| }; | ||
| const litActionCIDRepositoryCommon = { | ||
| batchGenerateEncryptedKeys: await Hash.of(batchGenerateEncryptedKey), | ||
| }; | ||
|
|
||
| // Write constant json files with lit action hashes | ||
| // Extra \n is for prettier rule | ||
| fs.writeFileSync( | ||
| path.join( | ||
| __dirname, | ||
| './src/lib/lit-actions-client/lit-action-cid-repository.json' | ||
| ), | ||
| JSON.stringify(litActionCIDRepository, null, 2) + '\n', | ||
| 'utf-8' | ||
| ); | ||
| fs.writeFileSync( | ||
| path.join( | ||
| __dirname, | ||
| './src/lib/lit-actions-client/lit-action-cid-repository-common.json' | ||
| ), | ||
| JSON.stringify(litActionCIDRepositoryCommon, null, 2) + '\n', | ||
| 'utf-8' | ||
| ); | ||
| } | ||
|
|
||
| updateConstants().then(() => { | ||
| console.log('Constants file updated successfully!'); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.