@xgamesfun/solana 0.0.0-stage → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/DISCLAIMER.md +41 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +13 -0
  4. package/README.md +172 -2
  5. package/bin/xsolana.mjs +189 -0
  6. package/examples/artwork-auction.json +51 -0
  7. package/examples/blind-forge.json +128 -0
  8. package/examples/coin-flip-arena.json +108 -0
  9. package/examples/duel-arena.json +137 -0
  10. package/examples/elements-set.json +281 -0
  11. package/examples/event-badges.json +67 -0
  12. package/examples/expedition-guild.json +161 -0
  13. package/examples/fair-presale.json +48 -0
  14. package/examples/falling-drop.json +90 -0
  15. package/examples/guild-missions.json +144 -0
  16. package/examples/halving-seasons.json +112 -0
  17. package/examples/hero-trials.json +96 -0
  18. package/examples/ideas.json +789 -0
  19. package/examples/level-ladder.json +65 -0
  20. package/examples/merge-2048.json +128 -0
  21. package/examples/nft-raffle.json +33 -0
  22. package/examples/paper-hands-farm.json +56 -0
  23. package/examples/partner-vault.json +115 -0
  24. package/examples/sacrifice-raffle.json +118 -0
  25. package/examples/scorched-treasury.json +84 -0
  26. package/examples/shelter-fair.json +164 -0
  27. package/examples/spark-pity.json +153 -0
  28. package/examples/stakers-draw.json +125 -0
  29. package/examples/star-fleet.json +157 -0
  30. package/examples/starforce.json +116 -0
  31. package/examples/stud-farm.json +134 -0
  32. package/examples/team-vesting.json +70 -0
  33. package/examples/trade-in-shop.json +168 -0
  34. package/js/approve/details.mjs +262 -0
  35. package/js/approve/ed25519.mjs +36 -0
  36. package/js/approve/live-check.mjs +144 -0
  37. package/js/approve/page.html +86 -0
  38. package/js/approve/page.js +203 -0
  39. package/js/approve/server.mjs +711 -0
  40. package/js/chain/base58.js +73 -0
  41. package/js/chain/borsh.js +261 -0
  42. package/js/chain/bytes.js +141 -0
  43. package/js/chain/core.js +169 -0
  44. package/js/chain/curve.js +52 -0
  45. package/js/chain/lookup.js +273 -0
  46. package/js/chain/mint.js +96 -0
  47. package/js/chain/pda.js +66 -0
  48. package/js/chain/programs.js +102 -0
  49. package/js/chain/rpc.js +217 -0
  50. package/js/chain/sha256.js +68 -0
  51. package/js/chain/token.js +85 -0
  52. package/js/chain/token2022.js +247 -0
  53. package/js/chain/tx.js +224 -0
  54. package/js/client/accounts.js +347 -0
  55. package/js/client/compressed.js +46 -0
  56. package/js/client/grant.js +240 -0
  57. package/js/client/idl/loot.js +2 -0
  58. package/js/client/idl/loot.json +17064 -0
  59. package/js/client/index.js +9 -0
  60. package/js/client/ix.js +2156 -0
  61. package/js/client/pda.js +110 -0
  62. package/js/client/policy.js +48 -0
  63. package/js/client/sizes.js +54 -0
  64. package/js/client/traits.js +44 -0
  65. package/js/connect/connect.mjs +182 -0
  66. package/js/economy/check.mjs +1991 -0
  67. package/js/economy/cost.mjs +170 -0
  68. package/js/economy/examples.mjs +114 -0
  69. package/js/economy/explain.mjs +235 -0
  70. package/js/economy/guide.mjs +231 -0
  71. package/js/economy/legal.mjs +15 -0
  72. package/js/economy/live.mjs +107 -0
  73. package/js/economy/model.mjs +583 -0
  74. package/js/economy/plan.mjs +887 -0
  75. package/js/economy/schema.json +2923 -0
  76. package/js/economy/secrets.mjs +60 -0
  77. package/js/economy/simulate.mjs +952 -0
  78. package/js/economy/txsize.mjs +45 -0
  79. package/js/economy/validate.mjs +85 -0
  80. package/js/index.js +10 -0
  81. package/js/mcp/server.mjs +113 -0
  82. package/js/mcp/tools.mjs +479 -0
  83. package/js/play/index.js +2109 -0
  84. package/js/results/index.js +184 -0
  85. package/js/results/wire.js +90 -0
  86. package/package.json +100 -4
  87. package/release.json +8 -0
  88. package/skills/xsolana-economy/SKILL.md +105 -0
  89. package/skills/xsolana-economy/references/after-launch.md +114 -0
  90. package/skills/xsolana-economy/references/apps.md +157 -0
  91. package/skills/xsolana-economy/references/sentence-to-spec.md +172 -0
  92. package/skills/xsolana-economy/references/telling-the-person.md +93 -0
  93. package/types/chain/base58.d.ts +10 -0
  94. package/types/chain/borsh.d.ts +23 -0
  95. package/types/chain/bytes.d.ts +45 -0
  96. package/types/chain/core.d.ts +50 -0
  97. package/types/chain/curve.d.ts +1 -0
  98. package/types/chain/lookup.d.ts +191 -0
  99. package/types/chain/mint.d.ts +25 -0
  100. package/types/chain/pda.d.ts +25 -0
  101. package/types/chain/programs.d.ts +65 -0
  102. package/types/chain/rpc.d.ts +66 -0
  103. package/types/chain/sha256.d.ts +1 -0
  104. package/types/chain/token.d.ts +141 -0
  105. package/types/chain/token2022.d.ts +53 -0
  106. package/types/chain/tx.d.ts +60 -0
  107. package/types/client/accounts.d.ts +178 -0
  108. package/types/client/compressed.d.ts +29 -0
  109. package/types/client/grant.d.ts +125 -0
  110. package/types/client/idl/loot.d.ts +4467 -0
  111. package/types/client/index.d.ts +8 -0
  112. package/types/client/ix.d.ts +1687 -0
  113. package/types/client/pda.d.ts +91 -0
  114. package/types/client/policy.d.ts +23 -0
  115. package/types/client/sizes.d.ts +13 -0
  116. package/types/client/traits.d.ts +12 -0
  117. package/types/economy/check.d.mts +105 -0
  118. package/types/economy/cost.d.mts +68 -0
  119. package/types/economy/examples.d.mts +27 -0
  120. package/types/economy/explain.d.mts +19 -0
  121. package/types/economy/guide.d.mts +140 -0
  122. package/types/economy/legal.d.mts +12 -0
  123. package/types/economy/live.d.mts +109 -0
  124. package/types/economy/model.d.mts +363 -0
  125. package/types/economy/plan.d.mts +1013 -0
  126. package/types/economy/secrets.d.mts +4 -0
  127. package/types/economy/simulate.d.mts +156 -0
  128. package/types/economy/txsize.d.mts +17 -0
  129. package/types/economy/validate.d.mts +3 -0
  130. package/types/index.d.ts +9 -0
  131. package/types/mcp/tools.d.mts +627 -0
  132. package/types/play/index.d.ts +469 -0
  133. package/types/results/index.d.ts +155 -0
  134. package/types/results/wire.d.ts +122 -0
