@typesol/cli 0.16.0 → 0.18.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/CHANGELOG.md +121 -0
- package/README.md +4 -4
- package/dist/clientgen.js +39 -0
- package/dist/compiler/analyze.d.ts +16 -1
- package/dist/compiler/analyze.js +355 -43
- package/dist/compiler/emit/base.d.ts +36 -1
- package/dist/compiler/emit/base.js +135 -4
- package/dist/compiler/emit/borsh.d.ts +13 -0
- package/dist/compiler/emit/borsh.js +298 -0
- package/dist/compiler/emit/calls.d.ts +2 -3
- package/dist/compiler/emit/calls.js +135 -29
- package/dist/compiler/emit/cpi.d.ts +62 -8
- package/dist/compiler/emit/cpi.js +1458 -40
- package/dist/compiler/emit/expressions.d.ts +5 -0
- package/dist/compiler/emit/expressions.js +85 -5
- package/dist/compiler/emit/function.js +82 -14
- package/dist/compiler/emit/program.js +24 -6
- package/dist/compiler/emit/shared.d.ts +20 -0
- package/dist/compiler/emit/shared.js +23 -3
- package/dist/compiler/emit/statements.d.ts +21 -0
- package/dist/compiler/emit/statements.js +380 -19
- package/dist/compiler/emit/storage.d.ts +6 -0
- package/dist/compiler/emit/storage.js +88 -16
- package/dist/compiler/idl.js +37 -5
- package/dist/compiler/model.d.ts +70 -4
- package/dist/compiler/model.js +8 -2
- package/dist/portgen.js +90 -4
- package/docs/errors.md +6 -4
- package/docs/language.md +32 -20
- package/docs/migrate-from-anchor.md +24 -7
- package/docs/test-your-program.md +1 -1
- package/lib/typesol.d.ts +652 -21
- package/package.json +1 -1
- package/runtime/typesol_rt.h +230 -7
package/lib/typesol.d.ts
CHANGED
|
@@ -31,7 +31,28 @@ export interface Pubkey {
|
|
|
31
31
|
* A fixed-length array stored inline in account data, e.g. `scores: FixedArray<u64, 8>`.
|
|
32
32
|
* Indexes are bounds-checked; out of range aborts the instruction.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Callback methods of Vec, FixedArray and FixedVec. Each expands into a loop over the elements (as `list.get(i)` gives
|
|
36
|
+
* them: structs by reference) with the arrow written at the call; it may read and write the function's variables.
|
|
37
|
+
*/
|
|
38
|
+
export interface ListMethods<T> {
|
|
39
|
+
forEach(fn: (x: T, index: u64) => void): void;
|
|
40
|
+
/** Whether `fn` holds for some element (stops at the first). */
|
|
41
|
+
some(fn: (x: T, index: u64) => boolean): boolean;
|
|
42
|
+
/** Whether `fn` holds for every element (stops at the first that fails). */
|
|
43
|
+
every(fn: (x: T, index: u64) => boolean): boolean;
|
|
44
|
+
/** The first element `fn` holds for, or null (integer, boolean, Pubkey and enum elements). */
|
|
45
|
+
find(fn: (x: T, index: u64) => boolean): T | null;
|
|
46
|
+
/** The index of the first element `fn` holds for, or -1. */
|
|
47
|
+
findIndex(fn: (x: T, index: u64) => boolean): i64;
|
|
48
|
+
reduce<A>(fn: (acc: A, x: T, index: u64) => A, initial: A): A;
|
|
49
|
+
/** Whether an element equals `value` (===). */
|
|
50
|
+
includes(value: T): boolean;
|
|
51
|
+
/** The index of the first element equal to `value`, or -1. */
|
|
52
|
+
indexOf(value: T): i64;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface FixedArray<T, N extends number> extends ListMethods<T> {
|
|
35
56
|
readonly length: u64;
|
|
36
57
|
get(index: bigint): T;
|
|
37
58
|
set(index: bigint, value: T): void;
|
|
@@ -63,7 +84,7 @@ export type Option<T> = T | null;
|
|
|
63
84
|
* A growable list. As the last field of an account struct it is stored Borsh-style (u32 length + elements)
|
|
64
85
|
* and the account is resized as it grows. As an instruction argument it is a read-only view.
|
|
65
86
|
*/
|
|
66
|
-
export interface Vec<T> {
|
|
87
|
+
export interface Vec<T> extends ListMethods<T> {
|
|
67
88
|
readonly length: u64;
|
|
68
89
|
get(index: bigint): T;
|
|
69
90
|
set(index: bigint, value: T): void;
|
|
@@ -77,6 +98,24 @@ export interface Vec<T> {
|
|
|
77
98
|
[Symbol.iterator](): Iterator<T>;
|
|
78
99
|
}
|
|
79
100
|
|
|
101
|
+
/**
|
|
102
|
+
* A list stored inline with room for N elements: a u32 length, then N slots (Anchor `Vec<T>` with `#[max_len(N)]`, but
|
|
103
|
+
* always 4 + N × size(T) bytes). Unlike `Vec<T>` it can be any field, any number of times, and in nested structs;
|
|
104
|
+
* `push` fails (5104) when it is full. Write a whole one with `fixedVec([a, b])`.
|
|
105
|
+
*/
|
|
106
|
+
export interface FixedVec<T, N extends number> extends ListMethods<T> {
|
|
107
|
+
readonly length: u64;
|
|
108
|
+
get(index: bigint): T;
|
|
109
|
+
set(index: bigint, value: T): void;
|
|
110
|
+
push(value: T): void;
|
|
111
|
+
pop(): T;
|
|
112
|
+
clear(): void;
|
|
113
|
+
[Symbol.iterator](): Iterator<T>;
|
|
114
|
+
readonly __capacity?: N;
|
|
115
|
+
}
|
|
116
|
+
/** A FixedVec value holding these elements (`acct.owners = fixedVec([a, b])`, `{ owners: fixedVec([]) }`). */
|
|
117
|
+
export declare function fixedVec<T>(items: T[]): FixedVec<T, never>;
|
|
118
|
+
|
|
80
119
|
/** One extra account passed after the declared ones. Nothing about it is checked until you check it. */
|
|
81
120
|
export interface RemainingAccount {
|
|
82
121
|
readonly key: Pubkey;
|
|
@@ -233,7 +272,10 @@ export interface TokenMetadataProgram extends AccountMeta {
|
|
|
233
272
|
isMutable: boolean,
|
|
234
273
|
signerSeeds?: Seed[] | SignerSeeds,
|
|
235
274
|
): void;
|
|
236
|
-
/**
|
|
275
|
+
/**
|
|
276
|
+
* With creators (1–5, shares adding up to 100), an unverified collection mint, and/or `isCollection: true`
|
|
277
|
+
* (CollectionDetails::V1: this NFT is a sized collection other NFTs are verified into).
|
|
278
|
+
*/
|
|
237
279
|
createV3(
|
|
238
280
|
metadata: AccountMeta,
|
|
239
281
|
mint: AccountMeta,
|
|
@@ -246,10 +288,42 @@ export interface TokenMetadataProgram extends AccountMeta {
|
|
|
246
288
|
uri: string,
|
|
247
289
|
sellerFeeBasisPoints: u16,
|
|
248
290
|
isMutable: boolean,
|
|
249
|
-
extras: { creators?: MetadataCreator[]; collection?: Pubkey },
|
|
291
|
+
extras: { creators?: MetadataCreator[]; collection?: Pubkey; isCollection?: boolean },
|
|
292
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
293
|
+
): void;
|
|
294
|
+
/**
|
|
295
|
+
* CreateMasterEditionV3: makes `mint` (supply 1, decimals 0) a master edition; the mint and freeze authorities move
|
|
296
|
+
* to the edition. `maxSupply` 0n is a one of one, `null` allows unlimited prints.
|
|
297
|
+
*/
|
|
298
|
+
createMasterEditionV3(
|
|
299
|
+
edition: AccountMeta,
|
|
300
|
+
mint: AccountMeta,
|
|
301
|
+
updateAuthority: AccountMeta,
|
|
302
|
+
mintAuthority: AccountMeta,
|
|
303
|
+
payer: Mut<Signer>,
|
|
304
|
+
metadata: AccountMeta,
|
|
305
|
+
tokenProgram: TokenProgram,
|
|
306
|
+
systemProgram: SystemProgram,
|
|
307
|
+
maxSupply: u64 | null,
|
|
308
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
309
|
+
): void;
|
|
310
|
+
/**
|
|
311
|
+
* Verify with CollectionV1: marks `metadata`'s collection (set with createV3's `collection`) verified. `authority` is
|
|
312
|
+
* the collection's update authority; the collection is a master edition created with `isCollection: true`.
|
|
313
|
+
*/
|
|
314
|
+
verifyCollection(
|
|
315
|
+
authority: AccountMeta,
|
|
316
|
+
metadata: AccountMeta,
|
|
317
|
+
collectionMint: AccountMeta,
|
|
318
|
+
collectionMetadata: AccountMeta,
|
|
319
|
+
collectionMasterEdition: AccountMeta,
|
|
320
|
+
systemProgram: SystemProgram,
|
|
321
|
+
instructionsSysvar: AccountMeta,
|
|
250
322
|
signerSeeds?: Seed[] | SignerSeeds,
|
|
251
323
|
): void;
|
|
252
324
|
}
|
|
325
|
+
/** The Metaplex master edition address of a mint (PDA ["metadata", program, mint, "edition"]). */
|
|
326
|
+
export declare function masterEditionAddress(mint: Pubkey): Pubkey;
|
|
253
327
|
/** The canonical program address of `seeds` under `program` (Rust `Pubkey::find_program_address(seeds, program).0`). */
|
|
254
328
|
export declare function findProgramAddress(seeds: Seed[], program: Pubkey): Pubkey;
|
|
255
329
|
/** The Metaplex metadata account address of a mint. */
|
|
@@ -350,6 +424,13 @@ export declare function realloc(account: AccountMeta, newSize: u64, payer: Mut<S
|
|
|
350
424
|
export declare function transferFee(mint: AccountMeta | RemainingAccount, amount: u64): u64;
|
|
351
425
|
/** The TransferHook extension's program, if any. */
|
|
352
426
|
export declare function transferHookProgram(mint: AccountMeta | RemainingAccount): Option<Pubkey>;
|
|
427
|
+
/** The TransferHook extension's authority (who may change the hook program), if any. */
|
|
428
|
+
export declare function transferHookAuthority(mint: AccountMeta | RemainingAccount): Option<Pubkey>;
|
|
429
|
+
/**
|
|
430
|
+
* Whether Token-2022 is transferring from this token account right now (its TransferHookAccount `transferring` flag):
|
|
431
|
+
* true inside a transfer hook called by Token-2022, false when the hook is invoked directly.
|
|
432
|
+
*/
|
|
433
|
+
export declare function isTransferring(tokenAccount: AccountMeta | RemainingAccount): boolean;
|
|
353
434
|
/** The PermanentDelegate extension's delegate, if any (it can move or burn anyone's tokens). */
|
|
354
435
|
export declare function permanentDelegate(mint: AccountMeta | RemainingAccount): Option<Pubkey>;
|
|
355
436
|
/** The MintCloseAuthority extension's authority, if any. */
|
|
@@ -368,6 +449,11 @@ export interface Signer extends AccountMeta {
|
|
|
368
449
|
readonly __signer: void;
|
|
369
450
|
}
|
|
370
451
|
|
|
452
|
+
/** An account owned by the System Program, e.g. a wallet (Anchor `SystemAccount`; 3011 otherwise). `Mut<SystemAccount>` to change lamports. */
|
|
453
|
+
export interface SystemAccount extends AccountMeta {
|
|
454
|
+
readonly __systemAccount?: void;
|
|
455
|
+
}
|
|
456
|
+
|
|
371
457
|
/** Any account, no ownership or data checks. Wrap in `Mut<AccountInfo>` to change lamports. */
|
|
372
458
|
export interface AccountInfo extends AccountMeta {
|
|
373
459
|
readonly __info: void;
|
|
@@ -407,13 +493,39 @@ export type InitIfNeeded<T> = T extends TokenAccount
|
|
|
407
493
|
* An existing account must be that ATA, of that mint and owner.
|
|
408
494
|
*/
|
|
409
495
|
createIfNeeded(payer: Mut<Signer>): boolean;
|
|
496
|
+
/**
|
|
497
|
+
* Anchor `init_if_needed` + `token::…`: create it as `create(payer, seeds, mint, authority)` does unless it exists;
|
|
498
|
+
* an existing one must be that PDA, a token account of `mint` owned by `authority`. True when it created it now.
|
|
499
|
+
*/
|
|
500
|
+
createIfNeeded(
|
|
501
|
+
payer: Mut<Signer>,
|
|
502
|
+
seeds: Seed[] | null,
|
|
503
|
+
mint: AccountMeta,
|
|
504
|
+
authority: Pubkey,
|
|
505
|
+
tokenProgram?: TokenProgram | Token2022Program | TokenInterface,
|
|
506
|
+
): boolean;
|
|
507
|
+
readonly pdaBump: u8;
|
|
410
508
|
}
|
|
411
|
-
: T
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
509
|
+
: T extends Mint
|
|
510
|
+
? T & {
|
|
511
|
+
/** Anchor `init_if_needed` + `mint::…`: an existing mint must have these decimals and authorities. */
|
|
512
|
+
createIfNeeded(
|
|
513
|
+
payer: Mut<Signer>,
|
|
514
|
+
seeds: Seed[] | null,
|
|
515
|
+
decimals: u8,
|
|
516
|
+
mintAuthority: Pubkey,
|
|
517
|
+
freezeAuthority: Pubkey | null,
|
|
518
|
+
tokenProgram?: TokenProgram | Token2022Program | TokenInterface,
|
|
519
|
+
): boolean;
|
|
415
520
|
readonly pdaBump: u8;
|
|
416
|
-
}
|
|
521
|
+
}
|
|
522
|
+
: T &
|
|
523
|
+
AccountMeta & {
|
|
524
|
+
/** Like create(payer, seeds, space?), unless the account exists (then it must be this PDA and a T). */
|
|
525
|
+
createIfNeeded(payer: Mut<Signer>, seeds: Seed[], space?: u64): boolean;
|
|
526
|
+
/** The PDA bump, after createIfNeeded(). */
|
|
527
|
+
readonly pdaBump: u8;
|
|
528
|
+
};
|
|
417
529
|
|
|
418
530
|
/**
|
|
419
531
|
* Declarative constraints, checked before your code runs (like Anchor's account attributes):
|
|
@@ -473,9 +585,47 @@ export declare function emitCpi<T>(event: T, eventAuthority: EventAuthority, sel
|
|
|
473
585
|
* account out. Accounts that sign (the new asset/collection, authorities) are keypair Signers, or PDAs of this
|
|
474
586
|
* program covered by `signerSeeds`.
|
|
475
587
|
*/
|
|
588
|
+
/**
|
|
589
|
+
* Who manages a Metaplex Core plugin: `"owner"`, `"updateAuthority"`, `"none"` (nobody: fixed), or an address. Left out,
|
|
590
|
+
* the plugin type's default (the owner for owner-managed plugins, the update authority for the others).
|
|
591
|
+
*/
|
|
592
|
+
export type CorePluginAuthority = "none" | "owner" | "updateAuthority" | Pubkey;
|
|
593
|
+
/** A Metaplex Core plugin, written as an object literal (Core's Plugin enum, with its authority when it is added). */
|
|
594
|
+
export type CorePlugin = (
|
|
595
|
+
| {
|
|
596
|
+
kind: "Royalties";
|
|
597
|
+
basisPoints: u16;
|
|
598
|
+
creators: { address: Pubkey; percentage: u8 }[];
|
|
599
|
+
/** Programs allowed (or denied) to move the asset; none by default. */
|
|
600
|
+
ruleSet?: { programAllowList: Pubkey[] } | { programDenyList: Pubkey[] };
|
|
601
|
+
}
|
|
602
|
+
| { kind: "FreezeDelegate"; frozen: boolean }
|
|
603
|
+
| { kind: "BurnDelegate" }
|
|
604
|
+
| { kind: "TransferDelegate" }
|
|
605
|
+
| { kind: "UpdateDelegate"; additionalDelegates?: Pubkey[] }
|
|
606
|
+
| { kind: "PermanentFreezeDelegate"; frozen: boolean }
|
|
607
|
+
| { kind: "Attributes"; attributes: { key: string; value: string }[] }
|
|
608
|
+
| { kind: "PermanentTransferDelegate" }
|
|
609
|
+
| { kind: "PermanentBurnDelegate" }
|
|
610
|
+
| { kind: "Edition"; number: u32 }
|
|
611
|
+
| { kind: "AddBlocker" }
|
|
612
|
+
| { kind: "ImmutableMetadata" }
|
|
613
|
+
/** On a collection: lets Bubblegum mint compressed NFTs into it (mintV2 with a collection). */
|
|
614
|
+
| { kind: "BubblegumV2" }
|
|
615
|
+
| { kind: "MasterEdition"; maxSupply?: u32 | null; name?: string | null; uri?: string | null }
|
|
616
|
+
| { kind: "VerifiedCreators"; signatures: { address: Pubkey; verified: boolean }[] }
|
|
617
|
+
| { kind: "Autograph"; signatures: { address: Pubkey; message: string }[] }
|
|
618
|
+
| { kind: "FreezeExecute"; frozen: boolean }
|
|
619
|
+
| { kind: "PermanentFreezeExecute"; frozen: boolean }
|
|
620
|
+
) & { authority?: CorePluginAuthority };
|
|
621
|
+
export type CorePluginKind = CorePlugin["kind"] | "Groups";
|
|
622
|
+
|
|
476
623
|
export interface MplCoreProgram extends AccountMeta {
|
|
477
624
|
readonly __mpl_core: void;
|
|
478
|
-
/**
|
|
625
|
+
/**
|
|
626
|
+
* CreateV1. In a collection, `authority` is the collection's update authority; `owner` defaults to the payer.
|
|
627
|
+
* `plugins` (a literal list, one of each kind) are created with the asset.
|
|
628
|
+
*/
|
|
479
629
|
createAsset(
|
|
480
630
|
asset: AccountMeta,
|
|
481
631
|
collection: AccountMeta | null,
|
|
@@ -487,6 +637,18 @@ export interface MplCoreProgram extends AccountMeta {
|
|
|
487
637
|
uri: string,
|
|
488
638
|
signerSeeds?: Seed[] | SignerSeeds,
|
|
489
639
|
): void;
|
|
640
|
+
createAsset(
|
|
641
|
+
asset: AccountMeta,
|
|
642
|
+
collection: AccountMeta | null,
|
|
643
|
+
authority: AccountMeta | null,
|
|
644
|
+
payer: Mut<Signer>,
|
|
645
|
+
owner: AccountMeta | null,
|
|
646
|
+
systemProgram: SystemProgram,
|
|
647
|
+
name: string,
|
|
648
|
+
uri: string,
|
|
649
|
+
plugins: CorePlugin[],
|
|
650
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
651
|
+
): void;
|
|
490
652
|
createCollection(
|
|
491
653
|
collection: AccountMeta,
|
|
492
654
|
updateAuthority: AccountMeta | null,
|
|
@@ -496,6 +658,70 @@ export interface MplCoreProgram extends AccountMeta {
|
|
|
496
658
|
uri: string,
|
|
497
659
|
signerSeeds?: Seed[] | SignerSeeds,
|
|
498
660
|
): void;
|
|
661
|
+
/** With plugins every asset of the collection inherits (Royalties, PermanentFreezeDelegate, …). */
|
|
662
|
+
createCollection(
|
|
663
|
+
collection: AccountMeta,
|
|
664
|
+
updateAuthority: AccountMeta | null,
|
|
665
|
+
payer: Mut<Signer>,
|
|
666
|
+
systemProgram: SystemProgram,
|
|
667
|
+
name: string,
|
|
668
|
+
uri: string,
|
|
669
|
+
plugins: CorePlugin[],
|
|
670
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
671
|
+
): void;
|
|
672
|
+
/** AddPluginV1, signed by `authority` (`null`: the payer): the owner for owner-managed plugins, else the update authority. */
|
|
673
|
+
addPlugin(
|
|
674
|
+
asset: AccountMeta,
|
|
675
|
+
collection: AccountMeta | null,
|
|
676
|
+
payer: Mut<Signer>,
|
|
677
|
+
authority: AccountMeta | null,
|
|
678
|
+
systemProgram: SystemProgram,
|
|
679
|
+
plugin: CorePlugin,
|
|
680
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
681
|
+
): void;
|
|
682
|
+
/** UpdatePluginV1: new values for a plugin the asset has (no `authority`), e.g. `{ kind: "FreezeDelegate", frozen: true }`. */
|
|
683
|
+
updatePlugin(
|
|
684
|
+
asset: AccountMeta,
|
|
685
|
+
collection: AccountMeta | null,
|
|
686
|
+
payer: Mut<Signer>,
|
|
687
|
+
authority: AccountMeta | null,
|
|
688
|
+
systemProgram: SystemProgram,
|
|
689
|
+
plugin: CorePlugin,
|
|
690
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
691
|
+
): void;
|
|
692
|
+
removePlugin(
|
|
693
|
+
asset: AccountMeta,
|
|
694
|
+
collection: AccountMeta | null,
|
|
695
|
+
payer: Mut<Signer>,
|
|
696
|
+
authority: AccountMeta | null,
|
|
697
|
+
systemProgram: SystemProgram,
|
|
698
|
+
kind: CorePluginKind,
|
|
699
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
700
|
+
): void;
|
|
701
|
+
addCollectionPlugin(
|
|
702
|
+
collection: AccountMeta,
|
|
703
|
+
payer: Mut<Signer>,
|
|
704
|
+
authority: AccountMeta | null,
|
|
705
|
+
systemProgram: SystemProgram,
|
|
706
|
+
plugin: CorePlugin,
|
|
707
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
708
|
+
): void;
|
|
709
|
+
updateCollectionPlugin(
|
|
710
|
+
collection: AccountMeta,
|
|
711
|
+
payer: Mut<Signer>,
|
|
712
|
+
authority: AccountMeta | null,
|
|
713
|
+
systemProgram: SystemProgram,
|
|
714
|
+
plugin: CorePlugin,
|
|
715
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
716
|
+
): void;
|
|
717
|
+
removeCollectionPlugin(
|
|
718
|
+
collection: AccountMeta,
|
|
719
|
+
payer: Mut<Signer>,
|
|
720
|
+
authority: AccountMeta | null,
|
|
721
|
+
systemProgram: SystemProgram,
|
|
722
|
+
kind: CorePluginKind,
|
|
723
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
724
|
+
): void;
|
|
499
725
|
/** TransferV1, signed by the owner (or a delegate) as `authority` (`null`: the payer). */
|
|
500
726
|
transferAsset(
|
|
501
727
|
asset: AccountMeta,
|
|
@@ -548,6 +774,311 @@ export interface BubblegumProgram extends AccountMeta {
|
|
|
548
774
|
sellerFeeBasisPoints: u16,
|
|
549
775
|
signerSeeds?: Seed[] | SignerSeeds,
|
|
550
776
|
): void;
|
|
777
|
+
/**
|
|
778
|
+
* CreateTreeConfigV2: a tree on mpl-account-compression (mcmt6…, allocated by the client and owned by it) with the
|
|
779
|
+
* mpl-noop log wrapper (mnoop…). `treeCreator` `null`: the payer.
|
|
780
|
+
*/
|
|
781
|
+
createTreeV2(
|
|
782
|
+
treeConfig: AccountMeta,
|
|
783
|
+
merkleTree: AccountMeta,
|
|
784
|
+
payer: Mut<Signer>,
|
|
785
|
+
treeCreator: AccountMeta | null,
|
|
786
|
+
logWrapper: AccountMeta,
|
|
787
|
+
compressionProgram: AccountMeta,
|
|
788
|
+
systemProgram: SystemProgram,
|
|
789
|
+
maxDepth: u32,
|
|
790
|
+
maxBufferSize: u32,
|
|
791
|
+
isPublic: boolean,
|
|
792
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
793
|
+
): void;
|
|
794
|
+
/** MintV2 of a leaf, optionally into a Metaplex Core collection (whose update authority signs as `authority`). */
|
|
795
|
+
mintV2(
|
|
796
|
+
treeConfig: AccountMeta,
|
|
797
|
+
payer: Mut<Signer>,
|
|
798
|
+
treeDelegate: AccountMeta | null,
|
|
799
|
+
leafOwner: AccountMeta,
|
|
800
|
+
leafDelegate: AccountMeta | null,
|
|
801
|
+
merkleTree: AccountMeta,
|
|
802
|
+
logWrapper: AccountMeta,
|
|
803
|
+
compressionProgram: AccountMeta,
|
|
804
|
+
mplCoreProgram: AccountMeta,
|
|
805
|
+
systemProgram: SystemProgram,
|
|
806
|
+
metadata: CompressedMetadata,
|
|
807
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
808
|
+
): void;
|
|
809
|
+
mintV2(
|
|
810
|
+
treeConfig: AccountMeta,
|
|
811
|
+
payer: Mut<Signer>,
|
|
812
|
+
treeDelegate: AccountMeta | null,
|
|
813
|
+
leafOwner: AccountMeta,
|
|
814
|
+
leafDelegate: AccountMeta | null,
|
|
815
|
+
merkleTree: AccountMeta,
|
|
816
|
+
logWrapper: AccountMeta,
|
|
817
|
+
compressionProgram: AccountMeta,
|
|
818
|
+
mplCoreProgram: AccountMeta,
|
|
819
|
+
systemProgram: SystemProgram,
|
|
820
|
+
metadata: CompressedMetadata,
|
|
821
|
+
collection: { collection: AccountMeta; authority: AccountMeta; cpiSigner: AccountMeta },
|
|
822
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
823
|
+
): void;
|
|
824
|
+
/** TransferV2, signed by the owner or delegate as `authority` (`null`: the payer); `proof` is the leaf's Merkle proof. */
|
|
825
|
+
transferV2(
|
|
826
|
+
treeConfig: AccountMeta,
|
|
827
|
+
payer: Mut<Signer>,
|
|
828
|
+
authority: AccountMeta | null,
|
|
829
|
+
leafOwner: AccountMeta,
|
|
830
|
+
leafDelegate: AccountMeta | null,
|
|
831
|
+
newLeafOwner: AccountMeta,
|
|
832
|
+
merkleTree: AccountMeta,
|
|
833
|
+
coreCollection: AccountMeta | null,
|
|
834
|
+
logWrapper: AccountMeta,
|
|
835
|
+
compressionProgram: AccountMeta,
|
|
836
|
+
systemProgram: SystemProgram,
|
|
837
|
+
leaf: CompressedLeaf,
|
|
838
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
839
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
840
|
+
): void;
|
|
841
|
+
burnV2(
|
|
842
|
+
treeConfig: AccountMeta,
|
|
843
|
+
payer: Mut<Signer>,
|
|
844
|
+
authority: AccountMeta | null,
|
|
845
|
+
leafOwner: AccountMeta,
|
|
846
|
+
leafDelegate: AccountMeta | null,
|
|
847
|
+
merkleTree: AccountMeta,
|
|
848
|
+
coreCollection: AccountMeta | null,
|
|
849
|
+
mplCoreCpiSigner: AccountMeta | null,
|
|
850
|
+
logWrapper: AccountMeta,
|
|
851
|
+
compressionProgram: AccountMeta,
|
|
852
|
+
mplCoreProgram: AccountMeta,
|
|
853
|
+
systemProgram: SystemProgram,
|
|
854
|
+
leaf: CompressedLeaf,
|
|
855
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
856
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
857
|
+
): void;
|
|
858
|
+
/** DelegateV2: the owner (null: the payer) sets a new leaf delegate. */
|
|
859
|
+
delegateV2(
|
|
860
|
+
treeConfig: AccountMeta,
|
|
861
|
+
payer: Mut<Signer>,
|
|
862
|
+
leafOwner: AccountMeta | null,
|
|
863
|
+
previousLeafDelegate: AccountMeta | null,
|
|
864
|
+
newLeafDelegate: AccountMeta,
|
|
865
|
+
merkleTree: AccountMeta,
|
|
866
|
+
logWrapper: AccountMeta,
|
|
867
|
+
compressionProgram: AccountMeta,
|
|
868
|
+
systemProgram: SystemProgram,
|
|
869
|
+
leaf: CompressedLeaf & { collectionHash?: Hash | null },
|
|
870
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
871
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
872
|
+
): void;
|
|
873
|
+
/** FreezeV2 / ThawV2: the leaf delegate (as `authority`, null: the payer) freezes or thaws the leaf. */
|
|
874
|
+
freezeV2(
|
|
875
|
+
treeConfig: AccountMeta,
|
|
876
|
+
payer: Mut<Signer>,
|
|
877
|
+
authority: AccountMeta | null,
|
|
878
|
+
leafOwner: AccountMeta,
|
|
879
|
+
leafDelegate: AccountMeta,
|
|
880
|
+
merkleTree: AccountMeta,
|
|
881
|
+
coreCollection: AccountMeta | null,
|
|
882
|
+
logWrapper: AccountMeta,
|
|
883
|
+
compressionProgram: AccountMeta,
|
|
884
|
+
systemProgram: SystemProgram,
|
|
885
|
+
leaf: CompressedLeaf,
|
|
886
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
887
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
888
|
+
): void;
|
|
889
|
+
thawV2(
|
|
890
|
+
treeConfig: AccountMeta,
|
|
891
|
+
payer: Mut<Signer>,
|
|
892
|
+
authority: AccountMeta | null,
|
|
893
|
+
leafOwner: AccountMeta,
|
|
894
|
+
leafDelegate: AccountMeta,
|
|
895
|
+
merkleTree: AccountMeta,
|
|
896
|
+
coreCollection: AccountMeta | null,
|
|
897
|
+
logWrapper: AccountMeta,
|
|
898
|
+
compressionProgram: AccountMeta,
|
|
899
|
+
systemProgram: SystemProgram,
|
|
900
|
+
leaf: CompressedLeaf,
|
|
901
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
902
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
903
|
+
): void;
|
|
904
|
+
/** SetNonTransferableV2 (soulbound), by the collection's permanent freeze delegate. */
|
|
905
|
+
setNonTransferableV2(
|
|
906
|
+
treeConfig: AccountMeta,
|
|
907
|
+
payer: Mut<Signer>,
|
|
908
|
+
authority: AccountMeta | null,
|
|
909
|
+
leafOwner: AccountMeta,
|
|
910
|
+
leafDelegate: AccountMeta | null,
|
|
911
|
+
merkleTree: AccountMeta,
|
|
912
|
+
coreCollection: AccountMeta,
|
|
913
|
+
logWrapper: AccountMeta,
|
|
914
|
+
compressionProgram: AccountMeta,
|
|
915
|
+
systemProgram: SystemProgram,
|
|
916
|
+
leaf: CompressedLeaf,
|
|
917
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
918
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
919
|
+
): void;
|
|
920
|
+
/** UpdateMetadataV2: the tree creator / delegate (or the collection's update authority) changes the metadata. */
|
|
921
|
+
updateMetadataV2(
|
|
922
|
+
treeConfig: AccountMeta,
|
|
923
|
+
payer: Mut<Signer>,
|
|
924
|
+
authority: AccountMeta | null,
|
|
925
|
+
leafOwner: AccountMeta,
|
|
926
|
+
leafDelegate: AccountMeta | null,
|
|
927
|
+
merkleTree: AccountMeta,
|
|
928
|
+
coreCollection: AccountMeta | null,
|
|
929
|
+
logWrapper: AccountMeta,
|
|
930
|
+
compressionProgram: AccountMeta,
|
|
931
|
+
systemProgram: SystemProgram,
|
|
932
|
+
leaf: CompressedLeafRef,
|
|
933
|
+
currentMetadata: CompressedMetadataV2,
|
|
934
|
+
update: CompressedMetadataUpdate,
|
|
935
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
936
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
937
|
+
): void;
|
|
938
|
+
/** VerifyCreatorV2 / UnverifyCreatorV2: a creator (signing) marks itself verified or not. */
|
|
939
|
+
verifyCreatorV2(
|
|
940
|
+
treeConfig: AccountMeta,
|
|
941
|
+
payer: Mut<Signer>,
|
|
942
|
+
creator: AccountMeta | null,
|
|
943
|
+
leafOwner: AccountMeta,
|
|
944
|
+
leafDelegate: AccountMeta | null,
|
|
945
|
+
merkleTree: AccountMeta,
|
|
946
|
+
logWrapper: AccountMeta,
|
|
947
|
+
compressionProgram: AccountMeta,
|
|
948
|
+
systemProgram: SystemProgram,
|
|
949
|
+
leaf: CompressedLeafRef,
|
|
950
|
+
metadata: CompressedMetadataV2,
|
|
951
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
952
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
953
|
+
): void;
|
|
954
|
+
unverifyCreatorV2(
|
|
955
|
+
treeConfig: AccountMeta,
|
|
956
|
+
payer: Mut<Signer>,
|
|
957
|
+
creator: AccountMeta | null,
|
|
958
|
+
leafOwner: AccountMeta,
|
|
959
|
+
leafDelegate: AccountMeta | null,
|
|
960
|
+
merkleTree: AccountMeta,
|
|
961
|
+
logWrapper: AccountMeta,
|
|
962
|
+
compressionProgram: AccountMeta,
|
|
963
|
+
systemProgram: SystemProgram,
|
|
964
|
+
leaf: CompressedLeafRef,
|
|
965
|
+
metadata: CompressedMetadataV2,
|
|
966
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
967
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
968
|
+
): void;
|
|
969
|
+
/** SetCollectionV2: move the leaf into (or out of) a Core collection. */
|
|
970
|
+
setCollectionV2(
|
|
971
|
+
treeConfig: AccountMeta,
|
|
972
|
+
payer: Mut<Signer>,
|
|
973
|
+
authority: AccountMeta | null,
|
|
974
|
+
newCollectionAuthority: AccountMeta | null,
|
|
975
|
+
leafOwner: AccountMeta,
|
|
976
|
+
leafDelegate: AccountMeta | null,
|
|
977
|
+
merkleTree: AccountMeta,
|
|
978
|
+
coreCollection: AccountMeta | null,
|
|
979
|
+
newCoreCollection: AccountMeta | null,
|
|
980
|
+
mplCoreCpiSigner: AccountMeta | null,
|
|
981
|
+
logWrapper: AccountMeta,
|
|
982
|
+
compressionProgram: AccountMeta,
|
|
983
|
+
mplCoreProgram: AccountMeta,
|
|
984
|
+
systemProgram: SystemProgram,
|
|
985
|
+
leaf: CompressedLeafRef,
|
|
986
|
+
metadata: CompressedMetadataV2,
|
|
987
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
988
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
989
|
+
): void;
|
|
990
|
+
/**
|
|
991
|
+
* V1 trees (SPL Account Compression): Transfer / Burn, signed by the leaf owner or delegate (a PDA owner signs with
|
|
992
|
+
* `signerSeeds`), and Delegate by the owner.
|
|
993
|
+
*/
|
|
994
|
+
transfer(
|
|
995
|
+
treeConfig: AccountMeta,
|
|
996
|
+
leafOwner: AccountMeta,
|
|
997
|
+
leafDelegate: AccountMeta,
|
|
998
|
+
newLeafOwner: AccountMeta,
|
|
999
|
+
merkleTree: AccountMeta,
|
|
1000
|
+
logWrapper: AccountMeta,
|
|
1001
|
+
compressionProgram: AccountMeta,
|
|
1002
|
+
systemProgram: SystemProgram,
|
|
1003
|
+
leaf: CompressedLeafV1,
|
|
1004
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
1005
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
1006
|
+
): void;
|
|
1007
|
+
burn(
|
|
1008
|
+
treeConfig: AccountMeta,
|
|
1009
|
+
leafOwner: AccountMeta,
|
|
1010
|
+
leafDelegate: AccountMeta,
|
|
1011
|
+
merkleTree: AccountMeta,
|
|
1012
|
+
logWrapper: AccountMeta,
|
|
1013
|
+
compressionProgram: AccountMeta,
|
|
1014
|
+
systemProgram: SystemProgram,
|
|
1015
|
+
leaf: CompressedLeafV1,
|
|
1016
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
1017
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
1018
|
+
): void;
|
|
1019
|
+
delegate(
|
|
1020
|
+
treeConfig: AccountMeta,
|
|
1021
|
+
leafOwner: AccountMeta,
|
|
1022
|
+
previousLeafDelegate: AccountMeta,
|
|
1023
|
+
newLeafDelegate: AccountMeta,
|
|
1024
|
+
merkleTree: AccountMeta,
|
|
1025
|
+
logWrapper: AccountMeta,
|
|
1026
|
+
compressionProgram: AccountMeta,
|
|
1027
|
+
systemProgram: SystemProgram,
|
|
1028
|
+
leaf: CompressedLeafV1,
|
|
1029
|
+
proof: RemainingAccounts | RemainingSlice,
|
|
1030
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
1031
|
+
): void;
|
|
1032
|
+
}
|
|
1033
|
+
/** Bubblegum V2 leaf metadata (MetadataArgsV2): non-fungible, primary sale not happened, mutable unless `isMutable: false`. */
|
|
1034
|
+
export interface CompressedMetadata {
|
|
1035
|
+
name: string;
|
|
1036
|
+
symbol: string;
|
|
1037
|
+
uri: string;
|
|
1038
|
+
sellerFeeBasisPoints: u16;
|
|
1039
|
+
creators?: { address: Pubkey; verified: boolean; share: u8 }[];
|
|
1040
|
+
isMutable?: boolean;
|
|
1041
|
+
}
|
|
1042
|
+
/** A leaf whose data and creator hashes the instruction computes from the metadata passed with it. */
|
|
1043
|
+
export interface CompressedLeafRef {
|
|
1044
|
+
root: Hash;
|
|
1045
|
+
assetDataHash?: Hash | null;
|
|
1046
|
+
flags?: u8 | null;
|
|
1047
|
+
nonce: u64;
|
|
1048
|
+
index: u32;
|
|
1049
|
+
}
|
|
1050
|
+
/** A V1 tree's leaf. */
|
|
1051
|
+
export interface CompressedLeafV1 {
|
|
1052
|
+
root: Hash;
|
|
1053
|
+
dataHash: Hash;
|
|
1054
|
+
creatorHash: Hash;
|
|
1055
|
+
nonce: u64;
|
|
1056
|
+
index: u32;
|
|
1057
|
+
}
|
|
1058
|
+
/** A leaf's full MetadataArgsV2, as it is now (with its creators' verified flags and its collection). */
|
|
1059
|
+
export interface CompressedMetadataV2 extends CompressedMetadata {
|
|
1060
|
+
primarySaleHappened?: boolean;
|
|
1061
|
+
collection?: Pubkey | null;
|
|
1062
|
+
}
|
|
1063
|
+
/** UpdateArgs: what to change (left out: unchanged). */
|
|
1064
|
+
export interface CompressedMetadataUpdate {
|
|
1065
|
+
name?: string;
|
|
1066
|
+
symbol?: string;
|
|
1067
|
+
uri?: string;
|
|
1068
|
+
creators?: { address: Pubkey; verified: boolean; share: u8 }[];
|
|
1069
|
+
sellerFeeBasisPoints?: u16;
|
|
1070
|
+
primarySaleHappened?: boolean;
|
|
1071
|
+
isMutable?: boolean;
|
|
1072
|
+
}
|
|
1073
|
+
/** The leaf a transfer or burn replaces, as an indexer (DAS getAssetProof / getAsset) reports it. */
|
|
1074
|
+
export interface CompressedLeaf {
|
|
1075
|
+
root: Hash;
|
|
1076
|
+
dataHash: Hash;
|
|
1077
|
+
creatorHash: Hash;
|
|
1078
|
+
assetDataHash?: Hash | null;
|
|
1079
|
+
flags?: u8 | null;
|
|
1080
|
+
nonce: u64;
|
|
1081
|
+
index: u32;
|
|
551
1082
|
}
|
|
552
1083
|
|
|
553
1084
|
/** The current slot and epoch (Clock sysvar). */
|
|
@@ -563,17 +1094,60 @@ export type Init<T> = T extends TokenAccount
|
|
|
563
1094
|
* account of those parameters, with `payer` funding rent. Fails if it already exists.
|
|
564
1095
|
*/
|
|
565
1096
|
create(payer: Mut<Signer>): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* Anchor `init` + `token::mint` / `token::authority`: create a token account of `mint` owned by `authority`, at the
|
|
1099
|
+
* PDA of `seeds` (or, with `null`, a new keypair account that signs), under the instruction's token program, with
|
|
1100
|
+
* `payer` funding rent. Returns the bump (0 for a keypair).
|
|
1101
|
+
*/
|
|
1102
|
+
create(
|
|
1103
|
+
payer: Mut<Signer>,
|
|
1104
|
+
seeds: Seed[] | null,
|
|
1105
|
+
mint: AccountMeta,
|
|
1106
|
+
authority: Pubkey,
|
|
1107
|
+
tokenProgram?: TokenProgram | Token2022Program | TokenInterface,
|
|
1108
|
+
): u8;
|
|
1109
|
+
/** The PDA bump, after create(seeds, …). */
|
|
1110
|
+
readonly pdaBump: u8;
|
|
566
1111
|
}
|
|
567
|
-
: T
|
|
568
|
-
|
|
1112
|
+
: T extends Mint
|
|
1113
|
+
? T & {
|
|
569
1114
|
/**
|
|
570
|
-
*
|
|
571
|
-
* `
|
|
1115
|
+
* Anchor `init` + `mint::decimals` / `mint::authority` / `mint::freeze_authority`: create a mint at the PDA of
|
|
1116
|
+
* `seeds` (or, with `null`, a new keypair account that signs) under the instruction's token program, with `payer`
|
|
1117
|
+
* funding rent. Returns the bump (0 for a keypair).
|
|
572
1118
|
*/
|
|
573
|
-
create(
|
|
574
|
-
|
|
1119
|
+
create(
|
|
1120
|
+
payer: Mut<Signer>,
|
|
1121
|
+
seeds: Seed[] | null,
|
|
1122
|
+
decimals: u8,
|
|
1123
|
+
mintAuthority: Pubkey,
|
|
1124
|
+
freezeAuthority: Pubkey | null,
|
|
1125
|
+
tokenProgram?: TokenProgram | Token2022Program | TokenInterface,
|
|
1126
|
+
): u8;
|
|
1127
|
+
/** With Token-2022 extensions (Anchor's `extensions::…`): the mint is sized for them and each is initialized first. */
|
|
1128
|
+
create(
|
|
1129
|
+
payer: Mut<Signer>,
|
|
1130
|
+
seeds: Seed[] | null,
|
|
1131
|
+
decimals: u8,
|
|
1132
|
+
mintAuthority: Pubkey,
|
|
1133
|
+
freezeAuthority: Pubkey | null,
|
|
1134
|
+
extensions: MintExtensions,
|
|
1135
|
+
tokenProgram?: Token2022Program | TokenInterface,
|
|
1136
|
+
): u8;
|
|
575
1137
|
readonly pdaBump: u8;
|
|
576
|
-
}
|
|
1138
|
+
}
|
|
1139
|
+
: T &
|
|
1140
|
+
AccountMeta & {
|
|
1141
|
+
/**
|
|
1142
|
+
* Derive the PDA from `seeds`, verify it matches this account, create it with
|
|
1143
|
+
* `payer` funding rent, and write the discriminator. Returns the bump.
|
|
1144
|
+
* With `null`: a new keypair account that signs the transaction (Anchor's `init` without seeds); returns 0.
|
|
1145
|
+
* `space` (Anchor's `space = …`, discriminator included) reserves more than 8 + the struct's size, up to 10240.
|
|
1146
|
+
*/
|
|
1147
|
+
create(payer: Mut<Signer>, seeds: Seed[] | null, space?: u64): u8;
|
|
1148
|
+
/** The PDA bump, after create(). */
|
|
1149
|
+
readonly pdaBump: u8;
|
|
1150
|
+
};
|
|
577
1151
|
|
|
578
1152
|
/**
|
|
579
1153
|
* A large account (over 10 KiB, up to 10 MiB) the client already allocated with System CreateAccount,
|
|
@@ -626,9 +1200,11 @@ export interface SystemProgram extends AccountMeta {
|
|
|
626
1200
|
interface TokenOps {
|
|
627
1201
|
transfer(from: TokenAccount, to: TokenAccount, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
628
1202
|
transferChecked(from: TokenAccount, mint: Mint, to: TokenAccount, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
629
|
-
|
|
1203
|
+
/** `mint`: a Mut<Mint>, or a mint this instruction created and initialized (Mut<Signer> / Mut<AccountInfo>). */
|
|
1204
|
+
mintTo(mint: Mint | AccountMeta, to: TokenAccount, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
630
1205
|
burn(from: TokenAccount, mint: Mint, authority: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
631
|
-
|
|
1206
|
+
/** Close a token account (empty), or under Token-2022 a mint with no supply left (its MintCloseAuthority signs). */
|
|
1207
|
+
closeAccount(account: TokenAccount | Mint, destination: AccountMeta, authority: AccountMeta, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
632
1208
|
/** Let `delegate` move up to `amount` from `source`. */
|
|
633
1209
|
approve(source: TokenAccount, delegate: AccountMeta, owner: AccountMeta, amount: u64, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
634
1210
|
revoke(source: TokenAccount, owner: AccountMeta, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
@@ -648,7 +1224,7 @@ interface TokenOps {
|
|
|
648
1224
|
interface Token2022Ops {
|
|
649
1225
|
/** Token-2022 only: write name/symbol/uri into a mint whose MetadataPointer points at itself (the mint needs lamports for the larger size). */
|
|
650
1226
|
initializeMetadata(
|
|
651
|
-
mint:
|
|
1227
|
+
mint: AccountMeta,
|
|
652
1228
|
updateAuthority: AccountMeta,
|
|
653
1229
|
mintAuthority: AccountMeta,
|
|
654
1230
|
name: string,
|
|
@@ -681,6 +1257,61 @@ interface Token2022Ops {
|
|
|
681
1257
|
initializeInterestBearingMint(mint: AccountMeta, rateAuthority: Pubkey | null, rate: i16): void;
|
|
682
1258
|
/** ImmutableOwner on a token account (before initializeAccount3): its owner can never change. */
|
|
683
1259
|
initializeImmutableOwner(account: AccountMeta): void;
|
|
1260
|
+
|
|
1261
|
+
// Token-2022 extension instructions on mints and accounts that have the extension.
|
|
1262
|
+
/** DefaultAccountState Update: new token accounts start frozen (true) or initialized (false). */
|
|
1263
|
+
updateDefaultAccountState(mint: AccountMeta, freezeAuthority: AccountMeta, frozen: boolean, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1264
|
+
/** TransferHook Update: the program invoked on every transfer (null: none). */
|
|
1265
|
+
updateTransferHook(mint: AccountMeta, authority: AccountMeta, programId: Pubkey | null, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1266
|
+
/** MemoTransfer Enable: incoming transfers to `account` need a memo instruction before them. */
|
|
1267
|
+
enableRequiredMemoTransfers(account: AccountMeta, owner: AccountMeta, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1268
|
+
/** MemoTransfer Disable. */
|
|
1269
|
+
disableRequiredMemoTransfers(account: AccountMeta, owner: AccountMeta, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1270
|
+
/** InterestBearingMint UpdateRate (basis points per year). */
|
|
1271
|
+
updateInterestRate(mint: AccountMeta, rateAuthority: AccountMeta, rate: i16, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1272
|
+
/** TransferFee TransferCheckedWithFee: `fee` must be the fee Token-2022 computes for `amount`; decimals are the mint's. */
|
|
1273
|
+
transferCheckedWithFee(
|
|
1274
|
+
from: TokenAccount,
|
|
1275
|
+
mint: Mint,
|
|
1276
|
+
to: TokenAccount,
|
|
1277
|
+
authority: AccountMeta,
|
|
1278
|
+
amount: u64,
|
|
1279
|
+
fee: u64,
|
|
1280
|
+
signerSeeds?: Seed[] | SignerSeeds,
|
|
1281
|
+
): void;
|
|
1282
|
+
/** TransferFee HarvestWithheldTokensToMint: move withheld fees from the given token accounts (passed on writable as they were passed) to the mint. */
|
|
1283
|
+
harvestWithheldTokensToMint(mint: AccountMeta, sources: RemainingAccounts | RemainingSlice): void;
|
|
1284
|
+
/** TransferFee WithdrawWithheldTokensFromMint: the fees held by the mint to `destination`. */
|
|
1285
|
+
withdrawWithheldTokensFromMint(mint: AccountMeta, destination: TokenAccount, withdrawAuthority: AccountMeta, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1286
|
+
/** TransferFee SetTransferFee: takes effect two epochs later. */
|
|
1287
|
+
setTransferFee(mint: AccountMeta, configAuthority: AccountMeta, basisPoints: u16, maximumFee: u64, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1288
|
+
|
|
1289
|
+
// The Token Metadata interface, for metadata stored in the mint (after initializeMetadata).
|
|
1290
|
+
/** Set "name", "symbol" or "uri", or any other key as an additional field. */
|
|
1291
|
+
updateMetadataField(mint: AccountMeta, updateAuthority: AccountMeta, field: string, value: string, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1292
|
+
/** Remove an additional field; with `idempotent` false a missing key fails. */
|
|
1293
|
+
removeMetadataKey(mint: AccountMeta, updateAuthority: AccountMeta, key: string, idempotent: boolean, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1294
|
+
/** Hand the update authority to `newAuthority`, or make the metadata immutable with null. */
|
|
1295
|
+
updateMetadataAuthority(mint: AccountMeta, updateAuthority: AccountMeta, newAuthority: Pubkey | null, signerSeeds?: Seed[] | SignerSeeds): void;
|
|
1296
|
+
/** Emit: the whole TokenMetadata as Token-2022's return data. */
|
|
1297
|
+
emitMetadata(mint: AccountMeta): void;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Token-2022 extensions for `mint.create(…, extensions)`: Anchor's `extensions::…` constraints. `null` authorities
|
|
1302
|
+
* mean none; `defaultAccountState: true` starts new token accounts frozen (it needs a freeze authority).
|
|
1303
|
+
*/
|
|
1304
|
+
export interface MintExtensions {
|
|
1305
|
+
transferFee?: { configAuthority: Pubkey | null; withdrawAuthority: Pubkey | null; basisPoints: u16; maximumFee: u64 };
|
|
1306
|
+
closeAuthority?: Pubkey | null;
|
|
1307
|
+
defaultAccountState?: boolean;
|
|
1308
|
+
nonTransferable?: true;
|
|
1309
|
+
interestBearing?: { rateAuthority: Pubkey | null; rate: i16 };
|
|
1310
|
+
permanentDelegate?: Pubkey;
|
|
1311
|
+
transferHook?: { authority: Pubkey | null; programId: Pubkey | null };
|
|
1312
|
+
metadataPointer?: { authority: Pubkey | null; metadataAddress: Pubkey | null };
|
|
1313
|
+
groupPointer?: { authority: Pubkey | null; groupAddress: Pubkey | null };
|
|
1314
|
+
groupMemberPointer?: { authority: Pubkey | null; memberAddress: Pubkey | null };
|
|
684
1315
|
}
|
|
685
1316
|
|
|
686
1317
|
/** The SPL Token program (Tokenkeg). Its address is checked. */
|
|
@@ -797,7 +1428,7 @@ export declare function i128(value: bigint): i128;
|
|
|
797
1428
|
* << aborts when bits would be lost or the amount is not below the width; >> is arithmetic on signed types;
|
|
798
1429
|
* ~ flips the bits within the type's width.
|
|
799
1430
|
*/
|
|
800
|
-
/** floor(a * b / c) with a
|
|
1431
|
+
/** floor(a * b / c) with a double-width intermediate (all u64, or all u128); aborts if c is 0 or the result does not fit. */
|
|
801
1432
|
export declare function mulDiv(a: u64, b: u64, c: u64): u64;
|
|
802
1433
|
/** ceil(a * b / c), like mulDiv. */
|
|
803
1434
|
export declare function mulDivCeil(a: u64, b: u64, c: u64): u64;
|