-
Notifications
You must be signed in to change notification settings - Fork 15
Add Canton client and Manual Exec #161
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
Open
RodrigoAD
wants to merge
17
commits into
main
Choose a base branch
from
add-canton-client
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bc21a0a
add basic canton support with json api client
RodrigoAD 299c8b1
add explicit disclosures discovery
RodrigoAD 6db5ed4
fix acs provider. first impl of eds
RodrigoAD 83711ab
refactor eds and add manual exec
RodrigoAD 5e2a009
add canton config for chain class
RodrigoAD 529f4df
fix submission
RodrigoAD 85e56ba
fix lint
RodrigoAD 4ece5e7
refactor acs querying
RodrigoAD 9171064
add build artifacts
RodrigoAD ff2bd2a
add canton send
RodrigoAD ddd85ff
fix acs provider
RodrigoAD fb7b8e1
add canton exec cmd
RodrigoAD 5c4278d
add canton get tx method
RodrigoAD 850eb05
add build artifacts
RodrigoAD 15bba1e
fix rebase
RodrigoAD 22c1ec2
fix lock and extra args
RodrigoAD 6047f6d
fix lint
RodrigoAD 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
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,27 @@ | ||
| import { type CantonWallet, CCIPArgumentInvalidError } from '@chainlink/ccip-sdk/src/index.ts' | ||
|
|
||
| /** | ||
| * Loads a Canton wallet from the provided options. | ||
| * | ||
| * A Canton "wallet" is simply a Daml party ID. The party can be supplied via: | ||
| * - `--wallet <party>` (if the value contains `::`, it's treated as a party ID) | ||
| * - `--canton-party <party>` (explicit Canton party flag) | ||
| * | ||
| * @param opts - CLI options containing wallet and/or canton-party values. | ||
| * @returns A {@link CantonWallet} with the resolved party ID. | ||
| * @throws {@link CCIPArgumentInvalidError} if no valid party ID can be resolved. | ||
| */ | ||
| export function loadCantonWallet(opts: { wallet?: unknown; cantonParty?: string }): CantonWallet { | ||
| // Prefer --wallet if it looks like a Daml party ID (contains `::`) | ||
| if (typeof opts.wallet === 'string' && opts.wallet.includes('::')) { | ||
| return { party: opts.wallet } | ||
| } | ||
| // Fall back to --canton-party | ||
| if (opts.cantonParty) { | ||
| return { party: opts.cantonParty } | ||
| } | ||
| throw new CCIPArgumentInvalidError( | ||
| 'wallet', | ||
| 'Canton requires a Daml party ID via --wallet <party::hash> or --canton-party <party>', | ||
| ) | ||
| } |
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 |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs' | |
| import { readFile } from 'node:fs/promises' | ||
|
|
||
| import { | ||
| type CantonConfig, | ||
| type Chain, | ||
| type ChainGetter, | ||
| type ChainTransaction, | ||
|
|
@@ -17,6 +18,7 @@ import { | |
| } from '@chainlink/ccip-sdk/src/index.ts' | ||
|
|
||
| import { loadAptosWallet } from './aptos.ts' | ||
| import { loadCantonWallet } from './canton.ts' | ||
| import { loadEvmWallet } from './evm.ts' | ||
| import { loadSolanaWallet } from './solana.ts' | ||
| import { loadSuiWallet } from './sui.ts' | ||
|
|
@@ -55,11 +57,33 @@ async function collectEndpoints( | |
|
|
||
| export function fetchChainsFromRpcs( | ||
| ctx: Ctx, | ||
| argv: Pick<GlobalOpts, 'rpcs' | 'rpcsFile' | 'api'>, | ||
| argv: Pick< | ||
| GlobalOpts, | ||
| | 'rpcs' | ||
| | 'rpcsFile' | ||
| | 'api' | ||
| | 'cantonJwt' | ||
| | 'cantonParty' | ||
| | 'cantonEdsUrl' | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Offchain services URLs could be hardcoded |
||
| | 'indexerUrl' | ||
| | 'cantonCcipParty' | ||
| | 'cantonTransferInstructionUrl' | ||
| >, | ||
| ): ChainGetter | ||
| export function fetchChainsFromRpcs( | ||
| ctx: Ctx, | ||
| argv: Pick<GlobalOpts, 'rpcs' | 'rpcsFile' | 'api'>, | ||
| argv: Pick< | ||
| GlobalOpts, | ||
| | 'rpcs' | ||
| | 'rpcsFile' | ||
| | 'api' | ||
| | 'cantonJwt' | ||
| | 'cantonParty' | ||
| | 'cantonEdsUrl' | ||
| | 'indexerUrl' | ||
| | 'cantonCcipParty' | ||
| | 'cantonTransferInstructionUrl' | ||
| >, | ||
| txHash: string, | ||
| ): [ChainGetter, Promise<[Chain, ChainTransaction]>] | ||
|
|
||
|
|
@@ -74,9 +98,30 @@ export function fetchChainsFromRpcs( | |
| */ | ||
| export function fetchChainsFromRpcs( | ||
| ctx: Ctx, | ||
| argv: Pick<GlobalOpts, 'rpcs' | 'rpcsFile' | 'api'>, | ||
| argv: Pick< | ||
| GlobalOpts, | ||
| | 'rpcs' | ||
| | 'rpcsFile' | ||
| | 'api' | ||
| | 'cantonJwt' | ||
| | 'cantonParty' | ||
| | 'cantonEdsUrl' | ||
| | 'indexerUrl' | ||
| | 'cantonCcipParty' | ||
| | 'cantonTransferInstructionUrl' | ||
| >, | ||
| txHash?: string, | ||
| ) { | ||
| const cantonConfig: CantonConfig | undefined = argv.cantonJwt | ||
| ? { | ||
| jwt: argv.cantonJwt, | ||
| party: argv.cantonParty ?? '', | ||
| edsUrl: argv.cantonEdsUrl ?? '', | ||
| indexerUrl: argv.indexerUrl, | ||
| ccipParty: argv.cantonCcipParty ?? '', | ||
| transferInstructionUrl: argv.cantonTransferInstructionUrl ?? '', | ||
| } | ||
| : undefined | ||
| const chains: Record<string, Promise<Chain>> = {} | ||
| const chainsCbs: Record< | ||
| string, | ||
|
|
@@ -104,6 +149,7 @@ export function fetchChainsFromRpcs( | |
| for (const url of endpoints) { | ||
| const chain$ = C.fromUrl(url, { | ||
| ...ctx, | ||
| ...(cantonConfig ? { cantonConfig } : {}), | ||
| apiClient: | ||
| argv.api === false ? null : typeof argv.api === 'string' ? argv.api : undefined, | ||
| }) | ||
|
|
@@ -222,6 +268,9 @@ export async function loadChainWallet(chain: Chain, argv: { wallet?: unknown; rp | |
| chain.network.networkType === NetworkType.Testnet, | ||
| ) | ||
| return [wallet.getAddress(), wallet] as const | ||
| case ChainFamily.Canton: | ||
| wallet = loadCantonWallet(argv) | ||
| return [wallet.party, wallet] as const | ||
| default: | ||
| // TypeScript exhaustiveness check - this should never be reached | ||
| throw new CCIPChainFamilyUnsupportedError((chain.network as { family: string }).family) | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrevmatos we need somehow all these values from the user input, what's the recommended way to get them through the CLI?
This way I understand is not ideal