@bonfida/spl-name-service 0.2.4 → 0.2.5
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/bindings.d.ts +1 -0
- package/dist/deprecated/utils.d.ts +1 -0
- package/dist/favorite-domain.d.ts +40 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/instructions.d.ts +1 -0
- package/dist/int.d.ts +1 -0
- package/dist/nft.d.ts +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/twitter_bindings.d.ts +1 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +41 -35
- package/dist/index.js +0 -1
- package/src/bindings.ts +0 -445
- package/src/constants.ts +0 -101
- package/src/deprecated/index.ts +0 -1
- package/src/deprecated/record.ts +0 -14
- package/src/deprecated/tokens.ts +0 -52
- package/src/deprecated/utils.ts +0 -186
- package/src/favorite-domain.ts +0 -25
- package/src/index.ts +0 -14
- package/src/instructions.ts +0 -585
- package/src/int.ts +0 -75
- package/src/nft.ts +0 -95
- package/src/record.ts +0 -256
- package/src/resolve.ts +0 -77
- package/src/state.ts +0 -163
- package/src/twitter_bindings.ts +0 -439
- package/src/types/record.ts +0 -24
- package/src/utils.ts +0 -246
package/src/instructions.ts
DELETED
|
@@ -1,585 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PublicKey,
|
|
3
|
-
TransactionInstruction,
|
|
4
|
-
SystemProgram,
|
|
5
|
-
} from "@solana/web3.js";
|
|
6
|
-
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
|
7
|
-
import { Numberu32, Numberu64 } from "./int";
|
|
8
|
-
import { Schema, serialize } from "borsh";
|
|
9
|
-
|
|
10
|
-
export interface AccountKey {
|
|
11
|
-
pubkey: PublicKey;
|
|
12
|
-
isSigner: boolean;
|
|
13
|
-
isWritable: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function createInstruction(
|
|
17
|
-
nameProgramId: PublicKey,
|
|
18
|
-
systemProgramId: PublicKey,
|
|
19
|
-
nameKey: PublicKey,
|
|
20
|
-
nameOwnerKey: PublicKey,
|
|
21
|
-
payerKey: PublicKey,
|
|
22
|
-
hashed_name: Buffer,
|
|
23
|
-
lamports: Numberu64,
|
|
24
|
-
space: Numberu32,
|
|
25
|
-
nameClassKey?: PublicKey,
|
|
26
|
-
nameParent?: PublicKey,
|
|
27
|
-
nameParentOwner?: PublicKey
|
|
28
|
-
): TransactionInstruction {
|
|
29
|
-
const buffers = [
|
|
30
|
-
Buffer.from(Int8Array.from([0])),
|
|
31
|
-
//@ts-ignore
|
|
32
|
-
new Numberu32(hashed_name.length).toBuffer(),
|
|
33
|
-
hashed_name,
|
|
34
|
-
lamports.toBuffer(),
|
|
35
|
-
space.toBuffer(),
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const data = Buffer.concat(buffers);
|
|
39
|
-
|
|
40
|
-
const keys = [
|
|
41
|
-
{
|
|
42
|
-
pubkey: systemProgramId,
|
|
43
|
-
isSigner: false,
|
|
44
|
-
isWritable: false,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
pubkey: payerKey,
|
|
48
|
-
isSigner: true,
|
|
49
|
-
isWritable: true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
pubkey: nameKey,
|
|
53
|
-
isSigner: false,
|
|
54
|
-
isWritable: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
pubkey: nameOwnerKey,
|
|
58
|
-
isSigner: false,
|
|
59
|
-
isWritable: false,
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
if (nameClassKey) {
|
|
64
|
-
keys.push({
|
|
65
|
-
pubkey: nameClassKey,
|
|
66
|
-
isSigner: true,
|
|
67
|
-
isWritable: false,
|
|
68
|
-
});
|
|
69
|
-
} else {
|
|
70
|
-
keys.push({
|
|
71
|
-
pubkey: new PublicKey(Buffer.alloc(32)),
|
|
72
|
-
isSigner: false,
|
|
73
|
-
isWritable: false,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
if (nameParent) {
|
|
77
|
-
keys.push({
|
|
78
|
-
pubkey: nameParent,
|
|
79
|
-
isSigner: false,
|
|
80
|
-
isWritable: false,
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
keys.push({
|
|
84
|
-
pubkey: new PublicKey(Buffer.alloc(32)),
|
|
85
|
-
isSigner: false,
|
|
86
|
-
isWritable: false,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (nameParentOwner) {
|
|
90
|
-
keys.push({
|
|
91
|
-
pubkey: nameParentOwner,
|
|
92
|
-
isSigner: true,
|
|
93
|
-
isWritable: false,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return new TransactionInstruction({
|
|
98
|
-
keys,
|
|
99
|
-
programId: nameProgramId,
|
|
100
|
-
data,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function updateInstruction(
|
|
105
|
-
nameProgramId: PublicKey,
|
|
106
|
-
nameAccountKey: PublicKey,
|
|
107
|
-
offset: Numberu32,
|
|
108
|
-
input_data: Buffer,
|
|
109
|
-
nameUpdateSigner: PublicKey
|
|
110
|
-
): TransactionInstruction {
|
|
111
|
-
const buffers = [
|
|
112
|
-
Buffer.from(Int8Array.from([1])),
|
|
113
|
-
offset.toBuffer(),
|
|
114
|
-
//@ts-ignore
|
|
115
|
-
new Numberu32(input_data.length).toBuffer(),
|
|
116
|
-
input_data,
|
|
117
|
-
];
|
|
118
|
-
|
|
119
|
-
const data = Buffer.concat(buffers);
|
|
120
|
-
const keys = [
|
|
121
|
-
{
|
|
122
|
-
pubkey: nameAccountKey,
|
|
123
|
-
isSigner: false,
|
|
124
|
-
isWritable: true,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
pubkey: nameUpdateSigner,
|
|
128
|
-
isSigner: true,
|
|
129
|
-
isWritable: false,
|
|
130
|
-
},
|
|
131
|
-
];
|
|
132
|
-
|
|
133
|
-
return new TransactionInstruction({
|
|
134
|
-
keys,
|
|
135
|
-
programId: nameProgramId,
|
|
136
|
-
data,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export function transferInstruction(
|
|
141
|
-
nameProgramId: PublicKey,
|
|
142
|
-
nameAccountKey: PublicKey,
|
|
143
|
-
newOwnerKey: PublicKey,
|
|
144
|
-
currentNameOwnerKey: PublicKey,
|
|
145
|
-
nameClassKey?: PublicKey,
|
|
146
|
-
nameParent?: PublicKey,
|
|
147
|
-
parentOwner?: PublicKey
|
|
148
|
-
): TransactionInstruction {
|
|
149
|
-
const buffers = [Buffer.from(Int8Array.from([2])), newOwnerKey.toBuffer()];
|
|
150
|
-
|
|
151
|
-
const data = Buffer.concat(buffers);
|
|
152
|
-
|
|
153
|
-
const keys = [
|
|
154
|
-
{
|
|
155
|
-
pubkey: nameAccountKey,
|
|
156
|
-
isSigner: false,
|
|
157
|
-
isWritable: true,
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
pubkey: parentOwner ? parentOwner : currentNameOwnerKey,
|
|
161
|
-
isSigner: true,
|
|
162
|
-
isWritable: false,
|
|
163
|
-
},
|
|
164
|
-
];
|
|
165
|
-
|
|
166
|
-
if (nameClassKey) {
|
|
167
|
-
keys.push({
|
|
168
|
-
pubkey: nameClassKey,
|
|
169
|
-
isSigner: true,
|
|
170
|
-
isWritable: false,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (parentOwner && nameParent) {
|
|
175
|
-
if (!nameClassKey) {
|
|
176
|
-
keys.push({
|
|
177
|
-
pubkey: PublicKey.default,
|
|
178
|
-
isSigner: false,
|
|
179
|
-
isWritable: false,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
keys.push({
|
|
183
|
-
pubkey: nameParent,
|
|
184
|
-
isSigner: false,
|
|
185
|
-
isWritable: false,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return new TransactionInstruction({
|
|
190
|
-
keys,
|
|
191
|
-
programId: nameProgramId,
|
|
192
|
-
data,
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function deleteInstruction(
|
|
197
|
-
nameProgramId: PublicKey,
|
|
198
|
-
nameAccountKey: PublicKey,
|
|
199
|
-
refundTargetKey: PublicKey,
|
|
200
|
-
nameOwnerKey: PublicKey
|
|
201
|
-
): TransactionInstruction {
|
|
202
|
-
const buffers = [Buffer.from(Int8Array.from([3]))];
|
|
203
|
-
|
|
204
|
-
const data = Buffer.concat(buffers);
|
|
205
|
-
const keys = [
|
|
206
|
-
{
|
|
207
|
-
pubkey: nameAccountKey,
|
|
208
|
-
isSigner: false,
|
|
209
|
-
isWritable: true,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
pubkey: nameOwnerKey,
|
|
213
|
-
isSigner: true,
|
|
214
|
-
isWritable: false,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
pubkey: refundTargetKey,
|
|
218
|
-
isSigner: false,
|
|
219
|
-
isWritable: true,
|
|
220
|
-
},
|
|
221
|
-
];
|
|
222
|
-
|
|
223
|
-
return new TransactionInstruction({
|
|
224
|
-
keys,
|
|
225
|
-
programId: nameProgramId,
|
|
226
|
-
data,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export class createV2Instruction {
|
|
231
|
-
tag: number;
|
|
232
|
-
name: string;
|
|
233
|
-
space: number;
|
|
234
|
-
|
|
235
|
-
static schema: Schema = new Map([
|
|
236
|
-
[
|
|
237
|
-
createV2Instruction,
|
|
238
|
-
{
|
|
239
|
-
kind: "struct",
|
|
240
|
-
fields: [
|
|
241
|
-
["tag", "u8"],
|
|
242
|
-
["name", "string"],
|
|
243
|
-
["space", "u32"],
|
|
244
|
-
],
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
]);
|
|
248
|
-
|
|
249
|
-
constructor(obj: { name: string; space: number }) {
|
|
250
|
-
this.tag = 9;
|
|
251
|
-
this.name = obj.name;
|
|
252
|
-
this.space = obj.space;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
serialize(): Uint8Array {
|
|
256
|
-
return serialize(createV2Instruction.schema, this);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
getInstruction(
|
|
260
|
-
programId: PublicKey,
|
|
261
|
-
rentSysvarAccount: PublicKey,
|
|
262
|
-
nameProgramId: PublicKey,
|
|
263
|
-
rootDomain: PublicKey,
|
|
264
|
-
nameAccount: PublicKey,
|
|
265
|
-
reverseLookupAccount: PublicKey,
|
|
266
|
-
centralState: PublicKey,
|
|
267
|
-
buyer: PublicKey,
|
|
268
|
-
buyerTokenAccount: PublicKey,
|
|
269
|
-
usdcVault: PublicKey,
|
|
270
|
-
state: PublicKey
|
|
271
|
-
): TransactionInstruction {
|
|
272
|
-
const data = Buffer.from(this.serialize());
|
|
273
|
-
const keys = [
|
|
274
|
-
{
|
|
275
|
-
pubkey: rentSysvarAccount,
|
|
276
|
-
isSigner: false,
|
|
277
|
-
isWritable: false,
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
pubkey: nameProgramId,
|
|
281
|
-
isSigner: false,
|
|
282
|
-
isWritable: false,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
pubkey: rootDomain,
|
|
286
|
-
isSigner: false,
|
|
287
|
-
isWritable: false,
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
pubkey: nameAccount,
|
|
291
|
-
isSigner: false,
|
|
292
|
-
isWritable: true,
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
pubkey: reverseLookupAccount,
|
|
296
|
-
isSigner: false,
|
|
297
|
-
isWritable: true,
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
pubkey: SystemProgram.programId,
|
|
301
|
-
isSigner: false,
|
|
302
|
-
isWritable: false,
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
pubkey: centralState,
|
|
306
|
-
isSigner: false,
|
|
307
|
-
isWritable: false,
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
pubkey: buyer,
|
|
311
|
-
isSigner: true,
|
|
312
|
-
isWritable: true,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
pubkey: buyerTokenAccount,
|
|
316
|
-
isSigner: false,
|
|
317
|
-
isWritable: true,
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
pubkey: usdcVault,
|
|
321
|
-
isSigner: false,
|
|
322
|
-
isWritable: true,
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
pubkey: TOKEN_PROGRAM_ID,
|
|
326
|
-
isSigner: false,
|
|
327
|
-
isWritable: false,
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
pubkey: state,
|
|
331
|
-
isSigner: false,
|
|
332
|
-
isWritable: false,
|
|
333
|
-
},
|
|
334
|
-
];
|
|
335
|
-
|
|
336
|
-
return new TransactionInstruction({
|
|
337
|
-
keys,
|
|
338
|
-
programId,
|
|
339
|
-
data,
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export class createReverseInstruction {
|
|
345
|
-
tag: number;
|
|
346
|
-
name: string;
|
|
347
|
-
|
|
348
|
-
static schema: Schema = new Map([
|
|
349
|
-
[
|
|
350
|
-
createReverseInstruction,
|
|
351
|
-
{
|
|
352
|
-
kind: "struct",
|
|
353
|
-
fields: [
|
|
354
|
-
["tag", "u8"],
|
|
355
|
-
["name", "string"],
|
|
356
|
-
],
|
|
357
|
-
},
|
|
358
|
-
],
|
|
359
|
-
]);
|
|
360
|
-
|
|
361
|
-
constructor(obj: { name: string }) {
|
|
362
|
-
this.tag = 5;
|
|
363
|
-
this.name = obj.name;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
serialize(): Uint8Array {
|
|
367
|
-
return serialize(createReverseInstruction.schema, this);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
getInstruction(
|
|
371
|
-
programId: PublicKey,
|
|
372
|
-
rentSysvarAccount: PublicKey,
|
|
373
|
-
namingServiceProgram: PublicKey,
|
|
374
|
-
rootDomain: PublicKey,
|
|
375
|
-
reverseLookupAccount: PublicKey,
|
|
376
|
-
centralStateAccount: PublicKey,
|
|
377
|
-
feePayer: PublicKey,
|
|
378
|
-
parentName?: PublicKey,
|
|
379
|
-
parentNameOwner?: PublicKey
|
|
380
|
-
): TransactionInstruction {
|
|
381
|
-
const data = Buffer.from(this.serialize());
|
|
382
|
-
let keys = [
|
|
383
|
-
{
|
|
384
|
-
pubkey: rentSysvarAccount,
|
|
385
|
-
isSigner: false,
|
|
386
|
-
isWritable: false,
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
pubkey: namingServiceProgram,
|
|
390
|
-
isSigner: false,
|
|
391
|
-
isWritable: false,
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
pubkey: rootDomain,
|
|
395
|
-
isSigner: false,
|
|
396
|
-
isWritable: false,
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
pubkey: reverseLookupAccount,
|
|
400
|
-
isSigner: false,
|
|
401
|
-
isWritable: true,
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
pubkey: PublicKey.default,
|
|
405
|
-
isSigner: false,
|
|
406
|
-
isWritable: false,
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
pubkey: centralStateAccount,
|
|
410
|
-
isSigner: false,
|
|
411
|
-
isWritable: false,
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
pubkey: feePayer,
|
|
415
|
-
isSigner: true,
|
|
416
|
-
isWritable: true,
|
|
417
|
-
},
|
|
418
|
-
];
|
|
419
|
-
|
|
420
|
-
if (parentName) {
|
|
421
|
-
if (!parentNameOwner) {
|
|
422
|
-
throw new Error("Missing parent name owner");
|
|
423
|
-
}
|
|
424
|
-
keys.push({
|
|
425
|
-
pubkey: parentName,
|
|
426
|
-
isSigner: false,
|
|
427
|
-
isWritable: true,
|
|
428
|
-
});
|
|
429
|
-
keys.push({
|
|
430
|
-
pubkey: parentNameOwner,
|
|
431
|
-
isSigner: true,
|
|
432
|
-
isWritable: false,
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return new TransactionInstruction({
|
|
437
|
-
keys,
|
|
438
|
-
programId,
|
|
439
|
-
data,
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export class createInstructionV3 {
|
|
445
|
-
tag: number;
|
|
446
|
-
name: string;
|
|
447
|
-
space: number;
|
|
448
|
-
referrerIdxOpt: number | null;
|
|
449
|
-
static schema: Schema = new Map([
|
|
450
|
-
[
|
|
451
|
-
createInstructionV3,
|
|
452
|
-
{
|
|
453
|
-
kind: "struct",
|
|
454
|
-
fields: [
|
|
455
|
-
["tag", "u8"],
|
|
456
|
-
["name", "string"],
|
|
457
|
-
["space", "u32"],
|
|
458
|
-
["referrerIdxOpt", { kind: "option", type: "u16" }],
|
|
459
|
-
],
|
|
460
|
-
},
|
|
461
|
-
],
|
|
462
|
-
]);
|
|
463
|
-
constructor(obj: {
|
|
464
|
-
name: string;
|
|
465
|
-
space: number;
|
|
466
|
-
referrerIdxOpt: number | null;
|
|
467
|
-
}) {
|
|
468
|
-
this.tag = 13;
|
|
469
|
-
this.name = obj.name;
|
|
470
|
-
this.space = obj.space;
|
|
471
|
-
this.referrerIdxOpt = obj.referrerIdxOpt;
|
|
472
|
-
}
|
|
473
|
-
serialize(): Uint8Array {
|
|
474
|
-
return serialize(createInstructionV3.schema, this);
|
|
475
|
-
}
|
|
476
|
-
getInstruction(
|
|
477
|
-
programId: PublicKey,
|
|
478
|
-
namingServiceProgram: PublicKey,
|
|
479
|
-
rootDomain: PublicKey,
|
|
480
|
-
name: PublicKey,
|
|
481
|
-
reverseLookup: PublicKey,
|
|
482
|
-
systemProgram: PublicKey,
|
|
483
|
-
centralState: PublicKey,
|
|
484
|
-
buyer: PublicKey,
|
|
485
|
-
buyerTokenSource: PublicKey,
|
|
486
|
-
pythMappingAcc: PublicKey,
|
|
487
|
-
pythProductAcc: PublicKey,
|
|
488
|
-
pythPriceAcc: PublicKey,
|
|
489
|
-
vault: PublicKey,
|
|
490
|
-
splTokenProgram: PublicKey,
|
|
491
|
-
rentSysvar: PublicKey,
|
|
492
|
-
state: PublicKey,
|
|
493
|
-
referrerAccountOpt?: PublicKey
|
|
494
|
-
): TransactionInstruction {
|
|
495
|
-
const data = Buffer.from(this.serialize());
|
|
496
|
-
let keys: AccountKey[] = [];
|
|
497
|
-
keys.push({
|
|
498
|
-
pubkey: namingServiceProgram,
|
|
499
|
-
isSigner: false,
|
|
500
|
-
isWritable: false,
|
|
501
|
-
});
|
|
502
|
-
keys.push({
|
|
503
|
-
pubkey: rootDomain,
|
|
504
|
-
isSigner: false,
|
|
505
|
-
isWritable: false,
|
|
506
|
-
});
|
|
507
|
-
keys.push({
|
|
508
|
-
pubkey: name,
|
|
509
|
-
isSigner: false,
|
|
510
|
-
isWritable: true,
|
|
511
|
-
});
|
|
512
|
-
keys.push({
|
|
513
|
-
pubkey: reverseLookup,
|
|
514
|
-
isSigner: false,
|
|
515
|
-
isWritable: true,
|
|
516
|
-
});
|
|
517
|
-
keys.push({
|
|
518
|
-
pubkey: systemProgram,
|
|
519
|
-
isSigner: false,
|
|
520
|
-
isWritable: false,
|
|
521
|
-
});
|
|
522
|
-
keys.push({
|
|
523
|
-
pubkey: centralState,
|
|
524
|
-
isSigner: false,
|
|
525
|
-
isWritable: false,
|
|
526
|
-
});
|
|
527
|
-
keys.push({
|
|
528
|
-
pubkey: buyer,
|
|
529
|
-
isSigner: true,
|
|
530
|
-
isWritable: true,
|
|
531
|
-
});
|
|
532
|
-
keys.push({
|
|
533
|
-
pubkey: buyerTokenSource,
|
|
534
|
-
isSigner: false,
|
|
535
|
-
isWritable: true,
|
|
536
|
-
});
|
|
537
|
-
keys.push({
|
|
538
|
-
pubkey: pythMappingAcc,
|
|
539
|
-
isSigner: false,
|
|
540
|
-
isWritable: false,
|
|
541
|
-
});
|
|
542
|
-
keys.push({
|
|
543
|
-
pubkey: pythProductAcc,
|
|
544
|
-
isSigner: false,
|
|
545
|
-
isWritable: false,
|
|
546
|
-
});
|
|
547
|
-
keys.push({
|
|
548
|
-
pubkey: pythPriceAcc,
|
|
549
|
-
isSigner: false,
|
|
550
|
-
isWritable: false,
|
|
551
|
-
});
|
|
552
|
-
keys.push({
|
|
553
|
-
pubkey: vault,
|
|
554
|
-
isSigner: false,
|
|
555
|
-
isWritable: true,
|
|
556
|
-
});
|
|
557
|
-
keys.push({
|
|
558
|
-
pubkey: splTokenProgram,
|
|
559
|
-
isSigner: false,
|
|
560
|
-
isWritable: false,
|
|
561
|
-
});
|
|
562
|
-
keys.push({
|
|
563
|
-
pubkey: rentSysvar,
|
|
564
|
-
isSigner: false,
|
|
565
|
-
isWritable: false,
|
|
566
|
-
});
|
|
567
|
-
keys.push({
|
|
568
|
-
pubkey: state,
|
|
569
|
-
isSigner: false,
|
|
570
|
-
isWritable: false,
|
|
571
|
-
});
|
|
572
|
-
if (!!referrerAccountOpt) {
|
|
573
|
-
keys.push({
|
|
574
|
-
pubkey: referrerAccountOpt,
|
|
575
|
-
isSigner: false,
|
|
576
|
-
isWritable: true,
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
return new TransactionInstruction({
|
|
580
|
-
keys,
|
|
581
|
-
programId,
|
|
582
|
-
data,
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
}
|
package/src/int.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
|
-
|
|
3
|
-
export class Numberu32 extends BN {
|
|
4
|
-
/**
|
|
5
|
-
* Convert to Buffer representation
|
|
6
|
-
*/
|
|
7
|
-
toBuffer(): Buffer {
|
|
8
|
-
const a = super.toArray().reverse();
|
|
9
|
-
const b = Buffer.from(a);
|
|
10
|
-
if (b.length === 4) {
|
|
11
|
-
return b;
|
|
12
|
-
}
|
|
13
|
-
if (b.length > 4) {
|
|
14
|
-
throw new Error("Numberu32 too large");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const zeroPad = Buffer.alloc(4);
|
|
18
|
-
b.copy(zeroPad);
|
|
19
|
-
return zeroPad;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Construct a Numberu64 from Buffer representation
|
|
24
|
-
*/
|
|
25
|
-
static fromBuffer(buffer): BN {
|
|
26
|
-
if (buffer.length !== 4) {
|
|
27
|
-
throw new Error(`Invalid buffer length: ${buffer.length}`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return new BN(
|
|
31
|
-
[...buffer]
|
|
32
|
-
.reverse()
|
|
33
|
-
.map((i) => `00${i.toString(16)}`.slice(-2))
|
|
34
|
-
.join(""),
|
|
35
|
-
16
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export class Numberu64 extends BN {
|
|
41
|
-
/**
|
|
42
|
-
* Convert to Buffer representation
|
|
43
|
-
*/
|
|
44
|
-
toBuffer(): Buffer {
|
|
45
|
-
const a = super.toArray().reverse();
|
|
46
|
-
const b = Buffer.from(a);
|
|
47
|
-
if (b.length === 8) {
|
|
48
|
-
return b;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (b.length > 8) {
|
|
52
|
-
throw new Error("Numberu64 too large");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const zeroPad = Buffer.alloc(8);
|
|
56
|
-
b.copy(zeroPad);
|
|
57
|
-
return zeroPad;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Construct a Numberu64 from Buffer representation
|
|
62
|
-
*/
|
|
63
|
-
static fromBuffer(buffer): BN {
|
|
64
|
-
if (buffer.length !== 8) {
|
|
65
|
-
throw new Error(`Invalid buffer length: ${buffer.length}`);
|
|
66
|
-
}
|
|
67
|
-
return new BN(
|
|
68
|
-
[...buffer]
|
|
69
|
-
.reverse()
|
|
70
|
-
.map((i) => `00${i.toString(16)}`.slice(-2))
|
|
71
|
-
.join(""),
|
|
72
|
-
16
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|