@x1id/resolve 0.10.0 → 0.12.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/README.md +74 -5
- package/dist/adminConfig.d.ts +63 -0
- package/dist/adminConfig.js +113 -0
- package/dist/adminMarket.d.ts +67 -0
- package/dist/adminMarket.js +134 -0
- package/dist/attestation.d.ts +103 -1
- package/dist/attestation.js +124 -0
- package/dist/gateClient.d.ts +98 -0
- package/dist/gateClient.js +118 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +138 -2
- package/dist/lease.d.ts +92 -0
- package/dist/lease.js +117 -0
- package/dist/namespaceOverride.d.ts +123 -0
- package/dist/namespaceOverride.js +204 -0
- package/dist/register.d.ts +30 -0
- package/dist/register.js +37 -0
- package/dist/scoped.d.ts +84 -0
- package/dist/scoped.js +126 -0
- package/dist/types.d.ts +23 -4
- package/dist/types.js +2 -1
- package/dist/universal.d.ts +58 -0
- package/dist/universal.js +67 -0
- package/dist/universalDetect.d.ts +44 -0
- package/dist/universalDetect.js +105 -0
- package/dist/universalEns.d.ts +44 -0
- package/dist/universalEns.js +138 -0
- package/dist/universalNative.d.ts +13 -0
- package/dist/universalNative.js +43 -0
- package/dist/universalSns.d.ts +95 -0
- package/dist/universalSns.js +223 -0
- package/dist/universalTypes.d.ts +117 -0
- package/dist/universalTypes.js +24 -0
- package/dist/voucher.d.ts +53 -0
- package/dist/voucher.js +56 -0
- package/dist/wasm.d.ts +17 -0
- package/dist/wasm.js +38 -0
- package/package.json +1 -1
- package/wasm/x1_resolve_wasm.wasm +0 -0
package/dist/voucher.d.ts
CHANGED
|
@@ -128,3 +128,56 @@ export interface RefundVoucherParams {
|
|
|
128
128
|
}
|
|
129
129
|
/** Build `refund_voucher` — payer-signed, only valid at/after `expiresAt`. */
|
|
130
130
|
export declare function buildRefundVoucherIx(p: RefundVoucherParams): BuiltInstruction;
|
|
131
|
+
/** `sha256("global:claim_voucher_tokenized")[0..8]`. */
|
|
132
|
+
export declare const CLAIM_VOUCHER_TOKENIZED_DISCRIMINATOR: Uint8Array;
|
|
133
|
+
export interface ClaimVoucherTokenizedParams {
|
|
134
|
+
readonly programId: AddressLike;
|
|
135
|
+
/** Submits + signs; fronts the tx fee (reimbursed) + the handle rent. */
|
|
136
|
+
readonly claimer: AddressLike;
|
|
137
|
+
readonly config: AddressLike;
|
|
138
|
+
readonly treasury: AddressLike;
|
|
139
|
+
readonly voucher: AddressLike;
|
|
140
|
+
/** The original voucher payer — receives rent back when the voucher closes. */
|
|
141
|
+
readonly voucherPayer: AddressLike;
|
|
142
|
+
/** Who the pNFT + ownership go to: the bound recipient, or the claimer for an
|
|
143
|
+
* open voucher. The mint's ATA + token record derive against THIS address. */
|
|
144
|
+
readonly owner: AddressLike;
|
|
145
|
+
/** The `["handle", name]` PDA. */
|
|
146
|
+
readonly handle: AddressLike;
|
|
147
|
+
readonly name: string;
|
|
148
|
+
/** `["nft_mint", handle]` PDA. */
|
|
149
|
+
readonly mint: AddressLike;
|
|
150
|
+
/** `owner`'s associated token account for `mint` (receives the frozen unit). */
|
|
151
|
+
readonly ownerTokenAccount: AddressLike;
|
|
152
|
+
/** Metaplex metadata PDA for `mint`. */
|
|
153
|
+
readonly metadata: AddressLike;
|
|
154
|
+
/** Metaplex master-edition PDA for `mint`. */
|
|
155
|
+
readonly masterEdition: AddressLike;
|
|
156
|
+
/** pNFT TokenRecord PDA for (`mint`, `ownerTokenAccount`). */
|
|
157
|
+
readonly tokenRecord: AddressLike;
|
|
158
|
+
/** The collection parent mint (`["collection_mint"]`). */
|
|
159
|
+
readonly collectionMint: AddressLike;
|
|
160
|
+
/** The collection parent metadata (writable — sized-collection bump). */
|
|
161
|
+
readonly collectionMetadata: AddressLike;
|
|
162
|
+
/** The collection parent master edition. */
|
|
163
|
+
readonly collectionMasterEdition: AddressLike;
|
|
164
|
+
/** The collection authority PDA. */
|
|
165
|
+
readonly collectionAuthority: AddressLike;
|
|
166
|
+
/** The integrator wallet — REQUIRED iff the voucher carries one; must equal
|
|
167
|
+
* the voucher's `integrator`. Omit otherwise. */
|
|
168
|
+
readonly integrator?: AddressLike;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Build `claim_voucher_tokenized` (#8335) — the tokenized sibling of
|
|
172
|
+
* {@link buildClaimVoucherIx} and the DEFAULT path the live gift-claim flow
|
|
173
|
+
* uses: it registers the handle AND mints its tradeable capability pNFT in one
|
|
174
|
+
* instruction. The pNFT + ownership go to `owner` (the bound recipient, or the
|
|
175
|
+
* claimer for an open voucher), so `ownerTokenAccount` / `tokenRecord` derive
|
|
176
|
+
* against `owner`, not the claimer. Data: `disc ‖ borsh(name)` — the handle type
|
|
177
|
+
* comes from the voucher, not an argument.
|
|
178
|
+
*
|
|
179
|
+
* The register + 3 Metaplex CPIs exceed the 200k default compute budget —
|
|
180
|
+
* prepend a ComputeBudget `setComputeUnitLimit` instruction in the SAME
|
|
181
|
+
* transaction (the app uses ~400k) or the claim fails on-chain.
|
|
182
|
+
*/
|
|
183
|
+
export declare function buildClaimVoucherTokenizedIx(p: ClaimVoucherTokenizedParams): BuiltInstruction;
|
package/dist/voucher.js
CHANGED
|
@@ -183,3 +183,59 @@ export function buildRefundVoucherIx(p) {
|
|
|
183
183
|
data,
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
+
// ===================== claim_voucher_tokenized (gift NFTs, #8335) =====================
|
|
187
|
+
/** `sha256("global:claim_voucher_tokenized")[0..8]`. */
|
|
188
|
+
export const CLAIM_VOUCHER_TOKENIZED_DISCRIMINATOR = Uint8Array.from([131, 111, 174, 105, 154, 248, 191, 235]);
|
|
189
|
+
// Fixed Metaplex / SPL program ids + sysvar in the pNFT-mint tail — hardcoded,
|
|
190
|
+
// never derived (matches the app's mintNft.ts).
|
|
191
|
+
const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
192
|
+
const ASSOCIATED_TOKEN_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
193
|
+
const TOKEN_METADATA_PROGRAM = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
|
|
194
|
+
const SYSVAR_INSTRUCTIONS = "Sysvar1nstructions1111111111111111111111111";
|
|
195
|
+
/**
|
|
196
|
+
* Build `claim_voucher_tokenized` (#8335) — the tokenized sibling of
|
|
197
|
+
* {@link buildClaimVoucherIx} and the DEFAULT path the live gift-claim flow
|
|
198
|
+
* uses: it registers the handle AND mints its tradeable capability pNFT in one
|
|
199
|
+
* instruction. The pNFT + ownership go to `owner` (the bound recipient, or the
|
|
200
|
+
* claimer for an open voucher), so `ownerTokenAccount` / `tokenRecord` derive
|
|
201
|
+
* against `owner`, not the claimer. Data: `disc ‖ borsh(name)` — the handle type
|
|
202
|
+
* comes from the voucher, not an argument.
|
|
203
|
+
*
|
|
204
|
+
* The register + 3 Metaplex CPIs exceed the 200k default compute budget —
|
|
205
|
+
* prepend a ComputeBudget `setComputeUnitLimit` instruction in the SAME
|
|
206
|
+
* transaction (the app uses ~400k) or the claim fails on-chain.
|
|
207
|
+
*/
|
|
208
|
+
export function buildClaimVoucherTokenizedIx(p) {
|
|
209
|
+
const name = encString(p.name);
|
|
210
|
+
const data = new Uint8Array(8 + name.length);
|
|
211
|
+
data.set(CLAIM_VOUCHER_TOKENIZED_DISCRIMINATOR, 0);
|
|
212
|
+
data.set(name, 8);
|
|
213
|
+
const keys = [
|
|
214
|
+
{ pubkey: toBase58(p.claimer, "claimer"), isSigner: true, isWritable: true },
|
|
215
|
+
{ pubkey: toBase58(p.config, "config"), isSigner: false, isWritable: true },
|
|
216
|
+
{ pubkey: toBase58(p.treasury, "treasury"), isSigner: false, isWritable: true },
|
|
217
|
+
{ pubkey: toBase58(p.voucher, "voucher"), isSigner: false, isWritable: true },
|
|
218
|
+
{ pubkey: toBase58(p.voucherPayer, "voucherPayer"), isSigner: false, isWritable: true },
|
|
219
|
+
{ pubkey: toBase58(p.owner, "owner"), isSigner: false, isWritable: false },
|
|
220
|
+
{ pubkey: toBase58(p.handle, "handle"), isSigner: false, isWritable: true },
|
|
221
|
+
// Metaplex pNFT tail — order + flags verbatim from mintNft.ts::tokenizedTailKeys.
|
|
222
|
+
{ pubkey: toBase58(p.mint, "mint"), isSigner: false, isWritable: true },
|
|
223
|
+
{ pubkey: toBase58(p.ownerTokenAccount, "ownerTokenAccount"), isSigner: false, isWritable: true },
|
|
224
|
+
{ pubkey: toBase58(p.metadata, "metadata"), isSigner: false, isWritable: true },
|
|
225
|
+
{ pubkey: toBase58(p.masterEdition, "masterEdition"), isSigner: false, isWritable: true },
|
|
226
|
+
{ pubkey: toBase58(p.tokenRecord, "tokenRecord"), isSigner: false, isWritable: true },
|
|
227
|
+
{ pubkey: toBase58(p.collectionMint, "collectionMint"), isSigner: false, isWritable: false },
|
|
228
|
+
{ pubkey: toBase58(p.collectionMetadata, "collectionMetadata"), isSigner: false, isWritable: true },
|
|
229
|
+
{ pubkey: toBase58(p.collectionMasterEdition, "collectionMasterEdition"), isSigner: false, isWritable: false },
|
|
230
|
+
{ pubkey: toBase58(p.collectionAuthority, "collectionAuthority"), isSigner: false, isWritable: false },
|
|
231
|
+
{ pubkey: TOKEN_METADATA_PROGRAM, isSigner: false, isWritable: false },
|
|
232
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
233
|
+
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
234
|
+
{ pubkey: SYSTEM_PROGRAM, isSigner: false, isWritable: false },
|
|
235
|
+
{ pubkey: SYSVAR_INSTRUCTIONS, isSigner: false, isWritable: false },
|
|
236
|
+
];
|
|
237
|
+
if (p.integrator !== undefined) {
|
|
238
|
+
keys.push({ pubkey: toBase58(p.integrator, "integrator"), isSigner: false, isWritable: true });
|
|
239
|
+
}
|
|
240
|
+
return { programId: toBase58(p.programId, "programId"), keys, data };
|
|
241
|
+
}
|
package/dist/wasm.d.ts
CHANGED
|
@@ -78,5 +78,22 @@ export declare class WasmResolver {
|
|
|
78
78
|
* Needed on BOTH sides of a `ProgrammableNonFungible` transfer.
|
|
79
79
|
*/
|
|
80
80
|
deriveTokenRecordAccount(mint: Uint8Array, token: Uint8Array, programId: Uint8Array): Uint8Array | null;
|
|
81
|
+
/**
|
|
82
|
+
* Derive the per-handle `NamespaceOverride` PDA under the registry program id
|
|
83
|
+
* — seeds `["namespace_override", handle, label]`, matching the on-chain
|
|
84
|
+
* `CreateNamespaceOverride` account. `handle` is the 32-byte handle PDA
|
|
85
|
+
* (from {@link deriveHandleAccount}); `label` is the namespace label (e.g.
|
|
86
|
+
* "xnt"), 1..=16 bytes. Returns the 32-byte override account, or null.
|
|
87
|
+
*
|
|
88
|
+
* NOTE: overrides are built but not yet honored by `resolve()` — this derive
|
|
89
|
+
* is for the write builders (namespaceOverride.ts) and the gated read path.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Derive a `Namespace` directory PDA under the registry program id — seeds
|
|
93
|
+
* `["namespace", label]`. Needed to pass the namespace account into a
|
|
94
|
+
* create-override instruction. `label` is 1..=16 bytes. Returns 32 bytes or null.
|
|
95
|
+
*/
|
|
96
|
+
deriveNamespaceAccount(label: string, programId: Uint8Array): Uint8Array | null;
|
|
97
|
+
deriveNamespaceOverrideAccount(handle: Uint8Array, label: string, programId: Uint8Array): Uint8Array | null;
|
|
81
98
|
}
|
|
82
99
|
export {};
|
package/dist/wasm.js
CHANGED
|
@@ -146,4 +146,42 @@ export class WasmResolver {
|
|
|
146
146
|
const n = this.#write(joined);
|
|
147
147
|
return this.#x.derive_token_record_account(n) === 1 ? this.#read() : null;
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Derive the per-handle `NamespaceOverride` PDA under the registry program id
|
|
151
|
+
* — seeds `["namespace_override", handle, label]`, matching the on-chain
|
|
152
|
+
* `CreateNamespaceOverride` account. `handle` is the 32-byte handle PDA
|
|
153
|
+
* (from {@link deriveHandleAccount}); `label` is the namespace label (e.g.
|
|
154
|
+
* "xnt"), 1..=16 bytes. Returns the 32-byte override account, or null.
|
|
155
|
+
*
|
|
156
|
+
* NOTE: overrides are built but not yet honored by `resolve()` — this derive
|
|
157
|
+
* is for the write builders (namespaceOverride.ts) and the gated read path.
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* Derive a `Namespace` directory PDA under the registry program id — seeds
|
|
161
|
+
* `["namespace", label]`. Needed to pass the namespace account into a
|
|
162
|
+
* create-override instruction. `label` is 1..=16 bytes. Returns 32 bytes or null.
|
|
163
|
+
*/
|
|
164
|
+
deriveNamespaceAccount(label, programId) {
|
|
165
|
+
if (programId.length !== 32)
|
|
166
|
+
return null;
|
|
167
|
+
const labelBytes = this.#enc.encode(label);
|
|
168
|
+
if (labelBytes.length < 1 || labelBytes.length > 16)
|
|
169
|
+
return null;
|
|
170
|
+
new Uint8Array(this.#x.memory.buffer, this.#x.program_ptr(), 32).set(programId);
|
|
171
|
+
const n = this.#write(labelBytes);
|
|
172
|
+
return this.#x.derive_namespace_account(n) === 1 ? this.#read() : null;
|
|
173
|
+
}
|
|
174
|
+
deriveNamespaceOverrideAccount(handle, label, programId) {
|
|
175
|
+
if (handle.length !== 32 || programId.length !== 32)
|
|
176
|
+
return null;
|
|
177
|
+
const labelBytes = this.#enc.encode(label);
|
|
178
|
+
if (labelBytes.length < 1 || labelBytes.length > 16)
|
|
179
|
+
return null;
|
|
180
|
+
new Uint8Array(this.#x.memory.buffer, this.#x.program_ptr(), 32).set(programId);
|
|
181
|
+
const joined = new Uint8Array(32 + labelBytes.length);
|
|
182
|
+
joined.set(handle, 0);
|
|
183
|
+
joined.set(labelBytes, 32);
|
|
184
|
+
const n = this.#write(joined);
|
|
185
|
+
return this.#x.derive_namespace_override_account(n) === 1 ? this.#read() : null;
|
|
186
|
+
}
|
|
149
187
|
}
|
package/package.json
CHANGED
|
Binary file
|