@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,31 +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 { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
|
|
9
|
-
import { type RelayData, type RelayDataArgs } from '../types';
|
|
10
|
-
export declare const FILL_RELAY_PARAMS_DISCRIMINATOR: Uint8Array;
|
|
11
|
-
export declare function getFillRelayParamsDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
-
export type FillRelayParams = {
|
|
13
|
-
discriminator: ReadonlyUint8Array;
|
|
14
|
-
relayData: RelayData;
|
|
15
|
-
repaymentChainId: bigint;
|
|
16
|
-
repaymentAddress: Address;
|
|
17
|
-
};
|
|
18
|
-
export type FillRelayParamsArgs = {
|
|
19
|
-
relayData: RelayDataArgs;
|
|
20
|
-
repaymentChainId: number | bigint;
|
|
21
|
-
repaymentAddress: Address;
|
|
22
|
-
};
|
|
23
|
-
export declare function getFillRelayParamsEncoder(): Encoder<FillRelayParamsArgs>;
|
|
24
|
-
export declare function getFillRelayParamsDecoder(): Decoder<FillRelayParams>;
|
|
25
|
-
export declare function getFillRelayParamsCodec(): Codec<FillRelayParamsArgs, FillRelayParams>;
|
|
26
|
-
export declare function decodeFillRelayParams<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<FillRelayParams, TAddress>;
|
|
27
|
-
export declare function decodeFillRelayParams<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<FillRelayParams, TAddress>;
|
|
28
|
-
export declare function fetchFillRelayParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<FillRelayParams, TAddress>>;
|
|
29
|
-
export declare function fetchMaybeFillRelayParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<FillRelayParams, TAddress>>;
|
|
30
|
-
export declare function fetchAllFillRelayParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<FillRelayParams>[]>;
|
|
31
|
-
export declare function fetchAllMaybeFillRelayParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<FillRelayParams>[]>;
|
|
@@ -1,67 +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.FILL_RELAY_PARAMS_DISCRIMINATOR = void 0;
|
|
11
|
-
exports.getFillRelayParamsDiscriminatorBytes = getFillRelayParamsDiscriminatorBytes;
|
|
12
|
-
exports.getFillRelayParamsEncoder = getFillRelayParamsEncoder;
|
|
13
|
-
exports.getFillRelayParamsDecoder = getFillRelayParamsDecoder;
|
|
14
|
-
exports.getFillRelayParamsCodec = getFillRelayParamsCodec;
|
|
15
|
-
exports.decodeFillRelayParams = decodeFillRelayParams;
|
|
16
|
-
exports.fetchFillRelayParams = fetchFillRelayParams;
|
|
17
|
-
exports.fetchMaybeFillRelayParams = fetchMaybeFillRelayParams;
|
|
18
|
-
exports.fetchAllFillRelayParams = fetchAllFillRelayParams;
|
|
19
|
-
exports.fetchAllMaybeFillRelayParams = fetchAllMaybeFillRelayParams;
|
|
20
|
-
const kit_1 = require("@solana/kit");
|
|
21
|
-
const types_1 = require("../types");
|
|
22
|
-
exports.FILL_RELAY_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
23
|
-
50, 243, 51, 185, 89, 60, 43, 202,
|
|
24
|
-
]);
|
|
25
|
-
function getFillRelayParamsDiscriminatorBytes() {
|
|
26
|
-
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.FILL_RELAY_PARAMS_DISCRIMINATOR);
|
|
27
|
-
}
|
|
28
|
-
function getFillRelayParamsEncoder() {
|
|
29
|
-
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
30
|
-
['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
31
|
-
['relayData', (0, types_1.getRelayDataEncoder)()],
|
|
32
|
-
['repaymentChainId', (0, kit_1.getU64Encoder)()],
|
|
33
|
-
['repaymentAddress', (0, kit_1.getAddressEncoder)()],
|
|
34
|
-
]), (value) => ({ ...value, discriminator: exports.FILL_RELAY_PARAMS_DISCRIMINATOR }));
|
|
35
|
-
}
|
|
36
|
-
function getFillRelayParamsDecoder() {
|
|
37
|
-
return (0, kit_1.getStructDecoder)([
|
|
38
|
-
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
39
|
-
['relayData', (0, types_1.getRelayDataDecoder)()],
|
|
40
|
-
['repaymentChainId', (0, kit_1.getU64Decoder)()],
|
|
41
|
-
['repaymentAddress', (0, kit_1.getAddressDecoder)()],
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
function getFillRelayParamsCodec() {
|
|
45
|
-
return (0, kit_1.combineCodec)(getFillRelayParamsEncoder(), getFillRelayParamsDecoder());
|
|
46
|
-
}
|
|
47
|
-
function decodeFillRelayParams(encodedAccount) {
|
|
48
|
-
return (0, kit_1.decodeAccount)(encodedAccount, getFillRelayParamsDecoder());
|
|
49
|
-
}
|
|
50
|
-
async function fetchFillRelayParams(rpc, address, config) {
|
|
51
|
-
const maybeAccount = await fetchMaybeFillRelayParams(rpc, address, config);
|
|
52
|
-
(0, kit_1.assertAccountExists)(maybeAccount);
|
|
53
|
-
return maybeAccount;
|
|
54
|
-
}
|
|
55
|
-
async function fetchMaybeFillRelayParams(rpc, address, config) {
|
|
56
|
-
const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
|
|
57
|
-
return decodeFillRelayParams(maybeAccount);
|
|
58
|
-
}
|
|
59
|
-
async function fetchAllFillRelayParams(rpc, addresses, config) {
|
|
60
|
-
const maybeAccounts = await fetchAllMaybeFillRelayParams(rpc, addresses, config);
|
|
61
|
-
(0, kit_1.assertAccountsExist)(maybeAccounts);
|
|
62
|
-
return maybeAccounts;
|
|
63
|
-
}
|
|
64
|
-
async function fetchAllMaybeFillRelayParams(rpc, addresses, config) {
|
|
65
|
-
const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
|
|
66
|
-
return maybeAccounts.map((maybeAccount) => decodeFillRelayParams(maybeAccount));
|
|
67
|
-
}
|
|
@@ -1,27 +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 { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
|
|
9
|
-
import { type RelayData, type RelayDataArgs } from '../types';
|
|
10
|
-
export declare const REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR: Uint8Array;
|
|
11
|
-
export declare function getRequestSlowFillParamsDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
-
export type RequestSlowFillParams = {
|
|
13
|
-
discriminator: ReadonlyUint8Array;
|
|
14
|
-
relayData: RelayData;
|
|
15
|
-
};
|
|
16
|
-
export type RequestSlowFillParamsArgs = {
|
|
17
|
-
relayData: RelayDataArgs;
|
|
18
|
-
};
|
|
19
|
-
export declare function getRequestSlowFillParamsEncoder(): Encoder<RequestSlowFillParamsArgs>;
|
|
20
|
-
export declare function getRequestSlowFillParamsDecoder(): Decoder<RequestSlowFillParams>;
|
|
21
|
-
export declare function getRequestSlowFillParamsCodec(): Codec<RequestSlowFillParamsArgs, RequestSlowFillParams>;
|
|
22
|
-
export declare function decodeRequestSlowFillParams<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<RequestSlowFillParams, TAddress>;
|
|
23
|
-
export declare function decodeRequestSlowFillParams<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<RequestSlowFillParams, TAddress>;
|
|
24
|
-
export declare function fetchRequestSlowFillParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<RequestSlowFillParams, TAddress>>;
|
|
25
|
-
export declare function fetchMaybeRequestSlowFillParams<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<RequestSlowFillParams, TAddress>>;
|
|
26
|
-
export declare function fetchAllRequestSlowFillParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<RequestSlowFillParams>[]>;
|
|
27
|
-
export declare function fetchAllMaybeRequestSlowFillParams(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<RequestSlowFillParams>[]>;
|
|
@@ -1,66 +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.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR = void 0;
|
|
11
|
-
exports.getRequestSlowFillParamsDiscriminatorBytes = getRequestSlowFillParamsDiscriminatorBytes;
|
|
12
|
-
exports.getRequestSlowFillParamsEncoder = getRequestSlowFillParamsEncoder;
|
|
13
|
-
exports.getRequestSlowFillParamsDecoder = getRequestSlowFillParamsDecoder;
|
|
14
|
-
exports.getRequestSlowFillParamsCodec = getRequestSlowFillParamsCodec;
|
|
15
|
-
exports.decodeRequestSlowFillParams = decodeRequestSlowFillParams;
|
|
16
|
-
exports.fetchRequestSlowFillParams = fetchRequestSlowFillParams;
|
|
17
|
-
exports.fetchMaybeRequestSlowFillParams = fetchMaybeRequestSlowFillParams;
|
|
18
|
-
exports.fetchAllRequestSlowFillParams = fetchAllRequestSlowFillParams;
|
|
19
|
-
exports.fetchAllMaybeRequestSlowFillParams = fetchAllMaybeRequestSlowFillParams;
|
|
20
|
-
const kit_1 = require("@solana/kit");
|
|
21
|
-
const types_1 = require("../types");
|
|
22
|
-
exports.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR = new Uint8Array([
|
|
23
|
-
5, 54, 214, 89, 197, 37, 118, 28,
|
|
24
|
-
]);
|
|
25
|
-
function getRequestSlowFillParamsDiscriminatorBytes() {
|
|
26
|
-
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR);
|
|
27
|
-
}
|
|
28
|
-
function getRequestSlowFillParamsEncoder() {
|
|
29
|
-
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
30
|
-
['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
31
|
-
['relayData', (0, types_1.getRelayDataEncoder)()],
|
|
32
|
-
]), (value) => ({
|
|
33
|
-
...value,
|
|
34
|
-
discriminator: exports.REQUEST_SLOW_FILL_PARAMS_DISCRIMINATOR,
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
function getRequestSlowFillParamsDecoder() {
|
|
38
|
-
return (0, kit_1.getStructDecoder)([
|
|
39
|
-
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
40
|
-
['relayData', (0, types_1.getRelayDataDecoder)()],
|
|
41
|
-
]);
|
|
42
|
-
}
|
|
43
|
-
function getRequestSlowFillParamsCodec() {
|
|
44
|
-
return (0, kit_1.combineCodec)(getRequestSlowFillParamsEncoder(), getRequestSlowFillParamsDecoder());
|
|
45
|
-
}
|
|
46
|
-
function decodeRequestSlowFillParams(encodedAccount) {
|
|
47
|
-
return (0, kit_1.decodeAccount)(encodedAccount, getRequestSlowFillParamsDecoder());
|
|
48
|
-
}
|
|
49
|
-
async function fetchRequestSlowFillParams(rpc, address, config) {
|
|
50
|
-
const maybeAccount = await fetchMaybeRequestSlowFillParams(rpc, address, config);
|
|
51
|
-
(0, kit_1.assertAccountExists)(maybeAccount);
|
|
52
|
-
return maybeAccount;
|
|
53
|
-
}
|
|
54
|
-
async function fetchMaybeRequestSlowFillParams(rpc, address, config) {
|
|
55
|
-
const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
|
|
56
|
-
return decodeRequestSlowFillParams(maybeAccount);
|
|
57
|
-
}
|
|
58
|
-
async function fetchAllRequestSlowFillParams(rpc, addresses, config) {
|
|
59
|
-
const maybeAccounts = await fetchAllMaybeRequestSlowFillParams(rpc, addresses, config);
|
|
60
|
-
(0, kit_1.assertAccountsExist)(maybeAccounts);
|
|
61
|
-
return maybeAccounts;
|
|
62
|
-
}
|
|
63
|
-
async function fetchAllMaybeRequestSlowFillParams(rpc, addresses, config) {
|
|
64
|
-
const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
|
|
65
|
-
return maybeAccounts.map((maybeAccount) => decodeRequestSlowFillParams(maybeAccount));
|
|
66
|
-
}
|
|
@@ -1,131 +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 AccountMeta, type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
|
|
9
|
-
import { SVM_SPOKE_PROGRAM_ADDRESS } from '../programs';
|
|
10
|
-
export declare const DEPOSIT_DISCRIMINATOR: Uint8Array;
|
|
11
|
-
export declare function getDepositDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
-
export type DepositInstruction<TProgram extends string = typeof SVM_SPOKE_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountState extends string | AccountMeta<string> = string, TAccountDelegate extends string | AccountMeta<string> = string, TAccountDepositorTokenAccount extends string | AccountMeta<string> = string, TAccountVault extends string | AccountMeta<string> = string, TAccountMint extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', TAccountAssociatedTokenProgram extends string | AccountMeta<string> = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL', TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', TAccountEventAuthority extends string | AccountMeta<string> = string, TAccountProgram extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
-
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
14
|
-
TAccountState extends string ? WritableAccount<TAccountState> : TAccountState,
|
|
15
|
-
TAccountDelegate extends string ? ReadonlyAccount<TAccountDelegate> : TAccountDelegate,
|
|
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
|
-
TAccountAssociatedTokenProgram extends string ? ReadonlyAccount<TAccountAssociatedTokenProgram> : TAccountAssociatedTokenProgram,
|
|
21
|
-
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
22
|
-
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
23
|
-
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
24
|
-
...TRemainingAccounts
|
|
25
|
-
]>;
|
|
26
|
-
export type DepositInstructionData = {
|
|
27
|
-
discriminator: ReadonlyUint8Array;
|
|
28
|
-
depositor: Address;
|
|
29
|
-
recipient: Address;
|
|
30
|
-
inputToken: Address;
|
|
31
|
-
outputToken: Address;
|
|
32
|
-
inputAmount: bigint;
|
|
33
|
-
outputAmount: ReadonlyUint8Array;
|
|
34
|
-
destinationChainId: bigint;
|
|
35
|
-
exclusiveRelayer: Address;
|
|
36
|
-
quoteTimestamp: number;
|
|
37
|
-
fillDeadline: number;
|
|
38
|
-
exclusivityParameter: number;
|
|
39
|
-
message: ReadonlyUint8Array;
|
|
40
|
-
};
|
|
41
|
-
export type DepositInstructionDataArgs = {
|
|
42
|
-
depositor: Address;
|
|
43
|
-
recipient: Address;
|
|
44
|
-
inputToken: Address;
|
|
45
|
-
outputToken: Address;
|
|
46
|
-
inputAmount: number | bigint;
|
|
47
|
-
outputAmount: ReadonlyUint8Array;
|
|
48
|
-
destinationChainId: number | bigint;
|
|
49
|
-
exclusiveRelayer: Address;
|
|
50
|
-
quoteTimestamp: number;
|
|
51
|
-
fillDeadline: number;
|
|
52
|
-
exclusivityParameter: number;
|
|
53
|
-
message: ReadonlyUint8Array;
|
|
54
|
-
};
|
|
55
|
-
export declare function getDepositInstructionDataEncoder(): Encoder<DepositInstructionDataArgs>;
|
|
56
|
-
export declare function getDepositInstructionDataDecoder(): Decoder<DepositInstructionData>;
|
|
57
|
-
export declare function getDepositInstructionDataCodec(): Codec<DepositInstructionDataArgs, DepositInstructionData>;
|
|
58
|
-
export type DepositAsyncInput<TAccountSigner extends string = string, TAccountState extends string = string, TAccountDelegate extends string = string, TAccountDepositorTokenAccount extends string = string, TAccountVault extends string = string, TAccountMint extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
59
|
-
signer: TransactionSigner<TAccountSigner>;
|
|
60
|
-
state: Address<TAccountState>;
|
|
61
|
-
delegate: Address<TAccountDelegate>;
|
|
62
|
-
depositorTokenAccount?: Address<TAccountDepositorTokenAccount>;
|
|
63
|
-
vault?: Address<TAccountVault>;
|
|
64
|
-
mint: Address<TAccountMint>;
|
|
65
|
-
tokenProgram?: Address<TAccountTokenProgram>;
|
|
66
|
-
associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
|
|
67
|
-
systemProgram?: Address<TAccountSystemProgram>;
|
|
68
|
-
eventAuthority?: Address<TAccountEventAuthority>;
|
|
69
|
-
program: Address<TAccountProgram>;
|
|
70
|
-
depositor: DepositInstructionDataArgs['depositor'];
|
|
71
|
-
recipient: DepositInstructionDataArgs['recipient'];
|
|
72
|
-
inputToken: DepositInstructionDataArgs['inputToken'];
|
|
73
|
-
outputToken: DepositInstructionDataArgs['outputToken'];
|
|
74
|
-
inputAmount: DepositInstructionDataArgs['inputAmount'];
|
|
75
|
-
outputAmount: DepositInstructionDataArgs['outputAmount'];
|
|
76
|
-
destinationChainId: DepositInstructionDataArgs['destinationChainId'];
|
|
77
|
-
exclusiveRelayer: DepositInstructionDataArgs['exclusiveRelayer'];
|
|
78
|
-
quoteTimestamp: DepositInstructionDataArgs['quoteTimestamp'];
|
|
79
|
-
fillDeadline: DepositInstructionDataArgs['fillDeadline'];
|
|
80
|
-
exclusivityParameter: DepositInstructionDataArgs['exclusivityParameter'];
|
|
81
|
-
message: DepositInstructionDataArgs['message'];
|
|
82
|
-
};
|
|
83
|
-
export declare function getDepositInstructionAsync<TAccountSigner extends string, TAccountState extends string, TAccountDelegate extends string, TAccountDepositorTokenAccount extends string, TAccountVault extends string, TAccountMint extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof SVM_SPOKE_PROGRAM_ADDRESS>(input: DepositAsyncInput<TAccountSigner, TAccountState, TAccountDelegate, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
84
|
-
programAddress?: TProgramAddress;
|
|
85
|
-
}): Promise<DepositInstruction<TProgramAddress, TAccountSigner, TAccountState, TAccountDelegate, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>>;
|
|
86
|
-
export type DepositInput<TAccountSigner extends string = string, TAccountState extends string = string, TAccountDelegate extends string = string, TAccountDepositorTokenAccount extends string = string, TAccountVault extends string = string, TAccountMint extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
87
|
-
signer: TransactionSigner<TAccountSigner>;
|
|
88
|
-
state: Address<TAccountState>;
|
|
89
|
-
delegate: Address<TAccountDelegate>;
|
|
90
|
-
depositorTokenAccount: Address<TAccountDepositorTokenAccount>;
|
|
91
|
-
vault: Address<TAccountVault>;
|
|
92
|
-
mint: Address<TAccountMint>;
|
|
93
|
-
tokenProgram?: Address<TAccountTokenProgram>;
|
|
94
|
-
associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
|
|
95
|
-
systemProgram?: Address<TAccountSystemProgram>;
|
|
96
|
-
eventAuthority: Address<TAccountEventAuthority>;
|
|
97
|
-
program: Address<TAccountProgram>;
|
|
98
|
-
depositor: DepositInstructionDataArgs['depositor'];
|
|
99
|
-
recipient: DepositInstructionDataArgs['recipient'];
|
|
100
|
-
inputToken: DepositInstructionDataArgs['inputToken'];
|
|
101
|
-
outputToken: DepositInstructionDataArgs['outputToken'];
|
|
102
|
-
inputAmount: DepositInstructionDataArgs['inputAmount'];
|
|
103
|
-
outputAmount: DepositInstructionDataArgs['outputAmount'];
|
|
104
|
-
destinationChainId: DepositInstructionDataArgs['destinationChainId'];
|
|
105
|
-
exclusiveRelayer: DepositInstructionDataArgs['exclusiveRelayer'];
|
|
106
|
-
quoteTimestamp: DepositInstructionDataArgs['quoteTimestamp'];
|
|
107
|
-
fillDeadline: DepositInstructionDataArgs['fillDeadline'];
|
|
108
|
-
exclusivityParameter: DepositInstructionDataArgs['exclusivityParameter'];
|
|
109
|
-
message: DepositInstructionDataArgs['message'];
|
|
110
|
-
};
|
|
111
|
-
export declare function getDepositInstruction<TAccountSigner extends string, TAccountState extends string, TAccountDelegate extends string, TAccountDepositorTokenAccount extends string, TAccountVault extends string, TAccountMint extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof SVM_SPOKE_PROGRAM_ADDRESS>(input: DepositInput<TAccountSigner, TAccountState, TAccountDelegate, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
112
|
-
programAddress?: TProgramAddress;
|
|
113
|
-
}): DepositInstruction<TProgramAddress, TAccountSigner, TAccountState, TAccountDelegate, TAccountDepositorTokenAccount, TAccountVault, TAccountMint, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>;
|
|
114
|
-
export type ParsedDepositInstruction<TProgram extends string = typeof SVM_SPOKE_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
115
|
-
programAddress: Address<TProgram>;
|
|
116
|
-
accounts: {
|
|
117
|
-
signer: TAccountMetas[0];
|
|
118
|
-
state: TAccountMetas[1];
|
|
119
|
-
delegate: TAccountMetas[2];
|
|
120
|
-
depositorTokenAccount: TAccountMetas[3];
|
|
121
|
-
vault: TAccountMetas[4];
|
|
122
|
-
mint: TAccountMetas[5];
|
|
123
|
-
tokenProgram: TAccountMetas[6];
|
|
124
|
-
associatedTokenProgram: TAccountMetas[7];
|
|
125
|
-
systemProgram: TAccountMetas[8];
|
|
126
|
-
eventAuthority: TAccountMetas[9];
|
|
127
|
-
program: TAccountMetas[10];
|
|
128
|
-
};
|
|
129
|
-
data: DepositInstructionData;
|
|
130
|
-
};
|
|
131
|
-
export declare function parseDepositInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedDepositInstruction<TProgram, TAccountMetas>;
|
|
@@ -1,241 +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.DEPOSIT_DISCRIMINATOR = void 0;
|
|
11
|
-
exports.getDepositDiscriminatorBytes = getDepositDiscriminatorBytes;
|
|
12
|
-
exports.getDepositInstructionDataEncoder = getDepositInstructionDataEncoder;
|
|
13
|
-
exports.getDepositInstructionDataDecoder = getDepositInstructionDataDecoder;
|
|
14
|
-
exports.getDepositInstructionDataCodec = getDepositInstructionDataCodec;
|
|
15
|
-
exports.getDepositInstructionAsync = getDepositInstructionAsync;
|
|
16
|
-
exports.getDepositInstruction = getDepositInstruction;
|
|
17
|
-
exports.parseDepositInstruction = parseDepositInstruction;
|
|
18
|
-
const kit_1 = require("@solana/kit");
|
|
19
|
-
const programs_1 = require("../programs");
|
|
20
|
-
const shared_1 = require("../shared");
|
|
21
|
-
exports.DEPOSIT_DISCRIMINATOR = new Uint8Array([
|
|
22
|
-
242, 35, 198, 137, 82, 225, 242, 182,
|
|
23
|
-
]);
|
|
24
|
-
function getDepositDiscriminatorBytes() {
|
|
25
|
-
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.DEPOSIT_DISCRIMINATOR);
|
|
26
|
-
}
|
|
27
|
-
function getDepositInstructionDataEncoder() {
|
|
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
|
-
['quoteTimestamp', (0, kit_1.getU32Encoder)()],
|
|
39
|
-
['fillDeadline', (0, kit_1.getU32Encoder)()],
|
|
40
|
-
['exclusivityParameter', (0, kit_1.getU32Encoder)()],
|
|
41
|
-
['message', (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
|
|
42
|
-
]), (value) => ({ ...value, discriminator: exports.DEPOSIT_DISCRIMINATOR }));
|
|
43
|
-
}
|
|
44
|
-
function getDepositInstructionDataDecoder() {
|
|
45
|
-
return (0, kit_1.getStructDecoder)([
|
|
46
|
-
['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
47
|
-
['depositor', (0, kit_1.getAddressDecoder)()],
|
|
48
|
-
['recipient', (0, kit_1.getAddressDecoder)()],
|
|
49
|
-
['inputToken', (0, kit_1.getAddressDecoder)()],
|
|
50
|
-
['outputToken', (0, kit_1.getAddressDecoder)()],
|
|
51
|
-
['inputAmount', (0, kit_1.getU64Decoder)()],
|
|
52
|
-
['outputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
|
|
53
|
-
['destinationChainId', (0, kit_1.getU64Decoder)()],
|
|
54
|
-
['exclusiveRelayer', (0, kit_1.getAddressDecoder)()],
|
|
55
|
-
['quoteTimestamp', (0, kit_1.getU32Decoder)()],
|
|
56
|
-
['fillDeadline', (0, kit_1.getU32Decoder)()],
|
|
57
|
-
['exclusivityParameter', (0, kit_1.getU32Decoder)()],
|
|
58
|
-
['message', (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
function getDepositInstructionDataCodec() {
|
|
62
|
-
return (0, kit_1.combineCodec)(getDepositInstructionDataEncoder(), getDepositInstructionDataDecoder());
|
|
63
|
-
}
|
|
64
|
-
async function getDepositInstructionAsync(input, config) {
|
|
65
|
-
// Program address.
|
|
66
|
-
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
67
|
-
// Original accounts.
|
|
68
|
-
const originalAccounts = {
|
|
69
|
-
signer: { value: input.signer ?? null, isWritable: true },
|
|
70
|
-
state: { value: input.state ?? null, isWritable: true },
|
|
71
|
-
delegate: { value: input.delegate ?? null, isWritable: false },
|
|
72
|
-
depositorTokenAccount: {
|
|
73
|
-
value: input.depositorTokenAccount ?? null,
|
|
74
|
-
isWritable: true,
|
|
75
|
-
},
|
|
76
|
-
vault: { value: input.vault ?? null, isWritable: true },
|
|
77
|
-
mint: { value: input.mint ?? null, isWritable: false },
|
|
78
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
79
|
-
associatedTokenProgram: {
|
|
80
|
-
value: input.associatedTokenProgram ?? null,
|
|
81
|
-
isWritable: false,
|
|
82
|
-
},
|
|
83
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
84
|
-
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
85
|
-
program: { value: input.program ?? null, isWritable: false },
|
|
86
|
-
};
|
|
87
|
-
const accounts = originalAccounts;
|
|
88
|
-
// Original args.
|
|
89
|
-
const args = { ...input };
|
|
90
|
-
// Resolve default values.
|
|
91
|
-
if (!accounts.tokenProgram.value) {
|
|
92
|
-
accounts.tokenProgram.value =
|
|
93
|
-
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
94
|
-
}
|
|
95
|
-
if (!accounts.depositorTokenAccount.value) {
|
|
96
|
-
accounts.depositorTokenAccount.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
97
|
-
programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
98
|
-
seeds: [
|
|
99
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectSome)(args.depositor)),
|
|
100
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.tokenProgram.value)),
|
|
101
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.mint.value)),
|
|
102
|
-
],
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (!accounts.vault.value) {
|
|
106
|
-
accounts.vault.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
107
|
-
programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
|
|
108
|
-
seeds: [
|
|
109
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.state.value)),
|
|
110
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.tokenProgram.value)),
|
|
111
|
-
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.mint.value)),
|
|
112
|
-
],
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
116
|
-
accounts.associatedTokenProgram.value =
|
|
117
|
-
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
118
|
-
}
|
|
119
|
-
if (!accounts.systemProgram.value) {
|
|
120
|
-
accounts.systemProgram.value =
|
|
121
|
-
'11111111111111111111111111111111';
|
|
122
|
-
}
|
|
123
|
-
if (!accounts.eventAuthority.value) {
|
|
124
|
-
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
125
|
-
programAddress,
|
|
126
|
-
seeds: [
|
|
127
|
-
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
128
|
-
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
129
|
-
105, 116, 121,
|
|
130
|
-
])),
|
|
131
|
-
],
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
135
|
-
const instruction = {
|
|
136
|
-
accounts: [
|
|
137
|
-
getAccountMeta(accounts.signer),
|
|
138
|
-
getAccountMeta(accounts.state),
|
|
139
|
-
getAccountMeta(accounts.delegate),
|
|
140
|
-
getAccountMeta(accounts.depositorTokenAccount),
|
|
141
|
-
getAccountMeta(accounts.vault),
|
|
142
|
-
getAccountMeta(accounts.mint),
|
|
143
|
-
getAccountMeta(accounts.tokenProgram),
|
|
144
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
145
|
-
getAccountMeta(accounts.systemProgram),
|
|
146
|
-
getAccountMeta(accounts.eventAuthority),
|
|
147
|
-
getAccountMeta(accounts.program),
|
|
148
|
-
],
|
|
149
|
-
programAddress,
|
|
150
|
-
data: getDepositInstructionDataEncoder().encode(args),
|
|
151
|
-
};
|
|
152
|
-
return instruction;
|
|
153
|
-
}
|
|
154
|
-
function getDepositInstruction(input, config) {
|
|
155
|
-
// Program address.
|
|
156
|
-
const programAddress = config?.programAddress ?? programs_1.SVM_SPOKE_PROGRAM_ADDRESS;
|
|
157
|
-
// Original accounts.
|
|
158
|
-
const originalAccounts = {
|
|
159
|
-
signer: { value: input.signer ?? null, isWritable: true },
|
|
160
|
-
state: { value: input.state ?? null, isWritable: true },
|
|
161
|
-
delegate: { value: input.delegate ?? null, isWritable: false },
|
|
162
|
-
depositorTokenAccount: {
|
|
163
|
-
value: input.depositorTokenAccount ?? null,
|
|
164
|
-
isWritable: true,
|
|
165
|
-
},
|
|
166
|
-
vault: { value: input.vault ?? null, isWritable: true },
|
|
167
|
-
mint: { value: input.mint ?? null, isWritable: false },
|
|
168
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
169
|
-
associatedTokenProgram: {
|
|
170
|
-
value: input.associatedTokenProgram ?? null,
|
|
171
|
-
isWritable: false,
|
|
172
|
-
},
|
|
173
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
174
|
-
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
175
|
-
program: { value: input.program ?? null, isWritable: false },
|
|
176
|
-
};
|
|
177
|
-
const accounts = originalAccounts;
|
|
178
|
-
// Original args.
|
|
179
|
-
const args = { ...input };
|
|
180
|
-
// Resolve default values.
|
|
181
|
-
if (!accounts.tokenProgram.value) {
|
|
182
|
-
accounts.tokenProgram.value =
|
|
183
|
-
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
184
|
-
}
|
|
185
|
-
if (!accounts.associatedTokenProgram.value) {
|
|
186
|
-
accounts.associatedTokenProgram.value =
|
|
187
|
-
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
|
|
188
|
-
}
|
|
189
|
-
if (!accounts.systemProgram.value) {
|
|
190
|
-
accounts.systemProgram.value =
|
|
191
|
-
'11111111111111111111111111111111';
|
|
192
|
-
}
|
|
193
|
-
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
|
|
194
|
-
const instruction = {
|
|
195
|
-
accounts: [
|
|
196
|
-
getAccountMeta(accounts.signer),
|
|
197
|
-
getAccountMeta(accounts.state),
|
|
198
|
-
getAccountMeta(accounts.delegate),
|
|
199
|
-
getAccountMeta(accounts.depositorTokenAccount),
|
|
200
|
-
getAccountMeta(accounts.vault),
|
|
201
|
-
getAccountMeta(accounts.mint),
|
|
202
|
-
getAccountMeta(accounts.tokenProgram),
|
|
203
|
-
getAccountMeta(accounts.associatedTokenProgram),
|
|
204
|
-
getAccountMeta(accounts.systemProgram),
|
|
205
|
-
getAccountMeta(accounts.eventAuthority),
|
|
206
|
-
getAccountMeta(accounts.program),
|
|
207
|
-
],
|
|
208
|
-
programAddress,
|
|
209
|
-
data: getDepositInstructionDataEncoder().encode(args),
|
|
210
|
-
};
|
|
211
|
-
return instruction;
|
|
212
|
-
}
|
|
213
|
-
function parseDepositInstruction(instruction) {
|
|
214
|
-
if (instruction.accounts.length < 11) {
|
|
215
|
-
// TODO: Coded error.
|
|
216
|
-
throw new Error('Not enough accounts');
|
|
217
|
-
}
|
|
218
|
-
let accountIndex = 0;
|
|
219
|
-
const getNextAccount = () => {
|
|
220
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
221
|
-
accountIndex += 1;
|
|
222
|
-
return accountMeta;
|
|
223
|
-
};
|
|
224
|
-
return {
|
|
225
|
-
programAddress: instruction.programAddress,
|
|
226
|
-
accounts: {
|
|
227
|
-
signer: getNextAccount(),
|
|
228
|
-
state: getNextAccount(),
|
|
229
|
-
delegate: getNextAccount(),
|
|
230
|
-
depositorTokenAccount: getNextAccount(),
|
|
231
|
-
vault: getNextAccount(),
|
|
232
|
-
mint: getNextAccount(),
|
|
233
|
-
tokenProgram: getNextAccount(),
|
|
234
|
-
associatedTokenProgram: getNextAccount(),
|
|
235
|
-
systemProgram: getNextAccount(),
|
|
236
|
-
eventAuthority: getNextAccount(),
|
|
237
|
-
program: getNextAccount(),
|
|
238
|
-
},
|
|
239
|
-
data: getDepositInstructionDataDecoder().decode(instruction.data),
|
|
240
|
-
};
|
|
241
|
-
}
|