@across-protocol/contracts 4.0.1 → 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 +9 -13
- package/dist/deployments/deployments.json +24 -1
- package/dist/hardhat.config.js +17 -1
- 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 +388 -388
- package/dist/src/svm/assets/svm_spoke.d.ts +388 -388
- 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/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 +388 -388
- 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
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
8
|
import { type Codec, type Decoder, type Encoder } from '@solana/web3-v2.js';
|
|
9
|
-
import { type
|
|
10
|
-
export type
|
|
11
|
-
relayData:
|
|
9
|
+
import { type RelayData, type RelayDataArgs } from '.';
|
|
10
|
+
export type SlowFill = {
|
|
11
|
+
relayData: RelayData;
|
|
12
12
|
chainId: bigint;
|
|
13
13
|
updatedOutputAmount: bigint;
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
16
|
-
relayData:
|
|
15
|
+
export type SlowFillArgs = {
|
|
16
|
+
relayData: RelayDataArgs;
|
|
17
17
|
chainId: number | bigint;
|
|
18
18
|
updatedOutputAmount: number | bigint;
|
|
19
19
|
};
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
20
|
+
export declare function getSlowFillEncoder(): Encoder<SlowFillArgs>;
|
|
21
|
+
export declare function getSlowFillDecoder(): Decoder<SlowFill>;
|
|
22
|
+
export declare function getSlowFillCodec(): Codec<SlowFillArgs, SlowFill>;
|
|
@@ -7,25 +7,25 @@
|
|
|
7
7
|
* @see https://github.com/codama-idl/codama
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
10
|
+
exports.getSlowFillEncoder = getSlowFillEncoder;
|
|
11
|
+
exports.getSlowFillDecoder = getSlowFillDecoder;
|
|
12
|
+
exports.getSlowFillCodec = getSlowFillCodec;
|
|
13
13
|
const web3_v2_js_1 = require("@solana/web3-v2.js");
|
|
14
14
|
const _1 = require(".");
|
|
15
|
-
function
|
|
15
|
+
function getSlowFillEncoder() {
|
|
16
16
|
return (0, web3_v2_js_1.getStructEncoder)([
|
|
17
|
-
['relayData', (0, _1.
|
|
17
|
+
['relayData', (0, _1.getRelayDataEncoder)()],
|
|
18
18
|
['chainId', (0, web3_v2_js_1.getU64Encoder)()],
|
|
19
19
|
['updatedOutputAmount', (0, web3_v2_js_1.getU64Encoder)()],
|
|
20
20
|
]);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function getSlowFillDecoder() {
|
|
23
23
|
return (0, web3_v2_js_1.getStructDecoder)([
|
|
24
|
-
['relayData', (0, _1.
|
|
24
|
+
['relayData', (0, _1.getRelayDataDecoder)()],
|
|
25
25
|
['chainId', (0, web3_v2_js_1.getU64Decoder)()],
|
|
26
26
|
['updatedOutputAmount', (0, web3_v2_js_1.getU64Decoder)()],
|
|
27
27
|
]);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return (0, web3_v2_js_1.combineCodec)(
|
|
29
|
+
function getSlowFillCodec() {
|
|
30
|
+
return (0, web3_v2_js_1.combineCodec)(getSlowFillEncoder(), getSlowFillDecoder());
|
|
31
31
|
}
|
|
@@ -11,21 +11,21 @@ export declare function loadExecuteRelayerRefundLeafParams(program: Program<SvmS
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function closeInstructionParams(program: Program<SvmSpoke>, signer: Keypair): Promise<void>;
|
|
13
13
|
/**
|
|
14
|
-
* Creates instructions to load
|
|
14
|
+
* Creates instructions to load fill relay parameters.
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function createFillRelayParamsInstructions(program: Program<SvmSpoke>, signer: PublicKey, relayData: RelayData, repaymentChainId: BN, repaymentAddress: PublicKey): Promise<{
|
|
17
17
|
loadInstructions: TransactionInstruction[];
|
|
18
18
|
closeInstruction: TransactionInstruction;
|
|
19
19
|
}>;
|
|
20
20
|
/**
|
|
21
|
-
* Loads
|
|
21
|
+
* Loads fill relay parameters.
|
|
22
22
|
*/
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function loadFillRelayParams(program: Program<SvmSpoke>, signer: Keypair, relayData: RelayData, repaymentChainId: BN, repaymentAddress: PublicKey): Promise<void>;
|
|
24
24
|
/**
|
|
25
|
-
* Loads
|
|
25
|
+
* Loads request slow fill parameters.
|
|
26
26
|
*/
|
|
27
|
-
export declare function
|
|
27
|
+
export declare function loadRequestSlowFillParams(program: Program<SvmSpoke>, signer: Keypair, relayData: RelayData): Promise<TransactionInstruction[]>;
|
|
28
28
|
/**
|
|
29
|
-
* Loads
|
|
29
|
+
* Loads execute slow relay leaf parameters.
|
|
30
30
|
*/
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function loadExecuteSlowRelayLeafParams(program: Program<SvmSpoke>, signer: Keypair, slowFillLeaf: SlowFillLeaf, rootBundleId: number, proof: number[][]): Promise<TransactionInstruction[]>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadExecuteRelayerRefundLeafParams = loadExecuteRelayerRefundLeafParams;
|
|
4
4
|
exports.closeInstructionParams = closeInstructionParams;
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
5
|
+
exports.createFillRelayParamsInstructions = createFillRelayParamsInstructions;
|
|
6
|
+
exports.loadFillRelayParams = loadFillRelayParams;
|
|
7
|
+
exports.loadRequestSlowFillParams = loadRequestSlowFillParams;
|
|
8
|
+
exports.loadExecuteSlowRelayLeafParams = loadExecuteSlowRelayLeafParams;
|
|
9
9
|
const web3_js_1 = require("@solana/web3.js");
|
|
10
10
|
const coders_1 = require("./coders");
|
|
11
11
|
/**
|
|
@@ -43,12 +43,12 @@ async function closeInstructionParams(program, signer) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Creates instructions to load
|
|
46
|
+
* Creates instructions to load fill relay parameters.
|
|
47
47
|
*/
|
|
48
|
-
async function
|
|
48
|
+
async function createFillRelayParamsInstructions(program, signer, relayData, repaymentChainId, repaymentAddress) {
|
|
49
49
|
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
50
50
|
const accountCoder = new coders_1.LargeAccountsCoder(program.idl);
|
|
51
|
-
const instructionParamsBytes = await accountCoder.encode("
|
|
51
|
+
const instructionParamsBytes = await accountCoder.encode("fillRelayParams", {
|
|
52
52
|
relayData,
|
|
53
53
|
repaymentChainId,
|
|
54
54
|
repaymentAddress,
|
|
@@ -63,27 +63,27 @@ async function createFillV3RelayParamsInstructions(program, signer, relayData, r
|
|
|
63
63
|
return { loadInstructions, closeInstruction };
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Loads
|
|
66
|
+
* Loads fill relay parameters.
|
|
67
67
|
*/
|
|
68
|
-
async function
|
|
68
|
+
async function loadFillRelayParams(program, signer, relayData, repaymentChainId, repaymentAddress) {
|
|
69
69
|
// Close the instruction params account if the caller has used it before.
|
|
70
70
|
await closeInstructionParams(program, signer);
|
|
71
71
|
// Execute load instructions sequentially.
|
|
72
|
-
const { loadInstructions } = await
|
|
72
|
+
const { loadInstructions } = await createFillRelayParamsInstructions(program, signer.publicKey, relayData, repaymentChainId, repaymentAddress);
|
|
73
73
|
for (let i = 0; i < loadInstructions.length; i += 1) {
|
|
74
74
|
await (0, web3_js_1.sendAndConfirmTransaction)(program.provider.connection, new web3_js_1.Transaction().add(loadInstructions[i]), [signer]);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* Loads
|
|
78
|
+
* Loads request slow fill parameters.
|
|
79
79
|
*/
|
|
80
|
-
async function
|
|
80
|
+
async function loadRequestSlowFillParams(program, signer, relayData) {
|
|
81
81
|
// Close the instruction params account if the caller has used it before.
|
|
82
82
|
await closeInstructionParams(program, signer);
|
|
83
83
|
// Execute load instructions sequentially.
|
|
84
84
|
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
85
85
|
const accountCoder = new coders_1.LargeAccountsCoder(program.idl);
|
|
86
|
-
const instructionParamsBytes = await accountCoder.encode("
|
|
86
|
+
const instructionParamsBytes = await accountCoder.encode("requestSlowFillParams", { relayData });
|
|
87
87
|
const loadInstructions = [];
|
|
88
88
|
loadInstructions.push(await program.methods
|
|
89
89
|
.initializeInstructionParams(instructionParamsBytes.length)
|
|
@@ -99,15 +99,15 @@ async function loadRequestV3SlowFillParams(program, signer, relayData) {
|
|
|
99
99
|
return loadInstructions;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* Loads
|
|
102
|
+
* Loads execute slow relay leaf parameters.
|
|
103
103
|
*/
|
|
104
|
-
async function
|
|
104
|
+
async function loadExecuteSlowRelayLeafParams(program, signer, slowFillLeaf, rootBundleId, proof) {
|
|
105
105
|
// Close the instruction params account if the caller has used it before.
|
|
106
106
|
await closeInstructionParams(program, signer);
|
|
107
107
|
// Execute load instructions sequentially.
|
|
108
108
|
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
109
109
|
const accountCoder = new coders_1.LargeAccountsCoder(program.idl);
|
|
110
|
-
const instructionParamsBytes = await accountCoder.encode("
|
|
110
|
+
const instructionParamsBytes = await accountCoder.encode("executeSlowRelayLeafParams", {
|
|
111
111
|
slowFillLeaf,
|
|
112
112
|
rootBundleId,
|
|
113
113
|
proof,
|
package/dist/src/types/svm.d.ts
CHANGED
|
@@ -85,15 +85,15 @@ export type DepositDataValues = [
|
|
|
85
85
|
export type FillDataValues = [number[], RelayData, BN, PublicKey];
|
|
86
86
|
export type FillDataParams = [number[], RelayData | null, BN | null, PublicKey | null];
|
|
87
87
|
/**
|
|
88
|
-
* Request
|
|
88
|
+
* Request Slow Fill Data Interfaces
|
|
89
89
|
*/
|
|
90
|
-
export type
|
|
91
|
-
export type
|
|
90
|
+
export type RequestSlowFillDataValues = [number[], RelayData];
|
|
91
|
+
export type RequestSlowFillDataParams = [number[], RelayData | null];
|
|
92
92
|
/**
|
|
93
|
-
* Execute
|
|
93
|
+
* Execute Slow Relay Leaf Data Interfaces
|
|
94
94
|
*/
|
|
95
|
-
export type
|
|
96
|
-
export type
|
|
95
|
+
export type ExecuteSlowRelayLeafDataValues = [number[], SlowFillLeaf, number, number[][]];
|
|
96
|
+
export type ExecuteSlowRelayLeafDataParams = [number[], SlowFillLeaf | null, number | null, number[][] | null];
|
|
97
97
|
/**
|
|
98
98
|
* Across+ Message Interface
|
|
99
99
|
*/
|