3land_sdk 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "3land_sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "sdk for interacting with 3land's solana program",
5
- "main": "./src/library/implementation/storeImplementation.ts",
6
- "type": "module",
5
+ "main": "./dist/library/implementation/storeImplementation.js",
7
6
  "scripts": {
7
+ "build:cjs": "tsc --module CommonJS --outDir dist",
8
8
  "test": "npx tsx ./src/index.ts"
9
9
  },
10
10
  "author": "biccs",
package/src/index.ts CHANGED
@@ -55,7 +55,7 @@ async function main() {
55
55
  const landStoreMainnet = "AmQNs2kgw4LvS9sm6yE9JJ4Hs3JpVu65eyx9pxMG2xA";
56
56
  const landStoreDevnet = "GyPCu89S63P9NcCQAtuSJesiefhhgpGWrNVJs4bF2cSK";
57
57
  // Create Collection
58
- // const collection = await createCollectionTest(
58
+ // const collection = await createCollectionImp(
59
59
  // optionsWithBase58,
60
60
  // collectionOpts
61
61
  // );
@@ -165,6 +165,7 @@ async function createCollectionImp(
165
165
  return collectionTx;
166
166
  } catch (error) {
167
167
  handleError(error);
168
+ return { success: false, error: error };
168
169
  }
169
170
  }
170
171
 
