@layerzerolabs/oft-v2-solana-sdk 2.3.45-initia-oft.5 → 3.0.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +6 -30
  2. package/package.json +8 -7
  3. package/src/generated/accounts/index.ts +11 -0
  4. package/src/generated/accounts/lzReceiveTypesAccounts.ts +168 -0
  5. package/src/generated/accounts/oFTStore.ts +199 -0
  6. package/src/generated/accounts/peerConfig.ts +173 -0
  7. package/src/generated/errors/index.ts +9 -0
  8. package/src/generated/errors/oft.ts +159 -0
  9. package/src/generated/index.ts +14 -0
  10. package/src/generated/instructions/index.ts +19 -0
  11. package/src/generated/instructions/initOft.ts +180 -0
  12. package/src/generated/instructions/lzReceive.ts +204 -0
  13. package/src/generated/instructions/lzReceiveTypes.ts +125 -0
  14. package/src/generated/instructions/oftVersion.ts +82 -0
  15. package/src/generated/instructions/quoteOft.ts +145 -0
  16. package/src/generated/instructions/quoteSend.ts +145 -0
  17. package/src/generated/instructions/send.ts +189 -0
  18. package/src/generated/instructions/setOftConfig.ts +125 -0
  19. package/src/generated/instructions/setPause.ts +120 -0
  20. package/src/generated/instructions/setPeerConfig.ts +149 -0
  21. package/src/generated/instructions/withdrawFee.ts +152 -0
  22. package/src/generated/programs/index.ts +9 -0
  23. package/src/generated/programs/oft.ts +47 -0
  24. package/src/generated/shared/index.ts +117 -0
  25. package/src/generated/types/enforcedOptions.ts +31 -0
  26. package/src/generated/types/index.ts +22 -0
  27. package/src/generated/types/lzAccount.ts +35 -0
  28. package/src/generated/types/lzReceiveParams.ts +50 -0
  29. package/src/generated/types/messagingFee.ts +29 -0
  30. package/src/generated/types/oFTFeeDetail.ts +34 -0
  31. package/src/generated/types/oFTLimits.ts +26 -0
  32. package/src/generated/types/oFTReceipt.ts +29 -0
  33. package/src/generated/types/oFTType.ts +23 -0
  34. package/src/generated/types/peerConfigParam.ts +130 -0
  35. package/src/generated/types/quoteOFTResult.ts +50 -0
  36. package/src/generated/types/rateLimitParams.ts +38 -0
  37. package/src/generated/types/rateLimiter.ts +38 -0
  38. package/src/generated/types/setOFTConfigParams.ts +124 -0
  39. package/src/generated/types/version.ts +26 -0
  40. package/src/index.ts +46 -0
  41. package/src/oft.ts +1003 -0
package/CHANGELOG.md CHANGED
@@ -1,40 +1,16 @@
1
1
  # @layerzerolabs/oft-v2-solana-sdk
2
2
 
3
- ## 2.3.45-initia-oft.5
3
+ ## 3.0.0
4
4
 
5
- ### Patch Changes
6
-
7
- - Build Initia,aptos,movement,bsc snapshot images with newest images
8
-
9
- ## 2.3.45-initia-oft.4
10
-
11
- ### Patch Changes
12
-
13
- - Build initia images with newest contracts
14
-
15
- ## 2.3.45-initia-oft.3
16
-
17
- ### Patch Changes
18
-
19
- - Fix Aptos OFT SDK to fit newest contracts
20
-
21
- ## 2.3.45-initia-oft.2
22
-
23
- ### Patch Changes
24
-
25
- - Fix bug in Initia OFT sdk
26
-
27
- ## 2.3.45-initia-oft.1
28
-
29
- ### Patch Changes
30
-
31
- - Build new initia images with newest contracts
5
+ ### Major Changes
32
6
 
33
- ## 2.3.45-initia-oft.0
7
+ - 095d9bf: oft v2
34
8
 
