@shunt-network/sdk 1.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.
- package/dist/clients/typescript/src/__tests__/instruction-parsers.test.d.ts +1 -0
- package/dist/clients/typescript/src/__tests__/voucher-numeric-safety.test.d.ts +1 -0
- package/dist/clients/typescript/src/__tests__/voucher-types.test-d.d.ts +1 -0
- package/dist/clients/typescript/src/generated/accounts/channel.d.ts +59 -0
- package/dist/clients/typescript/src/generated/accounts/index.d.ts +8 -0
- package/dist/clients/typescript/src/generated/errors/index.d.ts +8 -0
- package/dist/clients/typescript/src/generated/errors/paymentChannels.d.ts +84 -0
- package/dist/clients/typescript/src/generated/index.d.ts +13 -0
- package/dist/clients/typescript/src/generated/instructions/distribute.d.ts +90 -0
- package/dist/clients/typescript/src/generated/instructions/emitEvent.d.ts +42 -0
- package/dist/clients/typescript/src/generated/instructions/index.d.ts +17 -0
- package/dist/clients/typescript/src/generated/instructions/open.d.ts +100 -0
- package/dist/clients/typescript/src/generated/instructions/reclaim.d.ts +39 -0
- package/dist/clients/typescript/src/generated/instructions/requestClose.d.ts +39 -0
- package/dist/clients/typescript/src/generated/instructions/seal.d.ts +36 -0
- package/dist/clients/typescript/src/generated/instructions/settle.d.ts +39 -0
- package/dist/clients/typescript/src/generated/instructions/settleAndSeal.d.ts +47 -0
- package/dist/clients/typescript/src/generated/instructions/topUp.d.ts +56 -0
- package/dist/clients/typescript/src/generated/instructions/withdrawPayer.d.ts +51 -0
- package/dist/clients/typescript/src/generated/pdas/eventAuthority.d.ts +11 -0
- package/dist/clients/typescript/src/generated/pdas/index.d.ts +8 -0
- package/dist/clients/typescript/src/generated/programs/index.d.ts +8 -0
- package/dist/clients/typescript/src/generated/programs/paymentChannels.d.ts +80 -0
- package/dist/clients/typescript/src/generated/types/accountDiscriminator.d.ts +16 -0
- package/dist/clients/typescript/src/generated/types/channelStatus.d.ts +18 -0
- package/dist/clients/typescript/src/generated/types/distributeArgs.d.ts +18 -0
- package/dist/clients/typescript/src/generated/types/distributionEntry.d.ts +16 -0
- package/dist/clients/typescript/src/generated/types/index.d.ts +20 -0
- package/dist/clients/typescript/src/generated/types/openArgs.d.ts +26 -0
- package/dist/clients/typescript/src/generated/types/opened.d.ts +19 -0
- package/dist/clients/typescript/src/generated/types/payoutBeneficiary.d.ts +17 -0
- package/dist/clients/typescript/src/generated/types/payoutRedirected.d.ts +26 -0
- package/dist/clients/typescript/src/generated/types/redirectReason.d.ts +18 -0
- package/dist/clients/typescript/src/generated/types/settleAndSealArgs.d.ts +15 -0
- package/dist/clients/typescript/src/generated/types/settlementWatermarks.d.ts +19 -0
- package/dist/clients/typescript/src/generated/types/topUpArgs.d.ts +17 -0
- package/dist/clients/typescript/src/generated/types/voucherArgs.d.ts +23 -0
- package/dist/clients/typescript/src/index.d.ts +1 -0
- package/dist/clients/typescript/src/safe-codecs.d.ts +6 -0
- package/dist/clients/typescript/tsup.config.d.ts +2 -0
- package/dist/index.cjs +1399 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1549 -0
- package/dist/sdk/channel.d.ts +10 -0
- package/dist/sdk/client.d.ts +31 -0
- package/dist/sdk/utils.d.ts +3 -0
- package/dist/sdk/voucher.d.ts +14 -0
- package/package.json +36 -0
- package/src/clients/typescript/package.json +32 -0
- package/src/clients/typescript/src/__tests__/instruction-parsers.test.ts +81 -0
- package/src/clients/typescript/src/__tests__/voucher-numeric-safety.test.ts +176 -0
- package/src/clients/typescript/src/__tests__/voucher-types.test-d.ts +8 -0
- package/src/clients/typescript/src/generated/accounts/channel.ts +192 -0
- package/src/clients/typescript/src/generated/accounts/index.ts +9 -0
- package/src/clients/typescript/src/generated/errors/index.ts +9 -0
- package/src/clients/typescript/src/generated/errors/paymentChannels.ts +251 -0
- package/src/clients/typescript/src/generated/index.ts +14 -0
- package/src/clients/typescript/src/generated/instructions/distribute.ts +517 -0
- package/src/clients/typescript/src/generated/instructions/emitEvent.ts +194 -0
- package/src/clients/typescript/src/generated/instructions/index.ts +18 -0
- package/src/clients/typescript/src/generated/instructions/open.ts +577 -0
- package/src/clients/typescript/src/generated/instructions/reclaim.ts +165 -0
- package/src/clients/typescript/src/generated/instructions/requestClose.ts +173 -0
- package/src/clients/typescript/src/generated/instructions/seal.ts +151 -0
- package/src/clients/typescript/src/generated/instructions/settle.ts +180 -0
- package/src/clients/typescript/src/generated/instructions/settleAndSeal.ts +224 -0
- package/src/clients/typescript/src/generated/instructions/topUp.ts +267 -0
- package/src/clients/typescript/src/generated/instructions/withdrawPayer.ts +246 -0
- package/src/clients/typescript/src/generated/pdas/eventAuthority.ts +26 -0
- package/src/clients/typescript/src/generated/pdas/index.ts +9 -0
- package/src/clients/typescript/src/generated/programs/index.ts +9 -0
- package/src/clients/typescript/src/generated/programs/paymentChannels.ts +366 -0
- package/src/clients/typescript/src/generated/types/accountDiscriminator.ts +41 -0
- package/src/clients/typescript/src/generated/types/channelStatus.ts +40 -0
- package/src/clients/typescript/src/generated/types/distributeArgs.ts +47 -0
- package/src/clients/typescript/src/generated/types/distributionEntry.ts +48 -0
- package/src/clients/typescript/src/generated/types/index.ts +21 -0
- package/src/clients/typescript/src/generated/types/openArgs.ts +70 -0
- package/src/clients/typescript/src/generated/types/opened.ts +42 -0
- package/src/clients/typescript/src/generated/types/payoutBeneficiary.ts +42 -0
- package/src/clients/typescript/src/generated/types/payoutRedirected.ts +76 -0
- package/src/clients/typescript/src/generated/types/redirectReason.ts +40 -0
- package/src/clients/typescript/src/generated/types/settleAndSealArgs.ts +39 -0
- package/src/clients/typescript/src/generated/types/settlementWatermarks.ts +48 -0
- package/src/clients/typescript/src/generated/types/topUpArgs.ts +33 -0
- package/src/clients/typescript/src/generated/types/voucherArgs.ts +68 -0
- package/src/clients/typescript/src/index.ts +1 -0
- package/src/clients/typescript/src/safe-codecs.ts +82 -0
- package/src/clients/typescript/tsconfig.json +11 -0
- package/src/clients/typescript/tsup.config.ts +9 -0
- package/src/index.ts +4 -0
- package/src/sdk/channel.ts +128 -0
- package/src/sdk/client.ts +22 -0
- package/src/sdk/utils.ts +29 -0
- package/src/sdk/voucher.ts +50 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,517 @@
|
|
|
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
|
+
|
|
9
|
+
import {
|
|
10
|
+
AccountRole,
|
|
11
|
+
combineCodec,
|
|
12
|
+
getStructDecoder,
|
|
13
|
+
getStructEncoder,
|
|
14
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
15
|
+
SolanaError,
|
|
16
|
+
transformEncoder,
|
|
17
|
+
type AccountMeta,
|
|
18
|
+
type Address,
|
|
19
|
+
type Codec,
|
|
20
|
+
type Decoder,
|
|
21
|
+
type Encoder,
|
|
22
|
+
type Instruction,
|
|
23
|
+
type InstructionWithAccounts,
|
|
24
|
+
type InstructionWithData,
|
|
25
|
+
type ReadonlyAccount,
|
|
26
|
+
type ReadonlyUint8Array,
|
|
27
|
+
type WritableAccount,
|
|
28
|
+
} from "@solana/kit";
|
|
29
|
+
import {
|
|
30
|
+
getAccountMetaFactory,
|
|
31
|
+
type ResolvedInstructionAccount,
|
|
32
|
+
} from "@solana/program-client-core";
|
|
33
|
+
import { getU8Decoder, getU8Encoder } from "../../safe-codecs.js";
|
|
34
|
+
import { findEventAuthorityPda } from "../pdas";
|
|
35
|
+
import { PAYMENT_CHANNELS_PROGRAM_ADDRESS } from "../programs";
|
|
36
|
+
import {
|
|
37
|
+
getDistributeArgsDecoder,
|
|
38
|
+
getDistributeArgsEncoder,
|
|
39
|
+
type DistributeArgs,
|
|
40
|
+
type DistributeArgsArgs,
|
|
41
|
+
} from "../types";
|
|
42
|
+
|
|
43
|
+
export const DISTRIBUTE_DISCRIMINATOR = 7;
|
|
44
|
+
|
|
45
|
+
export function getDistributeDiscriminatorBytes(): ReadonlyUint8Array {
|
|
46
|
+
return getU8Encoder().encode(DISTRIBUTE_DISCRIMINATOR);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type DistributeInstruction<
|
|
50
|
+
TProgram extends string = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
51
|
+
TAccountChannel extends string | AccountMeta<string> = string,
|
|
52
|
+
TAccountPayer extends string | AccountMeta<string> = string,
|
|
53
|
+
TAccountRentPayer extends string | AccountMeta<string> = string,
|
|
54
|
+
TAccountChannelTokenAccount extends string | AccountMeta<string> = string,
|
|
55
|
+
TAccountPayerTokenAccount extends string | AccountMeta<string> = string,
|
|
56
|
+
TAccountPayeeTokenAccount extends string | AccountMeta<string> = string,
|
|
57
|
+
TAccountTreasuryTokenAccount extends string | AccountMeta<string> = string,
|
|
58
|
+
TAccountMint extends string | AccountMeta<string> = string,
|
|
59
|
+
TAccountTokenProgram extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountEventAuthority extends string | AccountMeta<string> = string,
|
|
61
|
+
TAccountSelfProgram extends string | AccountMeta<string> =
|
|
62
|
+
"CHNLxYvVA28MJP9PrFuDXccuoGXAx7jBacfLEkahyGsX",
|
|
63
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
64
|
+
> = Instruction<TProgram> &
|
|
65
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
66
|
+
InstructionWithAccounts<
|
|
67
|
+
[
|
|
68
|
+
TAccountChannel extends string
|
|
69
|
+
? WritableAccount<TAccountChannel>
|
|
70
|
+
: TAccountChannel,
|
|
71
|
+
TAccountPayer extends string
|
|
72
|
+
? WritableAccount<TAccountPayer>
|
|
73
|
+
: TAccountPayer,
|
|
74
|
+
TAccountRentPayer extends string
|
|
75
|
+
? WritableAccount<TAccountRentPayer>
|
|
76
|
+
: TAccountRentPayer,
|
|
77
|
+
TAccountChannelTokenAccount extends string
|
|
78
|
+
? WritableAccount<TAccountChannelTokenAccount>
|
|
79
|
+
: TAccountChannelTokenAccount,
|
|
80
|
+
TAccountPayerTokenAccount extends string
|
|
81
|
+
? WritableAccount<TAccountPayerTokenAccount>
|
|
82
|
+
: TAccountPayerTokenAccount,
|
|
83
|
+
TAccountPayeeTokenAccount extends string
|
|
84
|
+
? WritableAccount<TAccountPayeeTokenAccount>
|
|
85
|
+
: TAccountPayeeTokenAccount,
|
|
86
|
+
TAccountTreasuryTokenAccount extends string
|
|
87
|
+
? WritableAccount<TAccountTreasuryTokenAccount>
|
|
88
|
+
: TAccountTreasuryTokenAccount,
|
|
89
|
+
TAccountMint extends string
|
|
90
|
+
? ReadonlyAccount<TAccountMint>
|
|
91
|
+
: TAccountMint,
|
|
92
|
+
TAccountTokenProgram extends string
|
|
93
|
+
? ReadonlyAccount<TAccountTokenProgram>
|
|
94
|
+
: TAccountTokenProgram,
|
|
95
|
+
TAccountEventAuthority extends string
|
|
96
|
+
? ReadonlyAccount<TAccountEventAuthority>
|
|
97
|
+
: TAccountEventAuthority,
|
|
98
|
+
TAccountSelfProgram extends string
|
|
99
|
+
? ReadonlyAccount<TAccountSelfProgram>
|
|
100
|
+
: TAccountSelfProgram,
|
|
101
|
+
...TRemainingAccounts,
|
|
102
|
+
]
|
|
103
|
+
>;
|
|
104
|
+
|
|
105
|
+
export type DistributeInstructionData = {
|
|
106
|
+
discriminator: number;
|
|
107
|
+
distributeArgs: DistributeArgs;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type DistributeInstructionDataArgs = {
|
|
111
|
+
distributeArgs: DistributeArgsArgs;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export function getDistributeInstructionDataEncoder(): Encoder<DistributeInstructionDataArgs> {
|
|
115
|
+
return transformEncoder(
|
|
116
|
+
getStructEncoder([
|
|
117
|
+
["discriminator", getU8Encoder()],
|
|
118
|
+
["distributeArgs", getDistributeArgsEncoder()],
|
|
119
|
+
]),
|
|
120
|
+
(value) => ({ ...value, discriminator: DISTRIBUTE_DISCRIMINATOR }),
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function getDistributeInstructionDataDecoder(): Decoder<DistributeInstructionData> {
|
|
125
|
+
return getStructDecoder([
|
|
126
|
+
["discriminator", getU8Decoder()],
|
|
127
|
+
["distributeArgs", getDistributeArgsDecoder()],
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function getDistributeInstructionDataCodec(): Codec<
|
|
132
|
+
DistributeInstructionDataArgs,
|
|
133
|
+
DistributeInstructionData
|
|
134
|
+
> {
|
|
135
|
+
return combineCodec(
|
|
136
|
+
getDistributeInstructionDataEncoder(),
|
|
137
|
+
getDistributeInstructionDataDecoder(),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type DistributeAsyncInput<
|
|
142
|
+
TAccountChannel extends string = string,
|
|
143
|
+
TAccountPayer extends string = string,
|
|
144
|
+
TAccountRentPayer extends string = string,
|
|
145
|
+
TAccountChannelTokenAccount extends string = string,
|
|
146
|
+
TAccountPayerTokenAccount extends string = string,
|
|
147
|
+
TAccountPayeeTokenAccount extends string = string,
|
|
148
|
+
TAccountTreasuryTokenAccount extends string = string,
|
|
149
|
+
TAccountMint extends string = string,
|
|
150
|
+
TAccountTokenProgram extends string = string,
|
|
151
|
+
TAccountEventAuthority extends string = string,
|
|
152
|
+
TAccountSelfProgram extends string = string,
|
|
153
|
+
> = {
|
|
154
|
+
channel: Address<TAccountChannel>;
|
|
155
|
+
payer: Address<TAccountPayer>;
|
|
156
|
+
rentPayer: Address<TAccountRentPayer>;
|
|
157
|
+
channelTokenAccount: Address<TAccountChannelTokenAccount>;
|
|
158
|
+
payerTokenAccount: Address<TAccountPayerTokenAccount>;
|
|
159
|
+
payeeTokenAccount: Address<TAccountPayeeTokenAccount>;
|
|
160
|
+
treasuryTokenAccount: Address<TAccountTreasuryTokenAccount>;
|
|
161
|
+
mint: Address<TAccountMint>;
|
|
162
|
+
tokenProgram: Address<TAccountTokenProgram>;
|
|
163
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
164
|
+
selfProgram?: Address<TAccountSelfProgram>;
|
|
165
|
+
distributeArgs: DistributeInstructionDataArgs["distributeArgs"];
|
|
166
|
+
recipientTokenAccounts: Array<Address>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export async function getDistributeInstructionAsync<
|
|
170
|
+
TAccountChannel extends string,
|
|
171
|
+
TAccountPayer extends string,
|
|
172
|
+
TAccountRentPayer extends string,
|
|
173
|
+
TAccountChannelTokenAccount extends string,
|
|
174
|
+
TAccountPayerTokenAccount extends string,
|
|
175
|
+
TAccountPayeeTokenAccount extends string,
|
|
176
|
+
TAccountTreasuryTokenAccount extends string,
|
|
177
|
+
TAccountMint extends string,
|
|
178
|
+
TAccountTokenProgram extends string,
|
|
179
|
+
TAccountEventAuthority extends string,
|
|
180
|
+
TAccountSelfProgram extends string,
|
|
181
|
+
TProgramAddress extends Address = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
182
|
+
>(
|
|
183
|
+
input: DistributeAsyncInput<
|
|
184
|
+
TAccountChannel,
|
|
185
|
+
TAccountPayer,
|
|
186
|
+
TAccountRentPayer,
|
|
187
|
+
TAccountChannelTokenAccount,
|
|
188
|
+
TAccountPayerTokenAccount,
|
|
189
|
+
TAccountPayeeTokenAccount,
|
|
190
|
+
TAccountTreasuryTokenAccount,
|
|
191
|
+
TAccountMint,
|
|
192
|
+
TAccountTokenProgram,
|
|
193
|
+
TAccountEventAuthority,
|
|
194
|
+
TAccountSelfProgram
|
|
195
|
+
>,
|
|
196
|
+
config?: { programAddress?: TProgramAddress },
|
|
197
|
+
): Promise<
|
|
198
|
+
DistributeInstruction<
|
|
199
|
+
TProgramAddress,
|
|
200
|
+
TAccountChannel,
|
|
201
|
+
TAccountPayer,
|
|
202
|
+
TAccountRentPayer,
|
|
203
|
+
TAccountChannelTokenAccount,
|
|
204
|
+
TAccountPayerTokenAccount,
|
|
205
|
+
TAccountPayeeTokenAccount,
|
|
206
|
+
TAccountTreasuryTokenAccount,
|
|
207
|
+
TAccountMint,
|
|
208
|
+
TAccountTokenProgram,
|
|
209
|
+
TAccountEventAuthority,
|
|
210
|
+
TAccountSelfProgram
|
|
211
|
+
>
|
|
212
|
+
> {
|
|
213
|
+
// Program address.
|
|
214
|
+
const programAddress =
|
|
215
|
+
config?.programAddress ?? PAYMENT_CHANNELS_PROGRAM_ADDRESS;
|
|
216
|
+
|
|
217
|
+
// Original accounts.
|
|
218
|
+
const originalAccounts = {
|
|
219
|
+
channel: { value: input.channel ?? null, isWritable: true },
|
|
220
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
221
|
+
rentPayer: { value: input.rentPayer ?? null, isWritable: true },
|
|
222
|
+
channelTokenAccount: {
|
|
223
|
+
value: input.channelTokenAccount ?? null,
|
|
224
|
+
isWritable: true,
|
|
225
|
+
},
|
|
226
|
+
payerTokenAccount: {
|
|
227
|
+
value: input.payerTokenAccount ?? null,
|
|
228
|
+
isWritable: true,
|
|
229
|
+
},
|
|
230
|
+
payeeTokenAccount: {
|
|
231
|
+
value: input.payeeTokenAccount ?? null,
|
|
232
|
+
isWritable: true,
|
|
233
|
+
},
|
|
234
|
+
treasuryTokenAccount: {
|
|
235
|
+
value: input.treasuryTokenAccount ?? null,
|
|
236
|
+
isWritable: true,
|
|
237
|
+
},
|
|
238
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
239
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
240
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
241
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false },
|
|
242
|
+
};
|
|
243
|
+
const accounts = originalAccounts as Record<
|
|
244
|
+
keyof typeof originalAccounts,
|
|
245
|
+
ResolvedInstructionAccount
|
|
246
|
+
>;
|
|
247
|
+
|
|
248
|
+
// Original args.
|
|
249
|
+
const args = { ...input };
|
|
250
|
+
|
|
251
|
+
// Resolve default values.
|
|
252
|
+
if (!accounts.eventAuthority.value) {
|
|
253
|
+
accounts.eventAuthority.value = await findEventAuthorityPda();
|
|
254
|
+
}
|
|
255
|
+
if (!accounts.selfProgram.value) {
|
|
256
|
+
accounts.selfProgram.value =
|
|
257
|
+
"CHNLxYvVA28MJP9PrFuDXccuoGXAx7jBacfLEkahyGsX" as Address<"CHNLxYvVA28MJP9PrFuDXccuoGXAx7jBacfLEkahyGsX">;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Remaining accounts.
|
|
261
|
+
const remainingAccounts: AccountMeta[] = args.recipientTokenAccounts.map(
|
|
262
|
+
(address) => ({ address, role: AccountRole.WRITABLE }),
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
266
|
+
return Object.freeze({
|
|
267
|
+
accounts: [
|
|
268
|
+
getAccountMeta("channel", accounts.channel),
|
|
269
|
+
getAccountMeta("payer", accounts.payer),
|
|
270
|
+
getAccountMeta("rentPayer", accounts.rentPayer),
|
|
271
|
+
getAccountMeta("channelTokenAccount", accounts.channelTokenAccount),
|
|
272
|
+
getAccountMeta("payerTokenAccount", accounts.payerTokenAccount),
|
|
273
|
+
getAccountMeta("payeeTokenAccount", accounts.payeeTokenAccount),
|
|
274
|
+
getAccountMeta("treasuryTokenAccount", accounts.treasuryTokenAccount),
|
|
275
|
+
getAccountMeta("mint", accounts.mint),
|
|
276
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
277
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
278
|
+
getAccountMeta("selfProgram", accounts.selfProgram),
|
|
279
|
+
...remainingAccounts,
|
|
280
|
+
],
|
|
281
|
+
data: getDistributeInstructionDataEncoder().encode(
|
|
282
|
+
args as DistributeInstructionDataArgs,
|
|
283
|
+
),
|
|
284
|
+
programAddress,
|
|
285
|
+
} as DistributeInstruction<
|
|
286
|
+
TProgramAddress,
|
|
287
|
+
TAccountChannel,
|
|
288
|
+
TAccountPayer,
|
|
289
|
+
TAccountRentPayer,
|
|
290
|
+
TAccountChannelTokenAccount,
|
|
291
|
+
TAccountPayerTokenAccount,
|
|
292
|
+
TAccountPayeeTokenAccount,
|
|
293
|
+
TAccountTreasuryTokenAccount,
|
|
294
|
+
TAccountMint,
|
|
295
|
+
TAccountTokenProgram,
|
|
296
|
+
TAccountEventAuthority,
|
|
297
|
+
TAccountSelfProgram
|
|
298
|
+
>);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export type DistributeInput<
|
|
302
|
+
TAccountChannel extends string = string,
|
|
303
|
+
TAccountPayer extends string = string,
|
|
304
|
+
TAccountRentPayer extends string = string,
|
|
305
|
+
TAccountChannelTokenAccount extends string = string,
|
|
306
|
+
TAccountPayerTokenAccount extends string = string,
|
|
307
|
+
TAccountPayeeTokenAccount extends string = string,
|
|
308
|
+
TAccountTreasuryTokenAccount extends string = string,
|
|
309
|
+
TAccountMint extends string = string,
|
|
310
|
+
TAccountTokenProgram extends string = string,
|
|
311
|
+
TAccountEventAuthority extends string = string,
|
|
312
|
+
TAccountSelfProgram extends string = string,
|
|
313
|
+
> = {
|
|
314
|
+
channel: Address<TAccountChannel>;
|
|
315
|
+
payer: Address<TAccountPayer>;
|
|
316
|
+
rentPayer: Address<TAccountRentPayer>;
|
|
317
|
+
channelTokenAccount: Address<TAccountChannelTokenAccount>;
|
|
318
|
+
payerTokenAccount: Address<TAccountPayerTokenAccount>;
|
|
319
|
+
payeeTokenAccount: Address<TAccountPayeeTokenAccount>;
|
|
320
|
+
treasuryTokenAccount: Address<TAccountTreasuryTokenAccount>;
|
|
321
|
+
mint: Address<TAccountMint>;
|
|
322
|
+
tokenProgram: Address<TAccountTokenProgram>;
|
|
323
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
324
|
+
selfProgram?: Address<TAccountSelfProgram>;
|
|
325
|
+
distributeArgs: DistributeInstructionDataArgs["distributeArgs"];
|
|
326
|
+
recipientTokenAccounts: Array<Address>;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export function getDistributeInstruction<
|
|
330
|
+
TAccountChannel extends string,
|
|
331
|
+
TAccountPayer extends string,
|
|
332
|
+
TAccountRentPayer extends string,
|
|
333
|
+
TAccountChannelTokenAccount extends string,
|
|
334
|
+
TAccountPayerTokenAccount extends string,
|
|
335
|
+
TAccountPayeeTokenAccount extends string,
|
|
336
|
+
TAccountTreasuryTokenAccount extends string,
|
|
337
|
+
TAccountMint extends string,
|
|
338
|
+
TAccountTokenProgram extends string,
|
|
339
|
+
TAccountEventAuthority extends string,
|
|
340
|
+
TAccountSelfProgram extends string,
|
|
341
|
+
TProgramAddress extends Address = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
342
|
+
>(
|
|
343
|
+
input: DistributeInput<
|
|
344
|
+
TAccountChannel,
|
|
345
|
+
TAccountPayer,
|
|
346
|
+
TAccountRentPayer,
|
|
347
|
+
TAccountChannelTokenAccount,
|
|
348
|
+
TAccountPayerTokenAccount,
|
|
349
|
+
TAccountPayeeTokenAccount,
|
|
350
|
+
TAccountTreasuryTokenAccount,
|
|
351
|
+
TAccountMint,
|
|
352
|
+
TAccountTokenProgram,
|
|
353
|
+
TAccountEventAuthority,
|
|
354
|
+
TAccountSelfProgram
|
|
355
|
+
>,
|
|
356
|
+
config?: { programAddress?: TProgramAddress },
|
|
357
|
+
): DistributeInstruction<
|
|
358
|
+
TProgramAddress,
|
|
359
|
+
TAccountChannel,
|
|
360
|
+
TAccountPayer,
|
|
361
|
+
TAccountRentPayer,
|
|
362
|
+
TAccountChannelTokenAccount,
|
|
363
|
+
TAccountPayerTokenAccount,
|
|
364
|
+
TAccountPayeeTokenAccount,
|
|
365
|
+
TAccountTreasuryTokenAccount,
|
|
366
|
+
TAccountMint,
|
|
367
|
+
TAccountTokenProgram,
|
|
368
|
+
TAccountEventAuthority,
|
|
369
|
+
TAccountSelfProgram
|
|
370
|
+
> {
|
|
371
|
+
// Program address.
|
|
372
|
+
const programAddress =
|
|
373
|
+
config?.programAddress ?? PAYMENT_CHANNELS_PROGRAM_ADDRESS;
|
|
374
|
+
|
|
375
|
+
// Original accounts.
|
|
376
|
+
const originalAccounts = {
|
|
377
|
+
channel: { value: input.channel ?? null, isWritable: true },
|
|
378
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
379
|
+
rentPayer: { value: input.rentPayer ?? null, isWritable: true },
|
|
380
|
+
channelTokenAccount: {
|
|
381
|
+
value: input.channelTokenAccount ?? null,
|
|
382
|
+
isWritable: true,
|
|
383
|
+
},
|
|
384
|
+
payerTokenAccount: {
|
|
385
|
+
value: input.payerTokenAccount ?? null,
|
|
386
|
+
isWritable: true,
|
|
387
|
+
},
|
|
388
|
+
payeeTokenAccount: {
|
|
389
|
+
value: input.payeeTokenAccount ?? null,
|
|
390
|
+
isWritable: true,
|
|
391
|
+
},
|
|
392
|
+
treasuryTokenAccount: {
|
|
393
|
+
value: input.treasuryTokenAccount ?? null,
|
|
394
|
+
isWritable: true,
|
|
395
|
+
},
|
|
396
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
397
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
398
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
399
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false },
|
|
400
|
+
};
|
|
401
|
+
const accounts = originalAccounts as Record<
|
|
402
|
+
keyof typeof originalAccounts,
|
|
403
|
+
ResolvedInstructionAccount
|
|
404
|
+
>;
|
|
405
|
+
|
|
406
|
+
// Original args.
|
|
407
|
+
const args = { ...input };
|
|
408
|
+
|
|
409
|
+
// Resolve default values.
|
|
410
|
+
if (!accounts.selfProgram.value) {
|
|
411
|
+
accounts.selfProgram.value =
|
|
412
|
+
"CHNLxYvVA28MJP9PrFuDXccuoGXAx7jBacfLEkahyGsX" as Address<"CHNLxYvVA28MJP9PrFuDXccuoGXAx7jBacfLEkahyGsX">;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// Remaining accounts.
|
|
416
|
+
const remainingAccounts: AccountMeta[] = args.recipientTokenAccounts.map(
|
|
417
|
+
(address) => ({ address, role: AccountRole.WRITABLE }),
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
421
|
+
return Object.freeze({
|
|
422
|
+
accounts: [
|
|
423
|
+
getAccountMeta("channel", accounts.channel),
|
|
424
|
+
getAccountMeta("payer", accounts.payer),
|
|
425
|
+
getAccountMeta("rentPayer", accounts.rentPayer),
|
|
426
|
+
getAccountMeta("channelTokenAccount", accounts.channelTokenAccount),
|
|
427
|
+
getAccountMeta("payerTokenAccount", accounts.payerTokenAccount),
|
|
428
|
+
getAccountMeta("payeeTokenAccount", accounts.payeeTokenAccount),
|
|
429
|
+
getAccountMeta("treasuryTokenAccount", accounts.treasuryTokenAccount),
|
|
430
|
+
getAccountMeta("mint", accounts.mint),
|
|
431
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
432
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
433
|
+
getAccountMeta("selfProgram", accounts.selfProgram),
|
|
434
|
+
...remainingAccounts,
|
|
435
|
+
],
|
|
436
|
+
data: getDistributeInstructionDataEncoder().encode(
|
|
437
|
+
args as DistributeInstructionDataArgs,
|
|
438
|
+
),
|
|
439
|
+
programAddress,
|
|
440
|
+
} as DistributeInstruction<
|
|
441
|
+
TProgramAddress,
|
|
442
|
+
TAccountChannel,
|
|
443
|
+
TAccountPayer,
|
|
444
|
+
TAccountRentPayer,
|
|
445
|
+
TAccountChannelTokenAccount,
|
|
446
|
+
TAccountPayerTokenAccount,
|
|
447
|
+
TAccountPayeeTokenAccount,
|
|
448
|
+
TAccountTreasuryTokenAccount,
|
|
449
|
+
TAccountMint,
|
|
450
|
+
TAccountTokenProgram,
|
|
451
|
+
TAccountEventAuthority,
|
|
452
|
+
TAccountSelfProgram
|
|
453
|
+
>);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export type ParsedDistributeInstruction<
|
|
457
|
+
TProgram extends string = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
458
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
459
|
+
> = {
|
|
460
|
+
programAddress: Address<TProgram>;
|
|
461
|
+
accounts: {
|
|
462
|
+
channel: TAccountMetas[0];
|
|
463
|
+
payer: TAccountMetas[1];
|
|
464
|
+
rentPayer: TAccountMetas[2];
|
|
465
|
+
channelTokenAccount: TAccountMetas[3];
|
|
466
|
+
payerTokenAccount: TAccountMetas[4];
|
|
467
|
+
payeeTokenAccount: TAccountMetas[5];
|
|
468
|
+
treasuryTokenAccount: TAccountMetas[6];
|
|
469
|
+
mint: TAccountMetas[7];
|
|
470
|
+
tokenProgram: TAccountMetas[8];
|
|
471
|
+
eventAuthority: TAccountMetas[9];
|
|
472
|
+
selfProgram: TAccountMetas[10];
|
|
473
|
+
};
|
|
474
|
+
data: DistributeInstructionData;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
export function parseDistributeInstruction<
|
|
478
|
+
TProgram extends string,
|
|
479
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
480
|
+
>(
|
|
481
|
+
instruction: Instruction<TProgram> &
|
|
482
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
483
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
484
|
+
): ParsedDistributeInstruction<TProgram, TAccountMetas> {
|
|
485
|
+
if (instruction.accounts.length < 11) {
|
|
486
|
+
throw new SolanaError(
|
|
487
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
488
|
+
{
|
|
489
|
+
actualAccountMetas: instruction.accounts.length,
|
|
490
|
+
expectedAccountMetas: 11,
|
|
491
|
+
},
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
let accountIndex = 0;
|
|
495
|
+
const getNextAccount = () => {
|
|
496
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
497
|
+
accountIndex += 1;
|
|
498
|
+
return accountMeta;
|
|
499
|
+
};
|
|
500
|
+
return {
|
|
501
|
+
programAddress: instruction.programAddress,
|
|
502
|
+
accounts: {
|
|
503
|
+
channel: getNextAccount(),
|
|
504
|
+
payer: getNextAccount(),
|
|
505
|
+
rentPayer: getNextAccount(),
|
|
506
|
+
channelTokenAccount: getNextAccount(),
|
|
507
|
+
payerTokenAccount: getNextAccount(),
|
|
508
|
+
payeeTokenAccount: getNextAccount(),
|
|
509
|
+
treasuryTokenAccount: getNextAccount(),
|
|
510
|
+
mint: getNextAccount(),
|
|
511
|
+
tokenProgram: getNextAccount(),
|
|
512
|
+
eventAuthority: getNextAccount(),
|
|
513
|
+
selfProgram: getNextAccount(),
|
|
514
|
+
},
|
|
515
|
+
data: getDistributeInstructionDataDecoder().decode(instruction.data),
|
|
516
|
+
};
|
|
517
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
|
|
9
|
+
import {
|
|
10
|
+
combineCodec,
|
|
11
|
+
getStructDecoder,
|
|
12
|
+
getStructEncoder,
|
|
13
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
14
|
+
SolanaError,
|
|
15
|
+
transformEncoder,
|
|
16
|
+
type AccountMeta,
|
|
17
|
+
type AccountSignerMeta,
|
|
18
|
+
type Address,
|
|
19
|
+
type FixedSizeCodec,
|
|
20
|
+
type FixedSizeDecoder,
|
|
21
|
+
type FixedSizeEncoder,
|
|
22
|
+
type Instruction,
|
|
23
|
+
type InstructionWithAccounts,
|
|
24
|
+
type InstructionWithData,
|
|
25
|
+
type ReadonlySignerAccount,
|
|
26
|
+
type ReadonlyUint8Array,
|
|
27
|
+
type TransactionSigner,
|
|
28
|
+
} from "@solana/kit";
|
|
29
|
+
import {
|
|
30
|
+
getAccountMetaFactory,
|
|
31
|
+
type ResolvedInstructionAccount,
|
|
32
|
+
} from "@solana/program-client-core";
|
|
33
|
+
import { getU8Decoder, getU8Encoder } from "../../safe-codecs.js";
|
|
34
|
+
import { findEventAuthorityPda } from "../pdas";
|
|
35
|
+
import { PAYMENT_CHANNELS_PROGRAM_ADDRESS } from "../programs";
|
|
36
|
+
|
|
37
|
+
export const EMIT_EVENT_DISCRIMINATOR = 228;
|
|
38
|
+
|
|
39
|
+
export function getEmitEventDiscriminatorBytes(): ReadonlyUint8Array {
|
|
40
|
+
return getU8Encoder().encode(EMIT_EVENT_DISCRIMINATOR);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type EmitEventInstruction<
|
|
44
|
+
TProgram extends string = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
45
|
+
TAccountEventAuthority extends string | AccountMeta<string> = string,
|
|
46
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
47
|
+
> = Instruction<TProgram> &
|
|
48
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
49
|
+
InstructionWithAccounts<
|
|
50
|
+
[
|
|
51
|
+
TAccountEventAuthority extends string
|
|
52
|
+
? ReadonlySignerAccount<TAccountEventAuthority> &
|
|
53
|
+
AccountSignerMeta<TAccountEventAuthority>
|
|
54
|
+
: TAccountEventAuthority,
|
|
55
|
+
...TRemainingAccounts,
|
|
56
|
+
]
|
|
57
|
+
>;
|
|
58
|
+
|
|
59
|
+
export type EmitEventInstructionData = { discriminator: number };
|
|
60
|
+
|
|
61
|
+
export type EmitEventInstructionDataArgs = {};
|
|
62
|
+
|
|
63
|
+
export function getEmitEventInstructionDataEncoder(): FixedSizeEncoder<EmitEventInstructionDataArgs> {
|
|
64
|
+
return transformEncoder(
|
|
65
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
66
|
+
(value) => ({ ...value, discriminator: EMIT_EVENT_DISCRIMINATOR }),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function getEmitEventInstructionDataDecoder(): FixedSizeDecoder<EmitEventInstructionData> {
|
|
71
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getEmitEventInstructionDataCodec(): FixedSizeCodec<
|
|
75
|
+
EmitEventInstructionDataArgs,
|
|
76
|
+
EmitEventInstructionData
|
|
77
|
+
> {
|
|
78
|
+
return combineCodec(
|
|
79
|
+
getEmitEventInstructionDataEncoder(),
|
|
80
|
+
getEmitEventInstructionDataDecoder(),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type EmitEventAsyncInput<
|
|
85
|
+
TAccountEventAuthority extends string = string,
|
|
86
|
+
> = {
|
|
87
|
+
eventAuthority?: TransactionSigner<TAccountEventAuthority>;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export async function getEmitEventInstructionAsync<
|
|
91
|
+
TAccountEventAuthority extends string,
|
|
92
|
+
TProgramAddress extends Address = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
93
|
+
>(
|
|
94
|
+
input: EmitEventAsyncInput<TAccountEventAuthority>,
|
|
95
|
+
config?: { programAddress?: TProgramAddress },
|
|
96
|
+
): Promise<EmitEventInstruction<TProgramAddress, TAccountEventAuthority>> {
|
|
97
|
+
// Program address.
|
|
98
|
+
const programAddress =
|
|
99
|
+
config?.programAddress ?? PAYMENT_CHANNELS_PROGRAM_ADDRESS;
|
|
100
|
+
|
|
101
|
+
// Original accounts.
|
|
102
|
+
const originalAccounts = {
|
|
103
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
104
|
+
};
|
|
105
|
+
const accounts = originalAccounts as Record<
|
|
106
|
+
keyof typeof originalAccounts,
|
|
107
|
+
ResolvedInstructionAccount
|
|
108
|
+
>;
|
|
109
|
+
|
|
110
|
+
// Resolve default values.
|
|
111
|
+
if (!accounts.eventAuthority.value) {
|
|
112
|
+
accounts.eventAuthority.value = await findEventAuthorityPda();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
116
|
+
return Object.freeze({
|
|
117
|
+
accounts: [getAccountMeta("eventAuthority", accounts.eventAuthority)],
|
|
118
|
+
data: getEmitEventInstructionDataEncoder().encode({}),
|
|
119
|
+
programAddress,
|
|
120
|
+
} as EmitEventInstruction<TProgramAddress, TAccountEventAuthority>);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type EmitEventInput<TAccountEventAuthority extends string = string> = {
|
|
124
|
+
eventAuthority: TransactionSigner<TAccountEventAuthority>;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export function getEmitEventInstruction<
|
|
128
|
+
TAccountEventAuthority extends string,
|
|
129
|
+
TProgramAddress extends Address = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
130
|
+
>(
|
|
131
|
+
input: EmitEventInput<TAccountEventAuthority>,
|
|
132
|
+
config?: { programAddress?: TProgramAddress },
|
|
133
|
+
): EmitEventInstruction<TProgramAddress, TAccountEventAuthority> {
|
|
134
|
+
// Program address.
|
|
135
|
+
const programAddress =
|
|
136
|
+
config?.programAddress ?? PAYMENT_CHANNELS_PROGRAM_ADDRESS;
|
|
137
|
+
|
|
138
|
+
// Original accounts.
|
|
139
|
+
const originalAccounts = {
|
|
140
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
141
|
+
};
|
|
142
|
+
const accounts = originalAccounts as Record<
|
|
143
|
+
keyof typeof originalAccounts,
|
|
144
|
+
ResolvedInstructionAccount
|
|
145
|
+
>;
|
|
146
|
+
|
|
147
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
148
|
+
return Object.freeze({
|
|
149
|
+
accounts: [getAccountMeta("eventAuthority", accounts.eventAuthority)],
|
|
150
|
+
data: getEmitEventInstructionDataEncoder().encode({}),
|
|
151
|
+
programAddress,
|
|
152
|
+
} as EmitEventInstruction<TProgramAddress, TAccountEventAuthority>);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type ParsedEmitEventInstruction<
|
|
156
|
+
TProgram extends string = typeof PAYMENT_CHANNELS_PROGRAM_ADDRESS,
|
|
157
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
158
|
+
> = {
|
|
159
|
+
programAddress: Address<TProgram>;
|
|
160
|
+
accounts: {
|
|
161
|
+
eventAuthority: TAccountMetas[0];
|
|
162
|
+
};
|
|
163
|
+
data: EmitEventInstructionData;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export function parseEmitEventInstruction<
|
|
167
|
+
TProgram extends string,
|
|
168
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
169
|
+
>(
|
|
170
|
+
instruction: Instruction<TProgram> &
|
|
171
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
172
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
173
|
+
): ParsedEmitEventInstruction<TProgram, TAccountMetas> {
|
|
174
|
+
if (instruction.accounts.length !== 1) {
|
|
175
|
+
throw new SolanaError(
|
|
176
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
177
|
+
{
|
|
178
|
+
actualAccountMetas: instruction.accounts.length,
|
|
179
|
+
expectedAccountMetas: 1,
|
|
180
|
+
},
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
let accountIndex = 0;
|
|
184
|
+
const getNextAccount = () => {
|
|
185
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
186
|
+
accountIndex += 1;
|
|
187
|
+
return accountMeta;
|
|
188
|
+
};
|
|
189
|
+
return {
|
|
190
|
+
programAddress: instruction.programAddress,
|
|
191
|
+
accounts: { eventAuthority: getNextAccount() },
|
|
192
|
+
data: getEmitEventInstructionDataDecoder().decode(instruction.data),
|
|
193
|
+
};
|
|
194
|
+
}
|