@@ -181,6 +181,7 @@ export async function buySingleEditionInstruction(
181
181
  if (!data?.post) data.post = [];
182
182
 
183
183
  const coder = new BorshCoder(idl);
184
+
184
185
  const storedata = await connection.getAccountInfo(toPublicKey(storeAccount));
185
186
  if (!storedata) {
186
187
  throw new Error("no store data in print single");
@@ -52,722 +52,725 @@ export type AnchorError =
52
52
  | AccountReallocExceedsLimit
53
53
  | AccountDuplicateReallocs
54
54
  | DeclaredProgramIdMismatch
55
- | Deprecated
55
+ | Deprecated;
56
56
 
57
57
  export class InstructionMissing extends Error {
58
- static readonly code = 100
59
- readonly code = 100
60
- readonly name = "InstructionMissing"
61
- readonly msg = "8 byte instruction identifier not provided"
58
+ static readonly code = 100;
59
+ readonly code = 100;
60
+ override readonly name = "InstructionMissing";
61
+ readonly msg = "8 byte instruction identifier not provided";
62
62
 
63
63
  constructor(readonly logs?: string[]) {
64
- super("100: 8 byte instruction identifier not provided")
64
+ super("100: 8 byte instruction identifier not provided");
65
65
  }
66
66
  }
67
67
 
68
68
  export class InstructionFallbackNotFound extends Error {
69
- static readonly code = 101
70
- readonly code = 101
71
- readonly name = "InstructionFallbackNotFound"
72
- readonly msg = "Fallback functions are not supported"
69
+ static readonly code = 101;
70
+ readonly code = 101;
71
+ override readonly name = "InstructionFallbackNotFound";
72
+ readonly msg = "Fallback functions are not supported";
73
73
 
74
74
  constructor(readonly logs?: string[]) {
75
- super("101: Fallback functions are not supported")
75
+ super("101: Fallback functions are not supported");
76
76
  }
77
77
  }
78
78
 
79
79
  export class InstructionDidNotDeserialize extends Error {
80
- static readonly code = 102
81
- readonly code = 102
82
- readonly name = "InstructionDidNotDeserialize"
83
- readonly msg = "The program could not deserialize the given instruction"
80
+ static readonly code = 102;
81
+ readonly code = 102;
82
+ override readonly name = "InstructionDidNotDeserialize";
83
+ readonly msg = "The program could not deserialize the given instruction";
84
84
 
85
85
  constructor(readonly logs?: string[]) {
86
- super("102: The program could not deserialize the given instruction")
86
+ super("102: The program could not deserialize the given instruction");
87
87
  }
88
88
  }
89
89
 
90
90
  export class InstructionDidNotSerialize extends Error {
91
- static readonly code = 103
92
- readonly code = 103
93
- readonly name = "InstructionDidNotSerialize"
94
- readonly msg = "The program could not serialize the given instruction"
91
+ static readonly code = 103;
92
+ readonly code = 103;
93
+ override readonly name = "InstructionDidNotSerialize";
94
+ readonly msg = "The program could not serialize the given instruction";
95
95
 
96
96
  constructor(readonly logs?: string[]) {
97
- super("103: The program could not serialize the given instruction")
97
+ super("103: The program could not serialize the given instruction");
98
98
  }
99
99
  }
100
100
 
101
101
  export class IdlInstructionStub extends Error {
102
- static readonly code = 1000
103
- readonly code = 1000
104
- readonly name = "IdlInstructionStub"
105
- readonly msg = "The program was compiled without idl instructions"
102
+ static readonly code = 1000;
103
+ readonly code = 1000;
104
+ override readonly name = "IdlInstructionStub";
105
+ readonly msg = "The program was compiled without idl instructions";
106
106
 
107
107
  constructor(readonly logs?: string[]) {
108
- super("1000: The program was compiled without idl instructions")
108
+ super("1000: The program was compiled without idl instructions");
109
109
  }
110
110
  }
111
111
 
112
112
  export class IdlInstructionInvalidProgram extends Error {
113
- static readonly code = 1001
114
- readonly code = 1001
115
- readonly name = "IdlInstructionInvalidProgram"
113
+ static readonly code = 1001;
114
+ readonly code = 1001;
115
+ override readonly name = "IdlInstructionInvalidProgram";
116
116
  readonly msg =
117
- "The transaction was given an invalid program for the IDL instruction"
117
+ "The transaction was given an invalid program for the IDL instruction";
118
118
 
119
119
  constructor(readonly logs?: string[]) {
120
120
  super(
121
121
  "1001: The transaction was given an invalid program for the IDL instruction"
122
- )
122
+ );
123
123
  }
124
124
  }
125
125
 
126
126
  export class ConstraintMut extends Error {
127
- static readonly code = 2000
128
- readonly code = 2000
129
- readonly name = "ConstraintMut"
130
- readonly msg = "A mut constraint was violated"
127
+ static readonly code = 2000;
128
+ readonly code = 2000;
129
+ override readonly name = "ConstraintMut";
130
+ readonly msg = "A mut constraint was violated";
131
131
 
132
132
  constructor(readonly logs?: string[]) {
133
- super("2000: A mut constraint was violated")
133
+ super("2000: A mut constraint was violated");
134
134
  }
135
135
  }
136
136
 
137
137
  export class ConstraintHasOne extends Error {
138
- static readonly code = 2001
139
- readonly code = 2001
140
- readonly name = "ConstraintHasOne"
141
- readonly msg = "A has one constraint was violated"
138
+ static readonly code = 2001;
139
+ readonly code = 2001;
140
+ override readonly name = "ConstraintHasOne";
141
+ readonly msg = "A has one constraint was violated";
142
142
 
143
143
  constructor(readonly logs?: string[]) {
144
- super("2001: A has one constraint was violated")
144
+ super("2001: A has one constraint was violated");
145
145
  }
146
146
  }
147
147
 
148
148
  export class ConstraintSigner extends Error {
149
- static readonly code = 2002
150
- readonly code = 2002
151
- readonly name = "ConstraintSigner"
152
- readonly msg = "A signer constraint was violated"
149
+ static readonly code = 2002;
150
+ readonly code = 2002;
151
+ override readonly name = "ConstraintSigner";
152
+ readonly msg = "A signer constraint was violated";
153
153
 
154
154
  constructor(readonly logs?: string[]) {
155
- super("2002: A signer constraint was violated")
155
+ super("2002: A signer constraint was violated");
156
156
  }
157
157
  }
158
158
 
159
159
  export class ConstraintRaw extends Error {
160
- static readonly code = 2003
161
- readonly code = 2003
162
- readonly name = "ConstraintRaw"
163
- readonly msg = "A raw constraint was violated"
160
+ static readonly code = 2003;
161
+ readonly code = 2003;
162
+ override readonly name = "ConstraintRaw";
163
+ readonly msg = "A raw constraint was violated";
164
164
 
165
165
  constructor(readonly logs?: string[]) {
166
- super("2003: A raw constraint was violated")
166
+ super("2003: A raw constraint was violated");
167
167
  }
168
168
  }
169
169
 
170
170
  export class ConstraintOwner extends Error {
171
- static readonly code = 2004
172
- readonly code = 2004
173
- readonly name = "ConstraintOwner"
174
- readonly msg = "An owner constraint was violated"
171
+ static readonly code = 2004;
172
+ readonly code = 2004;
173
+ override readonly name = "ConstraintOwner";
174
+ readonly msg = "An owner constraint was violated";
175
175
 
176
176
  constructor(readonly logs?: string[]) {
177
- super("2004: An owner constraint was violated")
177
+ super("2004: An owner constraint was violated");
178
178
  }
179
179
  }
180
180
 
181
181
  export class ConstraintRentExempt extends Error {
182
- static readonly code = 2005
183
- readonly code = 2005
184
- readonly name = "ConstraintRentExempt"
185
- readonly msg = "A rent exemption constraint was violated"
182
+ static readonly code = 2005;
183
+ readonly code = 2005;
184
+ override readonly name = "ConstraintRentExempt";
185
+ readonly msg = "A rent exemption constraint was violated";
186
186
 
187
187
  constructor(readonly logs?: string[]) {
188
- super("2005: A rent exemption constraint was violated")
188
+ super("2005: A rent exemption constraint was violated");
189
189
  }
190
190
  }
191
191
 
192
192
  export class ConstraintSeeds extends Error {
193
- static readonly code = 2006
194
- readonly code = 2006
195
- readonly name = "ConstraintSeeds"
196
- readonly msg = "A seeds constraint was violated"
193
+ static readonly code = 2006;
194
+ readonly code = 2006;
195
+ override readonly name = "ConstraintSeeds";
196
+ readonly msg = "A seeds constraint was violated";
197
197
 
198
198
  constructor(readonly logs?: string[]) {
199
- super("2006: A seeds constraint was violated")
199
+ super("2006: A seeds constraint was violated");
200
200
  }
201
201
  }
202
202
 
203
203
  export class ConstraintExecutable extends Error {
204
- static readonly code = 2007
205
- readonly code = 2007
206
- readonly name = "ConstraintExecutable"
207
- readonly msg = "An executable constraint was violated"
204
+ static readonly code = 2007;
205
+ readonly code = 2007;
206
+ override readonly name = "ConstraintExecutable";
207
+ readonly msg = "An executable constraint was violated";
208
208
 
209
209
  constructor(readonly logs?: string[]) {
210
- super("2007: An executable constraint was violated")
210
+ super("2007: An executable constraint was violated");
211
211
  }
212
212
  }
213
213
 
214
214
  export class ConstraintState extends Error {
215
- static readonly code = 2008
216
- readonly code = 2008
217
- readonly name = "ConstraintState"
218
- readonly msg = "Deprecated Error, feel free to replace with something else"
215
+ static readonly code = 2008;
216
+ readonly code = 2008;
217
+ override readonly name = "ConstraintState";
218
+ readonly msg = "Deprecated Error, feel free to replace with something else";
219
219
 
220
220
  constructor(readonly logs?: string[]) {
221
- super("2008: Deprecated Error, feel free to replace with something else")
221
+ super("2008: Deprecated Error, feel free to replace with something else");
222
222
  }
223
223
  }
224
224
 
225
225
  export class ConstraintAssociated extends Error {
226
- static readonly code = 2009
227
- readonly code = 2009
228
- readonly name = "ConstraintAssociated"
229
- readonly msg = "An associated constraint was violated"
226
+ static readonly code = 2009;
227
+ readonly code = 2009;
228
+ override readonly name = "ConstraintAssociated";
229
+ readonly msg = "An associated constraint was violated";
230
230
 
231
231
  constructor(readonly logs?: string[]) {
232
- super("2009: An associated constraint was violated")
232
+ super("2009: An associated constraint was violated");
233
233
  }
234
234
  }
235
235
 
236
236
  export class ConstraintAssociatedInit extends Error {
237
- static readonly code = 2010
238
- readonly code = 2010
239
- readonly name = "ConstraintAssociatedInit"
240
- readonly msg = "An associated init constraint was violated"
237
+ static readonly code = 2010;
238
+ readonly code = 2010;
239
+ override readonly name = "ConstraintAssociatedInit";
240
+ readonly msg = "An associated init constraint was violated";
241
241
 
242
242
  constructor(readonly logs?: string[]) {
243
- super("2010: An associated init constraint was violated")
243
+ super("2010: An associated init constraint was violated");
244
244
  }
245
245
  }
246
246
 
247
247
  export class ConstraintClose extends Error {
248
- static readonly code = 2011
249
- readonly code = 2011
250
- readonly name = "ConstraintClose"
251
- readonly msg = "A close constraint was violated"
248
+ static readonly code = 2011;
249
+ readonly code = 2011;
250
+ override readonly name = "ConstraintClose";
251
+ readonly msg = "A close constraint was violated";
252
252
 
253
253
  constructor(readonly logs?: string[]) {
254
- super("2011: A close constraint was violated")
254
+ super("2011: A close constraint was violated");
255
255
  }
256
256
  }
257
257
 
258
258
  export class ConstraintAddress extends Error {
259
- static readonly code = 2012
260
- readonly code = 2012
261
- readonly name = "ConstraintAddress"
262
- readonly msg = "An address constraint was violated"
259
+ static readonly code = 2012;
260
+ readonly code = 2012;
261
+ override readonly name = "ConstraintAddress";
262
+ readonly msg = "An address constraint was violated";
263
263
 
264
264
  constructor(readonly logs?: string[]) {
265
- super("2012: An address constraint was violated")
265
+ super("2012: An address constraint was violated");
266
266
  }
267
267
  }
268
268
 
269
269
  export class ConstraintZero extends Error {
270
- static readonly code = 2013
271
- readonly code = 2013
272
- readonly name = "ConstraintZero"
273
- readonly msg = "Expected zero account discriminant"
270
+ static readonly code = 2013;
271
+ readonly code = 2013;
272
+ override readonly name = "ConstraintZero";
273
+ readonly msg = "Expected zero account discriminant";
274
274
 
275
275
  constructor(readonly logs?: string[]) {
276
- super("2013: Expected zero account discriminant")
276
+ super("2013: Expected zero account discriminant");
277
277
  }
278
278
  }
279
279
 
280
280
  export class ConstraintTokenMint extends Error {
281
- static readonly code = 2014
282
- readonly code = 2014
283
- readonly name = "ConstraintTokenMint"
284
- readonly msg = "A token mint constraint was violated"
281
+ static readonly code = 2014;
282
+ readonly code = 2014;
283
+ override readonly name = "ConstraintTokenMint";
284
+ readonly msg = "A token mint constraint was violated";
285
285
 
286
286
  constructor(readonly logs?: string[]) {
287
- super("2014: A token mint constraint was violated")
287
+ super("2014: A token mint constraint was violated");
288
288
  }
289
289
  }
290
290
 
291
291
  export class ConstraintTokenOwner extends Error {
292
- static readonly code = 2015
293
- readonly code = 2015
294
- readonly name = "ConstraintTokenOwner"
295
- readonly msg = "A token owner constraint was violated"
292
+ static readonly code = 2015;
293
+ readonly code = 2015;
294
+ override readonly name = "ConstraintTokenOwner";
295
+ readonly msg = "A token owner constraint was violated";
296
296
 
297
297
  constructor(readonly logs?: string[]) {
298
- super("2015: A token owner constraint was violated")
298
+ super("2015: A token owner constraint was violated");
299
299
  }
300
300
  }
301
301
 
302
302
  export class ConstraintMintMintAuthority extends Error {
303
- static readonly code = 2016
304
- readonly code = 2016
305
- readonly name = "ConstraintMintMintAuthority"
306
- readonly msg = "A mint mint authority constraint was violated"
303
+ static readonly code = 2016;
304
+ readonly code = 2016;
305
+ override readonly name = "ConstraintMintMintAuthority";
306
+ readonly msg = "A mint mint authority constraint was violated";
307
307
 
308
308
  constructor(readonly logs?: string[]) {
309
- super("2016: A mint mint authority constraint was violated")
309
+ super("2016: A mint mint authority constraint was violated");
310
310
  }
311
311
  }
312
312
 
313
313
  export class ConstraintMintFreezeAuthority extends Error {
314
- static readonly code = 2017
315
- readonly code = 2017
316
- readonly name = "ConstraintMintFreezeAuthority"
317
- readonly msg = "A mint freeze authority constraint was violated"
314
+ static readonly code = 2017;
315
+ readonly code = 2017;
316
+ override readonly name = "ConstraintMintFreezeAuthority";
317
+ readonly msg = "A mint freeze authority constraint was violated";
318
318
 
319
319
  constructor(readonly logs?: string[]) {
320
- super("2017: A mint freeze authority constraint was violated")
320
+ super("2017: A mint freeze authority constraint was violated");
321
321
  }
322
322
  }
323
323
 
324
324
  export class ConstraintMintDecimals extends Error {
325
- static readonly code = 2018
326
- readonly code = 2018
327
- readonly name = "ConstraintMintDecimals"
328
- readonly msg = "A mint decimals constraint was violated"
325
+ static readonly code = 2018;
326
+ readonly code = 2018;
327
+ override readonly name = "ConstraintMintDecimals";
328
+ readonly msg = "A mint decimals constraint was violated";
329
329
 
330
330
  constructor(readonly logs?: string[]) {
331
- super("2018: A mint decimals constraint was violated")
331
+ super("2018: A mint decimals constraint was violated");
332
332
  }
333
333
  }
334
334
 
335
335
  export class ConstraintSpace extends Error {
336
- static readonly code = 2019
337
- readonly code = 2019
338
- readonly name = "ConstraintSpace"
339
- readonly msg = "A space constraint was violated"
336
+ static readonly code = 2019;
337
+ readonly code = 2019;
338
+ override readonly name = "ConstraintSpace";
339
+ readonly msg = "A space constraint was violated";
340
340
 
341
341
  constructor(readonly logs?: string[]) {
342
- super("2019: A space constraint was violated")
342
+ super("2019: A space constraint was violated");
343
343
  }
344
344
  }
345
345
 
346
346
  export class ConstraintAccountIsNone extends Error {
347
- static readonly code = 2020
348
- readonly code = 2020
349
- readonly name = "ConstraintAccountIsNone"
350
- readonly msg = "A required account for the constraint is None"
347
+ static readonly code = 2020;
348
+ readonly code = 2020;
349
+ override readonly name = "ConstraintAccountIsNone";
350
+ readonly msg = "A required account for the constraint is None";
351
351
 
352
352
  constructor(readonly logs?: string[]) {
353
- super("2020: A required account for the constraint is None")
353
+ super("2020: A required account for the constraint is None");
354
354
  }
355
355
  }
356
356
 
357
357
  export class RequireViolated extends Error {
358
- static readonly code = 2500
359
- readonly code = 2500
360
- readonly name = "RequireViolated"
361
- readonly msg = "A require expression was violated"
358
+ static readonly code = 2500;
359
+ readonly code = 2500;
360
+ override readonly name = "RequireViolated";
361
+ readonly msg = "A require expression was violated";
362
362
 
363
363
  constructor(readonly logs?: string[]) {
364
- super("2500: A require expression was violated")
364
+ super("2500: A require expression was violated");
365
365
  }
366
366
  }
367
367
 
368
368
  export class RequireEqViolated extends Error {
369
- static readonly code = 2501
370
- readonly code = 2501
371
- readonly name = "RequireEqViolated"
372
- readonly msg = "A require_eq expression was violated"
369
+ static readonly code = 2501;
370
+ readonly code = 2501;
371
+ override readonly name = "RequireEqViolated";
372
+ readonly msg = "A require_eq expression was violated";
373
373
 
374
374
  constructor(readonly logs?: string[]) {
375
- super("2501: A require_eq expression was violated")
375
+ super("2501: A require_eq expression was violated");
376
376
  }
377
377
  }
378
378
 
379
379
  export class RequireKeysEqViolated extends Error {
380
- static readonly code = 2502
381
- readonly code = 2502
382
- readonly name = "RequireKeysEqViolated"
383
- readonly msg = "A require_keys_eq expression was violated"
380
+ static readonly code = 2502;
381
+ readonly code = 2502;
382
+ override readonly name = "RequireKeysEqViolated";
383
+ readonly msg = "A require_keys_eq expression was violated";
384
384
 
385
385
  constructor(readonly logs?: string[]) {
386
- super("2502: A require_keys_eq expression was violated")
386
+ super("2502: A require_keys_eq expression was violated");
387
387
  }
388
388
  }
389
389
 
390
390
  export class RequireNeqViolated extends Error {
391
- static readonly code = 2503
392
- readonly code = 2503
393
- readonly name = "RequireNeqViolated"
394
- readonly msg = "A require_neq expression was violated"
391
+ static readonly code = 2503;
392
+ readonly code = 2503;
393
+ override readonly name = "RequireNeqViolated";
394
+ readonly msg = "A require_neq expression was violated";
395
395
 
396
396
  constructor(readonly logs?: string[]) {
397
- super("2503: A require_neq expression was violated")
397
+ super("2503: A require_neq expression was violated");
398
398
  }
399
399
  }
400
400
 
401
401
  export class RequireKeysNeqViolated extends Error {
402
- static readonly code = 2504
403
- readonly code = 2504
404
- readonly name = "RequireKeysNeqViolated"
405
- readonly msg = "A require_keys_neq expression was violated"
402
+ static readonly code = 2504;
403
+ readonly code = 2504;
404
+ override readonly name = "RequireKeysNeqViolated";
405
+ readonly msg = "A require_keys_neq expression was violated";
406
406
 
407
407
  constructor(readonly logs?: string[]) {
408
- super("2504: A require_keys_neq expression was violated")
408
+ super("2504: A require_keys_neq expression was violated");
409
409
  }
410
410
  }
411
411
 
412
412
  export class RequireGtViolated extends Error {
413
- static readonly code = 2505
414
- readonly code = 2505
415
- readonly name = "RequireGtViolated"
416
- readonly msg = "A require_gt expression was violated"
413
+ static readonly code = 2505;
414
+ readonly code = 2505;
415
+ override readonly name = "RequireGtViolated";
416
+ readonly msg = "A require_gt expression was violated";
417
417
 
418
418
  constructor(readonly logs?: string[]) {
419
- super("2505: A require_gt expression was violated")
419
+ super("2505: A require_gt expression was violated");
420
420
  }
421
421
  }
422
422
 
423
423
  export class RequireGteViolated extends Error {
424
- static readonly code = 2506
425
- readonly code = 2506
426
- readonly name = "RequireGteViolated"
427
- readonly msg = "A require_gte expression was violated"
424
+ static readonly code = 2506;
425
+ readonly code = 2506;
426
+ override readonly name = "RequireGteViolated";
427
+ readonly msg = "A require_gte expression was violated";
428
428
 
429
429
  constructor(readonly logs?: string[]) {
430
- super("2506: A require_gte expression was violated")
430
+ super("2506: A require_gte expression was violated");
431
431
  }
432
432
  }
433
433
 
434
434
  export class AccountDiscriminatorAlreadySet extends Error {
435
- static readonly code = 3000
436
- readonly code = 3000
437
- readonly name = "AccountDiscriminatorAlreadySet"
438
- readonly msg = "The account discriminator was already set on this account"
435
+ static readonly code = 3000;
436
+ readonly code = 3000;
437
+ override readonly name = "AccountDiscriminatorAlreadySet";
438
+ readonly msg = "The account discriminator was already set on this account";
439
439
 
440
440
  constructor(readonly logs?: string[]) {
441
- super("3000: The account discriminator was already set on this account")
441
+ super("3000: The account discriminator was already set on this account");
442
442
  }
443
443
  }
444
444
 
445
445
  export class AccountDiscriminatorNotFound extends Error {
446
- static readonly code = 3001
447
- readonly code = 3001
448
- readonly name = "AccountDiscriminatorNotFound"
449
- readonly msg = "No 8 byte discriminator was found on the account"
446
+ static readonly code = 3001;
447
+ readonly code = 3001;
448
+ override readonly name = "AccountDiscriminatorNotFound";
449
+ readonly msg = "No 8 byte discriminator was found on the account";
450
450
 
451
451
  constructor(readonly logs?: string[]) {
452
- super("3001: No 8 byte discriminator was found on the account")
452
+ super("3001: No 8 byte discriminator was found on the account");
453
453
  }
454
454
  }
455
455
 
456
456
  export class AccountDiscriminatorMismatch extends Error {
457
- static readonly code = 3002
458
- readonly code = 3002
459
- readonly name = "AccountDiscriminatorMismatch"
460
- readonly msg = "8 byte discriminator did not match what was expected"
457
+ static readonly code = 3002;
458
+ readonly code = 3002;
459
+ override readonly name = "AccountDiscriminatorMismatch";
460
+ readonly msg = "8 byte discriminator did not match what was expected";
461
461
 
462
462
  constructor(readonly logs?: string[]) {
463
- super("3002: 8 byte discriminator did not match what was expected")
463
+ super("3002: 8 byte discriminator did not match what was expected");
464
464
  }
465
465
  }
466
466
 
467
467
  export class AccountDidNotDeserialize extends Error {
468
- static readonly code = 3003
469
- readonly code = 3003
470
- readonly name = "AccountDidNotDeserialize"
471
- readonly msg = "Failed to deserialize the account"
468
+ static readonly code = 3003;
469
+ readonly code = 3003;
470
+ override readonly name = "AccountDidNotDeserialize";
471
+ readonly msg = "Failed to deserialize the account";
472
472
 
473
473
  constructor(readonly logs?: string[]) {
474
- super("3003: Failed to deserialize the account")
474
+ super("3003: Failed to deserialize the account");
475
475
  }
476
476
  }
477
477
 
478
478
  export class AccountDidNotSerialize extends Error {
479
- static readonly code = 3004
480
- readonly code = 3004
481
- readonly name = "AccountDidNotSerialize"
482
- readonly msg = "Failed to serialize the account"
479
+ static readonly code = 3004;
480
+ readonly code = 3004;
481
+ override readonly name = "AccountDidNotSerialize";
482
+ readonly msg = "Failed to serialize the account";
483
483
 
484
484
  constructor(readonly logs?: string[]) {
485
- super("3004: Failed to serialize the account")
485
+ super("3004: Failed to serialize the account");
486
486
  }
487
487
  }
488
488
 
489
489
  export class AccountNotEnoughKeys extends Error {
490
- static readonly code = 3005
491
- readonly code = 3005
492
- readonly name = "AccountNotEnoughKeys"
493
- readonly msg = "Not enough account keys given to the instruction"
490
+ static readonly code = 3005;
491
+ readonly code = 3005;
492
+ override readonly name = "AccountNotEnoughKeys";
493
+ readonly msg = "Not enough account keys given to the instruction";
494
494
 
495
495
  constructor(readonly logs?: string[]) {
496
- super("3005: Not enough account keys given to the instruction")
496
+ super("3005: Not enough account keys given to the instruction");
497
497
  }
498
498
  }
499
499
 
500
500
  export class AccountNotMutable extends Error {
501
- static readonly code = 3006
502
- readonly code = 3006
503
- readonly name = "AccountNotMutable"
504
- readonly msg = "The given account is not mutable"
501
+ static readonly code = 3006;
502
+ readonly code = 3006;
503
+ override readonly name = "AccountNotMutable";
504
+ readonly msg = "The given account is not mutable";
505
505
 
506
506
  constructor(readonly logs?: string[]) {
507
- super("3006: The given account is not mutable")
507
+ super("3006: The given account is not mutable");
508
508
  }
509
509
  }
510
510
 
511
511
  export class AccountOwnedByWrongProgram extends Error {
512
- static readonly code = 3007
513
- readonly code = 3007
514
- readonly name = "AccountOwnedByWrongProgram"
512
+ static readonly code = 3007;
513
+ readonly code = 3007;
514
+ override readonly name = "AccountOwnedByWrongProgram";
515
515
  readonly msg =
516
- "The given account is owned by a different program than expected"
516
+ "The given account is owned by a different program than expected";
517
517
 
518
518
  constructor(readonly logs?: string[]) {
519
519
  super(
520
520
  "3007: The given account is owned by a different program than expected"
521
- )
521
+ );
522
522
  }
523
523
  }
