-
Notifications
You must be signed in to change notification settings - Fork 8
generateUnsignedTxs methods
#70
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
base: main
Are you sure you want to change the base?
Conversation
Coverage Report |
They allow fetching `UnsignedTx`, which can be signed and sent in ways other than injected Signer wallet. `simulateAndSendTxs` now is also smarter on fitting as many instructions as possible inside the same tx
ccip-sdk doesn't have static or cached `getWallet` anymore; instead, it receives a `opts.wallet` directly in the `sendMessage` and `executeReport` methods; users are then expected to provide compatible wallets, like done by the CLI without overriding any method in the SDK.
on all 3 supported chains
remove node:util dependency in sdk
ctx/DI-like patterns to pass down `logger` instance wherever needed
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.
Pull request overview
This PR introduces significant architectural changes to the CCIP SDK, focusing on decoupling wallet management from the SDK and adding support for unsigned transaction generation. The changes enable users to manage their own signing workflows while maintaining backward compatibility through CLI implementations.
Key Changes:
- Replaced internal wallet management with direct wallet injection into
sendMessageandexecuteReportmethods - Added
generateUnsignedSendMessageandgenerateUnsignedExecuteReportmethods for all chain families to support manual transaction signing workflows - Introduced optional logger injection throughout the SDK to replace hardcoded
consoleusage
Reviewed changes
Copilot reviewed 48 out of 49 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updated dependencies (eslint-plugin-jsdoc, prettier) and added bigint-buffer override |
| ccip-sdk/src/types.ts | Added Logger and WithLogger types for logger injection support |
| ccip-sdk/src/utils.ts | Added logger parameter to functions, removed node util import, added util backfill |
| ccip-sdk/src/chain.ts | Moved network to base class, removed getWalletAddress, added generateUnsigned* methods |
| ccip-sdk/src/evm/index.ts | Refactored sendMessage/executeReport to use wallet parameter, added generateUnsigned* methods |
| ccip-sdk/src/solana/index.ts | Similar wallet refactoring for Solana, removed getWallet methods |
| ccip-sdk/src/aptos/index.ts | Similar wallet refactoring for Aptos chain |
| ccip-cli/src/providers/*.ts | Moved wallet loading logic from SDK to CLI provider files |
| ccip-cli/src/commands/*.ts | Updated commands to use new context-based logging and wallet loading |
Comments suppressed due to low confidence (1)
ccip-sdk/src/evm/logs.ts:1
- The topics array structure changed from a flat array to nested arrays. The first topic should remain flat while the second topic is now wrapped in an array. This should be
[request.log.topics[0], [toBeHex(request.lane.destChainSelector, 32)]]to maintain the correct structure where only the destChainSelector is an array of possible values.
import {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it('should handle zero', () => { | ||
| const result = toLeArray(0n) | ||
| assert.deepEqual(result, new Uint8Array([0x00])) | ||
| assert.deepEqual(result, new Uint8Array([])) |
Copilot
AI
Dec 7, 2025
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.
The test expectation changed from [0x00] to [] for toLeArray(0n), but there's no explanation for this behavioral change. This could be a breaking change that needs documentation or a test that validates the new behavior is correct.
| key: altAddr, | ||
| state: { | ||
| deactivationSlot: BigInt(0), | ||
| deactivationSlot: 2n ** 64n - 1n, |
Copilot
AI
Dec 7, 2025
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.
Using 2n ** 64n - 1n as a magic number for non-deactivated lookup tables. Consider extracting this to a named constant like MAX_UINT64 or NON_DEACTIVATED_SLOT for better code clarity.
| // generate:nofail | ||
| // `const VERSION = '${require('./package.json').version}-${require('child_process').execSync('git rev-parse --short HEAD').toString().trim()}'` | ||
| const VERSION = '0.91.0-9e5d987' | ||
| const VERSION = '0.91.0-0161da7' |
Copilot
AI
Dec 7, 2025
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.
Hardcoded version string should be updated via the generation script. The comment indicates this is auto-generated between generate:nofail and generate:end markers, but the value appears to have been manually updated.
| ...RPCS, | ||
| '--rpcs-file', | ||
| '.gitignore', // Disable rpcs file loading | ||
| 'package.json', // Disable rpcs file loading |
Copilot
AI
Dec 7, 2025
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.
[nitpick] Using 'package.json' as a dummy file to disable rpcs file loading is fragile. If package.json is removed or renamed, this test will break. Consider using a dedicated test fixture or a non-existent file path that's explicitly documented as intentional.
| 'package.json', // Disable rpcs file loading | |
| '__nonexistent_rpcs_file__.json', // Intentionally non-existent file to disable rpcs file loading |
UnsignedTxobject containing raw data, before signature, which can be signed and sent by users.