@@ -0,0 +1 @@
1
+ export declare function isOnCurve(bytes: any): boolean;
@@ -0,0 +1,191 @@
1
+ export declare const LOOKUP_TABLE_PROGRAM = "AddressLookupTab1e1111111111111111111111111";
2
+ /** A table's account: 56 bytes of header, then its addresses, 32 bytes each (at most 256). */
3
+ export declare const TABLE_HEADER_BYTES = 56;
4
+ export declare const TABLE_MAX_ADDRESSES = 256;
5
+ /** The accounts a transaction may lock. */
6
+ export declare const MAX_ACCOUNT_LOCKS = 64;
7
+ /** A deactivated table can be closed once its deactivation slot has left the 512 recent slot hashes. */
8
+ export declare const TABLE_COOLDOWN_SLOTS = 513n;
9
+ /** The table `authority` makes at `slot` (a recent slot: the table's address names it): [address, bump]. */
10
+ export declare const tableAddress: (authority: any, slot: any) => any;
11
+ /** Makes the table `authority` owns at `slot`, its rent paid by `payer`. Returns { address, instruction }. */
12
+ export declare function createTableIx({ authority, payer, slot }: {
13
+ authority: any;
14
+ payer?: any;
15
+ slot: any;
16
+ }): {
17
+ address: any;
18
+ instruction: {
19
+ programId: string;
20
+ keys: any;
21
+ data: any;
22
+ };
23
+ };
24
+ /** Adds `addresses` to `table`, the rent of its growth paid by `payer`. */
25
+ export declare const extendTableIx: ({ table, authority, payer, addresses }: {
26
+ addresses: any;
27
+ authority: any;
28
+ payer?: any;
29
+ table: any;
30
+ }) => {
31
+ programId: string;
32
+ keys: any;
33
+ data: any;
34
+ };
35
+ /** Freezes `table`: nobody can add to it or close it after. */
36
+ export declare const freezeTableIx: ({ table, authority }: {
37
+ authority: any;
38
+ table: any;
39
+ }) => {
40
+ programId: string;
41
+ keys: any;
42
+ data: any;
43
+ };
44
+ /** Deactivates `table`: transactions can still use it until it cools down, then it can be closed. */
45
+ export declare const deactivateTableIx: ({ table, authority }: {
46
+ authority: any;
47
+ table: any;
48
+ }) => {
49
+ programId: string;
50
+ keys: any;
51
+ data: any;
52
+ };
53
+ /** Closes a cooled-down `table`: its rent goes to `recipient`. */
54
+ export declare const closeTableIx: ({ table, authority, recipient }: {
55
+ authority: any;
56
+ recipient?: any;
57
+ table: any;
58
+ }) => {
59
+ programId: string;
60
+ keys: any;
61
+ data: any;
62
+ };
63
+ /**
64
+ * A table's account read back: { authority (null once frozen), deactivationSlot (null while active),
65
+ * lastExtendedSlot, addresses }, or null when `account` is not a lookup table.
66
+ */
67
+ export declare function readTable(account: any): {
68
+ authority: string | null;
69
+ deactivationSlot: bigint | null;
70
+ lastExtendedSlot: bigint;
71
+ addresses: string[];
72
+ } | null;
73
+ /** The filter that finds the tables `authority` owns (getProgramAccounts on LOOKUP_TABLE_PROGRAM). */
74
+ export declare const tablesOf: (authority: any) => {
75
+ memcmp: {
76
+ offset: number;
77
+ bytes: any;
78
+ };
79
+ }[];
80
+ /**
81
+ * The slots the SlotHashes sysvar holds (its account's data: a count, then a slot and a hash each), newest first. It
82
+ * holds the last 512 slots that had a block: a table is made at one of them, and closes only once its deactivation
83
+ * slot has left them.
84
+ */
85
+ export declare function slotHashes(data: any): bigint[];
86
+ /** How many slots the SlotHashes sysvar holds when full. */
87
+ export declare const SLOT_HASHES_HELD = 512;
88
+ /**
89
+ * What is due for a table of yours at `slot`: 'close' (deactivated, and its deactivation slot has left `recent`, the
90
+ * slots SlotHashes holds: its rent comes back), 'cooling' (deactivated, not yet closable), or 'active'. A table is
91
+ * closable only when `recent` is a full read (512 slots) and its deactivation slot is older than all of them: an empty
92
+ * or short read (an RPC that answered nothing, a young chain) says cooling. Without `recent`, a table is counted
93
+ * closable 513 slots after its deactivation, which skipped slots can make too early.
94
+ */
95
+ export declare function tableStep(table: any, slot: any, recent?: null): "active" | "close" | "cooling";
96
+ /**
97
+ * How many accounts a transaction of `instructions` from `payer` locks: every account once, its programs included. As
98
+ * v0 with a lookup table it deactivates (`planTable`), the table and the lookup-table program are two more
99
+ * (`asV0`).
100
+ */
101
+ export declare function transactionLocks(payer: any, instructions: any, { asV0 }?: {
102
+ asV0?: boolean | undefined;
103
+ }): number;
104
+ /** The accounts of `instructions` a table can hold: every one that is neither a signer nor a program they call, once. */
105
+ export declare function tableAccounts(instructions: any): any[];
106
+ /**
107
+ * The message for `instructions` from `payer`: legacy when it fits, else v0 loading what it can from `tables`
108
+ * ([{ address, addresses }]). null when neither fits.
109
+ */
110
+ export declare function compileFitting({ payer, blockhash, instructions, tables }: {
111
+ blockhash: any;
112
+ instructions: any;
113
+ payer: any;
114
+ tables?: never[] | undefined;
115
+ }): Uint8Array<any> | null;
116
+ /**
117
+ * The plan for sending `instructions` from `payer` as v0 with a table of their accounts made at `slot`, `first` the
118
+ * addresses it holds first:
119
+ * { table: { address, addresses }, steps: [instructions…] (each a legacy transaction: the table's creation and as
120
+ * many additions as it takes), final: the instructions with the table's deactivation after them }. null when even that
121
+ * does not fit (more accounts than a transaction can lock, or instructions too long).
122
+ */
123
+ export declare function planTable({ payer, blockhash, slot, instructions, first }: {
124
+ blockhash: any;
125
+ first?: never[] | undefined;
126
+ instructions: any;
127
+ payer: any;
128
+ slot: any;
129
+ }): {
130
+ table: {
131
+ address: any;
132
+ addresses: any[];
133
+ };
134
+ steps: {
135
+ programId: string;
136
+ keys: any;
137
+ data: any;
138
+ }[][];
139
+ final: any[];
140
+ } | null;
141
+ /**
142
+ * How `instructions` from `payer` can be sent, decided before anyone signs:
143
+ * { legacy: true } they fit a legacy transaction;
144
+ * { table: true, first: [] } they fit one v0 transaction with a lookup table of their accounts,
145
+ * a compressed NFT's prove_leaf included (one transaction: nobody can
146
+ * prove its leaf again between the proof and the move);
147
+ * { first, rest, table } only when they don't: `first`, the instructions `alone` picks (each
148
+ * compressed NFT's prove_leaf), each sent alone with the transaction's
149
+ * compute-budget instructions, after the table is made (`table`: the
150
+ * rest goes as v0 with one) or before a legacy rest.
151
+ * null when nothing fits: more accounts than a transaction locks, or instructions too long even as v0.
152
+ */
153
+ export declare function sendPlan({ payer, blockhash, instructions, alone }: {
154
+ alone?: (() => boolean) | undefined;
155
+ blockhash?: string | undefined;
156
+ instructions: any;
157
+ payer: any;
158
+ }): {
159
+ legacy: boolean;
160
+ first: any;
161
+ budget: any;
162
+ rest: any;
163
+ table: boolean;
164
+ } | null;
165
+ declare const pause: (ms: any) => Promise<any>;
166
+ /**
167
+ * Sends `instructions` paid by `payer` (the only signer of a table's own transactions) and confirms it, as `sendPlan`
168
+ * decides before anything is signed: legacy when it fits; else one v0 transaction with a lookup table `payer` makes
169
+ * first (`planTable`); else the table first, then each compressed NFT's prove_leaf alone, then the rest as v0 (or the
170
+ * proofs then a legacy rest, when that fits with no table). The v0 transaction is compiled against the table as the
171
+ * chain holds it. `sign(message)` → the signed wire transaction. `rpc`: the client's (latestBlockhash, send, confirm,
172
+ * account, call('getSlot')). `table: false` sends no lookup table (a throwaway key holds no rent for one); `first`:
173
+ * addresses a table holds first (`planTable`). Throws a
174
+ * plain sentence when it can't be sent. Returns { signature (the last transaction's), table (its address, or null),
175
+ * steps (the signatures of the transactions before it) }.
176
+ */
177
+ export declare function sendFitting({ rpc, payer, instructions, sign, table, alone, first, sleep }: {
178
+ alone?: (() => boolean) | undefined;
179
+ first?: never[] | undefined;
180
+ instructions: any;
181
+ payer: any;
182
+ rpc: any;
183
+ sign: any;
184
+ sleep?: typeof pause | undefined;
185
+ table?: boolean | undefined;
186
+ }): Promise<{
187
+ signature: any;
188
+ table: any;
189
+ steps: any[];
190
+ }>;
191
+ export {};
@@ -0,0 +1,25 @@
1
+ /** Metaplex token metadata: key, update authority and mint come before name, symbol and uri. */
2
+ export declare function parseMetaplexMetadata(data: any): {
3
+ mint: string;
4
+ name: string;
5
+ symbol: string;
6
+ uri: string;
7
+ };
8
+ /**
9
+ * A mint account read: `owner` is the account's program. Returns null when it is not a mint: a classic mint is exactly
10
+ * 82 bytes; a Token-2022 mint is 82 bytes, or longer than a token account with its account type saying mint (a
11
+ * Token-2022 token account with extensions is longer too, and says it is an account).
12
+ * metadataData: the Metaplex metadata account's data, when there is one.
13
+ */
14
+ export declare function parseMint(address: any, owner: any, data: any, metadataData?: null): {
15
+ mint: any;
16
+ program: string;
17
+ native: boolean;
18
+ decimals: any;
19
+ supply: string;
20
+ mintAuthority: string | null;
21
+ freezeAuthority: string | null;
22
+ name: string | null;
23
+ symbol: string | null;
24
+ uri: string | null;
25
+ } | null;
@@ -0,0 +1,25 @@
1
+ export declare const SYSTEM_PROGRAM = "11111111111111111111111111111111";
2
+ export declare const TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
3
+ export declare const TOKEN_2022_PROGRAM = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
4
+ export declare const ASSOCIATED_TOKEN_PROGRAM = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
5
+ export declare const COMPUTE_BUDGET_PROGRAM = "ComputeBudget111111111111111111111111111111";
6
+ export declare const METAPLEX_METADATA_PROGRAM = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
7
+ /** Metaplex Core: the program of Core assets and collections. */
8
+ export declare const MPL_CORE_PROGRAM = "CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d";
9
+ export declare const SYSVAR_INSTRUCTIONS = "Sysvar1nstructions1111111111111111111111111";
10
+ export declare const SYSVAR_SLOT_HASHES = "SysvarS1otHashes111111111111111111111111111";
11
+ /** Wrapped SOL: a shop priced in SOL holds this mint, and players pay plain SOL. */
12
+ export declare const NATIVE_MINT = "So11111111111111111111111111111111111111112";
13
+ /** The address for these seeds (bump included), or null when it lands on the curve (not a valid PDA). */
14
+ export declare function createProgramAddress(seeds: any, programId: any): string | null;
15
+ /** The canonical PDA and its bump: the highest bump whose address is off the curve. */
16
+ export declare function findProgramAddress(seeds: any, programId: any): any;
17
+ /** The PDA address alone. */
18
+ export declare const pdaOf: (seeds: any, programId: any) => any;
19
+ /** `owner`'s associated token account for `mint` (the owner may itself be a PDA). */
20
+ export declare function associatedTokenAddress(owner: any, mint: any, tokenProgram?: string): any;
21
+ /**
22
+ * The address System's `CreateAccountWithSeed` makes from `base`, a `seed` text (32 bytes at most) and the program that
23
+ * will own it: sha256(base | seed | owner). Only `base` signs for it, so no new key is needed.
24
+ */
25
+ export declare function addressWithSeed(base: any, seed: any, owner: any): string;
@@ -0,0 +1,65 @@
1
+ /** An account as an instruction lists it. */
2
+ export declare const meta: (pubkey: any, isSigner: any, isWritable: any) => {
3
+ pubkey: any;
4
+ isSigner: any;
5
+ isWritable: any;
6
+ };
7
+ export declare function transferLamports(from: any, to: any, lamports: any): {
8
+ programId: string;
9
+ keys: {
10
+ pubkey: any;
11
+ isSigner: any;
12
+ isWritable: any;
13
+ }[];
14
+ data: Uint8Array<any>;
15
+ };
16
+ /** Compute Budget `RequestHeapFrame`: the transaction's programs get a heap of `bytes` (a multiple of 1 KiB, 32 KiB to 256 KiB). */
17
+ export declare const requestHeapFrame: (bytes: any) => {
18
+ programId: string;
19
+ keys: never[];
20
+ data: Uint8Array<any>;
21
+ };
22
+ export declare const computeUnitLimit: (units: any) => {
23
+ programId: string;
24
+ keys: never[];
25
+ data: Uint8Array<any>;
26
+ };
27
+ export declare const computeUnitPrice: (microLamports: any) => {
28
+ programId: string;
29
+ keys: never[];
30
+ data: Uint8Array<any>;
31
+ };
32
+ /** Create `owner`'s token account for `mint` unless it already exists; `payer` pays the rent. */
33
+ export declare function createAssociatedTokenAccountIdempotent(payer: any, owner: any, mint: any, tokenProgram?: string): {
34
+ programId: string;
35
+ keys: {
36
+ pubkey: any;
37
+ isSigner: any;
38
+ isWritable: any;
39
+ }[];
40
+ data: Uint8Array<ArrayBuffer>;
41
+ };
42
+ export declare const syncNative: (account: any) => {
43
+ programId: string;
44
+ keys: {
45
+ pubkey: any;
46
+ isSigner: any;
47
+ isWritable: any;
48
+ }[];
49
+ data: Uint8Array<ArrayBuffer>;
50
+ };
51
+ export declare const closeTokenAccount: (account: any, destination: any, owner: any) => {
52
+ programId: string;
53
+ keys: {
54
+ pubkey: any;
55
+ isSigner: any;
56
+ isWritable: any;
57
+ }[];
58
+ data: Uint8Array<ArrayBuffer>;
59
+ };
60
+ /**
61
+ * A purchase from a shop priced in SOL: wrap exactly the price into the player's wrapped-SOL account first and close
62
+ * that account after, so the player pays and keeps plain SOL. Other mints pass through. Compute-budget instructions
63
+ * stay in front.
64
+ */
65
+ export declare function withSolWrap(player: any, mint: any, price: any, instructions: any): any;
@@ -0,0 +1,66 @@
1
+ /** A JSON-RPC failure, with the node's own message (and logs for a failed simulation). */
2
+ export declare class RpcError extends Error {
3
+ code: any;
4
+ logs: any;
5
+ constructor(message: any, { code, logs }?: Readonly<Record<string, any>>);
6
+ }
7
+ declare const sleep: (ms: any) => Promise<any>;
8
+ /** The first block of each public Solana cluster: it names the cluster whatever URL reaches it. */
9
+ export declare const GENESIS: Readonly<{
10
+ devnet: "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG";
11
+ mainnet: "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
12
+ testnet: "4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY";
13
+ }>;
14
+ /** Refuses an RPC URL that names mainnet. Returns the URL. */
15
+ export declare function notMainnet(url: any): any;
16
+ /**
17
+ * Refuses a chain that is mainnet or testnet, by its genesis block, whatever its URL says (a local validator is
18
+ * let through). `rpc` has `call`. Returns the genesis hash.
19
+ */
20
+ export declare function checkCluster(rpc: any): Promise<any>;
21
+ /** The program's own words for a failed run (`AnchorError … Error Message: …`), else the last error log line. */
22
+ export declare function programError(err: any, logs: any): any;
23
+ /** A client for one RPC URL. `fetchImpl` and `sleepImpl` are for tests. */
24
+ export declare function rpcClient(url: any, { fetchImpl, sleepImpl }?: {
25
+ fetchImpl?: typeof fetch | undefined;
26
+ sleepImpl?: typeof sleep | undefined;
27
+ }): {
28
+ url: any;
29
+ call: (method: any, params?: any[]) => Promise<any>;
30
+ /** Accounts as of `commitment`; `minContextSlot`: from a node that has seen at least that slot (one's own landed send). */
31
+ accounts: (addresses: any, commitment?: string, { minContextSlot }?: Readonly<Record<string, any>>) => Promise<any[]>;
32
+ account(address: any, commitment?: string, options?: {}): Promise<any>;
33
+ latestBlockhash(): Promise<{
34
+ blockhash: any;
35
+ lastValidBlockHeight: any;
36
+ }>;
37
+ blockHeight(): Promise<any>;
38
+ balance(address: any): Promise<bigint>;
39
+ /**
40
+ * A token account's balance in base units, or 0n when there is no account there. Any other refusal throws: an
41
+ * address that is not a token account (a wallet's, passed by mistake: "Invalid param: not a Token account") is
42
+ * not an empty one.
43
+ */
44
+ tokenBalance(tokenAccount: any): Promise<bigint>;
45
+ programAccounts(program: any, filters: any): Promise<any>;
46
+ /**
47
+ * Dry-run a wire transaction (empty signature slots are fine). Throws with the program's reason when it fails.
48
+ * `accounts`: addresses whose state after the run to return (base64-decoded, or null).
49
+ */
50
+ simulate(wire: any, { accounts: watch, replaceBlockhash }?: {
51
+ accounts?: never[] | undefined;
52
+ replaceBlockhash?: boolean | undefined;
53
+ }): Promise<{
54
+ unitsConsumed: any;
55
+ logs: any;
56
+ accounts: any;
57
+ }>;
58
+ send(wire: any): Promise<any>;
59
+ signatureStatus: (signature: any) => Promise<any>;
60
+ /** Wait until a sent transaction is confirmed; throws with the program's reason when it failed. */
61
+ confirm(signature: any, { timeoutMs, lastValidBlockHeight }?: {
62
+ lastValidBlockHeight?: null | undefined;
63
+ timeoutMs?: number | undefined;
64
+ }): Promise<any>;
65
+ };
66
+ export {};
@@ -0,0 +1 @@
1
+ export declare function sha256(message: any): Uint8Array<ArrayBuffer>;
@@ -0,0 +1,141 @@
1
+ /** A classic mint's size. */
2
+ export declare const MINT_BYTES = 82;
3
+ /** A classic token account's size. */
4
+ export declare const TOKEN_ACCOUNT_BYTES = 165;
5
+ /** System `CreateAccount`: `from` pays `lamports` for `space` bytes at `address` (which signs), owned by `owner`. */
6
+ export declare function createAccountIx({ from, address, lamports, space, owner }: {
7
+ address: any;
8
+ from: any;
9
+ lamports: any;
10
+ owner: any;
11
+ space: any;
12
+ }): {
13
+ programId: string;
14
+ keys: {
15
+ pubkey: any;
16
+ isSigner: any;
17
+ isWritable: any;
18
+ }[];
19
+ data: Uint8Array<any>;
20
+ };
21
+ /**
22
+ * System `CreateAccountWithSeed`: `from` pays `lamports` for `space` bytes at `addressWithSeed(from, seed, owner)`, owned
23
+ * by `owner`. `from` is the base too, so it alone signs.
24
+ */
25
+ export declare function createAccountWithSeedIx({ from, address, seed, lamports, space, owner }: {
26
+ address: any;
27
+ from: any;
28
+ lamports: any;
29
+ owner: any;
30
+ seed: any;
31
+ space: any;
32
+ }): {
33
+ programId: string;
34
+ keys: {
35
+ pubkey: any;
36
+ isSigner: any;
37
+ isWritable: any;
38
+ }[];
39
+ data: Uint8Array<any>;
40
+ };
41
+ /**
42
+ * System `AllocateWithSeed`: the account at `addressWithSeed(base, seed, owner)`, which holds only lamports (System's, no
43
+ * data), gets `space` bytes and becomes `owner`'s. `base` alone signs. Unlike `CreateAccountWithSeed` it takes an address
44
+ * someone already sent lamports to; whoever pays tops it up to the rent first (a System transfer).
45
+ */
46
+ export declare function allocateWithSeedIx({ base, address, seed, space, owner }: {
47
+ address: any;
48
+ base: any;
49
+ owner: any;
50
+ seed: any;
51
+ space: any;
52
+ }): {
53
+ programId: string;
54
+ keys: {
55
+ pubkey: any;
56
+ isSigner: any;
57
+ isWritable: any;
58
+ }[];
59
+ data: Uint8Array<any>;
60
+ };
61
+ /** Token `InitializeAccount3`: `account` (made empty first) becomes a token account of `mint` that `owner` holds. */
62
+ export declare const initializeAccount3Ix: ({ account, mint, owner, tokenProgram }: {
63
+ account: any;
64
+ mint: any;
65
+ owner: any;
66
+ tokenProgram?: string | undefined;
67
+ }) => {
68
+ programId: string;
69
+ keys: {
70
+ pubkey: any;
71
+ isSigner: any;
72
+ isWritable: any;
73
+ }[];
74
+ data: Uint8Array<any>;
75
+ };
76
+ /** Token `InitializeMint2`. */
77
+ export declare function initializeMint2Ix({ mint, decimals, authority, freezeAuthority, tokenProgram }: {
78
+ authority: any;
79
+ decimals: any;
80
+ freezeAuthority?: null | undefined;
81
+ mint: any;
82
+ tokenProgram?: string | undefined;
83
+ }): {
84
+ programId: string;
85
+ keys: {
86
+ pubkey: any;
87
+ isSigner: any;
88
+ isWritable: any;
89
+ }[];
90
+ data: Uint8Array<any>;
91
+ };
92
+ /** Token `MintTo`: `authority` (the mint authority, which signs) mints `amount` into the token account `to`. */
93
+ export declare const mintToIx: ({ mint, to, authority, amount, tokenProgram }: {
94
+ amount: any;
95
+ authority: any;
96
+ mint: any;
97
+ to: any;
98
+ tokenProgram?: string | undefined;
99
+ }) => {
100
+ programId: string;
101
+ keys: {
102
+ pubkey: any;
103
+ isSigner: any;
104
+ isWritable: any;
105
+ }[];
106
+ data: Uint8Array<any>;
107
+ };
108
+ /** Token `TransferChecked`. */
109
+ export declare const transferCheckedIx: ({ from, mint, to, owner, amount, decimals, tokenProgram }: {
110
+ amount: any;
111
+ decimals: any;
112
+ from: any;
113
+ mint: any;
114
+ owner: any;
115
+ to: any;
116
+ tokenProgram?: string | undefined;
117
+ }) => {
118
+ programId: string;
119
+ keys: {
120
+ pubkey: any;
121
+ isSigner: any;
122
+ isWritable: any;
123
+ }[];
124
+ data: Uint8Array<any>;
125
+ };
126
+ /** Token `SetAuthority` of a mint's minting (`kind` 0) or freezing (1) to `newAuthority` (null: none). */
127
+ export declare const setAuthorityIx: ({ account, current, kind, newAuthority, tokenProgram }: {
128
+ account: any;
129
+ current: any;
130
+ kind?: number | undefined;
131
+ newAuthority: any;
132
+ tokenProgram?: string | undefined;
133
+ }) => {
134
+ programId: string;
135
+ keys: {
136
+ pubkey: any;
137
+ isSigner: any;
138
+ isWritable: any;
139
+ }[];
140
+ data: Uint8Array<any>;
141
+ };
@@ -0,0 +1,53 @@
1
+ export declare const MEMO_PROGRAM = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
2
+ /** The hook interface's Execute instruction: its discriminator, then the amount (u64). */
3
+ export declare const EXECUTE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
4
+ /** The value of extension `type` in a Token-2022 mint or account, or null. */
5
+ export declare function extension(data: any, type: any): any;
6
+ /** The transfer hook program a Token-2022 mint names, or null. */
7
+ export declare function hookProgramOf(mintData: any): string | null;
8
+ /**
9
+ * Whether a mint's new accounts start frozen, or can be made to (as the program judges it): a Token-2022
10
+ * mint carrying `DefaultAccountState` set to frozen, or set to anything while it has a freeze authority, which can switch
11
+ * it to frozen whenever it likes. An auction, a contest, a lottery, an offer and a sealed schedule refuse such a mint:
12
+ * each reads the setting once, as it opens, and a refund or payout opened into a frozen account would never land.
13
+ */
14
+ export declare function mayStartFrozen({ owner, data }: {
15
+ data: any;
16
+ owner: any;
17
+ }): boolean;
18
+ /**
19
+ * Who can stop a mint's tokens moving, read from its account (`owner`, its token program; `data`): its freeze authority
20
+ * (it can freeze any account of the mint), a Token-2022 pause (`PausableConfig`: its authority stops every transfer), a
21
+ * transfer hook (its program runs on every transfer and can refuse one), a permanent delegate (it can move anyone's
22
+ * tokens of the mint away). Each is [{ power, holder }], `holder` the address that has it. Empty for a plain mint.
23
+ */
24
+ export declare function mintPowers({ owner, data }: {
25
+ data: any;
26
+ owner: any;
27
+ }): any[];
28
+ /** Whether a token account requires a memo on every transfer into it. */
29
+ export declare function requiresMemo(accountData: any): boolean;
30
+ /** The hook's list of extra accounts for this mint. */
31
+ export declare const validationAddress: (mint: any, hookProgram: any) => any;
32
+ /** The ExtraAccountMeta entries of an "extra-account-metas" account: [{ discriminator, config, isSigner, isWritable }]. */
33
+ export declare function readExtraMetas(data: any): {
34
+ discriminator: any;
35
+ config: any;
36
+ isSigner: boolean;
37
+ isWritable: boolean;
38
+ }[];
39
+ /**
40
+ * The accounts to append after an instruction's own remaining accounts so every transfer of `mint` it makes can run:
41
+ * [] for a classic mint; the Memo program, and for a hooked mint the hook's accounts, for a Token-2022 one.
42
+ * `transfers`: the transfers the instruction makes ({ source, destination, authority, amount }), needed only when the
43
+ * hook's list depends on them; the accounts of all of them are passed. `rpc` reads the mint and the hook's list.
44
+ */
45
+ export declare function transferExtras(rpc: any, mint: any, transfers?: any[]): Promise<any[]>;
46
+ /** Length of a newly created associated account, including Token-2022's immutable owner. */
47
+ export declare function associatedAccountSize(mintAccount: any): number;
48
+ /** Shared browser/keeper resolution for all transfers of one mint, preserving role accounts before extras. */
49
+ export declare function resolveTransfers(rpc: any, mint: any, transfers?: any[]): Promise<{
50
+ tokenProgram: any;
51
+ accountSize: number;
52
+ extraAccounts: any[];
53
+ }>;
@@ -0,0 +1,60 @@
1
+ /** A serialized transaction must fit one packet. */
2
+ export declare const MAX_TRANSACTION_BYTES = 1232;
3
+ export declare const SIGNATURE_BYTES = 64;
4
+ /**
5
+ * A message. `version` is 'legacy' (default) or 0. For v0, `lookupTables` is [{ address, addresses: [base58] }]:
6
+ * read-only and writable accounts that are neither signers nor invoked programs load from a table when it holds them.
7
+ */
8
+ export declare function compileMessage({ payer, blockhash, instructions, version, lookupTables }: {
9
+ blockhash: any;
10
+ instructions: any;
11
+ lookupTables?: never[] | undefined;
12
+ payer: any;
13
+ version?: string | undefined;
14
+ }): Uint8Array<any>;
15
+ /**
16
+ * The parts of a message: version, header, static keys, blockhash and compiled instructions. Throws, saying so, on a
17
+ * message cut short or with bytes after its end.
18
+ */
19
+ export declare function readMessage(message: any): {
20
+ version: string;
21
+ header: {
22
+ numRequiredSignatures: any;
23
+ numReadonlySigned: any;
24
+ numReadonlyUnsigned: any;
25
+ };
26
+ keys: string[];
27
+ blockhash: string;
28
+ instructions: {
29
+ programIndex: any;
30
+ accountIndexes: any[];
31
+ data: any;
32
+ }[];
33
+ lookups: {
34
+ address: string;
35
+ writable: any[];
36
+ readonly: any[];
37
+ }[];
38
+ };
39
+ /** The addresses that must sign a message, in signature-slot order. */
40
+ export declare function signersOf(message: any): string[];
41
+ /** The wire form: one signature slot per required signer (empty unless given), then the message. */
42
+ export declare function wireTransaction(message: any, signatures?: any[]): Uint8Array<any>;
43
+ /** A wire transaction read back: its signatures, its message bytes and its signers. */
44
+ export declare function readTransaction(wire: any): {
45
+ signatures: any[];
46
+ message: any;
47
+ signers: string[];
48
+ };
49
+ /** A copy of the wire transaction with `signer`'s slot holding `signature`. */
50
+ export declare function withSignature(wire: any, signer: any, signature: any): Uint8Array<any>;
51
+ /** The transaction's id: its first signature, in base58. */
52
+ export declare const transactionId: (wire: any) => string;
53
+ /** Whether a signature slot is still empty. */
54
+ export declare const isEmptySignature: (signature: any) => any;
55
+ /** Whether two wire transactions carry the same message. */
56
+ export declare const sameMessage: (a: any, b: any) => boolean;
57
+ /** The size this message's transaction takes on the wire. */
58
+ export declare const transactionSize: (message: any) => number;
59
+ /** Whether these instructions fit one transaction from this payer. */
60
+ export declare function fits(input: any): boolean;