524
524
 
525
525
  export class InvalidProgramId extends Error {
526
- static readonly code = 3008
527
- readonly code = 3008
528
- readonly name = "InvalidProgramId"
529
- readonly msg = "Program ID was not as expected"
526
+ static readonly code = 3008;
527
+ readonly code = 3008;
528
+ override readonly name = "InvalidProgramId";
529
+ readonly msg = "Program ID was not as expected";
530
530
 
531
531
  constructor(readonly logs?: string[]) {
532
- super("3008: Program ID was not as expected")
532
+ super("3008: Program ID was not as expected");
533
533
  }
534
534
  }
535
535
 
536
536
  export class InvalidProgramExecutable extends Error {
537
- static readonly code = 3009
538
- readonly code = 3009
539
- readonly name = "InvalidProgramExecutable"
540
- readonly msg = "Program account is not executable"
537
+ static readonly code = 3009;
538
+ readonly code = 3009;
539
+ override readonly name = "InvalidProgramExecutable";
540
+ readonly msg = "Program account is not executable";
541
541
 
542
542
  constructor(readonly logs?: string[]) {
543
- super("3009: Program account is not executable")
543
+ super("3009: Program account is not executable");
544
544
  }
545
545
  }
546
546
 
547
547
  export class AccountNotSigner extends Error {
548
- static readonly code = 3010
549
- readonly code = 3010
550
- readonly name = "AccountNotSigner"
551
- readonly msg = "The given account did not sign"
548
+ static readonly code = 3010;
549
+ readonly code = 3010;
550
+ override readonly name = "AccountNotSigner";
551
+ readonly msg = "The given account did not sign";
552
552
 
553
553
  constructor(readonly logs?: string[]) {
554
- super("3010: The given account did not sign")
554
+ super("3010: The given account did not sign");
555
555
  }
556
556
  }
