@fastxyz/allset-sdk 0.1.0 → 0.1.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/LICENSE +1 -1
- package/README.md +79 -32
- package/dist/bridge.d.ts +4 -4
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +45 -39
- package/dist/bridge.js.map +1 -1
- package/dist/evm-executor.d.ts +20 -0
- package/dist/evm-executor.d.ts.map +1 -1
- package/dist/evm-executor.js +25 -1
- package/dist/evm-executor.js.map +1 -1
- package/dist/fast-client.d.ts +57 -0
- package/dist/fast-client.d.ts.map +1 -0
- package/dist/fast-client.js +335 -0
- package/dist/fast-client.js.map +1 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# AllSet SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
This repo contains only `@fastxyz/allset-sdk`. It does not include the Fast SDK package or the old workspace wiring from the `money` monorepo.
|
|
3
|
+
Official TypeScript SDK for the AllSet bridge. Bridge tokens between Fast network and supported EVM routes, with the current branch focused on Arbitrum Sepolia and Fast testnet flows.
|
|
6
4
|
|
|
7
5
|
## Install
|
|
8
6
|
|
|
@@ -10,56 +8,105 @@ This repo contains only `@fastxyz/allset-sdk`. It does not include the Fast SDK
|
|
|
10
8
|
npm install @fastxyz/allset-sdk
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install
|
|
17
|
-
```
|
|
11
|
+
## Quick Start
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm run build
|
|
23
|
-
npm test
|
|
24
|
-
npm run pack:dry-run
|
|
25
|
-
npm run pack:smoke
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
13
|
+
### Deposit (EVM → Fast)
|
|
29
14
|
|
|
30
15
|
```ts
|
|
31
|
-
import { createEvmExecutor,
|
|
16
|
+
import { createEvmExecutor, allsetProvider } from '@fastxyz/allset-sdk';
|
|
32
17
|
|
|
33
18
|
const evmExecutor = createEvmExecutor(
|
|
34
19
|
process.env.EVM_PRIVATE_KEY!,
|
|
35
|
-
|
|
36
|
-
421614
|
|
20
|
+
'https://sepolia-rollup.arbitrum.io/rpc',
|
|
21
|
+
421614
|
|
37
22
|
);
|
|
38
23
|
|
|
39
|
-
const result = await
|
|
24
|
+
const result = await allsetProvider.bridge({
|
|
40
25
|
fromChain: 'arbitrum',
|
|
41
26
|
toChain: 'fast',
|
|
42
27
|
fromToken: 'USDC',
|
|
43
28
|
toToken: 'fastUSDC',
|
|
44
29
|
fromDecimals: 6,
|
|
45
|
-
amount: '1000000',
|
|
30
|
+
amount: '1000000', // 1 USDC (6 decimals)
|
|
46
31
|
senderAddress: '0xYourEvmAddress',
|
|
47
32
|
receiverAddress: 'fast1yourfastaddress',
|
|
48
33
|
evmExecutor,
|
|
49
34
|
});
|
|
50
35
|
|
|
51
|
-
console.log(result);
|
|
36
|
+
console.log(result.txHash);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Withdraw (Fast → EVM)
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createFastWallet } from '@fastxyz/allset-sdk';
|
|
43
|
+
|
|
44
|
+
const wallet = createFastWallet();
|
|
45
|
+
console.log(wallet.address);
|
|
46
|
+
// Persist wallet.privateKey and wallet.publicKey securely.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Store that keypair securely, then use it with `createFastClient()`:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createFastClient, allsetProvider } from '@fastxyz/allset-sdk';
|
|
53
|
+
|
|
54
|
+
const fastClient = createFastClient({
|
|
55
|
+
privateKey: process.env.FAST_PRIVATE_KEY!, // 32-byte hex
|
|
56
|
+
publicKey: process.env.FAST_PUBLIC_KEY!, // 32-byte hex
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const result = await allsetProvider.bridge({
|
|
60
|
+
fromChain: 'fast',
|
|
61
|
+
toChain: 'arbitrum',
|
|
62
|
+
fromToken: 'fastUSDC',
|
|
63
|
+
toToken: 'USDC',
|
|
64
|
+
fromDecimals: 6,
|
|
65
|
+
amount: '1000000', // 1 USDC (6 decimals)
|
|
66
|
+
senderAddress: fastClient.address!,
|
|
67
|
+
receiverAddress: '0xYourEvmAddress',
|
|
68
|
+
fastClient,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
console.log(result.txHash);
|
|
72
|
+
// { txHash: '0x...', orderId: '0x...', estimatedTime: '1-5 minutes' }
|
|
52
73
|
```
|
|
53
74
|
|
|
54
|
-
|
|
75
|
+
Best practice: generate the Fast wallet once, store the private/public keys in your secret manager or environment, and pass those stored values into `createFastClient()`. Do not generate a fresh wallet on every app start unless that is explicitly what you want.
|
|
76
|
+
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
- **Deposit** - Bridge USDC from EVM chains to fastUSDC on Fast
|
|
80
|
+
- **Withdraw** - Bridge fastUSDC from Fast to USDC on EVM chains
|
|
81
|
+
- **EVM Executor** - Built-in viem-based transaction executor
|
|
82
|
+
- **Fast Client** - Built-in Fast network client for withdrawals
|
|
83
|
+
- **Fast Wallet Generator** - Generate a Fast keypair and address without another SDK
|
|
84
|
+
|
|
85
|
+
## Supported Networks
|
|
86
|
+
|
|
87
|
+
Current SDK implementation in this branch:
|
|
88
|
+
|
|
89
|
+
- Testnet-only bridge flows
|
|
90
|
+
- Arbitrum Sepolia (`421614`) + Fast testnet
|
|
91
|
+
- Token mapping for `USDC` <-> `fastUSDC`
|
|
55
92
|
|
|
56
|
-
|
|
57
|
-
- Fast to EVM and EVM to Fast flows only
|
|
58
|
-
- EVM executor support for Ethereum Sepolia (`11155111`) and Arbitrum Sepolia (`421614`)
|
|
59
|
-
- Current token registry maps Arbitrum Sepolia `USDC` and `fastUSDC`
|
|
93
|
+
Environment target matrix for AllSet deployments:
|
|
60
94
|
|
|
61
|
-
|
|
95
|
+
- Mainnet: Polygon, Arbitrum, Base with `USDC` -> `fastUSDC`
|
|
96
|
+
- Testnet: Sepolia, Arbitrum Sepolia, Tempo with testnet `USDC` -> `testUSDC`
|
|
97
|
+
|
|
98
|
+
## Documentation
|
|
99
|
+
|
|
100
|
+
See [SKILL.md](./SKILL.md) for detailed API documentation and troubleshooting.
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install
|
|
106
|
+
npm run build
|
|
107
|
+
npm test
|
|
108
|
+
```
|
|
62
109
|
|
|
63
|
-
##
|
|
110
|
+
## License
|
|
64
111
|
|
|
65
|
-
|
|
112
|
+
MIT
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bridge.ts —
|
|
2
|
+
* bridge.ts — AllSet bridge provider
|
|
3
3
|
*
|
|
4
|
-
* Bridges between Fast
|
|
4
|
+
* Bridges between Fast network and the SDK's supported EVM routes.
|
|
5
5
|
*
|
|
6
6
|
* Two directions:
|
|
7
7
|
* Deposit (EVM → Fast): call bridge.deposit(token, amount, receiver) on the EVM bridge contract
|
|
8
|
-
* Withdraw (Fast → EVM): transfer on Fast
|
|
8
|
+
* Withdraw (Fast → EVM): transfer on Fast network + submit ExternalClaim intent + POST to relayer
|
|
9
9
|
*/
|
|
10
10
|
import type { BridgeProvider } from './types.js';
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const allsetProvider: BridgeProvider;
|
|
12
12
|
//# sourceMappingURL=bridge.d.ts.map
|
package/dist/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAsC,MAAM,YAAY,CAAC;AAuFrF,eAAO,MAAM,cAAc,EAAE,cA4S5B,CAAC"}
|
package/dist/bridge.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bridge.ts —
|
|
2
|
+
* bridge.ts — AllSet bridge provider
|
|
3
3
|
*
|
|
4
|
-
* Bridges between Fast
|
|
4
|
+
* Bridges between Fast network and the SDK's supported EVM routes.
|
|
5
5
|
*
|
|
6
6
|
* Two directions:
|
|
7
7
|
* Deposit (EVM → Fast): call bridge.deposit(token, amount, receiver) on the EVM bridge contract
|
|
8
|
-
* Withdraw (Fast → EVM): transfer on Fast
|
|
8
|
+
* Withdraw (Fast → EVM): transfer on Fast network + submit ExternalClaim intent + POST to relayer
|
|
9
9
|
*/
|
|
10
10
|
import { bech32m } from 'bech32';
|
|
11
|
-
import { encodeAbiParameters, encodeFunctionData
|
|
11
|
+
import { encodeAbiParameters, encodeFunctionData } from 'viem';
|
|
12
12
|
import { FastError } from './fast-compat.js';
|
|
13
13
|
function base64ToBytes(b64) {
|
|
14
14
|
return new Uint8Array(Buffer.from(b64, 'base64'));
|
|
15
15
|
}
|
|
16
|
-
const FAST_USDC_TOKEN_ID =
|
|
17
|
-
const FAST_USDC_TOKEN_HEX = '
|
|
16
|
+
const FAST_USDC_TOKEN_ID = hexToUint8Array('b4cf1b9e227bb6a21b959338895dfb39b8d2a96dfa1ce5dd633561c193124cb5');
|
|
17
|
+
const FAST_USDC_TOKEN_HEX = 'b4cf1b9e227bb6a21b959338895dfb39b8d2a96dfa1ce5dd633561c193124cb5';
|
|
18
18
|
const CHAIN_CONFIGS = {
|
|
19
19
|
ethereum: {
|
|
20
20
|
chainId: 11155111,
|
|
21
21
|
bridgeContract: '0x38b48764f6B12e1Dd5e4f8391d06d34Ba3920201',
|
|
22
22
|
fastsetBridgeAddress: 'fast19cjwajufyuqv883ydlvrp8xrhxejuvfe40pxq5dsrv675zgh89sqg9txs8',
|
|
23
|
-
relayerUrl: 'https://staging.omniset.fastset.xyz/ethereum-sepolia-relayer',
|
|
23
|
+
relayerUrl: 'https://staging.omniset.fastset.xyz/ethereum-sepolia-relayer/relay',
|
|
24
24
|
},
|
|
25
25
|
arbitrum: {
|
|
26
26
|
chainId: 421614,
|
|
27
|
-
bridgeContract: '
|
|
28
|
-
fastsetBridgeAddress: '
|
|
29
|
-
relayerUrl: 'https://staging.
|
|
27
|
+
bridgeContract: '0xAc5164c04ee74c417e809916C65455499ae70eb6',
|
|
28
|
+
fastsetBridgeAddress: 'fast1x0g58phuf0pf32e9uvp3mv6hak4z37ytpqyfzjzhfsehua9kmegqwzv0td',
|
|
29
|
+
relayerUrl: 'https://staging.allset.fastset.xyz/arbitrum-sepolia/relayer/relay',
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
const CHAIN_TOKENS = {
|
|
@@ -45,7 +45,7 @@ const CHAIN_TOKENS = {
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
};
|
|
48
|
-
function
|
|
48
|
+
function resolveAllSetToken(token, evmChain) {
|
|
49
49
|
const chainTokens = CHAIN_TOKENS[evmChain];
|
|
50
50
|
if (!chainTokens)
|
|
51
51
|
return null;
|
|
@@ -87,8 +87,8 @@ const BRIDGE_DEPOSIT_ABI = [{
|
|
|
87
87
|
outputs: [],
|
|
88
88
|
stateMutability: 'payable',
|
|
89
89
|
}];
|
|
90
|
-
export const
|
|
91
|
-
name: '
|
|
90
|
+
export const allsetProvider = {
|
|
91
|
+
name: 'allset',
|
|
92
92
|
chains: ['fast', 'ethereum', 'arbitrum'],
|
|
93
93
|
networks: ['testnet'],
|
|
94
94
|
async bridge(params) {
|
|
@@ -96,28 +96,28 @@ export const omnisetProvider = {
|
|
|
96
96
|
const isDeposit = params.fromChain !== 'fast' && params.toChain === 'fast';
|
|
97
97
|
const isWithdraw = params.fromChain === 'fast';
|
|
98
98
|
if (!isDeposit && !isWithdraw) {
|
|
99
|
-
throw new FastError('UNSUPPORTED_OPERATION', `
|
|
99
|
+
throw new FastError('UNSUPPORTED_OPERATION', `AllSet only supports bridging between Fast network and EVM chains (ethereum, arbitrum). Got: ${params.fromChain} → ${params.toChain}`, {
|
|
100
100
|
note: 'Use fromChain: "fast" for withdrawals, or toChain: "fast" for deposits.\n Example: await allset.bridge({ fromChain: "ethereum", toChain: "fast", fromToken: "USDC", toToken: "fastUSDC", amount: "1000000", senderAddress: "0x...", receiverAddress: "fast1..." })',
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
if (isDeposit) {
|
|
104
104
|
if (!params.evmExecutor) {
|
|
105
|
-
throw new FastError('INVALID_PARAMS', '
|
|
105
|
+
throw new FastError('INVALID_PARAMS', 'AllSet deposit (EVM → Fast) requires evmExecutor', {
|
|
106
106
|
note: 'Provide an evmExecutor created with createEvmExecutor().\n Example: const executor = createEvmExecutor(privateKey, rpcUrl, chainId)',
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
const chainConfig = CHAIN_CONFIGS[params.fromChain];
|
|
110
110
|
if (!chainConfig) {
|
|
111
|
-
throw new FastError('UNSUPPORTED_OPERATION', `
|
|
112
|
-
note: 'Use "ethereum" or "arbitrum" as the source chain for
|
|
111
|
+
throw new FastError('UNSUPPORTED_OPERATION', `AllSet does not support EVM chain "${params.fromChain}". Supported: ${Object.keys(CHAIN_CONFIGS).join(', ')}`, {
|
|
112
|
+
note: 'Use "ethereum" or "arbitrum" as the source chain for AllSet deposits.',
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
let tokenInfo =
|
|
115
|
+
let tokenInfo = resolveAllSetToken(params.fromToken, params.fromChain);
|
|
116
116
|
if (!tokenInfo) {
|
|
117
|
-
tokenInfo =
|
|
117
|
+
tokenInfo = resolveAllSetToken(params.toToken, params.fromChain);
|
|
118
118
|
}
|
|
119
119
|
if (!tokenInfo) {
|
|
120
|
-
throw new FastError('TOKEN_NOT_FOUND', `Cannot resolve token "${params.fromToken}" on
|
|
120
|
+
throw new FastError('TOKEN_NOT_FOUND', `Cannot resolve token "${params.fromToken}" on AllSet for chain "${params.fromChain}".`, {
|
|
121
121
|
note: 'Supported tokens: USDC, fastUSDC.\n Example: await allset.bridge({ fromChain: "arbitrum", toChain: "fast", fromToken: "USDC", toToken: "fastUSDC", amount: "1000000", senderAddress: "0x...", receiverAddress: "fast1..." })',
|
|
122
122
|
});
|
|
123
123
|
}
|
|
@@ -127,8 +127,8 @@ export const omnisetProvider = {
|
|
|
127
127
|
}
|
|
128
128
|
catch (err) {
|
|
129
129
|
const msg = err instanceof Error ? err.message : String(err);
|
|
130
|
-
throw new FastError('INVALID_ADDRESS', `Failed to decode Fast
|
|
131
|
-
note: 'The receiver address must be a valid Fast
|
|
130
|
+
throw new FastError('INVALID_ADDRESS', `Failed to decode Fast network receiver address "${params.receiverAddress}": ${msg}`, {
|
|
131
|
+
note: 'The receiver address must be a valid Fast network bech32m address (fast1...).\n Example: fast1abc...',
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
const calldata = encodeFunctionData({
|
|
@@ -148,7 +148,7 @@ export const omnisetProvider = {
|
|
|
148
148
|
value: params.amount,
|
|
149
149
|
});
|
|
150
150
|
if (receipt.status === 'reverted') {
|
|
151
|
-
throw new FastError('TX_FAILED', `
|
|
151
|
+
throw new FastError('TX_FAILED', `AllSet deposit transaction reverted: ${receipt.txHash}`, {
|
|
152
152
|
note: 'The deposit transaction was reverted. Check that you have sufficient ETH balance.',
|
|
153
153
|
});
|
|
154
154
|
}
|
|
@@ -166,7 +166,7 @@ export const omnisetProvider = {
|
|
|
166
166
|
value: '0',
|
|
167
167
|
});
|
|
168
168
|
if (receipt.status === 'reverted') {
|
|
169
|
-
throw new FastError('TX_FAILED', `
|
|
169
|
+
throw new FastError('TX_FAILED', `AllSet deposit transaction reverted: ${receipt.txHash}`, {
|
|
170
170
|
note: 'The deposit transaction was reverted. Check that you have sufficient token balance and the approval succeeded.',
|
|
171
171
|
});
|
|
172
172
|
}
|
|
@@ -179,22 +179,22 @@ export const omnisetProvider = {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
if (!params.fastClient) {
|
|
182
|
-
throw new FastError('INVALID_PARAMS', '
|
|
182
|
+
throw new FastError('INVALID_PARAMS', 'AllSet withdrawal (Fast → EVM) requires fastClient', {
|
|
183
183
|
note: 'Provide a compatible FastClient implementation with submit() and evmSign().',
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
const chainConfig = CHAIN_CONFIGS[params.toChain];
|
|
187
187
|
if (!chainConfig) {
|
|
188
|
-
throw new FastError('UNSUPPORTED_OPERATION', `
|
|
189
|
-
note: 'Use "ethereum" or "arbitrum" as the destination chain for
|
|
188
|
+
throw new FastError('UNSUPPORTED_OPERATION', `AllSet does not support EVM destination chain "${params.toChain}". Supported: ${Object.keys(CHAIN_CONFIGS).join(', ')}`, {
|
|
189
|
+
note: 'Use "ethereum" or "arbitrum" as the destination chain for AllSet withdrawals.',
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
let tokenInfo =
|
|
192
|
+
let tokenInfo = resolveAllSetToken(params.fromToken, params.toChain);
|
|
193
193
|
if (!tokenInfo) {
|
|
194
|
-
tokenInfo =
|
|
194
|
+
tokenInfo = resolveAllSetToken(params.toToken, params.toChain);
|
|
195
195
|
}
|
|
196
196
|
if (!tokenInfo) {
|
|
197
|
-
throw new FastError('TOKEN_NOT_FOUND', `Cannot resolve token "${params.fromToken}" on
|
|
197
|
+
throw new FastError('TOKEN_NOT_FOUND', `Cannot resolve token "${params.fromToken}" on AllSet for destination chain "${params.toChain}".`, {
|
|
198
198
|
note: 'Supported tokens: USDC, fastUSDC.\n Example: await allset.bridge({ fromChain: "fast", toChain: "arbitrum", fromToken: "fastUSDC", toToken: "USDC", amount: "1000000", senderAddress: "fast1...", receiverAddress: "0x..." })',
|
|
199
199
|
});
|
|
200
200
|
}
|
|
@@ -212,17 +212,20 @@ export const omnisetProvider = {
|
|
|
212
212
|
const transferCrossSign = await params.fastClient.evmSign({
|
|
213
213
|
certificate: transferResult.certificate,
|
|
214
214
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
// Use the transaction hash directly (keccak256 of BCS-serialized transaction)
|
|
216
|
+
// This matches how x402-sdk and AllSetPortal compute the transfer ID
|
|
217
|
+
const transferFastTxId = transferResult.txHash;
|
|
218
218
|
const dynamicTransferPayload = encodeAbiParameters([{ type: 'address' }, { type: 'address' }], [
|
|
219
219
|
evmTokenAddress,
|
|
220
220
|
params.receiverAddress,
|
|
221
221
|
]);
|
|
222
|
+
// Deadline: 1 hour from now
|
|
223
|
+
const deadline = BigInt(Math.floor(Date.now() / 1000) + 3600);
|
|
222
224
|
const intentClaimEncoded = encodeAbiParameters([{
|
|
223
225
|
type: 'tuple',
|
|
224
226
|
components: [
|
|
225
|
-
{ name: '
|
|
227
|
+
{ name: 'transferFastTxId', type: 'bytes32' },
|
|
228
|
+
{ name: 'deadline', type: 'uint256' },
|
|
226
229
|
{
|
|
227
230
|
name: 'intents',
|
|
228
231
|
type: 'tuple[]',
|
|
@@ -234,7 +237,8 @@ export const omnisetProvider = {
|
|
|
234
237
|
},
|
|
235
238
|
],
|
|
236
239
|
}], [{
|
|
237
|
-
|
|
240
|
+
transferFastTxId,
|
|
241
|
+
deadline,
|
|
238
242
|
intents: [{
|
|
239
243
|
action: 1,
|
|
240
244
|
payload: dynamicTransferPayload,
|
|
@@ -261,11 +265,13 @@ export const omnisetProvider = {
|
|
|
261
265
|
const relayerBody = {
|
|
262
266
|
encoded_transfer_claim: Array.from(new Uint8Array(transferCrossSign.transaction.map(Number))),
|
|
263
267
|
transfer_proof: transferCrossSign.signature,
|
|
268
|
+
transfer_fast_tx_id: transferResult.txHash,
|
|
264
269
|
transfer_claim_id: transferResult.txHash,
|
|
265
270
|
fastset_address: params.senderAddress,
|
|
266
271
|
external_address: params.receiverAddress,
|
|
267
272
|
encoded_intent_claim: Array.from(new Uint8Array(intentCrossSign.transaction.map(Number))),
|
|
268
273
|
intent_proof: intentCrossSign.signature,
|
|
274
|
+
intent_fast_tx_id: intentResult.txHash,
|
|
269
275
|
intent_claim_id: intentResult.txHash,
|
|
270
276
|
external_token_address: evmTokenAddress,
|
|
271
277
|
};
|
|
@@ -276,13 +282,13 @@ export const omnisetProvider = {
|
|
|
276
282
|
});
|
|
277
283
|
if (!relayRes.ok) {
|
|
278
284
|
const text = await relayRes.text();
|
|
279
|
-
throw new FastError('TX_FAILED', `
|
|
280
|
-
note: 'The withdrawal was submitted to Fast
|
|
285
|
+
throw new FastError('TX_FAILED', `AllSet relayer request failed (${relayRes.status}): ${text}`, {
|
|
286
|
+
note: 'The withdrawal was submitted to Fast network but the relayer rejected it. Try again.',
|
|
281
287
|
});
|
|
282
288
|
}
|
|
283
289
|
return {
|
|
284
290
|
txHash: transferResult.txHash,
|
|
285
|
-
orderId:
|
|
291
|
+
orderId: transferFastTxId,
|
|
286
292
|
estimatedTime: '1-5 minutes',
|
|
287
293
|
};
|
|
288
294
|
}
|
|
@@ -290,7 +296,7 @@ export const omnisetProvider = {
|
|
|
290
296
|
if (err instanceof FastError)
|
|
291
297
|
throw err;
|
|
292
298
|
const msg = err instanceof Error ? err.message : String(err);
|
|
293
|
-
throw new FastError('TX_FAILED', `
|
|
299
|
+
throw new FastError('TX_FAILED', `AllSet bridge failed: ${msg}`, {
|
|
294
300
|
note: 'Check that both chains are configured and have sufficient balance.',
|
|
295
301
|
});
|
|
296
302
|
}
|
package/dist/bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src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AAO;gBACL,MAAM,EAAE,cAAc,CAAC,MAAM;gBAC7B,OAAO,EAAE,gBAAgB;gBACzB,aAAa,EAAE,aAAa;aAC7B,CAAC;QACJ,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,IAAI,GAAG,YAAY,SAAS;gBAAE,MAAM,GAAG,CAAC;YACxC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,IAAI,SAAS,CACjB,WAAW,EACX,yBAAyB,GAAG,EAAE,EAC9B;gBACE,IAAI,EAAE,oEAAoE;aAC3E,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/dist/evm-executor.d.ts
CHANGED
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
* evm-executor.ts — Minimal EVM transaction executor using viem
|
|
3
3
|
*
|
|
4
4
|
* Provides sendTx, checkAllowance, and approveErc20 for bridge operations.
|
|
5
|
+
* Also provides createEvmWallet() to generate a new EVM wallet.
|
|
5
6
|
*/
|
|
6
7
|
import type { EvmTxExecutor } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Generate a new EVM wallet (private key + address).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const wallet = createEvmWallet();
|
|
14
|
+
* console.log(wallet.address); // 0x...
|
|
15
|
+
* // Persist wallet.privateKey securely. Never log or commit it.
|
|
16
|
+
*
|
|
17
|
+
* // Use with createEvmExecutor
|
|
18
|
+
* const executor = createEvmExecutor(wallet.privateKey, rpcUrl, chainId);
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @returns Object containing privateKey and address
|
|
22
|
+
*/
|
|
23
|
+
export declare function createEvmWallet(): {
|
|
24
|
+
privateKey: `0x${string}`;
|
|
25
|
+
address: `0x${string}`;
|
|
26
|
+
};
|
|
7
27
|
export declare function createEvmExecutor(privateKey: string, rpcUrl: string, chainId: number): EvmTxExecutor;
|
|
8
28
|
//# sourceMappingURL=evm-executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm-executor.d.ts","sourceRoot":"","sources":["../src/evm-executor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"evm-executor.d.ts","sourceRoot":"","sources":["../src/evm-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,IAAI;IAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAA;CAAE,CAOvF;AAYD,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,aAAa,CAyDf"}
|
package/dist/evm-executor.js
CHANGED
|
@@ -2,10 +2,34 @@
|
|
|
2
2
|
* evm-executor.ts — Minimal EVM transaction executor using viem
|
|
3
3
|
*
|
|
4
4
|
* Provides sendTx, checkAllowance, and approveErc20 for bridge operations.
|
|
5
|
+
* Also provides createEvmWallet() to generate a new EVM wallet.
|
|
5
6
|
*/
|
|
6
7
|
import { createPublicClient, createWalletClient, http, parseAbi, } from 'viem';
|
|
7
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
8
|
+
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
|
|
8
9
|
import { arbitrumSepolia, sepolia } from 'viem/chains';
|
|
10
|
+
/**
|
|
11
|
+
* Generate a new EVM wallet (private key + address).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const wallet = createEvmWallet();
|
|
16
|
+
* console.log(wallet.address); // 0x...
|
|
17
|
+
* // Persist wallet.privateKey securely. Never log or commit it.
|
|
18
|
+
*
|
|
19
|
+
* // Use with createEvmExecutor
|
|
20
|
+
* const executor = createEvmExecutor(wallet.privateKey, rpcUrl, chainId);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @returns Object containing privateKey and address
|
|
24
|
+
*/
|
|
25
|
+
export function createEvmWallet() {
|
|
26
|
+
const privateKey = generatePrivateKey();
|
|
27
|
+
const account = privateKeyToAccount(privateKey);
|
|
28
|
+
return {
|
|
29
|
+
privateKey,
|
|
30
|
+
address: account.address,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
9
33
|
const ERC20_ABI = parseAbi([
|
|
10
34
|
'function approve(address spender, uint256 amount) returns (bool)',
|
|
11
35
|
'function allowance(address owner, address spender) view returns (uint256)',
|
package/dist/evm-executor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm-executor.js","sourceRoot":"","sources":["../src/evm-executor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"evm-executor.js","sourceRoot":"","sources":["../src/evm-executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,EACJ,QAAQ,GAGT,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,UAAU,GAAG,kBAAkB,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO;QACL,UAAU;QACV,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,QAAQ,CAAC;IACzB,kEAAkE;IAClE,2EAA2E;CAC5E,CAAC,CAAC;AAEH,MAAM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,IAAI,EAAE,CAAC,CAAC;YACvE,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;aAC9D,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK;YACxC,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC;gBAChD,OAAO,EAAE,KAAsB;gBAC/B,GAAG,EAAE,SAAS;gBACd,YAAY,EAAE,WAAW;gBACzB,IAAI,EAAE,CAAC,KAAsB,EAAE,OAAwB,CAAC;aACzD,CAAC,CAAC;YACH,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM;YACvC,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,aAAa,CAAC;gBAC5C,OAAO,EAAE,KAAsB;gBAC/B,GAAG,EAAE,SAAS;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,CAAC,OAAwB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;aACjD,CAAC,CAAC;YACH,MAAM,YAAY,CAAC,yBAAyB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fast-client.ts — FastClient implementation for AllSet SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides a reference implementation of the FastClient interface with proper
|
|
5
|
+
* handling of large integers (timestamp_nanos) to avoid JavaScript precision loss.
|
|
6
|
+
*/
|
|
7
|
+
import type { FastClient } from './types.js';
|
|
8
|
+
export interface FastClientOptions {
|
|
9
|
+
/** Private key as hex string (32 bytes / 64 hex chars) */
|
|
10
|
+
privateKey: string;
|
|
11
|
+
/** Public key as hex string (32 bytes / 64 hex chars) */
|
|
12
|
+
publicKey: string;
|
|
13
|
+
/** Optional RPC URL override */
|
|
14
|
+
rpcUrl?: string;
|
|
15
|
+
/** Optional cross-sign URL override */
|
|
16
|
+
crossSignUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FastWallet {
|
|
19
|
+
/** Private key as 64 hex chars (32 bytes), without 0x prefix */
|
|
20
|
+
privateKey: string;
|
|
21
|
+
/** Public key as 64 hex chars (32 bytes), without 0x prefix */
|
|
22
|
+
publicKey: string;
|
|
23
|
+
/** Fast bech32m address derived from the public key */
|
|
24
|
+
address: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Generate a new Fast wallet (private key + public key + address).
|
|
28
|
+
*
|
|
29
|
+
* Generate once, store the keys securely, then use them with createFastClient().
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const wallet = createFastWallet();
|
|
34
|
+
* const fastClient = createFastClient({
|
|
35
|
+
* privateKey: wallet.privateKey,
|
|
36
|
+
* publicKey: wallet.publicKey,
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function createFastWallet(): FastWallet;
|
|
41
|
+
/**
|
|
42
|
+
* Create a FastClient for interacting with the Fast network.
|
|
43
|
+
*
|
|
44
|
+
* IMPORTANT: This implementation properly handles large integers (timestamp_nanos)
|
|
45
|
+
* which exceed JavaScript's safe integer range. Incorrect handling causes transaction
|
|
46
|
+
* hash mismatches and on-chain verification failures (error 0x36289cf3).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const client = createFastClient({
|
|
51
|
+
* privateKey: process.env.FAST_PRIVATE_KEY!,
|
|
52
|
+
* publicKey: process.env.FAST_PUBLIC_KEY!,
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function createFastClient(options: FastClientOptions): FastClient;
|
|
57
|
+
//# sourceMappingURL=fast-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-client.d.ts","sourceRoot":"","sources":["../src/fast-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAkH7C,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB;AAOD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAkB7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAiOvE"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fast-client.ts — FastClient implementation for AllSet SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides a reference implementation of the FastClient interface with proper
|
|
5
|
+
* handling of large integers (timestamp_nanos) to avoid JavaScript precision loss.
|
|
6
|
+
*/
|
|
7
|
+
import { bcs } from '@mysten/bcs';
|
|
8
|
+
import * as ed from '@noble/ed25519';
|
|
9
|
+
import { sha512 } from '@noble/hashes/sha2.js';
|
|
10
|
+
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
11
|
+
import { bech32m } from 'bech32';
|
|
12
|
+
// Configure both the v3 hash API and the legacy sync hook for compatibility.
|
|
13
|
+
ed.etc.sha512Sync =
|
|
14
|
+
(...m) => sha512(ed.etc.concatBytes(...m));
|
|
15
|
+
ed.hashes.sha512 = sha512;
|
|
16
|
+
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
17
|
+
const DEFAULT_FAST_RPC_URL = 'https://staging.proxy.fastset.xyz';
|
|
18
|
+
const CROSS_SIGN_URL = 'https://staging.cross-sign.allset.fastset.xyz';
|
|
19
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
20
|
+
function hexToBytes(hex) {
|
|
21
|
+
const clean = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
22
|
+
if (!/^[0-9a-fA-F]*$/.test(clean) || clean.length % 2 !== 0) {
|
|
23
|
+
throw new Error(`Invalid hex string: ${hex}`);
|
|
24
|
+
}
|
|
25
|
+
const bytes = new Uint8Array(clean.length / 2);
|
|
26
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
27
|
+
bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
|
|
28
|
+
}
|
|
29
|
+
return bytes;
|
|
30
|
+
}
|
|
31
|
+
function bytesToHex(bytes) {
|
|
32
|
+
return Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
33
|
+
}
|
|
34
|
+
const BIGINT_MARKER = '__allset_bigint__:';
|
|
35
|
+
function stringifyRpcPayload(payload) {
|
|
36
|
+
return JSON.stringify(payload, (_key, value) => {
|
|
37
|
+
if (value instanceof Uint8Array)
|
|
38
|
+
return Array.from(value);
|
|
39
|
+
if (typeof value === 'bigint')
|
|
40
|
+
return `${BIGINT_MARKER}${value.toString()}`;
|
|
41
|
+
return value;
|
|
42
|
+
}).replace(/"__allset_bigint__:(-?\d+)"/g, '$1');
|
|
43
|
+
}
|
|
44
|
+
function parseRpcResponse(responseText) {
|
|
45
|
+
return JSON.parse(responseText.replace(/("timestamp_nanos"\s*:\s*)(\d+)/g, (_match, prefix, digits) => `${prefix}"${BIGINT_MARKER}${digits}"`), (_key, value) => {
|
|
46
|
+
if (typeof value === 'string' && value.startsWith(BIGINT_MARKER)) {
|
|
47
|
+
return BigInt(value.slice(BIGINT_MARKER.length));
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function pubkeyToFastAddress(pubkey) {
|
|
53
|
+
const pubkeyBytes = hexToBytes(pubkey);
|
|
54
|
+
const words = bech32m.toWords(pubkeyBytes);
|
|
55
|
+
return bech32m.encode('fast', words);
|
|
56
|
+
}
|
|
57
|
+
// ─── BCS Definitions ──────────────────────────────────────────────────────────
|
|
58
|
+
const AmountBcs = bcs.u256().transform({
|
|
59
|
+
input: (val) => {
|
|
60
|
+
const hexVal = val.startsWith('0x') ? val : `0x${val}`;
|
|
61
|
+
return BigInt(hexVal).toString();
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const TokenTransferBcs = bcs.struct('TokenTransfer', {
|
|
65
|
+
token_id: bcs.bytes(32),
|
|
66
|
+
amount: AmountBcs,
|
|
67
|
+
user_data: bcs.option(bcs.bytes(32)),
|
|
68
|
+
});
|
|
69
|
+
const ExternalClaimBodyBcs = bcs.struct('ExternalClaimBody', {
|
|
70
|
+
verifier_committee: bcs.vector(bcs.bytes(32)),
|
|
71
|
+
verifier_quorum: bcs.u64(),
|
|
72
|
+
claim_data: bcs.vector(bcs.u8()),
|
|
73
|
+
});
|
|
74
|
+
const ExternalClaimFullBcs = bcs.struct('ExternalClaimFull', {
|
|
75
|
+
claim: ExternalClaimBodyBcs,
|
|
76
|
+
signatures: bcs.vector(bcs.tuple([bcs.bytes(32), bcs.bytes(64)])),
|
|
77
|
+
});
|
|
78
|
+
const ClaimTypeBcs = bcs.enum('ClaimType', {
|
|
79
|
+
TokenTransfer: TokenTransferBcs,
|
|
80
|
+
TokenCreation: bcs.struct('TokenCreation', { dummy: bcs.u8() }),
|
|
81
|
+
TokenManagement: bcs.struct('TokenManagement', { dummy: bcs.u8() }),
|
|
82
|
+
Mint: bcs.struct('Mint', { dummy: bcs.u8() }),
|
|
83
|
+
Burn: bcs.struct('Burn', { dummy: bcs.u8() }),
|
|
84
|
+
StateInitialization: bcs.struct('StateInitialization', { dummy: bcs.u8() }),
|
|
85
|
+
StateUpdate: bcs.struct('StateUpdate', { dummy: bcs.u8() }),
|
|
86
|
+
ExternalClaim: ExternalClaimFullBcs,
|
|
87
|
+
StateReset: bcs.struct('StateReset', { dummy: bcs.u8() }),
|
|
88
|
+
JoinCommittee: bcs.struct('JoinCommittee', { dummy: bcs.u8() }),
|
|
89
|
+
LeaveCommittee: bcs.struct('LeaveCommittee', { dummy: bcs.u8() }),
|
|
90
|
+
ChangeCommittee: bcs.struct('ChangeCommittee', { dummy: bcs.u8() }),
|
|
91
|
+
Batch: bcs.struct('Batch', { dummy: bcs.u8() }),
|
|
92
|
+
});
|
|
93
|
+
const TransactionBcs = bcs.struct('Transaction', {
|
|
94
|
+
sender: bcs.bytes(32),
|
|
95
|
+
recipient: bcs.bytes(32),
|
|
96
|
+
nonce: bcs.u64(),
|
|
97
|
+
timestamp_nanos: bcs.u128(),
|
|
98
|
+
claim: ClaimTypeBcs,
|
|
99
|
+
archival: bcs.bool(),
|
|
100
|
+
});
|
|
101
|
+
// ─── FastClient Implementation ────────────────────────────────────────────────
|
|
102
|
+
/**
|
|
103
|
+
* Generate a new Fast wallet (private key + public key + address).
|
|
104
|
+
*
|
|
105
|
+
* Generate once, store the keys securely, then use them with createFastClient().
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const wallet = createFastWallet();
|
|
110
|
+
* const fastClient = createFastClient({
|
|
111
|
+
* privateKey: wallet.privateKey,
|
|
112
|
+
* publicKey: wallet.publicKey,
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export function createFastWallet() {
|
|
117
|
+
const privateKeyBytes = ed.utils.randomSecretKey();
|
|
118
|
+
let publicKeyBytes = null;
|
|
119
|
+
try {
|
|
120
|
+
publicKeyBytes = ed.getPublicKey(privateKeyBytes);
|
|
121
|
+
const privateKey = bytesToHex(privateKeyBytes);
|
|
122
|
+
const publicKey = bytesToHex(publicKeyBytes);
|
|
123
|
+
return {
|
|
124
|
+
privateKey,
|
|
125
|
+
publicKey,
|
|
126
|
+
address: pubkeyToFastAddress(publicKey),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
privateKeyBytes.fill(0);
|
|
131
|
+
publicKeyBytes?.fill(0);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a FastClient for interacting with the Fast network.
|
|
136
|
+
*
|
|
137
|
+
* IMPORTANT: This implementation properly handles large integers (timestamp_nanos)
|
|
138
|
+
* which exceed JavaScript's safe integer range. Incorrect handling causes transaction
|
|
139
|
+
* hash mismatches and on-chain verification failures (error 0x36289cf3).
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const client = createFastClient({
|
|
144
|
+
* privateKey: process.env.FAST_PRIVATE_KEY!,
|
|
145
|
+
* publicKey: process.env.FAST_PUBLIC_KEY!,
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export function createFastClient(options) {
|
|
150
|
+
const { privateKey, publicKey, rpcUrl = DEFAULT_FAST_RPC_URL, crossSignUrl = CROSS_SIGN_URL } = options;
|
|
151
|
+
const privateKeyBytes = hexToBytes(privateKey);
|
|
152
|
+
const publicKeyBytes = hexToBytes(publicKey);
|
|
153
|
+
if (privateKeyBytes.length !== 32) {
|
|
154
|
+
throw new Error('Fast privateKey must be a 32-byte hex string');
|
|
155
|
+
}
|
|
156
|
+
if (publicKeyBytes.length !== 32) {
|
|
157
|
+
throw new Error('Fast publicKey must be a 32-byte hex string');
|
|
158
|
+
}
|
|
159
|
+
const derivedPublicKey = ed.getPublicKey(privateKeyBytes);
|
|
160
|
+
const normalizedPublicKey = bytesToHex(publicKeyBytes);
|
|
161
|
+
const normalizedDerivedPublicKey = bytesToHex(derivedPublicKey);
|
|
162
|
+
derivedPublicKey.fill(0);
|
|
163
|
+
if (normalizedPublicKey !== normalizedDerivedPublicKey) {
|
|
164
|
+
throw new Error('Fast publicKey does not match the supplied privateKey');
|
|
165
|
+
}
|
|
166
|
+
const address = pubkeyToFastAddress(normalizedPublicKey);
|
|
167
|
+
async function getNonce() {
|
|
168
|
+
const payload = {
|
|
169
|
+
jsonrpc: '2.0',
|
|
170
|
+
id: Date.now(),
|
|
171
|
+
method: 'proxy_getAccountInfo',
|
|
172
|
+
params: {
|
|
173
|
+
address: Array.from(publicKeyBytes),
|
|
174
|
+
token_balances_filter: [],
|
|
175
|
+
state_key_filter: null,
|
|
176
|
+
certificate_by_nonce: null,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
const response = await fetch(rpcUrl, {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
headers: { 'Content-Type': 'application/json' },
|
|
182
|
+
body: stringifyRpcPayload(payload),
|
|
183
|
+
});
|
|
184
|
+
const result = parseRpcResponse(await response.text());
|
|
185
|
+
const nextNonce = result.result?.next_nonce;
|
|
186
|
+
return nextNonce === undefined ? 0 : Number(nextNonce);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Compute transaction hash from certificate.
|
|
190
|
+
*
|
|
191
|
+
* CRITICAL: timestamp_nanos can exceed JavaScript's safe integer range (2^53 - 1).
|
|
192
|
+
* We extract it from raw response text BEFORE JSON parsing to preserve precision.
|
|
193
|
+
*/
|
|
194
|
+
function computeTxHash(responseText, certificate) {
|
|
195
|
+
const cert = certificate;
|
|
196
|
+
if (!cert.envelope?.transaction) {
|
|
197
|
+
throw new Error('Certificate missing envelope.transaction');
|
|
198
|
+
}
|
|
199
|
+
const certTx = structuredClone(cert.envelope.transaction);
|
|
200
|
+
// Normalize amount to hex with 0x prefix
|
|
201
|
+
if (certTx.claim?.TokenTransfer?.amount !== undefined) {
|
|
202
|
+
const amt = certTx.claim.TokenTransfer.amount;
|
|
203
|
+
if (typeof amt === 'string' && !amt.startsWith('0x')) {
|
|
204
|
+
// Amount is hex string without prefix - just add prefix
|
|
205
|
+
certTx.claim.TokenTransfer.amount = '0x' + amt;
|
|
206
|
+
}
|
|
207
|
+
else if (typeof amt === 'number') {
|
|
208
|
+
certTx.claim.TokenTransfer.amount = '0x' + BigInt(amt).toString(16);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// CRITICAL: Extract timestamp_nanos from raw response to preserve precision
|
|
212
|
+
// JavaScript's JSON.parse converts large numbers to floats, losing precision
|
|
213
|
+
// for values > Number.MAX_SAFE_INTEGER (9007199254740991)
|
|
214
|
+
const rawTsMatch = responseText.match(/"timestamp_nanos"\s*:\s*(\d+)/);
|
|
215
|
+
if (rawTsMatch) {
|
|
216
|
+
certTx.timestamp_nanos = BigInt(rawTsMatch[1]);
|
|
217
|
+
}
|
|
218
|
+
else if (certTx.timestamp_nanos !== undefined) {
|
|
219
|
+
// Fallback - may lose precision for large values
|
|
220
|
+
certTx.timestamp_nanos = BigInt(certTx.timestamp_nanos);
|
|
221
|
+
}
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
223
|
+
const certTxBytes = TransactionBcs.serialize(certTx).toBytes();
|
|
224
|
+
return '0x' + bytesToHex(keccak_256(certTxBytes));
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
address,
|
|
228
|
+
async submit(params) {
|
|
229
|
+
const nonce = await getNonce();
|
|
230
|
+
// Decode recipient
|
|
231
|
+
const decoded = bech32m.decode(params.recipient, 90);
|
|
232
|
+
const recipientPubKey = new Uint8Array(bech32m.fromWords(decoded.words));
|
|
233
|
+
const baseTransaction = {
|
|
234
|
+
sender: publicKeyBytes,
|
|
235
|
+
recipient: recipientPubKey,
|
|
236
|
+
nonce,
|
|
237
|
+
timestamp_nanos: BigInt(Date.now()) * 1000000n,
|
|
238
|
+
archival: false,
|
|
239
|
+
};
|
|
240
|
+
let claim;
|
|
241
|
+
if (params.claim.TokenTransfer) {
|
|
242
|
+
const tt = params.claim.TokenTransfer;
|
|
243
|
+
const hexAmount = BigInt(tt.amount).toString(16);
|
|
244
|
+
claim = {
|
|
245
|
+
TokenTransfer: {
|
|
246
|
+
token_id: tt.token_id,
|
|
247
|
+
amount: hexAmount,
|
|
248
|
+
user_data: tt.user_data,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
else if (params.claim.ExternalClaim) {
|
|
253
|
+
const ec = params.claim.ExternalClaim;
|
|
254
|
+
claim = {
|
|
255
|
+
ExternalClaim: {
|
|
256
|
+
claim: {
|
|
257
|
+
verifier_committee: ec.claim.verifier_committee ?? [],
|
|
258
|
+
verifier_quorum: ec.claim.verifier_quorum ?? 0,
|
|
259
|
+
claim_data: ec.claim.claim_data ?? [],
|
|
260
|
+
},
|
|
261
|
+
signatures: ec.signatures ?? [],
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
throw new Error('Unsupported claim type: ' + Object.keys(params.claim).join(', '));
|
|
267
|
+
}
|
|
268
|
+
const transaction = {
|
|
269
|
+
...baseTransaction,
|
|
270
|
+
claim,
|
|
271
|
+
};
|
|
272
|
+
// Sign: ed25519("Transaction::" + BCS(transaction))
|
|
273
|
+
const msgHead = new TextEncoder().encode('Transaction::');
|
|
274
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
275
|
+
const msgBody = TransactionBcs.serialize(transaction).toBytes();
|
|
276
|
+
const msg = new Uint8Array(msgHead.length + msgBody.length);
|
|
277
|
+
msg.set(msgHead, 0);
|
|
278
|
+
msg.set(msgBody, msgHead.length);
|
|
279
|
+
const signatureBytes = await ed.signAsync(msg, privateKeyBytes.slice(0, 32));
|
|
280
|
+
// Submit to RPC
|
|
281
|
+
const payload = {
|
|
282
|
+
jsonrpc: '2.0',
|
|
283
|
+
id: Date.now(),
|
|
284
|
+
method: 'proxy_submitTransaction',
|
|
285
|
+
params: {
|
|
286
|
+
transaction,
|
|
287
|
+
signature: { Signature: Array.from(signatureBytes) },
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
const response = await fetch(rpcUrl, {
|
|
291
|
+
method: 'POST',
|
|
292
|
+
headers: { 'Content-Type': 'application/json' },
|
|
293
|
+
body: stringifyRpcPayload(payload),
|
|
294
|
+
});
|
|
295
|
+
// Keep raw response text for precise timestamp_nanos extraction
|
|
296
|
+
const responseText = await response.text();
|
|
297
|
+
const result = parseRpcResponse(responseText);
|
|
298
|
+
if (result.error) {
|
|
299
|
+
throw new Error(`Fast RPC error: ${result.error.message}`);
|
|
300
|
+
}
|
|
301
|
+
const submitResult = result.result;
|
|
302
|
+
const certificate = submitResult?.Success ?? submitResult;
|
|
303
|
+
if (!certificate) {
|
|
304
|
+
throw new Error('No result from Fast RPC');
|
|
305
|
+
}
|
|
306
|
+
// Compute hash with precise timestamp_nanos
|
|
307
|
+
const txHash = computeTxHash(responseText, certificate);
|
|
308
|
+
return { txHash, certificate };
|
|
309
|
+
},
|
|
310
|
+
async evmSign(params) {
|
|
311
|
+
const res = await fetch(crossSignUrl, {
|
|
312
|
+
method: 'POST',
|
|
313
|
+
headers: { 'Content-Type': 'application/json' },
|
|
314
|
+
body: stringifyRpcPayload({
|
|
315
|
+
jsonrpc: '2.0',
|
|
316
|
+
id: 1,
|
|
317
|
+
method: 'crossSign_evmSignCertificate',
|
|
318
|
+
params: { certificate: params.certificate },
|
|
319
|
+
}),
|
|
320
|
+
});
|
|
321
|
+
if (!res.ok) {
|
|
322
|
+
throw new Error(`Cross-sign request failed: ${res.status}`);
|
|
323
|
+
}
|
|
324
|
+
const json = await res.json();
|
|
325
|
+
if (json.error) {
|
|
326
|
+
throw new Error(`Cross-sign error: ${json.error.message}`);
|
|
327
|
+
}
|
|
328
|
+
if (!json.result?.transaction || !json.result?.signature) {
|
|
329
|
+
throw new Error('Cross-sign returned invalid response');
|
|
330
|
+
}
|
|
331
|
+
return json.result;
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=fast-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-client.js","sourceRoot":"","sources":["../src/fast-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGjC,6EAA6E;AAC5E,EAAE,CAAC,GAAqE,CAAC,UAAU;IAClF,CAAC,GAAG,CAAe,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3D,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AAE1B,iFAAiF;AAEjF,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AACjE,MAAM,cAAc,GAAG,+CAA+C,CAAC;AAEvE,iFAAiF;AAEjF,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACxD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CA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CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;gBACzD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YAC1D,CAAC;YAED,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fastxyz/allset-sdk —
|
|
2
|
+
* @fastxyz/allset-sdk — AllSet bridge SDK
|
|
3
3
|
*
|
|
4
|
-
* Bridges assets between Fast
|
|
4
|
+
* Bridges assets between Fast network and supported EVM routes.
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export { createEvmExecutor } from './evm-executor.js';
|
|
8
|
-
export
|
|
6
|
+
export { allsetProvider } from './bridge.js';
|
|
7
|
+
export { createEvmExecutor, createEvmWallet } from './evm-executor.js';
|
|
8
|
+
export { createFastClient, createFastWallet } from './fast-client.js';
|
|
9
|
+
export type { BridgeProvider, EvmTxExecutor, FastClient, AllSetChainConfig, AllSetTokenInfo, } from './types.js';
|
|
10
|
+
export type { FastClientOptions, FastWallet } from './fast-client.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,YAAY,EACV,cAAc,EACd,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fastxyz/allset-sdk —
|
|
2
|
+
* @fastxyz/allset-sdk — AllSet bridge SDK
|
|
3
3
|
*
|
|
4
|
-
* Bridges assets between Fast
|
|
4
|
+
* Bridges assets between Fast network and supported EVM routes.
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export { createEvmExecutor } from './evm-executor.js';
|
|
6
|
+
export { allsetProvider } from './bridge.js';
|
|
7
|
+
export { createEvmExecutor, createEvmWallet } from './evm-executor.js';
|
|
8
|
+
export { createFastClient, createFastWallet } from './fast-client.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -53,13 +53,13 @@ export interface BridgeProvider {
|
|
|
53
53
|
estimatedTime?: string;
|
|
54
54
|
}>;
|
|
55
55
|
}
|
|
56
|
-
export interface
|
|
56
|
+
export interface AllSetChainConfig {
|
|
57
57
|
chainId: number;
|
|
58
58
|
bridgeContract: string;
|
|
59
59
|
fastsetBridgeAddress: string;
|
|
60
60
|
relayerUrl: string;
|
|
61
61
|
}
|
|
62
|
-
export interface
|
|
62
|
+
export interface AllSetTokenInfo {
|
|
63
63
|
evmAddress: string;
|
|
64
64
|
fastsetTokenId: Uint8Array;
|
|
65
65
|
decimals: number;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,MAAM,EAAE;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACtD,OAAO,CAAC,MAAM,EAAE;QACd,WAAW,EAAE,OAAO,CAAC;KACtB,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAAA;KAAE,CAAC,CAAC;IAChE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/E,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MA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GAAG,OAAO,CAAC;QACV,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,UAAU,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastxyz/allset-sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "AllSet SDK for
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "AllSet SDK for AllSet bridge flows between Fast and EVM testnets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allset",
|
|
7
7
|
"sdk",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=20"
|
|
35
35
|
},
|
|
36
|
-
"author": "
|
|
36
|
+
"author": "Fast.xyz",
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/fastxyz/allset-sdk#readme",
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@mysten/bcs": "^2.0.2",
|
|
51
|
+
"@noble/ed25519": "^3.0.0",
|
|
52
|
+
"@noble/hashes": "^2.0.1",
|
|
50
53
|
"bech32": "^2.0.0",
|
|
51
54
|
"viem": "^2.46.2"
|
|
52
55
|
},
|