@across-protocol/contracts 6.0.0-beta.2 → 6.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -34
- package/contracts/chain-adapters/Solana_Adapter.sol +4 -7
- package/contracts/handlers/HyperliquidDepositHandler.sol +2 -2
- package/contracts/interfaces/SpokePoolPeripheryInterface.sol +16 -4
- package/contracts/libraries/HyperCoreLib.sol +113 -20
- package/contracts/libraries/PeripherySigningLib.sol +56 -0
- package/contracts/periphery/SpokePoolPeriphery.sol +58 -10
- package/dist/broadcast/deployed-addresses.json +19 -0
- package/dist/evm/artifacts/Constants.sol/Constants.json +1 -1
- package/dist/evm/artifacts/DeploymentUtils.sol/DeploymentUtils.json +1 -1
- package/dist/evm/artifacts/DstOFTHandler.sol/DstOFTHandler.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockAddressWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockFinder.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockIdentifierWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockLpTokenFactory.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockOptimisticOracle.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockStore.json +1 -1
- package/dist/evm/artifacts/HyperCoreFlowExecutor.sol/HyperCoreFlowExecutor.json +1 -1
- package/dist/evm/artifacts/HyperCoreLib.sol/HyperCoreLib.json +1 -1
- package/dist/evm/artifacts/HyperliquidDepositHandler.sol/HyperliquidDepositHandler.json +1 -1
- package/dist/evm/artifacts/PeripherySigningLib.sol/PeripherySigningLib.json +1 -1
- package/dist/evm/artifacts/Solana_Adapter.sol/Solana_Adapter.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SwapProxy.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPDstPeriphery.sol/SponsoredCCTPDstPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPSrcPeriphery.sol/SponsoredCCTPSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredOFTSrcPeriphery.sol/SponsoredOFTSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/SwapHandler.sol/SwapHandler.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SwapProxy.json +1 -1
- package/dist/src/consts.js +1 -0
- package/dist/src/svm/assets/idl/index.d.ts +5 -7
- package/dist/src/svm/assets/idl/index.js +6 -14
- package/dist/src/svm/assets/idl/sponsored_cctp_src_periphery.json +41 -24
- package/dist/src/svm/assets/idl/svm_spoke.json +1001 -2171
- package/dist/src/svm/assets/index.d.ts +2 -3
- package/dist/src/svm/assets/index.js +0 -1
- package/dist/src/svm/assets/sponsored_cctp_src_periphery.d.ts +41 -24
- package/dist/src/svm/assets/svm_spoke.d.ts +996 -2166
- package/dist/src/svm/assets/token_messenger_minter_v2.d.ts +18 -18
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/index.d.ts +0 -1
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/index.js +0 -1
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.d.ts +24 -12
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.js +30 -12
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/programs/sponsoredCctpSrcPeriphery.d.ts +4 -5
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/programs/sponsoredCctpSrcPeriphery.js +4 -8
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/index.d.ts +1 -0
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/index.js +1 -0
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/messageSent.d.ts +21 -0
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/messageSent.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/fillStatusAccount.d.ts +2 -2
- package/dist/src/svm/clients/SvmSpoke/accounts/fillStatusAccount.js +2 -2
- package/dist/src/svm/clients/SvmSpoke/accounts/index.d.ts +0 -3
- package/dist/src/svm/clients/SvmSpoke/accounts/index.js +0 -3
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.d.ts +94 -22
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.js +133 -24
- package/dist/src/svm/clients/SvmSpoke/instructions/adapterExecuteAcrossV5.d.ts +75 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/adapterExecuteAcrossV5.js +144 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/closeFillPda.d.ts +16 -8
- package/dist/src/svm/clients/SvmSpoke/instructions/closeFillPda.js +3 -3
- package/dist/src/svm/clients/SvmSpoke/instructions/index.d.ts +2 -7
- package/dist/src/svm/clients/SvmSpoke/instructions/index.js +2 -7
- package/dist/src/svm/clients/SvmSpoke/instructions/withdrawV5FillPayer.d.ts +58 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/withdrawV5FillPayer.js +134 -0
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.d.ts +29 -47
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.js +29 -61
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositInput.d.ts +25 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositInput.js +33 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositJitParams.d.ts +18 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositJitParams.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositParams.d.ts +43 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositParams.js +48 -0
- package/dist/src/svm/clients/SvmSpoke/types/index.d.ts +9 -1
- package/dist/src/svm/clients/SvmSpoke/types/index.js +9 -1
- package/dist/src/svm/clients/SvmSpoke/types/v5AdapterInput.d.ts +39 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5AdapterInput.js +59 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5DepositModificationRules.d.ts +17 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5DepositModificationRules.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillFloatWithdrawn.d.ts +19 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillFloatWithdrawn.js +28 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillInput.d.ts +25 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillInput.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillJit.d.ts +22 -0
- package/dist/src/svm/clients/SvmSpoke/types/{slowFill.js → v5FillJit.js} +11 -11
- package/dist/src/svm/clients/SvmSpoke/types/v5InputAmountMode.d.ts +29 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5InputAmountMode.js +38 -0
- package/dist/src/svm/web3-v1/cctpV2Helpers.d.ts +51 -65
- package/dist/src/svm/web3-v1/cctpV2Helpers.js +1 -1
- package/dist/src/svm/web3-v1/coders.d.ts +1 -1
- package/dist/src/svm/web3-v1/coders.js +4 -4
- package/dist/src/svm/web3-v1/conversionUtils.d.ts +1 -1
- package/dist/src/svm/web3-v1/conversionUtils.js +3 -3
- package/dist/src/svm/web3-v1/helpers.d.ts +1 -114
- package/dist/src/svm/web3-v1/helpers.js +1 -179
- package/dist/src/svm/web3-v1/instructionParamsUtils.d.ts +11 -26
- package/dist/src/svm/web3-v1/instructionParamsUtils.js +5 -90
- package/dist/src/svm/web3-v1/programConnectors.d.ts +1 -1
- package/dist/src/svm/web3-v1/programConnectors.js +2 -2
- package/dist/src/svm/web3-v1/relayHashUtils.d.ts +2 -6
- package/dist/src/svm/web3-v1/relayHashUtils.js +5 -66
- package/dist/src/svm/web3-v1/solanaProgramUtils.d.ts +1 -1
- package/dist/src/svm/web3-v1/solanaProgramUtils.js +7 -7
- package/dist/src/svm/web3-v1/transactionUtils.js +3 -3
- package/dist/src/svm/web3-v2/solanaProgramUtils.d.ts +1 -1
- package/dist/src/svm/web3-v2/solanaProgramUtils.js +4 -4
- package/dist/src/types/svm.d.ts +1 -46
- package/package.json +28 -13
- package/svm/idl/multicall_handler.json +31 -0
- package/svm/idl/sponsored_cctp_src_periphery.json +1982 -0
- package/svm/idl/svm_spoke.json +3930 -0
- package/dist/src/svm/assets/idl/test.json +0 -243
- package/dist/src/svm/assets/test.d.ts +0 -249
- package/dist/src/svm/assets/test.js +0 -2
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/messageSent.d.ts +0 -30
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/messageSent.js +0 -66
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.js +0 -70
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.js +0 -67
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.d.ts +0 -27
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.js +0 -66
- package/dist/src/svm/clients/SvmSpoke/instructions/deposit.d.ts +0 -131
- package/dist/src/svm/clients/SvmSpoke/instructions/deposit.js +0 -241
- package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.d.ts +0 -127
- package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.js +0 -239
- package/dist/src/svm/clients/SvmSpoke/instructions/executeSlowRelayLeaf.d.ts +0 -104
- package/dist/src/svm/clients/SvmSpoke/instructions/executeSlowRelayLeaf.js +0 -259
- package/dist/src/svm/clients/SvmSpoke/instructions/fillRelay.d.ts +0 -108
- package/dist/src/svm/clients/SvmSpoke/instructions/fillRelay.js +0 -265
- package/dist/src/svm/clients/SvmSpoke/instructions/getUnsafeDepositId.d.ts +0 -39
- package/dist/src/svm/clients/SvmSpoke/instructions/getUnsafeDepositId.js +0 -63
- package/dist/src/svm/clients/SvmSpoke/instructions/requestSlowFill.d.ts +0 -76
- package/dist/src/svm/clients/SvmSpoke/instructions/requestSlowFill.js +0 -187
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.d.ts +0 -135
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.js +0 -243
- package/dist/src/svm/clients/SvmSpoke/types/slowFill.d.ts +0 -22
- package/dist/target/types/svm_spoke.d.ts +0 -5106
- package/dist/target/types/svm_spoke.js +0 -2
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This code was AUTOGENERATED using the codama library.
|
|
4
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
-
* to add features, then rerun codama to update it.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/codama-idl/codama
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
-
const kit_1 = require("@solana/kit");
|
|
19
|
-
const programs_1 = require("../programs");
|
|
20
|
-
const shared_1 = require("../shared");
|
|
21
|
-
exports.UNSAFE_DEPOSIT_DISCRIMINATOR = new Uint8Array([
|
|
22
|
-
196, 187, 166, 179, 3, 146, 150, 246,
|
|
23
|
-
]);
|
|
24
|
-
function getUnsafeDepositDiscriminatorBytes() {
|
|
25
|
-
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UNSAFE_DEPOSIT_DISCRIMINATOR);
|
|
26
|
-
}
|
|
27
|
-
function getUnsafeDepositInstructionDataEncoder() {
|
|
28
|
-
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
29
|
-
['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
30
|
-
['depositor', (0, kit_1.getAddressEncoder)()],
|
|
31
|
-
['recipient', (0, kit_1.getAddressEncoder)()],
|
|
32
|
-
['inputToken', (0, kit_1.getAddressEncoder)()],
|
|
33
|
-
['outputToken', (0, kit_1.getAddressEncoder)()],
|
|
34
|
-
['inputAmount', (0, kit_1.getU64Encoder)()],
|
|
35
|
-
['outputAmount', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
|
|
36
|
-
['destinationChainId', (0, kit_1.getU64Encoder)()],
|
|
37
|
-
['exclusiveRelayer', (0, kit_1.getAddressEncoder)()],
|
|
38
|
-
['depositNonce', (0, kit_1.getU64Encoder)()],
|
|
39
|
-
['quoteTimestamp', (0, kit_1.getU32Encoder)()],
|
|
40
|
-
['fillDeadline', (0, kit_1.getU32Encoder)()],
|
|
41
|
-
['exclusivityParameter', (0, kit_1.getU32Encoder)()],
|
|
42
|
-
['message', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
|
|
43
|
-
]), (value) => ({ ...value, discriminator: exports.UNSAFE_DEPOSIT_DISCRIMINATOR }));
|
|
44
|
-
}
|
|
45
|
-
function getUnsafeDepositInstructionDataDecoder() {
|
|
46
|
-
return (0, kit_1.getStructDecoder)([
|
|
47
|
-
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
48
|
-
['depositor', (0, kit_1.getAddressDecoder)()],
|
|
49
|
-
['recipient', (0, kit_1.getAddressDecoder)()],
|
|
50
|
-
['inputToken', (0, kit_1.getAddressDecoder)()],
|
|
51
|
-
['outputToken', (0, kit_1.getAddressDecoder)()],
|
|
52
|
-
['inputAmount', (0, kit_1.getU64Decoder)()],
|
|
53
|
-
['outputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
|
|
54
|
-
['destinationChainId', (0, kit_1.getU64Decoder)()],
|
|
55
|
-
['exclusiveRelayer', (0, kit_1.getAddressDecoder)()],
|
|
56
|
-
['depositNonce', (0, kit_1.getU64Decoder)()],
|
|
57
|
-
['quoteTimestamp', (0, kit_1.getU32Decoder)()],
|
|
58
|
-
['fillDeadline', (0, kit_1.getU32Decoder)()],
|
|
59
|
-
['exclusivityParameter', (0, kit_1.getU32Decoder)()],
|
|
60
|
-
['message', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
|
|
61
|
-
]);
|
|
62
|
-
}
|
|
63
|
-
function getUnsafeDepositInstructionDataCodec() {
|
|
64
|
-
return (0, kit_1.combineCodec)(getUnsafeDepositInstructionDataEncoder(), getUnsafeDepositInstructionDataDecoder());
|
|
65
|
-
}
|
|
66
|
-
async function getUnsafeDepositInstructionAsync(input, config) {
|
|
67
|
-
// Program address.
|
|
68
|
-
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
69
|
-
// Original accounts.
|
|
70
|
-
const originalAccounts = {
|
|
71
|
-
signer: { value: input.signer ?? null, isWritable: true },
|
|
72
|
-
state: { value: input.state ?? null, isWritable: true },
|
|
73
|
-
delegate: { value: input.delegate ?? null, isWritable: false },
|
|
74
|
-
depositorTokenAccount: {
|
|
75
|
-
value: input.depositorTokenAccount ?? null,
|
|
76
|
-
isWritable: true,
|
|
77
|
-
},
|
|
78
|
-
vault: { value: input.vault ?? null, isWritable: true },
|
|
79
|
-
mint: { value: input.mint ?? null, isWritable: false },
|
|
80
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
81
|
-
associatedTokenProgram: {
|
|
82
|
-
value: input.associatedTokenProgram ?? null,
|
|
83
|
-
isWritable: false,
|
|
84
|
-
},
|
|
85
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
86
|
-
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
87
|
-
program: { value: input.program ?? null, isWritable: false },
|
|
88
|
-
};
|
|
89
|
-
const accounts = originalAccounts;
|
|
90
|
-
// Original args.
|
|
91
|
-
const args = { ...input };
|
|
92
|
-
// Resolve default values.
|
|
93
|
-
if (!accounts.tokenProgram.value) {
|
|
94
|
-
accounts.tokenProgram.value =
|
|
95
|
-
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
96
|
-
}
|
|
97
|
-
if (!accounts.depositorTokenAccount.value) {
|
|
98
|
-
accounts.depositorTokenAccount.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
99
|
-
programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
100
|
-
seeds: [
|
|
101
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectSome)(args.depositor)),
|
|
102
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.tokenProgram.value)),
|
|
103
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.mint.value)),
|
|
104
|
-
],
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (!accounts.vault.value) {
|
|
108
|
-
accounts.vault.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
109
|
-
programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
110
|
-
seeds: [
|
|
111
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.state.value)),
|
|
112
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.tokenProgram.value)),
|
|
113
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.mint.value)),
|
|
114
|
-
],
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
118
|
-
accounts.associatedTokenProgram.value =
|
|
119
|
-
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
120
|
-
}
|
|
121
|
-
if (!accounts.systemProgram.value) {
|
|
122
|
-
accounts.systemProgram.value =
|
|
123
|
-
'11111111111111111111111111111111';
|
|
124
|
-
}
|
|
125
|
-
if (!accounts.eventAuthority.value) {
|
|
126
|
-
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
127
|
-
programAddress,
|
|
128
|
-
seeds: [
|
|
129
|
-
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
130
|
-
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
131
|
-
105, 116, 121,
|
|
132
|
-
])),
|
|
133
|
-
],
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
137
|
-
const instruction = {
|
|
138
|
-
accounts: [
|
|
139
|
-
getAccountMeta(accounts.signer),
|
|
140
|
-
getAccountMeta(accounts.state),
|
|
141
|
-
getAccountMeta(accounts.delegate),
|
|
142
|
-
getAccountMeta(accounts.depositorTokenAccount),
|
|
143
|
-
getAccountMeta(accounts.vault),
|
|
144
|
-
getAccountMeta(accounts.mint),
|
|
145
|
-
getAccountMeta(accounts.tokenProgram),
|
|
146
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
147
|
-
getAccountMeta(accounts.systemProgram),
|
|
148
|
-
getAccountMeta(accounts.eventAuthority),
|
|
149
|
-
getAccountMeta(accounts.program),
|
|
150
|
-
],
|
|
151
|
-
programAddress,
|
|
152
|
-
data: getUnsafeDepositInstructionDataEncoder().encode(args),
|
|
153
|
-
};
|
|
154
|
-
return instruction;
|
|
155
|
-
}
|
|
156
|
-
function getUnsafeDepositInstruction(input, config) {
|
|
157
|
-
// Program address.
|
|
158
|
-
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
159
|
-
// Original accounts.
|
|
160
|
-
const originalAccounts = {
|
|
161
|
-
signer: { value: input.signer ?? null, isWritable: true },
|
|
162
|
-
state: { value: input.state ?? null, isWritable: true },
|
|
163
|
-
delegate: { value: input.delegate ?? null, isWritable: false },
|
|
164
|
-
depositorTokenAccount: {
|
|
165
|
-
value: input.depositorTokenAccount ?? null,
|
|
166
|
-
isWritable: true,
|
|
167
|
-
},
|
|
168
|
-
vault: { value: input.vault ?? null, isWritable: true },
|
|
169
|
-
mint: { value: input.mint ?? null, isWritable: false },
|
|
170
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
171
|
-
associatedTokenProgram: {
|
|
172
|
-
value: input.associatedTokenProgram ?? null,
|
|
173
|
-
isWritable: false,
|
|
174
|
-
},
|
|
175
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
176
|
-
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
177
|
-
program: { value: input.program ?? null, isWritable: false },
|
|
178
|
-
};
|
|
179
|
-
const accounts = originalAccounts;
|
|
180
|
-
// Original args.
|
|
181
|
-
const args = { ...input };
|
|
182
|
-
// Resolve default values.
|
|
183
|
-
if (!accounts.tokenProgram.value) {
|
|
184
|
-
accounts.tokenProgram.value =
|
|
185
|
-
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
186
|
-
}
|
|
187
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
188
|
-
accounts.associatedTokenProgram.value =
|
|
189
|
-
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
190
|
-
}
|
|
191
|
-
if (!accounts.systemProgram.value) {
|
|
192
|
-
accounts.systemProgram.value =
|
|
193
|
-
'11111111111111111111111111111111';
|
|
194
|
-
}
|
|
195
|
-
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
196
|
-
const instruction = {
|
|
197
|
-
accounts: [
|
|
198
|
-
getAccountMeta(accounts.signer),
|
|
199
|
-
getAccountMeta(accounts.state),
|
|
200
|
-
getAccountMeta(accounts.delegate),
|
|
201
|
-
getAccountMeta(accounts.depositorTokenAccount),
|
|
202
|
-
getAccountMeta(accounts.vault),
|
|
203
|
-
getAccountMeta(accounts.mint),
|
|
204
|
-
getAccountMeta(accounts.tokenProgram),
|
|
205
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
206
|
-
getAccountMeta(accounts.systemProgram),
|
|
207
|
-
getAccountMeta(accounts.eventAuthority),
|
|
208
|
-
getAccountMeta(accounts.program),
|
|
209
|
-
],
|
|
210
|
-
programAddress,
|
|
211
|
-
data: getUnsafeDepositInstructionDataEncoder().encode(args),
|
|
212
|
-
};
|
|
213
|
-
return instruction;
|
|
214
|
-
}
|
|
215
|
-
function parseUnsafeDepositInstruction(instruction) {
|
|
216
|
-
if (instruction.accounts.length < 11) {
|
|
217
|
-
// TODO: Coded error.
|
|
218
|
-
throw new Error('Not enough accounts');
|
|
219
|
-
}
|
|
220
|
-
let accountIndex = 0;
|
|
221
|
-
const getNextAccount = () => {
|
|
222
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
223
|
-
accountIndex += 1;
|
|
224
|
-
return accountMeta;
|
|
225
|
-
};
|
|
226
|
-
return {
|
|
227
|
-
programAddress: instruction.programAddress,
|
|
228
|
-
accounts: {
|
|
229
|
-
signer: getNextAccount(),
|
|
230
|
-
state: getNextAccount(),
|
|
231
|
-
delegate: getNextAccount(),
|
|
232
|
-
depositorTokenAccount: getNextAccount(),
|
|
233
|
-
vault: getNextAccount(),
|
|
234
|
-
mint: getNextAccount(),
|
|
235
|
-
tokenProgram: getNextAccount(),
|
|
236
|
-
associatedTokenProgram: getNextAccount(),
|
|
237
|
-
systemProgram: getNextAccount(),
|
|
238
|
-
eventAuthority: getNextAccount(),
|
|
239
|
-
program: getNextAccount(),
|
|
240
|
-
},
|
|
241
|
-
data: getUnsafeDepositInstructionDataDecoder().decode(instruction.data),
|
|
242
|
-
};
|
|
243
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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 Codec, type Decoder, type Encoder } from '@solana/kit';
|
|
9
|
-
import { type RelayData, type RelayDataArgs } from '.';
|
|
10
|
-
export type SlowFill = {
|
|
11
|
-
relayData: RelayData;
|
|
12
|
-
chainId: bigint;
|
|
13
|
-
updatedOutputAmount: bigint;
|
|
14
|
-
};
|
|
15
|
-
export type SlowFillArgs = {
|
|
16
|
-
relayData: RelayDataArgs;
|
|
17
|
-
chainId: number | bigint;
|
|
18
|
-
updatedOutputAmount: number | bigint;
|
|
19
|
-
};
|
|
20
|
-
export declare function getSlowFillEncoder(): Encoder<SlowFillArgs>;
|
|
21
|
-
export declare function getSlowFillDecoder(): Decoder<SlowFill>;
|
|
22
|
-
export declare function getSlowFillCodec(): Codec<SlowFillArgs, SlowFill>;
|