557
557
 
558
558
  export class AccountNotSystemOwned extends Error {
559
- static readonly code = 3011
560
- readonly code = 3011
561
- readonly name = "AccountNotSystemOwned"
562
- readonly msg = "The given account is not owned by the system program"
559
+ static readonly code = 3011;
560
+ readonly code = 3011;
561
+ override readonly name = "AccountNotSystemOwned";
562
+ readonly msg = "The given account is not owned by the system program";
563
563
 
564
564
  constructor(readonly logs?: string[]) {
565
- super("3011: The given account is not owned by the system program")
565
+ super("3011: The given account is not owned by the system program");
566
566
  }
567
567
  }
568
568
 
569
569
  export class AccountNotInitialized extends Error {
570
- static readonly code = 3012
571
- readonly code = 3012
572
- readonly name = "AccountNotInitialized"
573
- readonly msg = "The program expected this account to be already initialized"
570
+ static readonly code = 3012;
571
+ readonly code = 3012;
572
+ override readonly name = "AccountNotInitialized";
573
+ readonly msg = "The program expected this account to be already initialized";
574
574
 
575
575
  constructor(readonly logs?: string[]) {
576
- super("3012: The program expected this account to be already initialized")
576
+ super("3012: The program expected this account to be already initialized");
577
577
  }
578
578
  }