35
9
  ### Patch Changes
36
10
 
37
- - Build new initia images with testnet deployments
11
+ - Updated dependencies [095d9bf]
12
+ - @layerzerolabs/lz-solana-sdk-v2@3.0.0
13
+ - @layerzerolabs/lz-v2-utilities@3.0.0
38
14
 
39
15
  ## 2.3.44
40
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/oft-v2-solana-sdk",
3
- "version": "2.3.45-initia-oft.5",
3
+ "version": "3.0.0",
4
4
  "license": "BUSL-1.1",
5
5
  "exports": {
6
6
  ".": {
@@ -16,7 +16,8 @@
16
16
  "types": "./dist/index.d.ts",
17
17
  "files": [
18
18
  "deployments/**/*",
19
- "dist/**/*"
19
+ "dist/**/*",
20
+ "src/**/*"
20
21
  ],
21
22
  "scripts": {
22
23
  "_test": "anchor test --skip-build",
@@ -32,8 +33,8 @@
32
33
  },
33
34
  "dependencies": {
34
35
  "@ethersproject/bytes": "^5.7.0",
35
- "@layerzerolabs/lz-solana-sdk-v2": "^2.3.45-initia-oft.5",
36
- "@layerzerolabs/lz-v2-utilities": "^2.3.45-initia-oft.5",
36
+ "@layerzerolabs/lz-solana-sdk-v2": "^3.0.0",
37
+ "@layerzerolabs/lz-v2-utilities": "^3.0.0",
37
38
  "@metaplex-foundation/beet": "^0.7.1",
38
39
  "@metaplex-foundation/beet-solana": "^0.4.0",
39
40
  "@metaplex-foundation/umi": "^0.9.2",
@@ -50,8 +51,8 @@
50
51
  "@kinobi-so/nodes-from-anchor": "^0.21.2",
51
52
  "@kinobi-so/renderers": "^0.21.3",
52
53
  "@kinobi-so/renderers-js-umi": "^0.21.6",
53
- "@layerzerolabs/tsup-config-next": "^2.3.45-initia-oft.5",
54
- "@layerzerolabs/typescript-config-next": "^2.3.45-initia-oft.5",
54
+ "@layerzerolabs/tsup-config-next": "^3.0.0",
55
+ "@layerzerolabs/typescript-config-next": "^3.0.0",
55
56
  "@metaplex-foundation/mpl-toolbox": "^0.9.4",
56
57
  "@metaplex-foundation/solita": "^0.20.1",
57
58
  "@metaplex-foundation/umi": "^0.9.2",
@@ -75,6 +76,6 @@
75
76
  "typescript": "~5.2.2"
76
77
  },
77
78
  "publishConfig": {
78
- "access": "restricted"
79
+ "access": "public"
79
80
  }
80
81
  }
@@ -0,0 +1,11 @@
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 './lzReceiveTypesAccounts';
10
+ export * from './oFTStore';
11
+ export * from './peerConfig';
@@ -0,0 +1,168 @@
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
+ Pda,
13
+ PublicKey,
14
+ RpcAccount,
15
+ RpcGetAccountOptions,
16
+ RpcGetAccountsOptions,
17
+ assertAccountExists,
18
+ defaultPublicKey,
19
+ deserializeAccount,
20
+ gpaBuilder,
21
+ publicKey as toPublicKey,
22
+ } from '@metaplex-foundation/umi';
23
+ import {
24
+ Serializer,
25
+ bytes,
26
+ mapSerializer,
27
+ publicKey as publicKeySerializer,
28
+ struct,
29
+ } from '@metaplex-foundation/umi/serializers';
30
+
31
+ /**
32
+ * LzReceiveTypesAccounts includes accounts that are used in the LzReceiveTypes
33
+ * instruction.
34
+ */
35
+
36
+ export type LzReceiveTypesAccounts = Account<LzReceiveTypesAccountsAccountData>;
37
+
38
+ export type LzReceiveTypesAccountsAccountData = {
39
+ discriminator: Uint8Array;
40
+ oftStore: PublicKey;
41
+ tokenMint: PublicKey;
42
+ };
43
+
44
+ export type LzReceiveTypesAccountsAccountDataArgs = {
45
+ oftStore: PublicKey;
46
+ tokenMint: PublicKey;
47
+ };
48
+
49
+ export function getLzReceiveTypesAccountsAccountDataSerializer(): Serializer<
50
+ LzReceiveTypesAccountsAccountDataArgs,
51
+ LzReceiveTypesAccountsAccountData
52
+ > {
53
+ return mapSerializer<
54
+ LzReceiveTypesAccountsAccountDataArgs,
55
+ any,
56
+ LzReceiveTypesAccountsAccountData
57
+ >(
58
+ struct<LzReceiveTypesAccountsAccountData>(
59
+ [
60
+ ['discriminator', bytes({ size: 8 })],
61
+ ['oftStore', publicKeySerializer()],
62
+ ['tokenMint', publicKeySerializer()],
63
+ ],
64
+ { description: 'LzReceiveTypesAccountsAccountData' }
65
+ ),
66
+ (value) => ({
67
+ ...value,
68
+ discriminator: new Uint8Array([248, 87, 167, 117, 5, 251, 21, 126]),
69
+ })
70
+ ) as Serializer<
71
+ LzReceiveTypesAccountsAccountDataArgs,
72
+ LzReceiveTypesAccountsAccountData
73
+ >;
74
+ }
75
+
76
+ export function deserializeLzReceiveTypesAccounts(
77
+ rawAccount: RpcAccount
78
+ ): LzReceiveTypesAccounts {
79
+ return deserializeAccount(
80
+ rawAccount,
81
+ getLzReceiveTypesAccountsAccountDataSerializer()
82
+ );
83
+ }
84
+
85
+ export async function fetchLzReceiveTypesAccounts(
86
+ context: Pick<Context, 'rpc'>,
87
+ publicKey: PublicKey | Pda,
88
+ options?: RpcGetAccountOptions
89
+ ): Promise<LzReceiveTypesAccounts> {
90
+ const maybeAccount = await context.rpc.getAccount(
91
+ toPublicKey(publicKey, false),
92
+ options
93
+ );
94
+ assertAccountExists(maybeAccount, 'LzReceiveTypesAccounts');
95
+ return deserializeLzReceiveTypesAccounts(maybeAccount);
96
+ }
97
+
98
+ export async function safeFetchLzReceiveTypesAccounts(
99
+ context: Pick<Context, 'rpc'>,
100
+ publicKey: PublicKey | Pda,
101
+ options?: RpcGetAccountOptions
102
+ ): Promise<LzReceiveTypesAccounts | null> {
103
+ const maybeAccount = await context.rpc.getAccount(
104
+ toPublicKey(publicKey, false),
105
+ options
106
+ );
107
+ return maybeAccount.exists
108
+ ? deserializeLzReceiveTypesAccounts(maybeAccount)
109
+ : null;
110
+ }
111
+
112
+ export async function fetchAllLzReceiveTypesAccounts(
113
+ context: Pick<Context, 'rpc'>,
114
+ publicKeys: Array<PublicKey | Pda>,
115
+ options?: RpcGetAccountsOptions
116
+ ): Promise<LzReceiveTypesAccounts[]> {
117
+ const maybeAccounts = await context.rpc.getAccounts(
118
+ publicKeys.map((key) => toPublicKey(key, false)),
119
+ options
120
+ );
121
+ return maybeAccounts.map((maybeAccount) => {
122
+ assertAccountExists(maybeAccount, 'LzReceiveTypesAccounts');
123
+ return deserializeLzReceiveTypesAccounts(maybeAccount);
124
+ });
125
+ }
126
+
127
+ export async function safeFetchAllLzReceiveTypesAccounts(
128
+ context: Pick<Context, 'rpc'>,
129
+ publicKeys: Array<PublicKey | Pda>,
130
+ options?: RpcGetAccountsOptions
131
+ ): Promise<LzReceiveTypesAccounts[]> {
132
+ const maybeAccounts = await context.rpc.getAccounts(
133
+ publicKeys.map((key) => toPublicKey(key, false)),
134
+ options
135
+ );
136
+ return maybeAccounts
137
+ .filter((maybeAccount) => maybeAccount.exists)
138
+ .map((maybeAccount) =>
139
+ deserializeLzReceiveTypesAccounts(maybeAccount as RpcAccount)
140
+ );
141
+ }
142
+
143
+ export function getLzReceiveTypesAccountsGpaBuilder(
144
+ context: Pick<Context, 'rpc' | 'programs'>
145
+ ) {
146
+ const programId = context.programs.getPublicKey('oft', defaultPublicKey(), 'custom')
147
+ return gpaBuilder(context, programId)
148
+ .registerFields<{
149
+ discriminator: Uint8Array;
150
+ oftStore: PublicKey;
151
+ tokenMint: PublicKey;
152
+ }>({
153
+ discriminator: [0, bytes({ size: 8 })],
154
+ oftStore: [8, publicKeySerializer()],
155
+ tokenMint: [40, publicKeySerializer()],
156
+ })
157
+ .deserializeUsing<LzReceiveTypesAccounts>((account) =>
158
+ deserializeLzReceiveTypesAccounts(account)
159
+ )
160
+ .whereField(
161
+ 'discriminator',
162
+ new Uint8Array([248, 87, 167, 117, 5, 251, 21, 126])
163
+ );
164
+ }
165
+
166
+ export function getLzReceiveTypesAccountsSize(): number {
167
+ return 72;
168
+ }
@@ -0,0 +1,199 @@
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
+ defaultPublicKey,
21
+ deserializeAccount,
22
+ gpaBuilder,
23
+ publicKey as toPublicKey,
24
+ } from '@metaplex-foundation/umi';
25
+ import {
26
+ Serializer,
27
+ bool,
28
+ bytes,
29
+ mapSerializer,
30
+ option,
31
+ publicKey as publicKeySerializer,
32
+ struct,
33
+ u16,
34
+ u64,
35
+ u8,
36
+ } from '@metaplex-foundation/umi/serializers';
37
+ import { OFTType, OFTTypeArgs, getOFTTypeSerializer } from '../types';
38
+
39
+ export type OFTStore = Account<OFTStoreAccountData>;
40
+
41
+ export type OFTStoreAccountData = {
42
+ discriminator: Uint8Array;
43
+ oftType: OFTType;
44
+ ld2sdRate: bigint;
45
+ tokenMint: PublicKey;
46
+ tokenEscrow: PublicKey;
47
+ endpointProgram: PublicKey;
48
+ bump: number;
49
+ tvlLd: bigint;
50
+ admin: PublicKey;
51
+ defaultFeeBps: number;
52
+ paused: boolean;
53
+ pauser: Option<PublicKey>;
54
+ unpauser: Option<PublicKey>;
55
+ };
56
+
57
+ export type OFTStoreAccountDataArgs = {
58
+ oftType: OFTTypeArgs;
59
+ ld2sdRate: number | bigint;
60
+ tokenMint: PublicKey;
61
+ tokenEscrow: PublicKey;
62
+ endpointProgram: PublicKey;
63
+ bump: number;
64
+ tvlLd: number | bigint;
65
+ admin: PublicKey;
66
+ defaultFeeBps: number;
67
+ paused: boolean;
68
+ pauser: OptionOrNullable<PublicKey>;
69
+ unpauser: OptionOrNullable<PublicKey>;
70
+ };
71
+
72
+ export function getOFTStoreAccountDataSerializer(): Serializer<
73
+ OFTStoreAccountDataArgs,
74
+ OFTStoreAccountData
75
+ > {
76
+ return mapSerializer<OFTStoreAccountDataArgs, any, OFTStoreAccountData>(
77
+ struct<OFTStoreAccountData>(
78
+ [
79
+ ['discriminator', bytes({ size: 8 })],
80
+ ['oftType', getOFTTypeSerializer()],
81
+ ['ld2sdRate', u64()],
82
+ ['tokenMint', publicKeySerializer()],
83
+ ['tokenEscrow', publicKeySerializer()],
84
+ ['endpointProgram', publicKeySerializer()],
85
+ ['bump', u8()],
86
+ ['tvlLd', u64()],
87
+ ['admin', publicKeySerializer()],
88
+ ['defaultFeeBps', u16()],
89
+ ['paused', bool()],
90
+ ['pauser', option(publicKeySerializer())],
91
+ ['unpauser', option(publicKeySerializer())],
92
+ ],
93
+ { description: 'OFTStoreAccountData' }
94
+ ),
95
+ (value) => ({
96
+ ...value,
97
+ discriminator: new Uint8Array([195, 215, 104, 134, 185, 195, 240, 114]),
98
+ })
99
+ ) as Serializer<OFTStoreAccountDataArgs, OFTStoreAccountData>;
100
+ }
101
+
102
+ export function deserializeOFTStore(rawAccount: RpcAccount): OFTStore {
103
+ return deserializeAccount(rawAccount, getOFTStoreAccountDataSerializer());
104
+ }
105
+
106
+ export async function fetchOFTStore(
107
+ context: Pick<Context, 'rpc'>,
108
+ publicKey: PublicKey | Pda,
109
+ options?: RpcGetAccountOptions
110
+ ): Promise<OFTStore> {
111
+ const maybeAccount = await context.rpc.getAccount(
112
+ toPublicKey(publicKey, false),
113
+ options
114
+ );
115
+ assertAccountExists(maybeAccount, 'OFTStore');
116
+ return deserializeOFTStore(maybeAccount);
117
+ }
118
+
119
+ export async function safeFetchOFTStore(
120
+ context: Pick<Context, 'rpc'>,
121
+ publicKey: PublicKey | Pda,
122
+ options?: RpcGetAccountOptions
123
+ ): Promise<OFTStore | null> {
124
+ const maybeAccount = await context.rpc.getAccount(
125
+ toPublicKey(publicKey, false),
126
+ options
127
+ );
128
+ return maybeAccount.exists ? deserializeOFTStore(maybeAccount) : null;
129
+ }
130
+
131
+ export async function fetchAllOFTStore(
132
+ context: Pick<Context, 'rpc'>,
133
+ publicKeys: Array<PublicKey | Pda>,
134
+ options?: RpcGetAccountsOptions
135
+ ): Promise<OFTStore[]> {
136
+ const maybeAccounts = await context.rpc.getAccounts(
137
+ publicKeys.map((key) => toPublicKey(key, false)),
138
+ options
139
+ );
140
+ return maybeAccounts.map((maybeAccount) => {
141
+ assertAccountExists(maybeAccount, 'OFTStore');
142
+ return deserializeOFTStore(maybeAccount);
143
+ });
144
+ }
145
+
146
+ export async function safeFetchAllOFTStore(
147
+ context: Pick<Context, 'rpc'>,
148
+ publicKeys: Array<PublicKey | Pda>,
149
+ options?: RpcGetAccountsOptions
150
+ ): Promise<OFTStore[]> {
151
+ const maybeAccounts = await context.rpc.getAccounts(
152
+ publicKeys.map((key) => toPublicKey(key, false)),
153
+ options
154
+ );
155
+ return maybeAccounts
156
+ .filter((maybeAccount) => maybeAccount.exists)
157
+ .map((maybeAccount) => deserializeOFTStore(maybeAccount as RpcAccount));
158
+ }
159
+
160
+ export function getOFTStoreGpaBuilder(
161
+ context: Pick<Context, 'rpc' | 'programs'>
162
+ ) {
163
+ const programId = context.programs.getPublicKey('oft', defaultPublicKey(), 'custom')
164
+ return gpaBuilder(context, programId)
165
+ .registerFields<{
166
+ discriminator: Uint8Array;
167
+ oftType: OFTTypeArgs;
168
+ ld2sdRate: number | bigint;
169
+ tokenMint: PublicKey;
170
+ tokenEscrow: PublicKey;
171
+ endpointProgram: PublicKey;
172
+ bump: number;
173
+ tvlLd: number | bigint;
174
+ admin: PublicKey;
175
+ defaultFeeBps: number;
176
+ paused: boolean;
177
+ pauser: OptionOrNullable<PublicKey>;
178
+ unpauser: OptionOrNullable<PublicKey>;
179
+ }>({
180
+ discriminator: [0, bytes({ size: 8 })],
181
+ oftType: [8, getOFTTypeSerializer()],
182
+ ld2sdRate: [9, u64()],
183
+ tokenMint: [17, publicKeySerializer()],
184
+ tokenEscrow: [49, publicKeySerializer()],
185
+ endpointProgram: [81, publicKeySerializer()],
186
+ bump: [113, u8()],
187
+ tvlLd: [114, u64()],
188
+ admin: [122, publicKeySerializer()],
189
+ defaultFeeBps: [154, u16()],
190
+ paused: [156, bool()],
191
+ pauser: [157, option(publicKeySerializer())],
192
+ unpauser: [null, option(publicKeySerializer())],
193
+ })
194
+ .deserializeUsing<OFTStore>((account) => deserializeOFTStore(account))
195
+ .whereField(
196
+ 'discriminator',
197
+ new Uint8Array([195, 215, 104, 134, 185, 195, 240, 114])
198
+ );
199
+ }
@@ -0,0 +1,173 @@
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
+ defaultPublicKey,
21
+ deserializeAccount,
22
+ gpaBuilder,
23
+ publicKey as toPublicKey,
24
+ } from '@metaplex-foundation/umi';
25
+ import {
26
+ Serializer,
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
+ };
54
+
55
+ export type PeerConfigAccountDataArgs = {
56
+ peerAddress: Uint8Array;
57
+ enforcedOptions: EnforcedOptionsArgs;
58
+ outboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
59
+ inboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
60
+ feeBps: OptionOrNullable<number>;
61
+ bump: number;
62
+ };
63
+
64
+ export function getPeerConfigAccountDataSerializer(): Serializer<
65
+ PeerConfigAccountDataArgs,
66
+ PeerConfigAccountData
67
+ > {
68
+ return mapSerializer<PeerConfigAccountDataArgs, any, PeerConfigAccountData>(
69
+ struct<PeerConfigAccountData>(
70
+ [
71
+ ['discriminator', bytes({ size: 8 })],
72
+ ['peerAddress', bytes({ size: 32 })],
73
+ ['enforcedOptions', getEnforcedOptionsSerializer()],
74
+ ['outboundRateLimiter', option(getRateLimiterSerializer())],
75
+ ['inboundRateLimiter', option(getRateLimiterSerializer())],
76
+ ['feeBps', option(u16())],
77
+ ['bump', u8()],
78
+ ],
79
+ { description: 'PeerConfigAccountData' }
80
+ ),
81
+ (value) => ({
82
+ ...value,
83
+ discriminator: new Uint8Array([181, 157, 86, 198, 33, 193, 94, 203]),
84
+ })
85
+ ) as Serializer<PeerConfigAccountDataArgs, PeerConfigAccountData>;
86
+ }
87
+
88
+ export function deserializePeerConfig(rawAccount: RpcAccount): PeerConfig {
89
+ return deserializeAccount(rawAccount, getPeerConfigAccountDataSerializer());
90
+ }
91
+
92
+ export async function fetchPeerConfig(
93
+ context: Pick<Context, 'rpc'>,
94
+ publicKey: PublicKey | Pda,
95
+ options?: RpcGetAccountOptions
96
+ ): Promise<PeerConfig> {
97
+ const maybeAccount = await context.rpc.getAccount(
98
+ toPublicKey(publicKey, false),
99
+ options
100
+ );
101
+ assertAccountExists(maybeAccount, 'PeerConfig');
102
+ return deserializePeerConfig(maybeAccount);
103
+ }
104
+
105
+ export async function safeFetchPeerConfig(
106
+ context: Pick<Context, 'rpc'>,
107
+ publicKey: PublicKey | Pda,
108
+ options?: RpcGetAccountOptions
109
+ ): Promise<PeerConfig | null> {
110
+ const maybeAccount = await context.rpc.getAccount(
111
+ toPublicKey(publicKey, false),
112
+ options
113
+ );
114
+ return maybeAccount.exists ? deserializePeerConfig(maybeAccount) : null;
115
+ }
116
+
117
+ export async function fetchAllPeerConfig(
118
+ context: Pick<Context, 'rpc'>,
119
+ publicKeys: Array<PublicKey | Pda>,
120
+ options?: RpcGetAccountsOptions
121
+ ): Promise<PeerConfig[]> {
122
+ const maybeAccounts = await context.rpc.getAccounts(
123
+ publicKeys.map((key) => toPublicKey(key, false)),
124
+ options
125
+ );
126
+ return maybeAccounts.map((maybeAccount) => {
127
+ assertAccountExists(maybeAccount, 'PeerConfig');
128
+ return deserializePeerConfig(maybeAccount);
129
+ });
130
+ }
131
+
132
+ export async function safeFetchAllPeerConfig(
133
+ context: Pick<Context, 'rpc'>,
134
+ publicKeys: Array<PublicKey | Pda>,
135
+ options?: RpcGetAccountsOptions
136
+ ): Promise<PeerConfig[]> {
137
+ const maybeAccounts = await context.rpc.getAccounts(
138
+ publicKeys.map((key) => toPublicKey(key, false)),
139
+ options
140
+ );
141
+ return maybeAccounts
142
+ .filter((maybeAccount) => maybeAccount.exists)
143
+ .map((maybeAccount) => deserializePeerConfig(maybeAccount as RpcAccount));
144
+ }
145
+
146
+ export function getPeerConfigGpaBuilder(
147
+ context: Pick<Context, 'rpc' | 'programs'>
148
+ ) {
149
+ const programId = context.programs.getPublicKey('oft', defaultPublicKey(), 'custom')
150
+ return gpaBuilder(context, programId)
151
+ .registerFields<{
152
+ discriminator: Uint8Array;
153
+ peerAddress: Uint8Array;
154
+ enforcedOptions: EnforcedOptionsArgs;
155
+ outboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
156
+ inboundRateLimiter: OptionOrNullable<RateLimiterArgs>;
157
+ feeBps: OptionOrNullable<number>;
158
+ bump: number;
159
+ }>({
160
+ discriminator: [0, bytes({ size: 8 })],
161
+ peerAddress: [8, bytes({ size: 32 })],
162
+ enforcedOptions: [40, getEnforcedOptionsSerializer()],
163
+ outboundRateLimiter: [null, option(getRateLimiterSerializer())],
164
+ inboundRateLimiter: [null, option(getRateLimiterSerializer())],
165
+ feeBps: [null, option(u16())],
166
+ bump: [null, u8()],
167
+ })
168
+ .deserializeUsing<PeerConfig>((account) => deserializePeerConfig(account))
169
+ .whereField(
170
+ 'discriminator',
171
+ new Uint8Array([181, 157, 86, 198, 33, 193, 94, 203])
172
+ );
173
+ }
@@ -0,0 +1,9 @@
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 './oft';