@across-protocol/contracts 4.0.2 → 4.0.3
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/dist/deploy/consts.d.ts +1 -1
- package/dist/deploy/consts.js +1 -15
- package/dist/deployments/deployments.json +18 -0
- package/dist/scripts/svm/fakeFillWithRandomDistribution.js +2 -2
- package/dist/scripts/svm/queryEvents.js +1 -1
- package/dist/scripts/svm/simpleDeposit.js +3 -3
- package/dist/scripts/svm/simpleFakeRelayerRepayment.js +1 -1
- package/dist/scripts/svm/simpleFill.js +19 -6
- package/dist/src/svm/assets/idl/svm_spoke.json +435 -385
- package/dist/src/svm/assets/svm_spoke.d.ts +435 -385
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.d.ts +31 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.js +70 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.d.ts +31 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.js +67 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/index.d.ts +3 -3
- package/dist/src/svm/clients/SvmSpoke/accounts/index.js +3 -3
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.d.ts +27 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.js +66 -0
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.d.ts +35 -15
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.js +52 -22
- package/dist/src/svm/clients/SvmSpoke/instructions/deposit.d.ts +123 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{depositV3.js → deposit.js} +23 -23
- package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.d.ts +119 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{depositV3Now.js → depositNow.js} +23 -23
- package/dist/src/svm/clients/SvmSpoke/instructions/executeSlowRelayLeaf.d.ts +104 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{executeV3SlowRelayLeaf.js → executeSlowRelayLeaf.js} +26 -26
- package/dist/src/svm/clients/SvmSpoke/instructions/fillRelay.d.ts +104 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{fillV3Relay.js → fillRelay.js} +26 -26
- package/dist/src/svm/clients/SvmSpoke/instructions/index.d.ts +6 -6
- package/dist/src/svm/clients/SvmSpoke/instructions/index.js +6 -6
- package/dist/src/svm/clients/SvmSpoke/instructions/requestSlowFill.d.ts +76 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{requestV3SlowFill.js → requestSlowFill.js} +25 -25
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.d.ts +127 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/{unsafeDepositV3.js → unsafeDeposit.js} +23 -23
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.d.ts +23 -23
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.js +29 -29
- package/dist/src/svm/clients/SvmSpoke/types/{filledV3Relay.d.ts → filledRelay.d.ts} +8 -8
- package/dist/src/svm/clients/SvmSpoke/types/{filledV3Relay.js → filledRelay.js} +9 -9
- package/dist/src/svm/clients/SvmSpoke/types/{v3FundsDeposited.d.ts → fundsDeposited.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{v3FundsDeposited.js → fundsDeposited.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/index.d.ts +6 -6
- package/dist/src/svm/clients/SvmSpoke/types/index.js +6 -6
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayData.d.ts → relayData.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayData.js → relayData.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayExecutionEventInfo.d.ts → relayExecutionEventInfo.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{v3RelayExecutionEventInfo.js → relayExecutionEventInfo.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/{requestedV3SlowFill.d.ts → requestedSlowFill.d.ts} +5 -5
- package/dist/src/svm/clients/SvmSpoke/types/{requestedV3SlowFill.js → requestedSlowFill.js} +7 -7
- package/dist/src/svm/clients/SvmSpoke/types/{v3SlowFill.d.ts → slowFill.d.ts} +8 -8
- package/dist/src/svm/clients/SvmSpoke/types/{v3SlowFill.js → slowFill.js} +9 -9
- package/dist/src/svm/web3-v1/instructionParamsUtils.d.ts +8 -8
- package/dist/src/svm/web3-v1/instructionParamsUtils.js +16 -16
- package/dist/src/types/svm.d.ts +6 -6
- package/dist/target/types/svm_spoke.d.ts +435 -385
- package/dist/tasks/enableL1TokenAcrossEcosystem.js +14 -10
- package/dist/test/svm/SvmSpoke.Deposit.js +48 -47
- package/dist/test/svm/SvmSpoke.Fill.AcrossPlus.js +2 -2
- package/dist/test/svm/SvmSpoke.Fill.js +28 -56
- package/dist/test/svm/SvmSpoke.SlowFill.AcrossPlus.js +13 -13
- package/dist/test/svm/SvmSpoke.SlowFill.js +40 -40
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +3 -1
- package/package.json +2 -2
- package/dist/src/svm/clients/SvmSpoke/accounts/executeV3SlowRelayLeafParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/executeV3SlowRelayLeafParams.js +0 -70
- package/dist/src/svm/clients/SvmSpoke/accounts/fillV3RelayParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/fillV3RelayParams.js +0 -67
- package/dist/src/svm/clients/SvmSpoke/accounts/requestV3SlowFillParams.d.ts +0 -27
- package/dist/src/svm/clients/SvmSpoke/accounts/requestV3SlowFillParams.js +0 -66
- package/dist/src/svm/clients/SvmSpoke/instructions/depositV3.d.ts +0 -123
- package/dist/src/svm/clients/SvmSpoke/instructions/depositV3Now.d.ts +0 -119
- package/dist/src/svm/clients/SvmSpoke/instructions/executeV3SlowRelayLeaf.d.ts +0 -104
- package/dist/src/svm/clients/SvmSpoke/instructions/fillV3Relay.d.ts +0 -104
- package/dist/src/svm/clients/SvmSpoke/instructions/requestV3SlowFill.d.ts +0 -76
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDepositV3.d.ts +0 -127
package/dist/deploy/consts.d.ts
CHANGED
package/dist/deploy/consts.js
CHANGED
|
@@ -244,18 +244,4 @@ exports.POLYGON_CHAIN_IDS = {
|
|
|
244
244
|
* and is an internal mappinng maintained by Circle.
|
|
245
245
|
* @link https://developers.circle.com/stablecoins/docs/supported-domains
|
|
246
246
|
*/
|
|
247
|
-
exports.CIRCLE_DOMAIN_IDs = {
|
|
248
|
-
[utils_1.CHAIN_IDs.MAINNET]: 0,
|
|
249
|
-
[utils_1.CHAIN_IDs.OPTIMISM]: 2,
|
|
250
|
-
[utils_1.CHAIN_IDs.ARBITRUM]: 3,
|
|
251
|
-
[utils_1.CHAIN_IDs.BASE]: 6,
|
|
252
|
-
[utils_1.CHAIN_IDs.POLYGON]: 7,
|
|
253
|
-
[utils_1.CHAIN_IDs.UNICHAIN]: 10,
|
|
254
|
-
// Testnet
|
|
255
|
-
[utils_1.CHAIN_IDs.SEPOLIA]: 0,
|
|
256
|
-
[utils_1.CHAIN_IDs.OPTIMISM_SEPOLIA]: 2,
|
|
257
|
-
[utils_1.CHAIN_IDs.ARBITRUM_SEPOLIA]: 3,
|
|
258
|
-
[utils_1.CHAIN_IDs.BASE_SEPOLIA]: 6,
|
|
259
|
-
[utils_1.CHAIN_IDs.POLYGON_AMOY]: 7,
|
|
260
|
-
[utils_1.CHAIN_IDs.UNICHAIN_SEPOLIA]: 10,
|
|
261
|
-
};
|
|
247
|
+
exports.CIRCLE_DOMAIN_IDs = Object.fromEntries(Object.entries(utils_1.PUBLIC_NETWORKS).map(([chainId, { cctpDomain }]) => [Number(chainId), cctpDomain]));
|
|
@@ -183,5 +183,23 @@
|
|
|
183
183
|
"1301": {
|
|
184
184
|
"SpokePool": { "address": "0x6999526e507Cc3b03b180BbE05E1Ff938259A874", "blockNumber": 12593713 },
|
|
185
185
|
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 12594561 }
|
|
186
|
+
},
|
|
187
|
+
"133268194659241": {
|
|
188
|
+
"SvmSpoke": {
|
|
189
|
+
"address": "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq",
|
|
190
|
+
"blockNumber": 356313770
|
|
191
|
+
},
|
|
192
|
+
"MulticallHandler": {
|
|
193
|
+
"address": "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h",
|
|
194
|
+
"blockNumber": 356321050
|
|
195
|
+
},
|
|
196
|
+
"MessageTransmitter": {
|
|
197
|
+
"address": "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd",
|
|
198
|
+
"blockNumber": 339604856
|
|
199
|
+
},
|
|
200
|
+
"TokenMessengerMinter": {
|
|
201
|
+
"address": "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3",
|
|
202
|
+
"blockNumber": 277864039
|
|
203
|
+
}
|
|
186
204
|
}
|
|
187
205
|
}
|
|
@@ -153,7 +153,7 @@ async function fillV3RelayToRandom() {
|
|
|
153
153
|
// Prepare fill instruction as we will need to use Address Lookup Table (ALT).
|
|
154
154
|
const fillV3RelayValues = [relayHash, relayData, repaymentChain, repaymentAddress];
|
|
155
155
|
if (bufferParams) {
|
|
156
|
-
await (0, web3_v1_1.
|
|
156
|
+
await (0, web3_v1_1.loadFillRelayParams)(program, signer, fillV3RelayValues[1], fillV3RelayValues[2], fillV3RelayValues[3]);
|
|
157
157
|
}
|
|
158
158
|
const fillV3RelayParams = bufferParams ? [fillV3RelayValues[0], null, null, null] : fillV3RelayValues;
|
|
159
159
|
const [instructionParams] = bufferParams
|
|
@@ -177,7 +177,7 @@ async function fillV3RelayToRandom() {
|
|
|
177
177
|
...multicallHandlerCoder.compiledKeyMetas,
|
|
178
178
|
];
|
|
179
179
|
const fillInstruction = await program.methods
|
|
180
|
-
.
|
|
180
|
+
.fillRelay(...fillV3RelayParams)
|
|
181
181
|
.accounts(fillAccounts)
|
|
182
182
|
.remainingAccounts(remainingAccounts)
|
|
183
183
|
.instruction();
|
|
@@ -49,7 +49,7 @@ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
|
49
49
|
.option("inputAmount", { type: "number", demandOption: true, describe: "Input amount" })
|
|
50
50
|
.option("outputAmount", { type: "number", demandOption: true, describe: "Output amount" })
|
|
51
51
|
.option("destinationChainId", { type: "string", demandOption: true, describe: "Destination chain ID" }).argv;
|
|
52
|
-
async function
|
|
52
|
+
async function deposit() {
|
|
53
53
|
const resolvedArgv = await argv;
|
|
54
54
|
const seed = new anchor_1.BN(resolvedArgv.seed);
|
|
55
55
|
const recipient = new web3_js_1.PublicKey(resolvedArgv.recipient);
|
|
@@ -98,7 +98,7 @@ async function depositV3() {
|
|
|
98
98
|
const tokenDecimals = (await (0, spl_token_1.getMint)(provider.connection, inputToken, undefined, spl_token_1.TOKEN_PROGRAM_ID)).decimals;
|
|
99
99
|
// Delegate state PDA to pull depositor tokens.
|
|
100
100
|
const approveIx = await (0, spl_token_1.createApproveCheckedInstruction)(userTokenAccount, inputToken, statePda, signer.publicKey, BigInt(inputAmount.toString()), tokenDecimals, undefined, spl_token_1.TOKEN_PROGRAM_ID);
|
|
101
|
-
const depositIx = await program.methods.
|
|
101
|
+
const depositIx = await program.methods.deposit(signer.publicKey, recipient, inputToken, outputToken, inputAmount, outputAmount, destinationChainId, exclusiveRelayer, quoteTimestamp, fillDeadline, exclusivityDeadline, message)
|
|
102
102
|
.accounts({
|
|
103
103
|
state: statePda,
|
|
104
104
|
route: routePda,
|
|
@@ -114,4 +114,4 @@ async function depositV3() {
|
|
|
114
114
|
console.log("Transaction signature:", tx);
|
|
115
115
|
}
|
|
116
116
|
// Run the depositV3 function
|
|
117
|
-
|
|
117
|
+
deposit();
|
|
@@ -76,7 +76,7 @@ async function testBundleLogic() {
|
|
|
76
76
|
// Delegate state PDA to pull depositor tokens.
|
|
77
77
|
const inputAmount = amounts.reduce((acc, amount) => acc.add(amount), new anchor_1.BN(0));
|
|
78
78
|
const approveIx = await (0, spl_token_1.createApproveCheckedInstruction)(userTokenAccount, inputToken, statePda, signer.publicKey, BigInt(inputAmount.toString()), tokenDecimals, undefined, spl_token_1.TOKEN_PROGRAM_ID);
|
|
79
|
-
const depositIx = await program.methods.
|
|
79
|
+
const depositIx = await program.methods.deposit(signer.publicKey, signer.publicKey, // recipient is the signer for this example
|
|
80
80
|
inputToken, inputToken, // Re-use inputToken as outputToken. does not matter for this deposit.
|
|
81
81
|
inputAmount, new anchor_1.BN(0), new anchor_1.BN(11155111), // destinationChainId. assumed to be enabled, as with routePDA
|
|
82
82
|
web3_js_1.PublicKey.default, // exclusiveRelayer
|
|
@@ -54,7 +54,7 @@ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
|
54
54
|
.option("depositId", { type: "string", demandOption: true, describe: "Deposit ID" })
|
|
55
55
|
.option("fillDeadline", { type: "number", demandOption: false, describe: "Fill deadline" })
|
|
56
56
|
.option("exclusivityDeadline", { type: "number", demandOption: false, describe: "Exclusivity deadline" }).argv;
|
|
57
|
-
async function
|
|
57
|
+
async function fillRelay() {
|
|
58
58
|
const resolvedArgv = await argv;
|
|
59
59
|
const depositor = new web3_js_1.PublicKey(resolvedArgv.depositor);
|
|
60
60
|
const recipient = new web3_js_1.PublicKey(resolvedArgv.recipient);
|
|
@@ -114,10 +114,19 @@ async function fillV3Relay() {
|
|
|
114
114
|
value: value.toString(),
|
|
115
115
|
})));
|
|
116
116
|
const tokenDecimals = (await (0, spl_token_1.getMint)(provider.connection, outputToken, undefined, spl_token_1.TOKEN_PROGRAM_ID)).decimals;
|
|
117
|
+
// Create the ATA using the create_token_accounts method
|
|
118
|
+
const createTokenAccountsIx = await program.methods
|
|
119
|
+
.createTokenAccounts()
|
|
120
|
+
.accounts({ signer: signer.publicKey, mint: outputToken, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID })
|
|
121
|
+
.remainingAccounts([
|
|
122
|
+
{ pubkey: recipient, isWritable: false, isSigner: false },
|
|
123
|
+
{ pubkey: recipientTokenAccount, isWritable: true, isSigner: false },
|
|
124
|
+
])
|
|
125
|
+
.instruction();
|
|
117
126
|
// Delegate state PDA to pull relayer tokens.
|
|
118
127
|
const approveIx = await (0, spl_token_1.createApproveCheckedInstruction)(relayerTokenAccount, outputToken, statePda, signer.publicKey, BigInt(relayData.outputAmount.toString()), tokenDecimals, undefined, spl_token_1.TOKEN_PROGRAM_ID);
|
|
119
|
-
const
|
|
120
|
-
|
|
128
|
+
const fillDataValues = [Array.from(relayHashUint8Array), relayData, chainId, signer.publicKey];
|
|
129
|
+
const fillAccounts = {
|
|
121
130
|
state: statePda,
|
|
122
131
|
signer: signer.publicKey,
|
|
123
132
|
instructionParams: program.programId,
|
|
@@ -129,11 +138,15 @@ async function fillV3Relay() {
|
|
|
129
138
|
associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
130
139
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
131
140
|
programId: programId,
|
|
132
|
-
|
|
141
|
+
program: program.programId,
|
|
142
|
+
};
|
|
143
|
+
const fillIx = await program.methods
|
|
144
|
+
.fillRelay(...fillDataValues)
|
|
145
|
+
.accounts(fillAccounts)
|
|
133
146
|
.instruction();
|
|
134
|
-
const fillTx = new web3_js_1.Transaction().add(approveIx, fillIx);
|
|
147
|
+
const fillTx = new web3_js_1.Transaction().add(createTokenAccountsIx, approveIx, fillIx);
|
|
135
148
|
const tx = await (0, web3_js_1.sendAndConfirmTransaction)(provider.connection, fillTx, [signer]);
|
|
136
149
|
console.log("Transaction signature:", tx);
|
|
137
150
|
}
|
|
138
151
|
// Run the fillV3Relay function
|
|
139
|
-
|
|
152
|
+
fillRelay();
|