579
579
 
580
580
  export class AccountNotProgramData extends Error {
581
- static readonly code = 3013
582
- readonly code = 3013
583
- readonly name = "AccountNotProgramData"
584
- readonly msg = "The given account is not a program data account"
581
+ static readonly code = 3013;
582
+ readonly code = 3013;
583
+ override readonly name = "AccountNotProgramData";
584
+ readonly msg = "The given account is not a program data account";
585
585
 
586
586
  constructor(readonly logs?: string[]) {
587
- super("3013: The given account is not a program data account")
587
+ super("3013: The given account is not a program data account");
588
588
  }
589
589
  }
590
590
 
591
591
  export class AccountNotAssociatedTokenAccount extends Error {
592
- static readonly code = 3014
593
- readonly code = 3014
594
- readonly name = "AccountNotAssociatedTokenAccount"
595
- readonly msg = "The given account is not the associated token account"
592
+ static readonly code = 3014;
593
+ readonly code = 3014;
594
+ override readonly name = "AccountNotAssociatedTokenAccount";
595
+ readonly msg = "The given account is not the associated token account";
596
596
 
597
597
  constructor(readonly logs?: string[]) {
598
- super("3014: The given account is not the associated token account")
598
+ super("3014: The given account is not the associated token account");
599
599
  }
600
600
  }
