@chainlink/ccip-cli 0.90.2 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -21
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/manual-exec.d.ts +9 -0
- package/dist/commands/manual-exec.d.ts.map +1 -1
- package/dist/commands/manual-exec.js +40 -35
- package/dist/commands/manual-exec.js.map +1 -1
- package/dist/commands/parse.d.ts +9 -0
- package/dist/commands/parse.d.ts.map +1 -1
- package/dist/commands/parse.js +18 -7
- package/dist/commands/parse.js.map +1 -1
- package/dist/commands/send.d.ts +9 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +39 -26
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/show.d.ts +9 -0
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +46 -39
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/supported-tokens.d.ts +9 -2
- package/dist/commands/supported-tokens.d.ts.map +1 -1
- package/dist/commands/supported-tokens.js +35 -30
- package/dist/commands/supported-tokens.js.map +1 -1
- package/dist/commands/types.d.ts +13 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +1 -0
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/utils.d.ts +75 -10
- package/dist/commands/utils.d.ts.map +1 -1
- package/dist/commands/utils.js +95 -19
- package/dist/commands/utils.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/providers/aptos.d.ts +35 -0
- package/dist/providers/aptos.d.ts.map +1 -1
- package/dist/providers/aptos.js +34 -9
- package/dist/providers/aptos.js.map +1 -1
- package/dist/providers/evm.d.ts +10 -1
- package/dist/providers/evm.d.ts.map +1 -1
- package/dist/providers/evm.js +11 -5
- package/dist/providers/evm.js.map +1 -1
- package/dist/providers/index.d.ts +15 -8
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +47 -11
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/solana.d.ts +30 -0
- package/dist/providers/solana.d.ts.map +1 -1
- package/dist/providers/solana.js +30 -5
- package/dist/providers/solana.js.map +1 -1
- package/package.json +11 -8
- package/src/commands/index.ts +2 -1
- package/src/commands/manual-exec.ts +40 -33
- package/src/commands/parse.ts +19 -8
- package/src/commands/send.ts +47 -30
- package/src/commands/show.ts +47 -48
- package/src/commands/supported-tokens.ts +35 -30
- package/src/commands/types.ts +15 -0
- package/src/commands/utils.ts +112 -26
- package/src/index.ts +29 -7
- package/src/providers/aptos.ts +33 -8
- package/src/providers/evm.ts +22 -5
- package/src/providers/index.ts +67 -15
- package/src/providers/solana.ts +31 -6
- package/tsconfig.json +2 -1
package/src/providers/solana.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs'
|
|
2
2
|
import util from 'node:util'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { Wallet as SolanaWallet } from '@coral-xyz/anchor'
|
|
4
|
+
import { Wallet as AnchorWallet } from '@coral-xyz/anchor'
|
|
6
5
|
import SolanaLedger from '@ledgerhq/hw-app-solana'
|
|
7
6
|
import HIDTransport from '@ledgerhq/hw-transport-node-hid'
|
|
8
7
|
import {
|
|
@@ -16,17 +15,27 @@ import {
|
|
|
16
15
|
import bs58 from 'bs58'
|
|
17
16
|
import { getBytes, hexlify } from 'ethers'
|
|
18
17
|
|
|
18
|
+
/** Ledger hardware wallet signer for Solana. */
|
|
19
19
|
export class LedgerSolanaWallet {
|
|
20
20
|
publicKey: PublicKey
|
|
21
21
|
wallet: SolanaLedger.default
|
|
22
22
|
path: string
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Private constructor - use static `create` method instead.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
24
28
|
private constructor(solanaLW: SolanaLedger.default, pubKey: PublicKey, path: string) {
|
|
25
29
|
this.wallet = solanaLW
|
|
26
30
|
this.publicKey = pubKey
|
|
27
31
|
this.path = path
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new LedgerSolanaWallet instance.
|
|
36
|
+
* @param path - BIP44 derivation path.
|
|
37
|
+
* @returns A new LedgerSolanaWallet instance.
|
|
38
|
+
*/
|
|
30
39
|
static async create(path: string) {
|
|
31
40
|
try {
|
|
32
41
|
const transport = await HIDTransport.default.create()
|
|
@@ -41,6 +50,11 @@ export class LedgerSolanaWallet {
|
|
|
41
50
|
}
|
|
42
51
|
}
|
|
43
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Signs a transaction with the Ledger device.
|
|
55
|
+
* @param tx - Transaction to sign.
|
|
56
|
+
* @returns Signed transaction.
|
|
57
|
+
*/
|
|
44
58
|
async signTransaction<T extends Transaction | VersionedTransaction>(tx: T) {
|
|
45
59
|
console.debug('Ledger: Request to sign message from', this.publicKey.toBase58())
|
|
46
60
|
// serializeMessage on v0, serialize on v1
|
|
@@ -56,6 +70,11 @@ export class LedgerSolanaWallet {
|
|
|
56
70
|
return tx
|
|
57
71
|
}
|
|
58
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Signs multiple transactions with the Ledger device.
|
|
75
|
+
* @param txs - Transactions to sign.
|
|
76
|
+
* @returns Signed transactions.
|
|
77
|
+
*/
|
|
59
78
|
async signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]) {
|
|
60
79
|
console.info('Signing multiple transactions with Ledger')
|
|
61
80
|
const signedTxs: T[] = []
|
|
@@ -65,14 +84,20 @@ export class LedgerSolanaWallet {
|
|
|
65
84
|
return signedTxs
|
|
66
85
|
}
|
|
67
86
|
|
|
87
|
+
/** Payer property - not available on Ledger. */
|
|
68
88
|
get payer(): Keypair {
|
|
69
89
|
throw new Error('Payer method not available on Ledger')
|
|
70
90
|
}
|
|
71
91
|
}
|
|
72
92
|
|
|
73
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Loads a Solana wallet from a file or Ledger device.
|
|
95
|
+
* @param wallet - wallet options (as passed to yargs argv)
|
|
96
|
+
* @returns Promise to Anchor Wallet instance
|
|
97
|
+
*/
|
|
98
|
+
export async function loadSolanaWallet({
|
|
74
99
|
wallet: walletOpt,
|
|
75
|
-
}: { wallet?: unknown } = {}): Promise<
|
|
100
|
+
}: { wallet?: unknown } = {}): Promise<AnchorWallet> {
|
|
76
101
|
if (!walletOpt)
|
|
77
102
|
walletOpt = process.env['USER_KEY'] || process.env['OWNER_KEY'] || '~/.config/solana/id.json'
|
|
78
103
|
let wallet: string
|
|
@@ -83,11 +108,11 @@ SolanaChain.getWallet = async function loadSolanaWallet({
|
|
|
83
108
|
let derivationPath = walletOpt.split(':')[1]
|
|
84
109
|
if (!derivationPath) derivationPath = "44'/501'/0'"
|
|
85
110
|
else if (!isNaN(Number(derivationPath))) derivationPath = `44'/501'/${derivationPath}'`
|
|
86
|
-
return (await LedgerSolanaWallet.create(derivationPath)) as
|
|
111
|
+
return (await LedgerSolanaWallet.create(derivationPath)) as AnchorWallet
|
|
87
112
|
} else if (existsSync(walletOpt)) {
|
|
88
113
|
wallet = hexlify(new Uint8Array(JSON.parse(readFileSync(walletOpt, 'utf8'))))
|
|
89
114
|
}
|
|
90
|
-
return new
|
|
115
|
+
return new AnchorWallet(
|
|
91
116
|
Keypair.fromSecretKey(wallet.startsWith('0x') ? getBytes(wallet) : bs58.decode(wallet)),
|
|
92
117
|
)
|
|
93
118
|
}
|