@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
|
@@ -7,46 +7,46 @@
|
|
|
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.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
10
|
+
exports.FILL_RELAY_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getFillRelayDiscriminatorBytes = getFillRelayDiscriminatorBytes;
|
|
12
|
+
exports.getFillRelayInstructionDataEncoder = getFillRelayInstructionDataEncoder;
|
|
13
|
+
exports.getFillRelayInstructionDataDecoder = getFillRelayInstructionDataDecoder;
|
|
14
|
+
exports.getFillRelayInstructionDataCodec = getFillRelayInstructionDataCodec;
|
|
15
|
+
exports.getFillRelayInstructionAsync = getFillRelayInstructionAsync;
|
|
16
|
+
exports.getFillRelayInstruction = getFillRelayInstruction;
|
|
17
|
+
exports.parseFillRelayInstruction = parseFillRelayInstruction;
|
|
18
18
|
const web3_v2_js_1 = require("@solana/web3-v2.js");
|
|
19
19
|
const programs_1 = require("../programs");
|
|
20
20
|
const shared_1 = require("../shared");
|
|
21
21
|
const types_1 = require("../types");
|
|
22
|
-
exports.
|
|
23
|
-
|
|
22
|
+
exports.FILL_RELAY_DISCRIMINATOR = new Uint8Array([
|
|
23
|
+
100, 84, 222, 90, 106, 209, 58, 222,
|
|
24
24
|
]);
|
|
25
|
-
function
|
|
26
|
-
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.
|
|
25
|
+
function getFillRelayDiscriminatorBytes() {
|
|
26
|
+
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.FILL_RELAY_DISCRIMINATOR);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function getFillRelayInstructionDataEncoder() {
|
|
29
29
|
return (0, web3_v2_js_1.transformEncoder)((0, web3_v2_js_1.getStructEncoder)([
|
|
30
30
|
['discriminator', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8)],
|
|
31
31
|
['relayHash', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 32)],
|
|
32
|
-
['relayData', (0, web3_v2_js_1.getOptionEncoder)((0, types_1.
|
|
32
|
+
['relayData', (0, web3_v2_js_1.getOptionEncoder)((0, types_1.getRelayDataEncoder)())],
|
|
33
33
|
['repaymentChainId', (0, web3_v2_js_1.getOptionEncoder)((0, web3_v2_js_1.getU64Encoder)())],
|
|
34
34
|
['repaymentAddress', (0, web3_v2_js_1.getOptionEncoder)((0, web3_v2_js_1.getAddressEncoder)())],
|
|
35
|
-
]), (value) => ({ ...value, discriminator: exports.
|
|
35
|
+
]), (value) => ({ ...value, discriminator: exports.FILL_RELAY_DISCRIMINATOR }));
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function getFillRelayInstructionDataDecoder() {
|
|
38
38
|
return (0, web3_v2_js_1.getStructDecoder)([
|
|
39
39
|
['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
|
|
40
40
|
['relayHash', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 32)],
|
|
41
|
-
['relayData', (0, web3_v2_js_1.getOptionDecoder)((0, types_1.
|
|
41
|
+
['relayData', (0, web3_v2_js_1.getOptionDecoder)((0, types_1.getRelayDataDecoder)())],
|
|
42
42
|
['repaymentChainId', (0, web3_v2_js_1.getOptionDecoder)((0, web3_v2_js_1.getU64Decoder)())],
|
|
43
43
|
['repaymentAddress', (0, web3_v2_js_1.getOptionDecoder)((0, web3_v2_js_1.getAddressDecoder)())],
|
|
44
44
|
]);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return (0, web3_v2_js_1.combineCodec)(
|
|
46
|
+
function getFillRelayInstructionDataCodec() {
|
|
47
|
+
return (0, web3_v2_js_1.combineCodec)(getFillRelayInstructionDataEncoder(), getFillRelayInstructionDataDecoder());
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function getFillRelayInstructionAsync(input, config) {
|
|
50
50
|
// Program address.
|
|
51
51
|
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
52
52
|
// Original accounts.
|
|
@@ -100,7 +100,7 @@ async function getFillV3RelayInstructionAsync(input, config) {
|
|
|
100
100
|
accounts.recipientTokenAccount.value = await (0, web3_v2_js_1.getProgramDerivedAddress)({
|
|
101
101
|
programAddress,
|
|
102
102
|
seeds: [
|
|
103
|
-
(0, web3_v2_js_1.getOptionEncoder)((0, types_1.
|
|
103
|
+
(0, web3_v2_js_1.getOptionEncoder)((0, types_1.getRelayDataEncoder)()).encode((0, shared_1.expectSome)(args.relayData)),
|
|
104
104
|
(0, web3_v2_js_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.tokenProgram.value)),
|
|
105
105
|
(0, web3_v2_js_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.mint.value)),
|
|
106
106
|
],
|
|
@@ -151,11 +151,11 @@ async function getFillV3RelayInstructionAsync(input, config) {
|
|
|
151
151
|
getAccountMeta(accounts.program),
|
|
152
152
|
],
|
|
153
153
|
programAddress,
|
|
154
|
-
data:
|
|
154
|
+
data: getFillRelayInstructionDataEncoder().encode(args),
|
|
155
155
|
};
|
|
156
156
|
return instruction;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function getFillRelayInstruction(input, config) {
|
|
159
159
|
// Program address.
|
|
160
160
|
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
161
161
|
// Original accounts.
|
|
@@ -218,11 +218,11 @@ function getFillV3RelayInstruction(input, config) {
|
|
|
218
218
|
getAccountMeta(accounts.program),
|
|
219
219
|
],
|
|
220
220
|
programAddress,
|
|
221
|
-
data:
|
|
221
|
+
data: getFillRelayInstructionDataEncoder().encode(args),
|
|
222
222
|
};
|
|
223
223
|
return instruction;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function parseFillRelayInstruction(instruction) {
|
|
226
226
|
if (instruction.accounts.length < 12) {
|
|
227
227
|
// TODO: Coded error.
|
|
228
228
|
throw new Error('Not enough accounts');
|
|
@@ -255,6 +255,6 @@ function parseFillV3RelayInstruction(instruction) {
|
|
|
255
255
|
eventAuthority: getNextAccount(),
|
|
256
256
|
program: getNextAccount(),
|
|
257
257
|
},
|
|
258
|
-
data:
|
|
258
|
+
data: getFillRelayInstructionDataDecoder().decode(instruction.data),
|
|
259
259
|
};
|
|
260
260
|
}
|
|
@@ -11,13 +11,13 @@ export * from './closeClaimAccount';
|
|
|
11
11
|
export * from './closeFillPda';
|
|
12
12
|
export * from './closeInstructionParams';
|
|
13
13
|
export * from './createTokenAccounts';
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
14
|
+
export * from './deposit';
|
|
15
|
+
export * from './depositNow';
|
|
16
16
|
export * from './emergencyDeleteRootBundle';
|
|
17
17
|
export * from './executeRelayerRefundLeaf';
|
|
18
18
|
export * from './executeRelayerRefundLeafDeferred';
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
19
|
+
export * from './executeSlowRelayLeaf';
|
|
20
|
+
export * from './fillRelay';
|
|
21
21
|
export * from './getUnsafeDepositId';
|
|
22
22
|
export * from './handleReceiveMessage';
|
|
23
23
|
export * from './initialize';
|
|
@@ -26,10 +26,10 @@ export * from './initializeInstructionParams';
|
|
|
26
26
|
export * from './pauseDeposits';
|
|
27
27
|
export * from './pauseFills';
|
|
28
28
|
export * from './relayRootBundle';
|
|
29
|
-
export * from './
|
|
29
|
+
export * from './requestSlowFill';
|
|
30
30
|
export * from './setCrossDomainAdmin';
|
|
31
31
|
export * from './setCurrentTime';
|
|
32
32
|
export * from './setEnableRoute';
|
|
33
33
|
export * from './transferOwnership';
|
|
34
|
-
export * from './
|
|
34
|
+
export * from './unsafeDeposit';
|
|
35
35
|
export * from './writeInstructionParamsFragment';
|
|
@@ -27,13 +27,13 @@ __exportStar(require("./closeClaimAccount"), exports);
|
|
|
27
27
|
__exportStar(require("./closeFillPda"), exports);
|
|
28
28
|
__exportStar(require("./closeInstructionParams"), exports);
|
|
29
29
|
__exportStar(require("./createTokenAccounts"), exports);
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
30
|
+
__exportStar(require("./deposit"), exports);
|
|
31
|
+
__exportStar(require("./depositNow"), exports);
|
|
32
32
|
__exportStar(require("./emergencyDeleteRootBundle"), exports);
|
|
33
33
|
__exportStar(require("./executeRelayerRefundLeaf"), exports);
|
|
34
34
|
__exportStar(require("./executeRelayerRefundLeafDeferred"), exports);
|
|
35
|
-
__exportStar(require("./
|
|
36
|
-
__exportStar(require("./
|
|
35
|
+
__exportStar(require("./executeSlowRelayLeaf"), exports);
|
|
36
|
+
__exportStar(require("./fillRelay"), exports);
|
|
37
37
|
__exportStar(require("./getUnsafeDepositId"), exports);
|
|
38
38
|
__exportStar(require("./handleReceiveMessage"), exports);
|
|
39
39
|
__exportStar(require("./initialize"), exports);
|
|
@@ -42,10 +42,10 @@ __exportStar(require("./initializeInstructionParams"), exports);
|
|
|
42
42
|
__exportStar(require("./pauseDeposits"), exports);
|
|
43
43
|
__exportStar(require("./pauseFills"), exports);
|
|
44
44
|
__exportStar(require("./relayRootBundle"), exports);
|
|
45
|
-
__exportStar(require("./
|
|
45
|
+
__exportStar(require("./requestSlowFill"), exports);
|
|
46
46
|
__exportStar(require("./setCrossDomainAdmin"), exports);
|
|
47
47
|
__exportStar(require("./setCurrentTime"), exports);
|
|
48
48
|
__exportStar(require("./setEnableRoute"), exports);
|
|
49
49
|
__exportStar(require("./transferOwnership"), exports);
|
|
50
|
-
__exportStar(require("./
|
|
50
|
+
__exportStar(require("./unsafeDeposit"), exports);
|
|
51
51
|
__exportStar(require("./writeInstructionParamsFragment"), exports);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/web3-v2.js';
|
|
9
|
+
import { SVM_SPOKE_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
import { type RelayData, type RelayDataArgs } from '../types';
|
|
11
|
+
export declare const REQUEST_SLOW_FILL_DISCRIMINATOR: Uint8Array;
|
|
12
|
+
export declare function getRequestSlowFillDiscriminatorBytes(): ReadonlyUint8Array;
|
|
13
|
+
export type RequestSlowFillInstruction<TProgram extends string = typeof SVM_SPOKE_PROGRAM_ADDRESS, TAccountSigner extends string | IAccountMeta<string> = string, TAccountInstructionParams extends string | IAccountMeta<string> = string, TAccountState extends string | IAccountMeta<string> = string, TAccountFillStatus extends string | IAccountMeta<string> = string, TAccountSystemProgram extends string | IAccountMeta<string> = '11111111111111111111111111111111', TAccountEventAuthority extends string | IAccountMeta<string> = string, TAccountProgram extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
14
|
+
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & IAccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
15
|
+
TAccountInstructionParams extends string ? WritableAccount<TAccountInstructionParams> : TAccountInstructionParams,
|
|
16
|
+
TAccountState extends string ? ReadonlyAccount<TAccountState> : TAccountState,
|
|
17
|
+
TAccountFillStatus extends string ? WritableAccount<TAccountFillStatus> : TAccountFillStatus,
|
|
18
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
19
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
20
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
21
|
+
...TRemainingAccounts
|
|
22
|
+
]>;
|
|
23
|
+
export type RequestSlowFillInstructionData = {
|
|
24
|
+
discriminator: ReadonlyUint8Array;
|
|
25
|
+
relayHash: ReadonlyUint8Array;
|
|
26
|
+
relayData: Option<RelayData>;
|
|
27
|
+
};
|
|
28
|
+
export type RequestSlowFillInstructionDataArgs = {
|
|
29
|
+
relayHash: ReadonlyUint8Array;
|
|
30
|
+
relayData: OptionOrNullable<RelayDataArgs>;
|
|
31
|
+
};
|
|
32
|
+
export declare function getRequestSlowFillInstructionDataEncoder(): Encoder<RequestSlowFillInstructionDataArgs>;
|
|
33
|
+
export declare function getRequestSlowFillInstructionDataDecoder(): Decoder<RequestSlowFillInstructionData>;
|
|
34
|
+
export declare function getRequestSlowFillInstructionDataCodec(): Codec<RequestSlowFillInstructionDataArgs, RequestSlowFillInstructionData>;
|
|
35
|
+
export type RequestSlowFillAsyncInput<TAccountSigner extends string = string, TAccountInstructionParams extends string = string, TAccountState extends string = string, TAccountFillStatus extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
36
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
37
|
+
instructionParams?: Address<TAccountInstructionParams>;
|
|
38
|
+
state: Address<TAccountState>;
|
|
39
|
+
fillStatus?: Address<TAccountFillStatus>;
|
|
40
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
41
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
42
|
+
program: Address<TAccountProgram>;
|
|
43
|
+
relayHash: RequestSlowFillInstructionDataArgs['relayHash'];
|
|
44
|
+
relayData: RequestSlowFillInstructionDataArgs['relayData'];
|
|
45
|
+
};
|
|
46
|
+
export declare function getRequestSlowFillInstructionAsync<TAccountSigner extends string, TAccountInstructionParams extends string, TAccountState extends string, TAccountFillStatus extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof SVM_SPOKE_PROGRAM_ADDRESS>(input: RequestSlowFillAsyncInput<TAccountSigner, TAccountInstructionParams, TAccountState, TAccountFillStatus, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
47
|
+
programAddress?: TProgramAddress;
|
|
48
|
+
}): Promise<RequestSlowFillInstruction<TProgramAddress, TAccountSigner, TAccountInstructionParams, TAccountState, TAccountFillStatus, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>>;
|
|
49
|
+
export type RequestSlowFillInput<TAccountSigner extends string = string, TAccountInstructionParams extends string = string, TAccountState extends string = string, TAccountFillStatus extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
50
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
51
|
+
instructionParams?: Address<TAccountInstructionParams>;
|
|
52
|
+
state: Address<TAccountState>;
|
|
53
|
+
fillStatus: Address<TAccountFillStatus>;
|
|
54
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
55
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
56
|
+
program: Address<TAccountProgram>;
|
|
57
|
+
relayHash: RequestSlowFillInstructionDataArgs['relayHash'];
|
|
58
|
+
relayData: RequestSlowFillInstructionDataArgs['relayData'];
|
|
59
|
+
};
|
|
60
|
+
export declare function getRequestSlowFillInstruction<TAccountSigner extends string, TAccountInstructionParams extends string, TAccountState extends string, TAccountFillStatus extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof SVM_SPOKE_PROGRAM_ADDRESS>(input: RequestSlowFillInput<TAccountSigner, TAccountInstructionParams, TAccountState, TAccountFillStatus, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
61
|
+
programAddress?: TProgramAddress;
|
|
62
|
+
}): RequestSlowFillInstruction<TProgramAddress, TAccountSigner, TAccountInstructionParams, TAccountState, TAccountFillStatus, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>;
|
|
63
|
+
export type ParsedRequestSlowFillInstruction<TProgram extends string = typeof SVM_SPOKE_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
64
|
+
programAddress: Address<TProgram>;
|
|
65
|
+
accounts: {
|
|
66
|
+
signer: TAccountMetas[0];
|
|
67
|
+
instructionParams?: TAccountMetas[1] | undefined;
|
|
68
|
+
state: TAccountMetas[2];
|
|
69
|
+
fillStatus: TAccountMetas[3];
|
|
70
|
+
systemProgram: TAccountMetas[4];
|
|
71
|
+
eventAuthority: TAccountMetas[5];
|
|
72
|
+
program: TAccountMetas[6];
|
|
73
|
+
};
|
|
74
|
+
data: RequestSlowFillInstructionData;
|
|
75
|
+
};
|
|
76
|
+
export declare function parseRequestSlowFillInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedRequestSlowFillInstruction<TProgram, TAccountMetas>;
|
package/dist/src/svm/clients/SvmSpoke/instructions/{requestV3SlowFill.js → requestSlowFill.js}
RENAMED
|
@@ -7,42 +7,42 @@
|
|
|
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.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
10
|
+
exports.REQUEST_SLOW_FILL_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getRequestSlowFillDiscriminatorBytes = getRequestSlowFillDiscriminatorBytes;
|
|
12
|
+
exports.getRequestSlowFillInstructionDataEncoder = getRequestSlowFillInstructionDataEncoder;
|
|
13
|
+
exports.getRequestSlowFillInstructionDataDecoder = getRequestSlowFillInstructionDataDecoder;
|
|
14
|
+
exports.getRequestSlowFillInstructionDataCodec = getRequestSlowFillInstructionDataCodec;
|
|
15
|
+
exports.getRequestSlowFillInstructionAsync = getRequestSlowFillInstructionAsync;
|
|
16
|
+
exports.getRequestSlowFillInstruction = getRequestSlowFillInstruction;
|
|
17
|
+
exports.parseRequestSlowFillInstruction = parseRequestSlowFillInstruction;
|
|
18
18
|
const web3_v2_js_1 = require("@solana/web3-v2.js");
|
|
19
19
|
const programs_1 = require("../programs");
|
|
20
20
|
const shared_1 = require("../shared");
|
|
21
21
|
const types_1 = require("../types");
|
|
22
|
-
exports.
|
|
23
|
-
|
|
22
|
+
exports.REQUEST_SLOW_FILL_DISCRIMINATOR = new Uint8Array([
|
|
23
|
+
39, 157, 165, 187, 88, 217, 207, 98,
|
|
24
24
|
]);
|
|
25
|
-
function
|
|
26
|
-
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.
|
|
25
|
+
function getRequestSlowFillDiscriminatorBytes() {
|
|
26
|
+
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.REQUEST_SLOW_FILL_DISCRIMINATOR);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function getRequestSlowFillInstructionDataEncoder() {
|
|
29
29
|
return (0, web3_v2_js_1.transformEncoder)((0, web3_v2_js_1.getStructEncoder)([
|
|
30
30
|
['discriminator', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8)],
|
|
31
31
|
['relayHash', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 32)],
|
|
32
|
-
['relayData', (0, web3_v2_js_1.getOptionEncoder)((0, types_1.
|
|
33
|
-
]), (value) => ({ ...value, discriminator: exports.
|
|
32
|
+
['relayData', (0, web3_v2_js_1.getOptionEncoder)((0, types_1.getRelayDataEncoder)())],
|
|
33
|
+
]), (value) => ({ ...value, discriminator: exports.REQUEST_SLOW_FILL_DISCRIMINATOR }));
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function getRequestSlowFillInstructionDataDecoder() {
|
|
36
36
|
return (0, web3_v2_js_1.getStructDecoder)([
|
|
37
37
|
['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
|
|
38
38
|
['relayHash', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 32)],
|
|
39
|
-
['relayData', (0, web3_v2_js_1.getOptionDecoder)((0, types_1.
|
|
39
|
+
['relayData', (0, web3_v2_js_1.getOptionDecoder)((0, types_1.getRelayDataDecoder)())],
|
|
40
40
|
]);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return (0, web3_v2_js_1.combineCodec)(
|
|
42
|
+
function getRequestSlowFillInstructionDataCodec() {
|
|
43
|
+
return (0, web3_v2_js_1.combineCodec)(getRequestSlowFillInstructionDataEncoder(), getRequestSlowFillInstructionDataDecoder());
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
45
|
+
async function getRequestSlowFillInstructionAsync(input, config) {
|
|
46
46
|
// Program address.
|
|
47
47
|
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
48
48
|
// Original accounts.
|
|
@@ -110,11 +110,11 @@ async function getRequestV3SlowFillInstructionAsync(input, config) {
|
|
|
110
110
|
getAccountMeta(accounts.program),
|
|
111
111
|
],
|
|
112
112
|
programAddress,
|
|
113
|
-
data:
|
|
113
|
+
data: getRequestSlowFillInstructionDataEncoder().encode(args),
|
|
114
114
|
};
|
|
115
115
|
return instruction;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function getRequestSlowFillInstruction(input, config) {
|
|
118
118
|
// Program address.
|
|
119
119
|
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
120
120
|
// Original accounts.
|
|
@@ -150,11 +150,11 @@ function getRequestV3SlowFillInstruction(input, config) {
|
|
|
150
150
|
getAccountMeta(accounts.program),
|
|
151
151
|
],
|
|
152
152
|
programAddress,
|
|
153
|
-
data:
|
|
153
|
+
data: getRequestSlowFillInstructionDataEncoder().encode(args),
|
|
154
154
|
};
|
|
155
155
|
return instruction;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function parseRequestSlowFillInstruction(instruction) {
|
|
158
158
|
if (instruction.accounts.length < 7) {
|
|
159
159
|
// TODO: Coded error.
|
|
160
160
|
throw new Error('Not enough accounts');
|
|
@@ -182,6 +182,6 @@ function parseRequestV3SlowFillInstruction(instruction) {
|
|
|
182
182
|
eventAuthority: getNextAccount(),
|
|
183
183
|
program: getNextAccount(),
|
|
184
184
|
},
|
|
185
|
-
data:
|
|
185
|
+
data: getRequestSlowFillInstructionDataDecoder().decode(instruction.data),
|
|
186
186
|
};
|
|
187
187
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/web3-v2.js';
|
|
9
|
+
import { SVM_SPOKE_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
+
export declare const UNSAFE_DEPOSIT_DISCRIMINATOR: Uint8Array;
|
|
11
|
+
export declare function getUnsafeDepositDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
|
+
export type UnsafeDepositInstruction<TProgram extends string = typeof SVM_SPOKE_PROGRAM_ADDRESS, TAccountSigner extends string | IAccountMeta<string> = string, TAccountState extends string | IAccountMeta<string> = string, TAccountRoute extends string | IAccountMeta<string> = string, TAccountDepositorTokenAccount extends string | IAccountMeta<string> = string, TAccountVault extends string | IAccountMeta<string> = string, TAccountMint extends string | IAccountMeta<string> = string, TAccountTokenProgram extends string | IAccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TAccountEventAuthority extends string | IAccountMeta<string> = string, TAccountProgram extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
|
|
13
|
+
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & IAccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
14
|
+
TAccountState extends string ? WritableAccount<TAccountState> : TAccountState,
|
|
15
|
+
TAccountRoute extends string ? ReadonlyAccount<TAccountRoute> : TAccountRoute,
|
|
16
|
+
TAccountDepositorTokenAccount extends string ? WritableAccount<TAccountDepositorTokenAccount> : TAccountDepositorTokenAccount,
|
|
17
|
+
TAccountVault extends string ? WritableAccount<TAccountVault> : TAccountVault,
|
|
18
|
+
TAccountMint extends string ? ReadonlyAccount<TAccountMint> : TAccountMint,
|
|
19
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
20
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
21
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
22
|
+
...TRemainingAccounts
|
|
23
|
+
]>;
|
|
24
|
+
export type UnsafeDepositInstructionData = {
|
|
25
|
+
discriminator: ReadonlyUint8Array;
|
|
26
|
+
depositor: Address;
|
|
27
|
+
recipient: Address;
|
|
28
|
+
inputToken: Address;
|
|
29
|
+
outputToken: Address;
|
|
30
|
+
inputAmount: bigint;
|
|
31
|
+
outputAmount: bigint;
|
|
32
|
+
destinationChainId: bigint;
|
|
33
|
+
exclusiveRelayer: Address;
|
|
34
|
+
depositNonce: bigint;
|
|
35
|
+
quoteTimestamp: number;
|
|
36
|
+
fillDeadline: number;
|
|
37
|
+
exclusivityParameter: number;
|
|
38
|
+
message: ReadonlyUint8Array;
|
|
39
|
+
};
|
|
40
|
+
export type UnsafeDepositInstructionDataArgs = {
|
|
41
|
+
depositor: Address;
|
|
42
|
+
recipient: Address;
|
|
43
|
+
inputToken: Address;
|
|
44
|
+
outputToken: Address;
|
|
45
|
+
inputAmount: number | bigint;
|
|
46
|
+
outputAmount: number | bigint;
|
|
47
|
+
destinationChainId: number | bigint;
|
|
48
|
+
exclusiveRelayer: Address;
|
|
49
|
+
depositNonce: number | bigint;
|
|
50
|
+
quoteTimestamp: number;
|
|
51
|
+
fillDeadline: number;
|
|
52
|
+
exclusivityParameter: number;
|
|
53
|
+
message: ReadonlyUint8Array;
|
|
54
|
+
};
|
|
55
|
+
export declare function getUnsafeDepositInstructionDataEncoder(): Encoder<UnsafeDepositInstructionDataArgs>;
|
|
56
|
+
export declare function getUnsafeDepositInstructionDataDecoder(): Decoder<UnsafeDepositInstructionData>;
|
|
57
|
+
export declare function getUnsafeDepositInstructionDataCodec(): Codec<UnsafeDepositInstructionDataArgs, UnsafeDepositInstructionData>;
|
|
58
|
+
export type UnsafeDepositAsyncInput<TAccountSigner extends string = string, TAccountState extends string = string, TAccountRoute extends string = string, TAccountDepositorTokenAccount extends string = string, TAccountVault extends string = string, TAccountMint extends string = string, TAccountTokenProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
59
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
60
|
+
state: Address<TAccountState>;
|
|
61
|
+
route: Address<TAccountRoute>;
|
|
62
|
+
depositorTokenAccount?: Address<TAccountDepositorTokenAccount>;
|
|
63
|
+
vault?: Address<TAccountVault>;
|
|
64
|
+
mint: Address<TAccountMint>;
|
|
65
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
66
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
67
|
+
program: Address<TAccountProgram>;
|
|
68
|
+
depositor: UnsafeDepositInstructionDataArgs['depositor'];
|
|
69
|
+
recipient: UnsafeDepositInstructionDataArgs['recipient'];
|
|
70
|
+
inputToken: UnsafeDepositInstructionDataArgs['inputToken'];
|
|
71
|
+
outputToken: UnsafeDepositInstructionDataArgs['outputToken'];
|
|
72
|
+
inputAmount: UnsafeDepositInstructionDataArgs['inputAmount'];
|
|
73
|
+
outputAmount: UnsafeDepositInstructionDataArgs['outputAmount'];
|
|
74
|
+
destinationChainId: UnsafeDepositInstructionDataArgs['destinationChainId'];
|
|
75
|
+
exclusiveRelayer: UnsafeDepositInstructionDataArgs['exclusiveRelayer'];
|
|
76
|
+
depositNonce: UnsafeDepositInstructionDataArgs['depositNonce'];
|
|
77
|
+
quoteTimestamp: UnsafeDepositInstructionDataArgs['quoteTimestamp'];
|
|
78
|
+
fillDeadline: UnsafeDepositInstructionDataArgs['fillDeadline'];
|
|
79
|
+
exclusivityParameter: UnsafeDepositInstructionDataArgs['exclusivityParameter'];
|
|
80
|
+
message: UnsafeDepositInstructionDataArgs['message'];
|
|
81
|
+
};
|
|
82
|
+
export declare function getUnsafeDepositInstructionAsync<TAccountSigner extends string, TAccountState extends string, TAccountRoute extends string, TAccountDepositorTokenAccount extends string, TAccountVault extends string, TAccountMint extends string, TAccountTokenProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof SVM_SPOKE_PROGRAM_ADDRESS>(input: UnsafeDepositAsyncInput<TAccountSigner, TAccountState, TAccountRoute, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
83
|
+
programAddress?: TProgramAddress;
|
|
84
|
+
}): Promise<UnsafeDepositInstruction<TProgramAddress, TAccountSigner, TAccountState, TAccountRoute, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountEventAuthority, TAccountProgram>>;
|
|
85
|
+
export type UnsafeDepositInput<TAccountSigner extends string = string, TAccountState extends string = string, TAccountRoute extends string = string, TAccountDepositorTokenAccount extends string = string, TAccountVault extends string = string, TAccountMint extends string = string, TAccountTokenProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
86
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
87
|
+
state: Address<TAccountState>;
|
|
88
|
+
route: Address<TAccountRoute>;
|
|
89
|
+
depositorTokenAccount: Address<TAccountDepositorTokenAccount>;
|
|
90
|
+
vault: Address<TAccountVault>;
|
|
91
|
+
mint: Address<TAccountMint>;
|
|
92
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
93
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
94
|
+
program: Address<TAccountProgram>;
|
|
95
|
+
depositor: UnsafeDepositInstructionDataArgs['depositor'];
|
|
96
|
+
recipient: UnsafeDepositInstructionDataArgs['recipient'];
|
|
97
|
+
inputToken: UnsafeDepositInstructionDataArgs['inputToken'];
|
|
98
|
+
outputToken: UnsafeDepositInstructionDataArgs['outputToken'];
|
|
99
|
+
inputAmount: UnsafeDepositInstructionDataArgs['inputAmount'];
|
|
100
|
+
outputAmount: UnsafeDepositInstructionDataArgs['outputAmount'];
|
|
101
|
+
destinationChainId: UnsafeDepositInstructionDataArgs['destinationChainId'];
|
|
102
|
+
exclusiveRelayer: UnsafeDepositInstructionDataArgs['exclusiveRelayer'];
|
|
103
|
+
depositNonce: UnsafeDepositInstructionDataArgs['depositNonce'];
|
|
104
|
+
quoteTimestamp: UnsafeDepositInstructionDataArgs['quoteTimestamp'];
|
|
105
|
+
fillDeadline: UnsafeDepositInstructionDataArgs['fillDeadline'];
|
|
106
|
+
exclusivityParameter: UnsafeDepositInstructionDataArgs['exclusivityParameter'];
|
|
107
|
+
message: UnsafeDepositInstructionDataArgs['message'];
|
|
108
|
+
};
|
|
109
|
+
export declare function getUnsafeDepositInstruction<TAccountSigner extends string, TAccountState extends string, TAccountRoute extends string, TAccountDepositorTokenAccount extends string, TAccountVault extends string, TAccountMint extends string, TAccountTokenProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof SVM_SPOKE_PROGRAM_ADDRESS>(input: UnsafeDepositInput<TAccountSigner, TAccountState, TAccountRoute, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
110
|
+
programAddress?: TProgramAddress;
|
|
111
|
+
}): UnsafeDepositInstruction<TProgramAddress, TAccountSigner, TAccountState, TAccountRoute, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountEventAuthority, TAccountProgram>;
|
|
112
|
+
export type ParsedUnsafeDepositInstruction<TProgram extends string = typeof SVM_SPOKE_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
|
|
113
|
+
programAddress: Address<TProgram>;
|
|
114
|
+
accounts: {
|
|
115
|
+
signer: TAccountMetas[0];
|
|
116
|
+
state: TAccountMetas[1];
|
|
117
|
+
route: TAccountMetas[2];
|
|
118
|
+
depositorTokenAccount: TAccountMetas[3];
|
|
119
|
+
vault: TAccountMetas[4];
|
|
120
|
+
mint: TAccountMetas[5];
|
|
121
|
+
tokenProgram: TAccountMetas[6];
|
|
122
|
+
eventAuthority: TAccountMetas[7];
|
|
123
|
+
program: TAccountMetas[8];
|
|
124
|
+
};
|
|
125
|
+
data: UnsafeDepositInstructionData;
|
|
126
|
+
};
|
|
127
|
+
export declare function parseUnsafeDepositInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedUnsafeDepositInstruction<TProgram, TAccountMetas>;
|
|
@@ -7,24 +7,24 @@
|
|
|
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.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
10
|
+
exports.UNSAFE_DEPOSIT_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getUnsafeDepositDiscriminatorBytes = getUnsafeDepositDiscriminatorBytes;
|
|
12
|
+
exports.getUnsafeDepositInstructionDataEncoder = getUnsafeDepositInstructionDataEncoder;
|
|
13
|
+
exports.getUnsafeDepositInstructionDataDecoder = getUnsafeDepositInstructionDataDecoder;
|
|
14
|
+
exports.getUnsafeDepositInstructionDataCodec = getUnsafeDepositInstructionDataCodec;
|
|
15
|
+
exports.getUnsafeDepositInstructionAsync = getUnsafeDepositInstructionAsync;
|
|
16
|
+
exports.getUnsafeDepositInstruction = getUnsafeDepositInstruction;
|
|
17
|
+
exports.parseUnsafeDepositInstruction = parseUnsafeDepositInstruction;
|
|
18
18
|
const web3_v2_js_1 = require("@solana/web3-v2.js");
|
|
19
19
|
const programs_1 = require("../programs");
|
|
20
20
|
const shared_1 = require("../shared");
|
|
21
|
-
exports.
|
|
22
|
-
|
|
21
|
+
exports.UNSAFE_DEPOSIT_DISCRIMINATOR = new Uint8Array([
|
|
22
|
+
196, 187, 166, 179, 3, 146, 150, 246,
|
|
23
23
|
]);
|
|
24
|
-
function
|
|
25
|
-
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.
|
|
24
|
+
function getUnsafeDepositDiscriminatorBytes() {
|
|
25
|
+
return (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8).encode(exports.UNSAFE_DEPOSIT_DISCRIMINATOR);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function getUnsafeDepositInstructionDataEncoder() {
|
|
28
28
|
return (0, web3_v2_js_1.transformEncoder)((0, web3_v2_js_1.getStructEncoder)([
|
|
29
29
|
['discriminator', (0, web3_v2_js_1.fixEncoderSize)((0, web3_v2_js_1.getBytesEncoder)(), 8)],
|
|
30
30
|
['depositor', (0, web3_v2_js_1.getAddressEncoder)()],
|
|
@@ -40,9 +40,9 @@ function getUnsafeDepositV3InstructionDataEncoder() {
|
|
|
40
40
|
['fillDeadline', (0, web3_v2_js_1.getU32Encoder)()],
|
|
41
41
|
['exclusivityParameter', (0, web3_v2_js_1.getU32Encoder)()],
|
|
42
42
|
['message', (0, web3_v2_js_1.addEncoderSizePrefix)((0, web3_v2_js_1.getBytesEncoder)(), (0, web3_v2_js_1.getU32Encoder)())],
|
|
43
|
-
]), (value) => ({ ...value, discriminator: exports.
|
|
43
|
+
]), (value) => ({ ...value, discriminator: exports.UNSAFE_DEPOSIT_DISCRIMINATOR }));
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function getUnsafeDepositInstructionDataDecoder() {
|
|
46
46
|
return (0, web3_v2_js_1.getStructDecoder)([
|
|
47
47
|
['discriminator', (0, web3_v2_js_1.fixDecoderSize)((0, web3_v2_js_1.getBytesDecoder)(), 8)],
|
|
48
48
|
['depositor', (0, web3_v2_js_1.getAddressDecoder)()],
|
|
@@ -60,10 +60,10 @@ function getUnsafeDepositV3InstructionDataDecoder() {
|
|
|
60
60
|
['message', (0, web3_v2_js_1.addDecoderSizePrefix)((0, web3_v2_js_1.getBytesDecoder)(), (0, web3_v2_js_1.getU32Decoder)())],
|
|
61
61
|
]);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
return (0, web3_v2_js_1.combineCodec)(
|
|
63
|
+
function getUnsafeDepositInstructionDataCodec() {
|
|
64
|
+
return (0, web3_v2_js_1.combineCodec)(getUnsafeDepositInstructionDataEncoder(), getUnsafeDepositInstructionDataDecoder());
|
|
65
65
|
}
|
|
66
|
-
async function
|
|
66
|
+
async function getUnsafeDepositInstructionAsync(input, config) {
|
|
67
67
|
// Program address.
|
|
68
68
|
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
69
69
|
// Original accounts.
|
|
@@ -134,11 +134,11 @@ async function getUnsafeDepositV3InstructionAsync(input, config) {
|
|
|
134
134
|
getAccountMeta(accounts.program),
|
|
135
135
|
],
|
|
136
136
|
programAddress,
|
|
137
|
-
data:
|
|
137
|
+
data: getUnsafeDepositInstructionDataEncoder().encode(args),
|
|
138
138
|
};
|
|
139
139
|
return instruction;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function getUnsafeDepositInstruction(input, config) {
|
|
142
142
|
// Program address.
|
|
143
143
|
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
144
144
|
// Original accounts.
|
|
@@ -178,11 +178,11 @@ function getUnsafeDepositV3Instruction(input, config) {
|
|
|
178
178
|
getAccountMeta(accounts.program),
|
|
179
179
|
],
|
|
180
180
|
programAddress,
|
|
181
|
-
data:
|
|
181
|
+
data: getUnsafeDepositInstructionDataEncoder().encode(args),
|
|
182
182
|
};
|
|
183
183
|
return instruction;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function parseUnsafeDepositInstruction(instruction) {
|
|
186
186
|
if (instruction.accounts.length < 9) {
|
|
187
187
|
// TODO: Coded error.
|
|
188
188
|
throw new Error('Not enough accounts');
|
|
@@ -206,6 +206,6 @@ function parseUnsafeDepositV3Instruction(instruction) {
|
|
|
206
206
|
eventAuthority: getNextAccount(),
|
|
207
207
|
program: getNextAccount(),
|
|
208
208
|
},
|
|
209
|
-
data:
|
|
209
|
+
data: getUnsafeDepositInstructionDataDecoder().decode(instruction.data),
|
|
210
210
|
};
|
|
211
211
|
}
|