601
601
 
602
602
  export class AccountSysvarMismatch extends Error {
603
- static readonly code = 3015
604
- readonly code = 3015
605
- readonly name = "AccountSysvarMismatch"
606
- readonly msg = "The given public key does not match the required sysvar"
603
+ static readonly code = 3015;
604
+ readonly code = 3015;
605
+ override readonly name = "AccountSysvarMismatch";
606
+ readonly msg = "The given public key does not match the required sysvar";
607
607
 
608
608
  constructor(readonly logs?: string[]) {
609
- super("3015: The given public key does not match the required sysvar")
609
+ super("3015: The given public key does not match the required sysvar");
610
610
  }
611
611
  }
612
612
 
613
613
  export class AccountReallocExceedsLimit extends Error {
614
- static readonly code = 3016
615
- readonly code = 3016
616
- readonly name = "AccountReallocExceedsLimit"
614
+ static readonly code = 3016;
615
+ readonly code = 3016;
616
+ override readonly name = "AccountReallocExceedsLimit";
617
617
  readonly msg =
618
- "The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"
618
+ "The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit";
619
619
 
620
620
  constructor(readonly logs?: string[]) {
621
621
  super(
622
622
  "3016: The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"
623
- )
623
+ );
624
624
  }
625
625
  }
626
626
 
