@layerzerolabs/oft-v2-solana-sdk 3.0.46 → 3.0.48
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/CHANGELOG.md +20 -0
- package/deployments/solana-sandbox-local/{TokenOneOFT.json → 302/TokenOneOFT.json} +5 -4
- package/deployments/solana-sandbox-local/{TokenThreeOFT.json → 302/TokenThreeOFT.json} +5 -4
- package/deployments/solana-sandbox-local/{TokenTwoOFTAdapter.json → 302/TokenTwoOFTAdapter.json} +5 -4
- package/deployments/solana-testnet/202/TokenOneOFT.json +16 -0
- package/dist/index.cjs +2101 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1349 -269
- package/dist/index.d.ts +1349 -269
- package/dist/index.mjs +2099 -260
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -9
- package/src/consts.ts +5 -0
- package/src/generated/{accounts → oft202/accounts}/lzReceiveTypesAccounts.ts +1 -2
- package/src/generated/{accounts → oft202/accounts}/oFTStore.ts +1 -2
- package/src/generated/oft202/accounts/peerConfig.ts +178 -0
- package/src/generated/oft202/instructions/index.ts +18 -0
- package/src/generated/{instructions → oft202/instructions}/initOft.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/lzReceive.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/lzReceiveTypes.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/quoteOft.ts +1 -2
- package/src/generated/oft202/instructions/quoteSend.ts +149 -0
- package/src/generated/oft202/instructions/send.ts +193 -0
- package/src/generated/{instructions → oft202/instructions}/setOftConfig.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/setPause.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/setPeerConfig.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/withdrawFee.ts +1 -2
- package/src/generated/{programs → oft202/programs}/oft.ts +2 -2
- package/src/generated/oft202/types/composeParams.ts +35 -0
- package/src/generated/oft202/types/index.ts +22 -0
- package/src/generated/oft202/types/peerConfigParam.ts +143 -0
- package/src/generated/oft302/accounts/index.ts +11 -0
- package/src/generated/oft302/accounts/lzReceiveTypesAccounts.ts +167 -0
- package/src/generated/oft302/accounts/oFTStore.ts +198 -0
- package/src/generated/{accounts → oft302/accounts}/peerConfig.ts +1 -2
- package/src/generated/oft302/errors/index.ts +9 -0
- package/src/generated/oft302/errors/oft.ts +159 -0
- package/src/generated/oft302/index.ts +14 -0
- package/src/generated/oft302/instructions/initOft.ts +179 -0
- package/src/generated/oft302/instructions/lzReceive.ts +203 -0
- package/src/generated/oft302/instructions/lzReceiveTypes.ts +124 -0
- package/src/generated/{instructions → oft302/instructions}/oftVersion.ts +1 -2
- package/src/generated/oft302/instructions/quoteOft.ts +144 -0
- package/src/generated/{instructions → oft302/instructions}/quoteSend.ts +1 -2
- package/src/generated/{instructions → oft302/instructions}/send.ts +1 -2
- package/src/generated/oft302/instructions/setOftConfig.ts +124 -0
- package/src/generated/oft302/instructions/setPause.ts +119 -0
- package/src/generated/oft302/instructions/setPeerConfig.ts +148 -0
- package/src/generated/oft302/instructions/withdrawFee.ts +151 -0
- package/src/generated/oft302/programs/index.ts +9 -0
- package/src/generated/oft302/programs/oft.ts +47 -0
- package/src/generated/oft302/shared/index.ts +117 -0
- package/src/generated/oft302/types/enforcedOptions.ts +31 -0
- package/src/generated/oft302/types/lzAccount.ts +35 -0
- package/src/generated/oft302/types/lzReceiveParams.ts +50 -0
- package/src/generated/oft302/types/messagingFee.ts +29 -0
- package/src/generated/oft302/types/oFTFeeDetail.ts +34 -0
- package/src/generated/oft302/types/oFTLimits.ts +26 -0
- package/src/generated/oft302/types/oFTReceipt.ts +29 -0
- package/src/generated/oft302/types/oFTType.ts +23 -0
- package/src/generated/oft302/types/quoteOFTResult.ts +50 -0
- package/src/generated/oft302/types/rateLimitParams.ts +38 -0
- package/src/generated/oft302/types/rateLimiter.ts +38 -0
- package/src/generated/oft302/types/setOFTConfigParams.ts +124 -0
- package/src/index.ts +5 -46
- package/src/oft202.ts +618 -0
- package/src/{oft.ts → oft302.ts} +54 -55
- package/src/pda.ts +34 -0
- package/src/types.ts +40 -0
- /package/src/generated/{accounts → oft202/accounts}/index.ts +0 -0
- /package/src/generated/{errors → oft202/errors}/index.ts +0 -0
- /package/src/generated/{errors → oft202/errors}/oft.ts +0 -0
- /package/src/generated/{index.ts → oft202/index.ts} +0 -0
- /package/src/generated/{programs → oft202/programs}/index.ts +0 -0
- /package/src/generated/{shared → oft202/shared}/index.ts +0 -0
- /package/src/generated/{types → oft202/types}/enforcedOptions.ts +0 -0
- /package/src/generated/{types → oft202/types}/lzAccount.ts +0 -0
- /package/src/generated/{types → oft202/types}/lzReceiveParams.ts +0 -0
- /package/src/generated/{types → oft202/types}/messagingFee.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTFeeDetail.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTLimits.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTReceipt.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTType.ts +0 -0
- /package/src/generated/{types → oft202/types}/quoteOFTResult.ts +0 -0
- /package/src/generated/{types → oft202/types}/rateLimitParams.ts +0 -0
- /package/src/generated/{types → oft202/types}/rateLimiter.ts +0 -0
- /package/src/generated/{types → oft202/types}/setOFTConfigParams.ts +0 -0
- /package/src/generated/{instructions → oft302/instructions}/index.ts +0 -0
- /package/src/generated/{types → oft302/types}/index.ts +0 -0
- /package/src/generated/{types → oft302/types}/peerConfigParam.ts +0 -0
- /package/src/generated/{types → oft302/types}/version.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/oft-v2-solana-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.48",
|
|
4
4
|
"license": "BUSL-1.1",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -22,20 +22,21 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"_test": "anchor test --skip-build",
|
|
24
24
|
"api-gen": "$npm_execpath gen-idl && $npm_execpath ts-node scripts/generate.ts",
|
|
25
|
-
"build": "$npm_execpath clean-prebuild && $npm_execpath sync-target && $npm_execpath build-ts",
|
|
25
|
+
"build": "$npm_execpath clean-prebuild && $npm_execpath sync-target && $npm_execpath api-gen && $npm_execpath build-ts",
|
|
26
26
|
"build-ts": "$npm_execpath tsc --noEmit && $npm_execpath tsup",
|
|
27
27
|
"clean": "$npm_execpath clean-prebuild",
|
|
28
28
|
"clean-prebuild": "rimraf .turbo target dist",
|
|
29
29
|
"gen-idl": "$npm_execpath sync-target-idl && rsync -avc --delete target/idl/ ./idl/",
|
|
30
|
-
"sync-
|
|
30
|
+
"sync-oft202": "cp ../contracts/target/idl/oft.json target/idl/oft202.json && cp ../contracts/target/deploy/oft.so target/deploy/oft202.so",
|
|
31
|
+
"sync-target": "$npm_execpath sync-target-deploy && $npm_execpath sync-target-idl && $npm_execpath sync-oft202",
|
|
31
32
|
"sync-target-deploy": "mkdir -p target/deploy && rsync -avc --delete ../../../../../packages/layerzero-v2/solana/target/deploy/ target/deploy/",
|
|
32
33
|
"sync-target-idl": "mkdir -p target/idl && rsync -avc --delete ../../../../../packages/layerzero-v2/solana/target/idl/oft.json target/idl/"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@ethersproject/bytes": "^5.7.0",
|
|
36
|
-
"@layerzerolabs/lz-foundation": "^3.0.
|
|
37
|
-
"@layerzerolabs/lz-solana-sdk-v2": "^3.0.
|
|
38
|
-
"@layerzerolabs/lz-v2-utilities": "^3.0.
|
|
37
|
+
"@layerzerolabs/lz-foundation": "^3.0.48",
|
|
38
|
+
"@layerzerolabs/lz-solana-sdk-v2": "^3.0.48",
|
|
39
|
+
"@layerzerolabs/lz-v2-utilities": "^3.0.48",
|
|
39
40
|
"@metaplex-foundation/beet": "^0.7.1",
|
|
40
41
|
"@metaplex-foundation/beet-solana": "^0.4.0",
|
|
41
42
|
"@metaplex-foundation/umi": "^0.9.2",
|
|
@@ -52,9 +53,10 @@
|
|
|
52
53
|
"@kinobi-so/nodes-from-anchor": "^0.21.2",
|
|
53
54
|
"@kinobi-so/renderers": "^0.21.3",
|
|
54
55
|
"@kinobi-so/renderers-js-umi": "^0.21.6",
|
|
55
|
-
"@layerzerolabs/
|
|
56
|
-
"@layerzerolabs/
|
|
57
|
-
"@
|
|
56
|
+
"@layerzerolabs/oft-v2-solana": "^0.0.0",
|
|
57
|
+
"@layerzerolabs/tsup-config-next": "^3.0.48",
|
|
58
|
+
"@layerzerolabs/typescript-config-next": "^3.0.48",
|
|
59
|
+
"@metaplex-foundation/mpl-toolbox": "^0.9.2",
|
|
58
60
|
"@metaplex-foundation/solita": "^0.20.1",
|
|
59
61
|
"@metaplex-foundation/umi": "^0.9.2",
|
|
60
62
|
"@metaplex-foundation/umi-bundle-defaults": "^0.9.2",
|
package/src/consts.ts
ADDED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
RpcGetAccountOptions,
|
|
16
16
|
RpcGetAccountsOptions,
|
|
17
17
|
assertAccountExists,
|
|
18
|
-
defaultPublicKey,
|
|
19
18
|
deserializeAccount,
|
|
20
19
|
gpaBuilder,
|
|
21
20
|
publicKey as toPublicKey,
|
|
@@ -143,7 +142,7 @@ export async function safeFetchAllLzReceiveTypesAccounts(
|
|
|
143
142
|
export function getLzReceiveTypesAccountsGpaBuilder(
|
|
144
143
|
context: Pick<Context, 'rpc' | 'programs'>
|
|
145
144
|
) {
|
|
146
|
-
const programId = context.programs.getPublicKey('oft',
|
|
145
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
147
146
|
return gpaBuilder(context, programId)
|
|
148
147
|
.registerFields<{
|
|
149
148
|
discriminator: Uint8Array;
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
RpcGetAccountOptions,
|
|
18
18
|
RpcGetAccountsOptions,
|
|
19
19
|
assertAccountExists,
|
|
20
|
-
defaultPublicKey,
|
|
21
20
|
deserializeAccount,
|
|
22
21
|
gpaBuilder,
|
|
23
22
|
publicKey as toPublicKey,
|
|
@@ -160,7 +159,7 @@ export async function safeFetchAllOFTStore(
|
|
|
160
159
|
export function getOFTStoreGpaBuilder(
|
|
161
160
|
context: Pick<Context, 'rpc' | 'programs'>
|
|
162
161
|
) {
|
|
163
|
-
const programId = context.programs.getPublicKey('oft',
|
|
162
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
164
163
|
return gpaBuilder(context, programId)
|
|
165
164
|
.registerFields<{
|
|
166
165
|
discriminator: Uint8Array;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Account,
|
|
11
|
+
Context,
|
|
12
|
+
Option,
|
|
13
|
+
OptionOrNullable,
|
|
14
|
+
Pda,
|
|
15
|
+
PublicKey,
|
|
16
|
+
RpcAccount,
|
|
17
|
+
RpcGetAccountOptions,
|
|
18
|
+
RpcGetAccountsOptions,
|
|
19
|
+
assertAccountExists,
|
|
20
|
+
deserializeAccount,
|
|
21
|
+
gpaBuilder,
|
|
22
|
+
publicKey as toPublicKey,
|
|
23
|
+
} from '@metaplex-foundation/umi';
|
|
24
|
+
import {
|
|
25
|
+
Serializer,
|
|
26
|
+
bool,
|
|
27
|
+
bytes,
|
|
28
|
+
mapSerializer,
|
|
29
|
+
option,
|
|
30
|
+
struct,
|
|
31
|
+
u16,
|
|
32
|
+
u8,
|
|
33
|
+
} from '@metaplex-foundation/umi/serializers';
|
|
34
|
+
import {
|
|
35
|
+
EnforcedOptions,
|
|
36
|
+
EnforcedOptionsArgs,
|
|
37
|
+
RateLimiter,
|
|
38
|
+
RateLimiterArgs,
|
|
39
|
+
getEnforcedOptionsSerializer,
|
|
40
|
+
getRateLimiterSerializer,
|
|
41
|
+
} from '../types';
|
|
42
|
+
|
|
43
|
+
export type PeerConfig = Account<PeerConfigAccountData>;
|
|
44
|
+
|
|
45
|
+
export type PeerConfigAccountData = {
|
|
46
|
+
discriminator: Uint8Array;
|
|
47
|
+
peerAddress: Uint8Array;
|
|
48
|
+
enforcedOptions: EnforcedOptions;
|
|
49
|
+
outboundRateLimiter: Option<RateLimiter>;
|
|
50
|
+
inboundRateLimiter: Option<RateLimiter>;
|
|
51
|
+
feeBps: Option<number>;
|
|
52
|
+
bump: number;
|
|
53
|
+
isEndpointV1: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type PeerConfigAccountDataArgs = {
|
|
57
|
+
peerAddress: Uint8Array;
|
|
58
|
+
enforcedOptions: EnforcedOptionsArgs;
|
|
59
|
+
outboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
|
|
60
|
+
inboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
|
|
61
|
+
feeBps: OptionOrNullable<number>;
|
|
62
|
+
bump: number;
|
|
63
|
+
isEndpointV1: boolean;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function getPeerConfigAccountDataSerializer(): Serializer<
|
|
67
|
+
PeerConfigAccountDataArgs,
|
|
68
|
+
PeerConfigAccountData
|
|
69
|
+
> {
|
|
70
|
+
return mapSerializer<PeerConfigAccountDataArgs, any, PeerConfigAccountData>(
|
|
71
|
+
struct<PeerConfigAccountData>(
|
|
72
|
+
[
|
|
73
|
+
['discriminator', bytes({ size: 8 })],
|
|
74
|
+
['peerAddress', bytes({ size: 32 })],
|
|
75
|
+
['enforcedOptions', getEnforcedOptionsSerializer()],
|
|
76
|
+
['outboundRateLimiter', option(getRateLimiterSerializer())],
|
|
77
|
+
['inboundRateLimiter', option(getRateLimiterSerializer())],
|
|
78
|
+
['feeBps', option(u16())],
|
|
79
|
+
['bump', u8()],
|
|
80
|
+
['isEndpointV1', bool()],
|
|
81
|
+
],
|
|
82
|
+
{ description: 'PeerConfigAccountData' }
|
|
83
|
+
),
|
|
84
|
+
(value) => ({
|
|
85
|
+
...value,
|
|
86
|
+
discriminator: new Uint8Array([181, 157, 86, 198, 33, 193, 94, 203]),
|
|
87
|
+
})
|
|
88
|
+
) as Serializer<PeerConfigAccountDataArgs, PeerConfigAccountData>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function deserializePeerConfig(rawAccount: RpcAccount): PeerConfig {
|
|
92
|
+
return deserializeAccount(rawAccount, getPeerConfigAccountDataSerializer());
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function fetchPeerConfig(
|
|
96
|
+
context: Pick<Context, 'rpc'>,
|
|
97
|
+
publicKey: PublicKey | Pda,
|
|
98
|
+
options?: RpcGetAccountOptions
|
|
99
|
+
): Promise<PeerConfig> {
|
|
100
|
+
const maybeAccount = await context.rpc.getAccount(
|
|
101
|
+
toPublicKey(publicKey, false),
|
|
102
|
+
options
|
|
103
|
+
);
|
|
104
|
+
assertAccountExists(maybeAccount, 'PeerConfig');
|
|
105
|
+
return deserializePeerConfig(maybeAccount);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export async function safeFetchPeerConfig(
|
|
109
|
+
context: Pick<Context, 'rpc'>,
|
|
110
|
+
publicKey: PublicKey | Pda,
|
|
111
|
+
options?: RpcGetAccountOptions
|
|
112
|
+
): Promise<PeerConfig | null> {
|
|
113
|
+
const maybeAccount = await context.rpc.getAccount(
|
|
114
|
+
toPublicKey(publicKey, false),
|
|
115
|
+
options
|
|
116
|
+
);
|
|
117
|
+
return maybeAccount.exists ? deserializePeerConfig(maybeAccount) : null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export async function fetchAllPeerConfig(
|
|
121
|
+
context: Pick<Context, 'rpc'>,
|
|
122
|
+
publicKeys: Array<PublicKey | Pda>,
|
|
123
|
+
options?: RpcGetAccountsOptions
|
|
124
|
+
): Promise<PeerConfig[]> {
|
|
125
|
+
const maybeAccounts = await context.rpc.getAccounts(
|
|
126
|
+
publicKeys.map((key) => toPublicKey(key, false)),
|
|
127
|
+
options
|
|
128
|
+
);
|
|
129
|
+
return maybeAccounts.map((maybeAccount) => {
|
|
130
|
+
assertAccountExists(maybeAccount, 'PeerConfig');
|
|
131
|
+
return deserializePeerConfig(maybeAccount);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export async function safeFetchAllPeerConfig(
|
|
136
|
+
context: Pick<Context, 'rpc'>,
|
|
137
|
+
publicKeys: Array<PublicKey | Pda>,
|
|
138
|
+
options?: RpcGetAccountsOptions
|
|
139
|
+
): Promise<PeerConfig[]> {
|
|
140
|
+
const maybeAccounts = await context.rpc.getAccounts(
|
|
141
|
+
publicKeys.map((key) => toPublicKey(key, false)),
|
|
142
|
+
options
|
|
143
|
+
);
|
|
144
|
+
return maybeAccounts
|
|
145
|
+
.filter((maybeAccount) => maybeAccount.exists)
|
|
146
|
+
.map((maybeAccount) => deserializePeerConfig(maybeAccount as RpcAccount));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function getPeerConfigGpaBuilder(
|
|
150
|
+
context: Pick<Context, 'rpc' | 'programs'>
|
|
151
|
+
) {
|
|
152
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
153
|
+
return gpaBuilder(context, programId)
|
|
154
|
+
.registerFields<{
|
|
155
|
+
discriminator: Uint8Array;
|
|
156
|
+
peerAddress: Uint8Array;
|
|
157
|
+
enforcedOptions: EnforcedOptionsArgs;
|
|
158
|
+
outboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
|
|
159
|
+
inboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
|
|
160
|
+
feeBps: OptionOrNullable<number>;
|
|
161
|
+
bump: number;
|
|
162
|
+
isEndpointV1: boolean;
|
|
163
|
+
}>({
|
|
164
|
+
discriminator: [0, bytes({ size: 8 })],
|
|
165
|
+
peerAddress: [8, bytes({ size: 32 })],
|
|
166
|
+
enforcedOptions: [40, getEnforcedOptionsSerializer()],
|
|
167
|
+
outboundRateLimiter: [null, option(getRateLimiterSerializer())],
|
|
168
|
+
inboundRateLimiter: [null, option(getRateLimiterSerializer())],
|
|
169
|
+
feeBps: [null, option(u16())],
|
|
170
|
+
bump: [null, u8()],
|
|
171
|
+
isEndpointV1: [null, bool()],
|
|
172
|
+
})
|
|
173
|
+
.deserializeUsing<PeerConfig>((account) => deserializePeerConfig(account))
|
|
174
|
+
.whereField(
|
|
175
|
+
'discriminator',
|
|
176
|
+
new Uint8Array([181, 157, 86, 198, 33, 193, 94, 203])
|
|
177
|
+
);
|
|
178
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export * from './initOft';
|
|
10
|
+
export * from './lzReceive';
|
|
11
|
+
export * from './lzReceiveTypes';
|
|
12
|
+
export * from './quoteOft';
|
|
13
|
+
export * from './quoteSend';
|
|
14
|
+
export * from './send';
|
|
15
|
+
export * from './setOftConfig';
|
|
16
|
+
export * from './setPause';
|
|
17
|
+
export * from './setPeerConfig';
|
|
18
|
+
export * from './withdrawFee';
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
PublicKey,
|
|
15
15
|
Signer,
|
|
16
16
|
TransactionBuilder,
|
|
17
|
-
defaultPublicKey,
|
|
18
17
|
transactionBuilder,
|
|
19
18
|
} from '@metaplex-foundation/umi';
|
|
20
19
|
import {
|
|
@@ -91,7 +90,7 @@ export function initOft(
|
|
|
91
90
|
input: InitOftInstructionAccounts & InitOftInstructionArgs
|
|
92
91
|
): TransactionBuilder {
|
|
93
92
|
// Program ID.
|
|
94
|
-
const programId = context.programs.getPublicKey('oft',
|
|
93
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
95
94
|
|
|
96
95
|
// Accounts.
|
|
97
96
|
const resolvedAccounts = {
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
PublicKey,
|
|
13
13
|
Signer,
|
|
14
14
|
TransactionBuilder,
|
|
15
|
-
defaultPublicKey,
|
|
16
15
|
transactionBuilder,
|
|
17
16
|
} from '@metaplex-foundation/umi';
|
|
18
17
|
import {
|
|
@@ -89,7 +88,7 @@ export function lzReceive(
|
|
|
89
88
|
input: LzReceiveInstructionAccounts & LzReceiveInstructionArgs
|
|
90
89
|
): TransactionBuilder {
|
|
91
90
|
// Program ID.
|
|
92
|
-
const programId = context.programs.getPublicKey('oft',
|
|
91
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
93
92
|
|
|
94
93
|
// Accounts.
|
|
95
94
|
const resolvedAccounts = {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
Pda,
|
|
12
12
|
PublicKey,
|
|
13
13
|
TransactionBuilder,
|
|
14
|
-
defaultPublicKey,
|
|
15
14
|
transactionBuilder,
|
|
16
15
|
} from '@metaplex-foundation/umi';
|
|
17
16
|
import {
|
|
@@ -80,7 +79,7 @@ export function lzReceiveTypes(
|
|
|
80
79
|
input: LzReceiveTypesInstructionAccounts & LzReceiveTypesInstructionArgs
|
|
81
80
|
): TransactionBuilder {
|
|
82
81
|
// Program ID.
|
|
83
|
-
const programId = context.programs.getPublicKey('oft',
|
|
82
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
84
83
|
|
|
85
84
|
// Accounts.
|
|
86
85
|
const resolvedAccounts = {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
Pda,
|
|
14
14
|
PublicKey,
|
|
15
15
|
TransactionBuilder,
|
|
16
|
-
defaultPublicKey,
|
|
17
16
|
transactionBuilder,
|
|
18
17
|
} from '@metaplex-foundation/umi';
|
|
19
18
|
import {
|
|
@@ -99,7 +98,7 @@ export function quoteOft(
|
|
|
99
98
|
input: QuoteOftInstructionAccounts & QuoteOftInstructionArgs
|
|
100
99
|
): TransactionBuilder {
|
|
101
100
|
// Program ID.
|
|
102
|
-
const programId = context.programs.getPublicKey('oft',
|
|
101
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
103
102
|
|
|
104
103
|
// Accounts.
|
|
105
104
|
const resolvedAccounts = {
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Context,
|
|
11
|
+
Option,
|
|
12
|
+
OptionOrNullable,
|
|
13
|
+
Pda,
|
|
14
|
+
PublicKey,
|
|
15
|
+
TransactionBuilder,
|
|
16
|
+
transactionBuilder,
|
|
17
|
+
} from '@metaplex-foundation/umi';
|
|
18
|
+
import {
|
|
19
|
+
Serializer,
|
|
20
|
+
bool,
|
|
21
|
+
bytes,
|
|
22
|
+
mapSerializer,
|
|
23
|
+
option,
|
|
24
|
+
struct,
|
|
25
|
+
u32,
|
|
26
|
+
u64,
|
|
27
|
+
} from '@metaplex-foundation/umi/serializers';
|
|
28
|
+
import {
|
|
29
|
+
ResolvedAccount,
|
|
30
|
+
ResolvedAccountsWithIndices,
|
|
31
|
+
getAccountMetasAndSigners,
|
|
32
|
+
} from '../shared';
|
|
33
|
+
import {
|
|
34
|
+
ComposeParams,
|
|
35
|
+
ComposeParamsArgs,
|
|
36
|
+
getComposeParamsSerializer,
|
|
37
|
+
} from '../types';
|
|
38
|
+
|
|
39
|
+
// Accounts.
|
|
40
|
+
export type QuoteSendInstructionAccounts = {
|
|
41
|
+
oftStore: PublicKey | Pda;
|
|
42
|
+
peer: PublicKey | Pda;
|
|
43
|
+
tokenMint: PublicKey | Pda;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Data.
|
|
47
|
+
export type QuoteSendInstructionData = {
|
|
48
|
+
discriminator: Uint8Array;
|
|
49
|
+
dstEid: number;
|
|
50
|
+
to: Uint8Array;
|
|
51
|
+
amountLd: bigint;
|
|
52
|
+
minAmountLd: bigint;
|
|
53
|
+
options: Uint8Array;
|
|
54
|
+
payInLzToken: boolean;
|
|
55
|
+
composeParams: Option<ComposeParams>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type QuoteSendInstructionDataArgs = {
|
|
59
|
+
dstEid: number;
|
|
60
|
+
to: Uint8Array;
|
|
61
|
+
amountLd: number | bigint;
|
|
62
|
+
minAmountLd: number | bigint;
|
|
63
|
+
options: Uint8Array;
|
|
64
|
+
payInLzToken: boolean;
|
|
65
|
+
composeParams: OptionOrNullable<ComposeParamsArgs>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export function getQuoteSendInstructionDataSerializer(): Serializer<
|
|
69
|
+
QuoteSendInstructionDataArgs,
|
|
70
|
+
QuoteSendInstructionData
|
|
71
|
+
> {
|
|
72
|
+
return mapSerializer<
|
|
73
|
+
QuoteSendInstructionDataArgs,
|
|
74
|
+
any,
|
|
75
|
+
QuoteSendInstructionData
|
|
76
|
+
>(
|
|
77
|
+
struct<QuoteSendInstructionData>(
|
|
78
|
+
[
|
|
79
|
+
['discriminator', bytes({ size: 8 })],
|
|
80
|
+
['dstEid', u32()],
|
|
81
|
+
['to', bytes({ size: 32 })],
|
|
82
|
+
['amountLd', u64()],
|
|
83
|
+
['minAmountLd', u64()],
|
|
84
|
+
['options', bytes({ size: u32() })],
|
|
85
|
+
['payInLzToken', bool()],
|
|
86
|
+
['composeParams', option(getComposeParamsSerializer())],
|
|
87
|
+
],
|
|
88
|
+
{ description: 'QuoteSendInstructionData' }
|
|
89
|
+
),
|
|
90
|
+
(value) => ({
|
|
91
|
+
...value,
|
|
92
|
+
discriminator: new Uint8Array([207, 0, 49, 214, 160, 211, 76, 211]),
|
|
93
|
+
})
|
|
94
|
+
) as Serializer<QuoteSendInstructionDataArgs, QuoteSendInstructionData>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Args.
|
|
98
|
+
export type QuoteSendInstructionArgs = QuoteSendInstructionDataArgs;
|
|
99
|
+
|
|
100
|
+
// Instruction.
|
|
101
|
+
export function quoteSend(
|
|
102
|
+
context: Pick<Context, 'programs'>,
|
|
103
|
+
input: QuoteSendInstructionAccounts & QuoteSendInstructionArgs
|
|
104
|
+
): TransactionBuilder {
|
|
105
|
+
// Program ID.
|
|
106
|
+
const programId = context.programs.getPublicKey('oft', '');
|
|
107
|
+
|
|
108
|
+
// Accounts.
|
|
109
|
+
const resolvedAccounts = {
|
|
110
|
+
oftStore: {
|
|
111
|
+
index: 0,
|
|
112
|
+
isWritable: false as boolean,
|
|
113
|
+
value: input.oftStore ?? null,
|
|
114
|
+
},
|
|
115
|
+
peer: { index: 1, isWritable: false as boolean, value: input.peer ?? null },
|
|
116
|
+
tokenMint: {
|
|
117
|
+
index: 2,
|
|
118
|
+
isWritable: false as boolean,
|
|
119
|
+
value: input.tokenMint ?? null,
|
|
120
|
+
},
|
|
121
|
+
} satisfies ResolvedAccountsWithIndices;
|
|
122
|
+
|
|
123
|
+
// Arguments.
|
|
124
|
+
const resolvedArgs: QuoteSendInstructionArgs = { ...input };
|
|
125
|
+
|
|
126
|
+
// Accounts in order.
|
|
127
|
+
const orderedAccounts: ResolvedAccount[] = Object.values(
|
|
128
|
+
resolvedAccounts
|
|
129
|
+
).sort((a, b) => a.index - b.index);
|
|
130
|
+
|
|
131
|
+
// Keys and Signers.
|
|
132
|
+
const [keys, signers] = getAccountMetasAndSigners(
|
|
133
|
+
orderedAccounts,
|
|
134
|
+
'programId',
|
|
135
|
+
programId
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
// Data.
|
|
139
|
+
const data = getQuoteSendInstructionDataSerializer().serialize(
|
|
140
|
+
resolvedArgs as QuoteSendInstructionDataArgs
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
// Bytes Created On Chain.
|
|
144
|
+
const bytesCreatedOnChain = 0;
|
|
145
|
+
|
|
146
|
+
return transactionBuilder([
|
|
147
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
|
|
148
|
+
]);
|
|
149
|
+
}
|