627
627
  export class AccountDuplicateReallocs extends Error {
628
- static readonly code = 3017
629
- readonly code = 3017
630
- readonly name = "AccountDuplicateReallocs"
631
- readonly msg = "The account was duplicated for more than one reallocation"
628
+ static readonly code = 3017;
629
+ readonly code = 3017;
630
+ override readonly name = "AccountDuplicateReallocs";
631
+ readonly msg = "The account was duplicated for more than one reallocation";
632
632
 
633
633
  constructor(readonly logs?: string[]) {
634
- super("3017: The account was duplicated for more than one reallocation")
634
+ super("3017: The account was duplicated for more than one reallocation");
635
635
  }
636
636
  }
637
637
 
638
638
  export class DeclaredProgramIdMismatch extends Error {
639
- static readonly code = 4100
640
- readonly code = 4100
641
- readonly name = "DeclaredProgramIdMismatch"
642
- readonly msg = "The declared program id does not match the actual program id"
639
+ static readonly code = 4100;
640
+ readonly code = 4100;
641
+ override readonly name = "DeclaredProgramIdMismatch";
642
+ readonly msg = "The declared program id does not match the actual program id";
643
643
 
644
644
  constructor(readonly logs?: string[]) {
645
- super("4100: The declared program id does not match the actual program id")
645
+ super("4100: The declared program id does not match the actual program id");
646
646
  }
647
647
  }
648
648
 
649
649
  export class Deprecated extends Error {
650
- static readonly code = 5000
651
- readonly code = 5000
652
- readonly name = "Deprecated"
653
- readonly msg = "The API being used is deprecated and should no longer be used"
650
+ static readonly code = 5000;
651
+ readonly code = 5000;
652
+ override readonly name = "Deprecated";
653
+ readonly msg =
654
+ "The API being used is deprecated and should no longer be used";
654
655
 
655
656
  constructor(readonly logs?: string[]) {
656
- super("5000: The API being used is deprecated and should no longer be used")
657
+ super(
658
+ "5000: The API being used is deprecated and should no longer be used"
659
+ );
657
660
  }
658
661
  }
659
662
 
660
663
  export function fromCode(code: number, logs?: string[]): AnchorError | null {
661
664
  switch (code) {
662
665
  case 100:
663
- return new InstructionMissing(logs)
666
+ return new InstructionMissing(logs);
664
667
  case 101:
665
- return new InstructionFallbackNotFound(logs)
668
+ return new InstructionFallbackNotFound(logs);
666
669
  case 102:
667
- return new InstructionDidNotDeserialize(logs)
670
+ return new InstructionDidNotDeserialize(logs);
668
671
  case 103:
669
- return new InstructionDidNotSerialize(logs)
672
+ return new InstructionDidNotSerialize(logs);
670
673
  case 1000:
671
- return new IdlInstructionStub(logs)
674
+ return new IdlInstructionStub(logs);
672
675
  case 1001:
673
- return new IdlInstructionInvalidProgram(logs)
676
+ return new IdlInstructionInvalidProgram(logs);
674
677
  case 2000:
675
- return new ConstraintMut(logs)
678
+ return new ConstraintMut(logs);
676
679
  case 2001:
677
- return new ConstraintHasOne(logs)
680
+ return new ConstraintHasOne(logs);
678
681
  case 2002:
679
- return new ConstraintSigner(logs)
682
+ return new ConstraintSigner(logs);
680
683
  case 2003:
681
- return new ConstraintRaw(logs)
684
+ return new ConstraintRaw(logs);
682
685
  case 2004:
683
- return new ConstraintOwner(logs)
686
+ return new ConstraintOwner(logs);
684
687
  case 2005:
685
- return new ConstraintRentExempt(logs)
688
+ return new ConstraintRentExempt(logs);
686
689
  case 2006:
687
- return new ConstraintSeeds(logs)
690
+ return new ConstraintSeeds(logs);
688
691
  case 2007:
689
- return new ConstraintExecutable(logs)
692
+ return new ConstraintExecutable(logs);
690
693
  case 2008:
691
- return new ConstraintState(logs)
694
+ return new ConstraintState(logs);
692
695
  case 2009:
693
- return new ConstraintAssociated(logs)
696
+ return new ConstraintAssociated(logs);
694
697
  case 2010:
695
- return new ConstraintAssociatedInit(logs)
698
+ return new ConstraintAssociatedInit(logs);
696
699
  case 2011:
697
- return new ConstraintClose(logs)
700
+ return new ConstraintClose(logs);
698
701
  case 2012:
699
- return new ConstraintAddress(logs)
702
+ return new ConstraintAddress(logs);
700
703
  case 2013:
701
- return new ConstraintZero(logs)
704
+ return new ConstraintZero(logs);
702
705
  case 2014:
703
- return new ConstraintTokenMint(logs)
706
+ return new ConstraintTokenMint(logs);
704
707
  case 2015:
705
- return new ConstraintTokenOwner(logs)
708
+ return new ConstraintTokenOwner(logs);
706
709
  case 2016:
707
- return new ConstraintMintMintAuthority(logs)
710
+ return new ConstraintMintMintAuthority(logs);
708
711
  case 2017:
709
- return new ConstraintMintFreezeAuthority(logs)
712
+ return new ConstraintMintFreezeAuthority(logs);
710
713
  case 2018:
711
- return new ConstraintMintDecimals(logs)
714
+ return new ConstraintMintDecimals(logs);
712
715
  case 2019:
713
- return new ConstraintSpace(logs)
716
+ return new ConstraintSpace(logs);
714
717
  case 2020:
715
- return new ConstraintAccountIsNone(logs)
718
+ return new ConstraintAccountIsNone(logs);
716
719
  case 2500:
717
- return new RequireViolated(logs)
720
+ return new RequireViolated(logs);
718
721
  case 2501:
719
- return new RequireEqViolated(logs)
722
+ return new RequireEqViolated(logs);
720
723
  case 2502:
721
- return new RequireKeysEqViolated(logs)
724
+ return new RequireKeysEqViolated(logs);
722
725
  case 2503:
723
- return new RequireNeqViolated(logs)
726
+ return new RequireNeqViolated(logs);
724
727
  case 2504:
725
- return new RequireKeysNeqViolated(logs)
728
+ return new RequireKeysNeqViolated(logs);
726
729
  case 2505:
727
- return new RequireGtViolated(logs)
730
+ return new RequireGtViolated(logs);
728
731
  case 2506:
729
- return new RequireGteViolated(logs)
732
+ return new RequireGteViolated(logs);
730
733
  case 3000:
731
- return new AccountDiscriminatorAlreadySet(logs)
734
+ return new AccountDiscriminatorAlreadySet(logs);
732
735
  case 3001:
733
- return new AccountDiscriminatorNotFound(logs)
736
+ return new AccountDiscriminatorNotFound(logs);
734
737
  case 3002:
735
- return new AccountDiscriminatorMismatch(logs)
738
+ return new AccountDiscriminatorMismatch(logs);
736
739
  case 3003:
737
- return new AccountDidNotDeserialize(logs)
740
+ return new AccountDidNotDeserialize(logs);
738
741
  case 3004:
739
- return new AccountDidNotSerialize(logs)
742
+ return new AccountDidNotSerialize(logs);
740
743
  case 3005:
741
- return new AccountNotEnoughKeys(logs)
744
+ return new AccountNotEnoughKeys(logs);
742
745
  case 3006:
743
- return new AccountNotMutable(logs)
746
+ return new AccountNotMutable(logs);
744
747
  case 3007:
745
- return new AccountOwnedByWrongProgram(logs)
748
+ return new AccountOwnedByWrongProgram(logs);
746
749
  case 3008:
747
- return new InvalidProgramId(logs)
750
+ return new InvalidProgramId(logs);
748
751
  case 3009:
749
- return new InvalidProgramExecutable(logs)
752
+ return new InvalidProgramExecutable(logs);
750
753
  case 3010:
751
- return new AccountNotSigner(logs)
754
+ return new AccountNotSigner(logs);
752
755
  case 3011:
753
- return new AccountNotSystemOwned(logs)
756
+ return new AccountNotSystemOwned(logs);
754
757
  case 3012:
755
- return new AccountNotInitialized(logs)
758
+ return new AccountNotInitialized(logs);
756
759
  case 3013:
757
- return new AccountNotProgramData(logs)
760
+ return new AccountNotProgramData(logs);
758
761
  case 3014:
759
- return new AccountNotAssociatedTokenAccount(logs)
762
+ return new AccountNotAssociatedTokenAccount(logs);
760
763
  case 3015:
761
- return new AccountSysvarMismatch(logs)
764
+ return new AccountSysvarMismatch(logs);
762
765
  case 3016:
763
- return new AccountReallocExceedsLimit(logs)
766
+ return new AccountReallocExceedsLimit(logs);
764
767
  case 3017:
765
- return new AccountDuplicateReallocs(logs)
768
+ return new AccountDuplicateReallocs(logs);
766
769
  case 4100:
767
- return new DeclaredProgramIdMismatch(logs)
770
+ return new DeclaredProgramIdMismatch(logs);
768
771
  case 5000:
769
- return new Deprecated(logs)
772
+ return new Deprecated(logs);
770
773
  }
771
774
 
772
- return null
775
+ return null;
773
776
  }
package/tsconfig.json CHANGED
@@ -1,12 +1,29 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es6",
3
+ "target": "es2020",
4
4
  "module": "commonjs",
5
+ "lib": ["es2020", "dom"],
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
5
11
  "strict": true,
12
+ "noImplicitAny": true,
13
+ "strictBindCallApply": true,
14
+ "strictPropertyInitialization": true,
15
+ "noImplicitThis": true,
16
+ "useUnknownInCatchVariables": true,
17
+ "alwaysStrict": true,
18
+ "exactOptionalPropertyTypes": true,
19
+ "noImplicitReturns": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noImplicitOverride": true,
6
22
  "esModuleInterop": true,
7
- "outDir": "./dist",
8
- "declaration": true
23
+ "forceConsistentCasingInFileNames": true,
24
+ "skipLibCheck": true,
25
+ "resolveJsonModule": true,
9
26
  },
10
- "include": ["src"],
11
- "exclude": ["node_modules"]
12
- }
27
+ "include": ["src/**/*"],
28
+ "exclude": ["node_modules", "dist", "**/*.test.ts"]
29
+ }