@heyanon-arp/sdk 0.0.33 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets.d.ts +0 -2
- package/dist/errors/index.d.ts +0 -1
- package/dist/errors/post-commit.d.ts +0 -1
- package/dist/escrow/create-lock.d.ts +16 -6
- package/dist/escrow/index.d.ts +2 -2
- package/dist/escrow/lock-account.d.ts +0 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -60
- package/dist/index.mjs +3 -54
- package/dist/purpose.d.ts +0 -2
- package/dist/settlement/index.d.ts +0 -2
- package/dist/types/discovery.d.ts +0 -1
- package/dist/types/envelope.d.ts +0 -13
- package/dist/types/inbox.d.ts +0 -1
- package/dist/types/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/settlement/token-program.d.ts +0 -56
package/dist/assets.d.ts
CHANGED
|
@@ -82,8 +82,6 @@ export declare const WELL_KNOWN_ASSETS: Readonly<Record<string, AssetIdentifier>
|
|
|
82
82
|
* Lookup table keys exported for `--help` choices in the CLI.
|
|
83
83
|
*/
|
|
84
84
|
export declare const WELL_KNOWN_ASSET_KEYS: readonly string[];
|
|
85
|
-
/** Whitelisted assets for one cluster (defensive copies). */
|
|
86
|
-
export declare function listWhitelistedAssets(cluster: SolanaCluster): AssetIdentifier[];
|
|
87
85
|
/**
|
|
88
86
|
* Reverse lookup: CAIP-19 `asset_id` → whitelist entry + its cluster
|
|
89
87
|
* and shorthand key. Returns `null` for anything not whitelisted.
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { POST_COMMIT_ERROR_CODES, POST_COMMIT_ERROR_CODE_PREFIXES, isPostCommitErrorCode } from './post-commit';
|
|
2
|
-
export type { PostCommitErrorCode } from './post-commit';
|
|
3
2
|
export { DELEGATION_OFFER_REJECTION_CODES, DelegationOfferRejectionCodes, CLI_AUTH_TOKEN_ERROR_CODES, CliAuthTokenErrorCodes } from './codes';
|
|
4
3
|
export type { ApiErrorBody, DelegationOfferRejectionCode, CliAuthTokenErrorCode } from './codes';
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* (the server was missing `RECEIPT_INVALID_STATE`). It is now owned here.
|
|
17
17
|
*/
|
|
18
18
|
export declare const POST_COMMIT_ERROR_CODES: readonly ["DELEGATION_ALREADY_EXISTS", "DELEGATION_INVALID_STATE", "DELEGATION_NOT_FOUND", "DELEGATION_RELATIONSHIP_MISMATCH", "DELEGATION_ACCEPTER_IS_OFFERER", "DELEGATION_DECLINER_IS_OFFERER", "DELEGATION_CANCELER_NOT_OFFERER", "DELEGATION_ASSET_NOT_ALLOWED", "DELEGATION_PRICING_MISMATCH", "DELEGATION_CAPACITY_EXCEEDED", "DELEGATION_PENDING_LOCK", "DELEGATION_FUNDER_NOT_OFFERER", "DELEGATION_ALREADY_FUNDED", "WORK_DELEGATION_NOT_FOUND", "WORK_DELEGATION_NOT_ACTIVE", "WORK_RELATIONSHIP_MISMATCH", "WORK_REQUESTER_NOT_OFFERER", "WORK_REQUEST_ALREADY_EXISTS", "WORK_REQUEST_NOT_FOUND", "WORK_RESPONDER_IS_CALLER", "WORK_INVALID_STATE", "RECEIPT_ALREADY_EXISTS", "RECEIPT_DELEGATION_NOT_FOUND", "RECEIPT_DELEGATION_NOT_ACTIVE", "RECEIPT_RELATIONSHIP_MISMATCH", "RECEIPT_ISSUER_IS_CALLER", "RECEIPT_NOT_FOUND", "RECEIPT_INVALID_STATE", "RECEIPT_RESPONSE_HASH_NOT_FOUND", "RECEIPT_REQUEST_HASH_NOT_FOUND", "RECEIPT_DELIVERABLE_HASH_MISMATCH"];
|
|
19
|
-
export type PostCommitErrorCode = (typeof POST_COMMIT_ERROR_CODES)[number];
|
|
20
19
|
/**
|
|
21
20
|
* Code-FAMILY prefixes that are always post-commit, enumerated rather
|
|
22
21
|
* than listed member-by-member because they grow over time:
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the canonical instruction-data byte sequence for a Solana
|
|
3
|
+
* `create_lock` instruction. Pure-bytes builder: callers compose
|
|
4
|
+
* this around a Solana Transaction object (in arp-server's
|
|
5
|
+
* ReleaseTxBuilderService style) or hand it to a separate CLI
|
|
6
|
+
* Solana web3 wrapper.
|
|
7
|
+
*
|
|
8
|
+
* The SDK doesn't depend on `@solana/web3.js` — that's a workspace
|
|
9
|
+
* rule (keeps the SDK installable in browser contexts that don't
|
|
10
|
+
* want the full Solana SDK pulled in). Callers feed in pre-derived
|
|
11
|
+
* PDAs / pubkeys; we return the 80-byte ix data buffer.
|
|
12
|
+
*
|
|
13
|
+
* Anchor 8-byte instruction discriminators:
|
|
14
|
+
* sha256("global:create_lock")[0..8] = ab d8 5c a7 a5 08 99 5a
|
|
15
|
+
* sha256("global:create_lock_native")[0..8] = ea 13 da 24 17 4a da 6c
|
|
16
|
+
*/
|
|
1
17
|
export declare const CREATE_LOCK_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
2
18
|
/** sha256("global:create_lock_native")[0..8] — the lamport-path variant. */
|
|
3
19
|
export declare const CREATE_LOCK_NATIVE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
@@ -33,9 +49,3 @@ export interface CreateLockArgs {
|
|
|
33
49
|
export declare function buildCreateLockIxData(args: CreateLockArgs, opts?: {
|
|
34
50
|
native?: boolean;
|
|
35
51
|
}): Uint8Array;
|
|
36
|
-
/**
|
|
37
|
-
* Sanity check: confirm the hard-coded discriminator matches what
|
|
38
|
-
* sha256("global:create_lock")[0..8] should produce. Exposed for the
|
|
39
|
-
* SDK test suite; not used at runtime.
|
|
40
|
-
*/
|
|
41
|
-
export declare function computeCreateLockDiscriminator(): Uint8Array;
|
package/dist/escrow/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { deriveLockId, delegationIdToBytes16, bytes16ToDelegationId } from './lo
|
|
|
2
2
|
export { deriveDelegationConditionHash, type DelegationTermsSubset, type DelegationTermsInput } from './condition-hash';
|
|
3
3
|
export { parseCaip19SolanaAssetId, type ParsedSolanaAssetId } from './caip19';
|
|
4
4
|
export type { EscrowConfigStatus } from './config-status';
|
|
5
|
-
export { buildCreateLockIxData,
|
|
5
|
+
export { buildCreateLockIxData, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, type CreateLockArgs, } from './create-lock';
|
|
6
6
|
export { ESCROW_PDA_SEEDS, NO_ARG_LIFECYCLE_INSTRUCTIONS, type NoArgLifecycleInstruction, instructionDiscriminator, buildLifecycleIxData, buildResolveDisputeIxData, type ResolveDisputeArgs, } from './lifecycle-instructions';
|
|
7
|
-
export { LOCK_ACCOUNT_SIZE, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, LockStates, LockTerminalStates, ESCROW_RELEASE_METHODS, EscrowReleaseMethods, NATIVE_SOL_MINT_BASE58, type LockStateName, type LockTerminalState, type EscrowReleaseMethodName, isEscrowReleaseMethod, type DecodedLockAccount, decodeLockAccount,
|
|
7
|
+
export { LOCK_ACCOUNT_SIZE, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, LockStates, LockTerminalStates, ESCROW_RELEASE_METHODS, EscrowReleaseMethods, NATIVE_SOL_MINT_BASE58, type LockStateName, type LockTerminalState, type EscrowReleaseMethodName, isEscrowReleaseMethod, type DecodedLockAccount, decodeLockAccount, } from './lock-account';
|
|
8
8
|
export * from './instructions';
|
|
@@ -97,5 +97,3 @@ export interface DecodedLockAccount {
|
|
|
97
97
|
* beats silently-wrong fields.
|
|
98
98
|
*/
|
|
99
99
|
export declare function decodeLockAccount(data: Uint8Array): DecodedLockAccount;
|
|
100
|
-
/** Test hook: the canonical discriminator computation. */
|
|
101
|
-
export declare function computeLockAccountDiscriminator(): Uint8Array;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - challenge — ARP-CHALLENGE-v1 ownership proof (registration)
|
|
11
11
|
* - attestation — scrypt key-link owner attestation
|
|
12
12
|
* - server-chain — signed_message_hash, server_event_hash, audit walker
|
|
13
|
-
* - settlement —
|
|
13
|
+
* - settlement — canonical Solana program-id base58 constants
|
|
14
14
|
* - purpose — domain separators (`ARP-*-v1`)
|
|
15
15
|
* - utils — uuid v4, sender_nonce, RFC 3339, expires_at
|
|
16
16
|
* - types — wire-level TypeScript types (Envelope, body union, identity)
|
package/dist/index.js
CHANGED
|
@@ -162,8 +162,6 @@ var Purpose = {
|
|
|
162
162
|
RECEIPT: "ARP-RECEIPT-v1",
|
|
163
163
|
/** Identity ownership challenge proof. */
|
|
164
164
|
CHALLENGE: "ARP-CHALLENGE-v1",
|
|
165
|
-
/** Verifiable Credential issued by the platform. */
|
|
166
|
-
VC: "ARP-VC-v1",
|
|
167
165
|
/** Owner attestation linking identity ↔ settlement keys at registration. */
|
|
168
166
|
KEY_LINK: "ARP-KEY-LINK-v1"
|
|
169
167
|
};
|
|
@@ -304,41 +302,6 @@ var TOKEN_2022_PROGRAM_ID_BASE58 = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
|
304
302
|
var ASSOCIATED_TOKEN_PROGRAM_ID_BASE58 = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
305
303
|
var SYSTEM_PROGRAM_ID_BASE58 = "11111111111111111111111111111111";
|
|
306
304
|
var ESCROW_PROGRAM_ID_BASE58 = "DckBAFZcE1AZWgVsz5ipnwSUy2wWeK5eBPBoyJgKVPzb";
|
|
307
|
-
|
|
308
|
-
// src/settlement/token-program.ts
|
|
309
|
-
function detectTokenProgramFromOwner(mintAccountOwnerBase58) {
|
|
310
|
-
if (mintAccountOwnerBase58 === SPL_TOKEN_PROGRAM_ID_BASE58) {
|
|
311
|
-
return { kind: "legacy", programIdBase58: SPL_TOKEN_PROGRAM_ID_BASE58 };
|
|
312
|
-
}
|
|
313
|
-
if (mintAccountOwnerBase58 === TOKEN_2022_PROGRAM_ID_BASE58) {
|
|
314
|
-
throw new Error(
|
|
315
|
-
`detectTokenProgram: mint owner is the Token-2022 program (${TOKEN_2022_PROGRAM_ID_BASE58}), which ARP escrow does not support; use a legacy SPL Token mint (${SPL_TOKEN_PROGRAM_ID_BASE58}) or native SOL`
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
throw new Error(`detectTokenProgram: unsupported mint owner ${mintAccountOwnerBase58}; ARP escrow supports legacy SPL Token (${SPL_TOKEN_PROGRAM_ID_BASE58}) only`);
|
|
319
|
-
}
|
|
320
|
-
function detectTokenProgramFromOwnerBytes(mintAccountOwnerBytes) {
|
|
321
|
-
if (mintAccountOwnerBytes.length !== 32) {
|
|
322
|
-
throw new Error(`detectTokenProgram: mintAccountOwnerBytes must be 32 bytes, got ${mintAccountOwnerBytes.length}`);
|
|
323
|
-
}
|
|
324
|
-
return detectTokenProgramFromOwner(bytesToBase58(mintAccountOwnerBytes));
|
|
325
|
-
}
|
|
326
|
-
function bytesToBase58(bytes) {
|
|
327
|
-
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
328
|
-
let zeros = 0;
|
|
329
|
-
for (let i = 0; i < bytes.length && bytes[i] === 0; i++) zeros++;
|
|
330
|
-
let num = 0n;
|
|
331
|
-
for (const b of bytes) {
|
|
332
|
-
num = num * 256n + BigInt(b);
|
|
333
|
-
}
|
|
334
|
-
let out = "";
|
|
335
|
-
while (num > 0n) {
|
|
336
|
-
const rem = Number(num % 58n);
|
|
337
|
-
num = num / 58n;
|
|
338
|
-
out = ALPHABET[rem] + out;
|
|
339
|
-
}
|
|
340
|
-
return "1".repeat(zeros) + out;
|
|
341
|
-
}
|
|
342
305
|
function uuidV4() {
|
|
343
306
|
const bytes = utils.randomBytes(16);
|
|
344
307
|
bytes[6] = bytes[6] & 15 | 64;
|
|
@@ -534,9 +497,6 @@ var ReadModelStatuses = {
|
|
|
534
497
|
|
|
535
498
|
// src/types/discovery.ts
|
|
536
499
|
var DISCOVERY_SORTS = ["reputation", "recent", "created"];
|
|
537
|
-
function isDiscoverySort(v) {
|
|
538
|
-
return typeof v === "string" && DISCOVERY_SORTS.includes(v);
|
|
539
|
-
}
|
|
540
500
|
var DiscoverySorts = {
|
|
541
501
|
REPUTATION: "reputation",
|
|
542
502
|
RECENT: "recent",
|
|
@@ -545,9 +505,6 @@ var DiscoverySorts = {
|
|
|
545
505
|
|
|
546
506
|
// src/types/inbox.ts
|
|
547
507
|
var INBOX_BLOCK_SCOPES = ["account", "did"];
|
|
548
|
-
function isInboxBlockScope(v) {
|
|
549
|
-
return typeof v === "string" && INBOX_BLOCK_SCOPES.includes(v);
|
|
550
|
-
}
|
|
551
508
|
var InboxBlockScopes = {
|
|
552
509
|
ACCOUNT: "account",
|
|
553
510
|
DID: "did"
|
|
@@ -657,9 +614,6 @@ var WELL_KNOWN_ASSETS = Object.fromEntries(
|
|
|
657
614
|
Object.entries(ASSET_WHITELIST).flatMap(([cluster, assets]) => assets.map((asset) => [`${asset.symbol}:${cluster}`, asset]))
|
|
658
615
|
);
|
|
659
616
|
var WELL_KNOWN_ASSET_KEYS = Object.keys(WELL_KNOWN_ASSETS);
|
|
660
|
-
function listWhitelistedAssets(cluster) {
|
|
661
|
-
return ASSET_WHITELIST[cluster].map((a) => ({ ...a }));
|
|
662
|
-
}
|
|
663
617
|
function findAssetByAssetId(assetId) {
|
|
664
618
|
for (const [cluster, assets] of Object.entries(ASSET_WHITELIST)) {
|
|
665
619
|
const asset = assets.find((a) => a.asset_id === assetId);
|
|
@@ -768,6 +722,8 @@ function parseCaip19SolanaAssetId(assetId) {
|
|
|
768
722
|
}
|
|
769
723
|
throw new Error(`Unsupported CAIP-19 namespace: ${JSON.stringify(namespaceRaw)} (only 'spl' and 'slip44' are supported on Solana)`);
|
|
770
724
|
}
|
|
725
|
+
|
|
726
|
+
// src/escrow/create-lock.ts
|
|
771
727
|
var CREATE_LOCK_DISCRIMINATOR = new Uint8Array([171, 216, 92, 167, 165, 8, 153, 90]);
|
|
772
728
|
var CREATE_LOCK_NATIVE_DISCRIMINATOR = new Uint8Array([234, 19, 218, 36, 23, 74, 218, 108]);
|
|
773
729
|
function buildCreateLockIxData(args, opts = {}) {
|
|
@@ -801,10 +757,6 @@ function writeU64LE(buf, off, value) {
|
|
|
801
757
|
v >>= 8n;
|
|
802
758
|
}
|
|
803
759
|
}
|
|
804
|
-
function computeCreateLockDiscriminator() {
|
|
805
|
-
const h = sha2.sha256(new TextEncoder().encode("global:create_lock"));
|
|
806
|
-
return h.slice(0, 8);
|
|
807
|
-
}
|
|
808
760
|
var ESCROW_PDA_SEEDS = {
|
|
809
761
|
LOCK: "lock",
|
|
810
762
|
ESCROW: "escrow",
|
|
@@ -915,9 +867,6 @@ function decodeLockAccount(data) {
|
|
|
915
867
|
bump: data[268]
|
|
916
868
|
};
|
|
917
869
|
}
|
|
918
|
-
function computeLockAccountDiscriminator() {
|
|
919
|
-
return sha2.sha256(new TextEncoder().encode("account:Lock")).slice(0, 8);
|
|
920
|
-
}
|
|
921
870
|
function toHex(bytes) {
|
|
922
871
|
let hex = "";
|
|
923
872
|
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
@@ -1348,8 +1297,6 @@ exports.bytes16ToDelegationId = bytes16ToDelegationId;
|
|
|
1348
1297
|
exports.canonicalBytes = canonicalBytes;
|
|
1349
1298
|
exports.canonicalJson = canonicalJson;
|
|
1350
1299
|
exports.canonicalSha256Hex = canonicalSha256Hex;
|
|
1351
|
-
exports.computeCreateLockDiscriminator = computeCreateLockDiscriminator;
|
|
1352
|
-
exports.computeLockAccountDiscriminator = computeLockAccountDiscriminator;
|
|
1353
1300
|
exports.decodeLockAccount = decodeLockAccount;
|
|
1354
1301
|
exports.delegationIdToBytes16 = delegationIdToBytes16;
|
|
1355
1302
|
exports.deriveAta = deriveAta;
|
|
@@ -1364,8 +1311,6 @@ exports.deriveLockPda = deriveLockPda;
|
|
|
1364
1311
|
exports.deriveOperatorAuthPda = deriveOperatorAuthPda;
|
|
1365
1312
|
exports.deriveScryptKey = deriveScryptKey;
|
|
1366
1313
|
exports.deriveStakeVaultPda = deriveStakeVaultPda;
|
|
1367
|
-
exports.detectTokenProgramFromOwner = detectTokenProgramFromOwner;
|
|
1368
|
-
exports.detectTokenProgramFromOwnerBytes = detectTokenProgramFromOwnerBytes;
|
|
1369
1314
|
exports.expiresAt = expiresAt;
|
|
1370
1315
|
exports.fetchLockAccount = fetchLockAccount;
|
|
1371
1316
|
exports.findAssetByAssetId = findAssetByAssetId;
|
|
@@ -1381,10 +1326,8 @@ exports.isDecimalAmountString = isDecimalAmountString;
|
|
|
1381
1326
|
exports.isDeclineReason = isDeclineReason;
|
|
1382
1327
|
exports.isDelegationAction = isDelegationAction;
|
|
1383
1328
|
exports.isDelegationState = isDelegationState;
|
|
1384
|
-
exports.isDiscoverySort = isDiscoverySort;
|
|
1385
1329
|
exports.isEscrowReleaseMethod = isEscrowReleaseMethod;
|
|
1386
1330
|
exports.isHandshakeDecision = isHandshakeDecision;
|
|
1387
|
-
exports.isInboxBlockScope = isInboxBlockScope;
|
|
1388
1331
|
exports.isPostCommitErrorCode = isPostCommitErrorCode;
|
|
1389
1332
|
exports.isReadModelStatus = isReadModelStatus;
|
|
1390
1333
|
exports.isReceiptVerdict = isReceiptVerdict;
|
|
@@ -1395,7 +1338,6 @@ exports.isValidAgentName = isValidAgentName;
|
|
|
1395
1338
|
exports.isValidDid = isValidDid;
|
|
1396
1339
|
exports.isWhitelistedAssetId = isWhitelistedAssetId;
|
|
1397
1340
|
exports.isWorkLogState = isWorkLogState;
|
|
1398
|
-
exports.listWhitelistedAssets = listWhitelistedAssets;
|
|
1399
1341
|
exports.normalizeName = normalizeName;
|
|
1400
1342
|
exports.parseCaip19SolanaAssetId = parseCaip19SolanaAssetId;
|
|
1401
1343
|
exports.parseDid = parseDid;
|
package/dist/index.mjs
CHANGED
|
@@ -137,8 +137,6 @@ var Purpose = {
|
|
|
137
137
|
RECEIPT: "ARP-RECEIPT-v1",
|
|
138
138
|
/** Identity ownership challenge proof. */
|
|
139
139
|
CHALLENGE: "ARP-CHALLENGE-v1",
|
|
140
|
-
/** Verifiable Credential issued by the platform. */
|
|
141
|
-
VC: "ARP-VC-v1",
|
|
142
140
|
/** Owner attestation linking identity ↔ settlement keys at registration. */
|
|
143
141
|
KEY_LINK: "ARP-KEY-LINK-v1"
|
|
144
142
|
};
|
|
@@ -279,41 +277,6 @@ var TOKEN_2022_PROGRAM_ID_BASE58 = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
|
279
277
|
var ASSOCIATED_TOKEN_PROGRAM_ID_BASE58 = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
280
278
|
var SYSTEM_PROGRAM_ID_BASE58 = "11111111111111111111111111111111";
|
|
281
279
|
var ESCROW_PROGRAM_ID_BASE58 = "DckBAFZcE1AZWgVsz5ipnwSUy2wWeK5eBPBoyJgKVPzb";
|
|
282
|
-
|
|
283
|
-
// src/settlement/token-program.ts
|
|
284
|
-
function detectTokenProgramFromOwner(mintAccountOwnerBase58) {
|
|
285
|
-
if (mintAccountOwnerBase58 === SPL_TOKEN_PROGRAM_ID_BASE58) {
|
|
286
|
-
return { kind: "legacy", programIdBase58: SPL_TOKEN_PROGRAM_ID_BASE58 };
|
|
287
|
-
}
|
|
288
|
-
if (mintAccountOwnerBase58 === TOKEN_2022_PROGRAM_ID_BASE58) {
|
|
289
|
-
throw new Error(
|
|
290
|
-
`detectTokenProgram: mint owner is the Token-2022 program (${TOKEN_2022_PROGRAM_ID_BASE58}), which ARP escrow does not support; use a legacy SPL Token mint (${SPL_TOKEN_PROGRAM_ID_BASE58}) or native SOL`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
throw new Error(`detectTokenProgram: unsupported mint owner ${mintAccountOwnerBase58}; ARP escrow supports legacy SPL Token (${SPL_TOKEN_PROGRAM_ID_BASE58}) only`);
|
|
294
|
-
}
|
|
295
|
-
function detectTokenProgramFromOwnerBytes(mintAccountOwnerBytes) {
|
|
296
|
-
if (mintAccountOwnerBytes.length !== 32) {
|
|
297
|
-
throw new Error(`detectTokenProgram: mintAccountOwnerBytes must be 32 bytes, got ${mintAccountOwnerBytes.length}`);
|
|
298
|
-
}
|
|
299
|
-
return detectTokenProgramFromOwner(bytesToBase58(mintAccountOwnerBytes));
|
|
300
|
-
}
|
|
301
|
-
function bytesToBase58(bytes) {
|
|
302
|
-
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
303
|
-
let zeros = 0;
|
|
304
|
-
for (let i = 0; i < bytes.length && bytes[i] === 0; i++) zeros++;
|
|
305
|
-
let num = 0n;
|
|
306
|
-
for (const b of bytes) {
|
|
307
|
-
num = num * 256n + BigInt(b);
|
|
308
|
-
}
|
|
309
|
-
let out = "";
|
|
310
|
-
while (num > 0n) {
|
|
311
|
-
const rem = Number(num % 58n);
|
|
312
|
-
num = num / 58n;
|
|
313
|
-
out = ALPHABET[rem] + out;
|
|
314
|
-
}
|
|
315
|
-
return "1".repeat(zeros) + out;
|
|
316
|
-
}
|
|
317
280
|
function uuidV4() {
|
|
318
281
|
const bytes = randomBytes(16);
|
|
319
282
|
bytes[6] = bytes[6] & 15 | 64;
|
|
@@ -509,9 +472,6 @@ var ReadModelStatuses = {
|
|
|
509
472
|
|
|
510
473
|
// src/types/discovery.ts
|
|
511
474
|
var DISCOVERY_SORTS = ["reputation", "recent", "created"];
|
|
512
|
-
function isDiscoverySort(v) {
|
|
513
|
-
return typeof v === "string" && DISCOVERY_SORTS.includes(v);
|
|
514
|
-
}
|
|
515
475
|
var DiscoverySorts = {
|
|
516
476
|
REPUTATION: "reputation",
|
|
517
477
|
RECENT: "recent",
|
|
@@ -520,9 +480,6 @@ var DiscoverySorts = {
|
|
|
520
480
|
|
|
521
481
|
// src/types/inbox.ts
|
|
522
482
|
var INBOX_BLOCK_SCOPES = ["account", "did"];
|
|
523
|
-
function isInboxBlockScope(v) {
|
|
524
|
-
return typeof v === "string" && INBOX_BLOCK_SCOPES.includes(v);
|
|
525
|
-
}
|
|
526
483
|
var InboxBlockScopes = {
|
|
527
484
|
ACCOUNT: "account",
|
|
528
485
|
DID: "did"
|
|
@@ -632,9 +589,6 @@ var WELL_KNOWN_ASSETS = Object.fromEntries(
|
|
|
632
589
|
Object.entries(ASSET_WHITELIST).flatMap(([cluster, assets]) => assets.map((asset) => [`${asset.symbol}:${cluster}`, asset]))
|
|
633
590
|
);
|
|
634
591
|
var WELL_KNOWN_ASSET_KEYS = Object.keys(WELL_KNOWN_ASSETS);
|
|
635
|
-
function listWhitelistedAssets(cluster) {
|
|
636
|
-
return ASSET_WHITELIST[cluster].map((a) => ({ ...a }));
|
|
637
|
-
}
|
|
638
592
|
function findAssetByAssetId(assetId) {
|
|
639
593
|
for (const [cluster, assets] of Object.entries(ASSET_WHITELIST)) {
|
|
640
594
|
const asset = assets.find((a) => a.asset_id === assetId);
|
|
@@ -743,6 +697,8 @@ function parseCaip19SolanaAssetId(assetId) {
|
|
|
743
697
|
}
|
|
744
698
|
throw new Error(`Unsupported CAIP-19 namespace: ${JSON.stringify(namespaceRaw)} (only 'spl' and 'slip44' are supported on Solana)`);
|
|
745
699
|
}
|
|
700
|
+
|
|
701
|
+
// src/escrow/create-lock.ts
|
|
746
702
|
var CREATE_LOCK_DISCRIMINATOR = new Uint8Array([171, 216, 92, 167, 165, 8, 153, 90]);
|
|
747
703
|
var CREATE_LOCK_NATIVE_DISCRIMINATOR = new Uint8Array([234, 19, 218, 36, 23, 74, 218, 108]);
|
|
748
704
|
function buildCreateLockIxData(args, opts = {}) {
|
|
@@ -776,10 +732,6 @@ function writeU64LE(buf, off, value) {
|
|
|
776
732
|
v >>= 8n;
|
|
777
733
|
}
|
|
778
734
|
}
|
|
779
|
-
function computeCreateLockDiscriminator() {
|
|
780
|
-
const h = sha256(new TextEncoder().encode("global:create_lock"));
|
|
781
|
-
return h.slice(0, 8);
|
|
782
|
-
}
|
|
783
735
|
var ESCROW_PDA_SEEDS = {
|
|
784
736
|
LOCK: "lock",
|
|
785
737
|
ESCROW: "escrow",
|
|
@@ -890,9 +842,6 @@ function decodeLockAccount(data) {
|
|
|
890
842
|
bump: data[268]
|
|
891
843
|
};
|
|
892
844
|
}
|
|
893
|
-
function computeLockAccountDiscriminator() {
|
|
894
|
-
return sha256(new TextEncoder().encode("account:Lock")).slice(0, 8);
|
|
895
|
-
}
|
|
896
845
|
function toHex(bytes) {
|
|
897
846
|
let hex = "";
|
|
898
847
|
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
@@ -1226,4 +1175,4 @@ var CliAuthTokenErrorCodes = {
|
|
|
1226
1175
|
REQUIRED: "AUTH_TOKEN_REQUIRED"
|
|
1227
1176
|
};
|
|
1228
1177
|
|
|
1229
|
-
export { AGENT_NAME_REGEX, AGENT_TAG_REGEX, ASSET_DECIMALS_MAX, ASSET_DECIMALS_MIN, ASSET_SYMBOL_MAX_LEN, ASSET_SYMBOL_MIN_LEN, ASSET_WHITELIST, ASSOCIATED_TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, BODY_TYPES, BodyTypes, CAIP19_REGEX, CLI_AUTH_TOKEN_ERROR_CODES, CLI_LOGIN_SESSION_STATES, CLI_LOGIN_SESSION_STORED_STATES, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, CURRENT_PROTOCOL_VERSION, CliAuthTokenErrorCodes, CliLoginSessionStates, DECIMAL_AMOUNT_REGEX, DECLINE_REASONS, DELEGATION_ACTIONS, DELEGATION_ACTIVE_STATES, DELEGATION_OFFER_REJECTION_CODES, DELEGATION_STATES, DEVNET_MINTS, DID_ARP_REGEX, DISCOVERY_SORTS, DelegationActions, DelegationOfferRejectionCodes, DelegationStates, DiscoverySorts, ED25519_SIG_PREFIX, ESCROW_PDA_SEEDS, ESCROW_PROGRAM_ID_BASE58, ESCROW_RELEASE_METHODS, EscrowReleaseMethods, HANDSHAKE_DECISIONS, HandshakeDecisions, INBOX_BLOCK_SCOPES, InboxBlockScopes, LIVE_RELATIONSHIP_STATE_NAMES, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_ACCOUNT_SIZE, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, LockStates, LockTerminalStates, MAINNET_MINTS, MAX_CLOCK_SKEW_SECONDS, MAX_ENVELOPE_TTL_SECONDS, NATIVE_SOL_MINT, NATIVE_SOL_MINT_BASE58, NO_ARG_LIFECYCLE_INSTRUCTIONS, OWNER_SIGNING_METHODS, POST_COMMIT_ERROR_CODES, POST_COMMIT_ERROR_CODE_PREFIXES, PROTOCOL_VERSIONS, Purpose, READ_MODEL_STATUSES, RECEIPT_VERDICTS, RELATIONSHIP_STATE_NAMES, RESERVED_NAMES, ReadModelStatuses, ReceiptVerdicts, RelationshipStates, SCRYPT_PARAMS, SHA256_HEX_RE, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID, SPL_TOKEN_PROGRAM_ID_BASE58, SYSTEM_PROGRAM_ID_BASE58, TOKEN_2022_PROGRAM_ID_BASE58, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, WORK_LOG_STATES, WorkLogStates, base58btcDecode, base58btcEncode, buildAcceptLockIx, buildCancelLockIx, buildClaimExpiredWorkIx, buildClaimWorkPaymentIx, buildCloseDisputeIx, buildCreateLockIx, buildCreateLockIxData, buildLifecycleIxData, buildOpenDisputeIx, buildResolveDisputeIx, buildResolveDisputeIxData, buildSubmitWorkIx, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex,
|
|
1178
|
+
export { AGENT_NAME_REGEX, AGENT_TAG_REGEX, ASSET_DECIMALS_MAX, ASSET_DECIMALS_MIN, ASSET_SYMBOL_MAX_LEN, ASSET_SYMBOL_MIN_LEN, ASSET_WHITELIST, ASSOCIATED_TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, BODY_TYPES, BodyTypes, CAIP19_REGEX, CLI_AUTH_TOKEN_ERROR_CODES, CLI_LOGIN_SESSION_STATES, CLI_LOGIN_SESSION_STORED_STATES, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, CURRENT_PROTOCOL_VERSION, CliAuthTokenErrorCodes, CliLoginSessionStates, DECIMAL_AMOUNT_REGEX, DECLINE_REASONS, DELEGATION_ACTIONS, DELEGATION_ACTIVE_STATES, DELEGATION_OFFER_REJECTION_CODES, DELEGATION_STATES, DEVNET_MINTS, DID_ARP_REGEX, DISCOVERY_SORTS, DelegationActions, DelegationOfferRejectionCodes, DelegationStates, DiscoverySorts, ED25519_SIG_PREFIX, ESCROW_PDA_SEEDS, ESCROW_PROGRAM_ID_BASE58, ESCROW_RELEASE_METHODS, EscrowReleaseMethods, HANDSHAKE_DECISIONS, HandshakeDecisions, INBOX_BLOCK_SCOPES, InboxBlockScopes, LIVE_RELATIONSHIP_STATE_NAMES, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_ACCOUNT_SIZE, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, LockStates, LockTerminalStates, MAINNET_MINTS, MAX_CLOCK_SKEW_SECONDS, MAX_ENVELOPE_TTL_SECONDS, NATIVE_SOL_MINT, NATIVE_SOL_MINT_BASE58, NO_ARG_LIFECYCLE_INSTRUCTIONS, OWNER_SIGNING_METHODS, POST_COMMIT_ERROR_CODES, POST_COMMIT_ERROR_CODE_PREFIXES, PROTOCOL_VERSIONS, Purpose, READ_MODEL_STATUSES, RECEIPT_VERDICTS, RELATIONSHIP_STATE_NAMES, RESERVED_NAMES, ReadModelStatuses, ReceiptVerdicts, RelationshipStates, SCRYPT_PARAMS, SHA256_HEX_RE, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID, SPL_TOKEN_PROGRAM_ID_BASE58, SYSTEM_PROGRAM_ID_BASE58, TOKEN_2022_PROGRAM_ID_BASE58, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, WORK_LOG_STATES, WorkLogStates, base58btcDecode, base58btcEncode, buildAcceptLockIx, buildCancelLockIx, buildClaimExpiredWorkIx, buildClaimWorkPaymentIx, buildCloseDisputeIx, buildCreateLockIx, buildCreateLockIxData, buildLifecycleIxData, buildOpenDisputeIx, buildResolveDisputeIx, buildResolveDisputeIxData, buildSubmitWorkIx, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, decodeLockAccount, delegationIdToBytes16, deriveAta, deriveCollateralConfigPda, deriveConfigPda, deriveDelegationConditionHash, deriveDisputeResolutionPda, deriveEscrowPda, deriveEventAuthorityPda, deriveLockId, deriveLockPda, deriveOperatorAuthPda, deriveScryptKey, deriveStakeVaultPda, expiresAt, fetchLockAccount, findAssetByAssetId, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAssetIdentifier, isBodyType, isCliLoginSessionWireState, isDecimalAmountString, isDeclineReason, isDelegationAction, isDelegationState, isEscrowReleaseMethod, isHandshakeDecision, isPostCommitErrorCode, isReadModelStatus, isReceiptVerdict, isRelationshipState, isReservedName, isSha256Hex, isValidAgentName, isValidDid, isWhitelistedAssetId, isWorkLogState, normalizeName, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
|
package/dist/purpose.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ export declare const Purpose: {
|
|
|
17
17
|
readonly RECEIPT: "ARP-RECEIPT-v1";
|
|
18
18
|
/** Identity ownership challenge proof. */
|
|
19
19
|
readonly CHALLENGE: "ARP-CHALLENGE-v1";
|
|
20
|
-
/** Verifiable Credential issued by the platform. */
|
|
21
|
-
readonly VC: "ARP-VC-v1";
|
|
22
20
|
/** Owner attestation linking identity ↔ settlement keys at registration. */
|
|
23
21
|
readonly KEY_LINK: "ARP-KEY-LINK-v1";
|
|
24
22
|
};
|
|
@@ -1,3 +1 @@
|
|
|
1
1
|
export { SPL_TOKEN_PROGRAM_ID_BASE58, TOKEN_2022_PROGRAM_ID_BASE58, ASSOCIATED_TOKEN_PROGRAM_ID_BASE58, SYSTEM_PROGRAM_ID_BASE58, ESCROW_PROGRAM_ID_BASE58 } from './program-ids';
|
|
2
|
-
export { detectTokenProgramFromOwner, detectTokenProgramFromOwnerBytes } from './token-program';
|
|
3
|
-
export type { TokenProgramKind, TokenProgramDetection } from './token-program';
|
|
@@ -10,7 +10,6 @@ import type { AcceptPrefs, AgentReputation } from './agent';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const DISCOVERY_SORTS: readonly ["reputation", "recent", "created"];
|
|
12
12
|
export type DiscoverySort = (typeof DISCOVERY_SORTS)[number];
|
|
13
|
-
export declare function isDiscoverySort(v: unknown): v is DiscoverySort;
|
|
14
13
|
/** Named-member accessor for {@link DiscoverySort} (vocab-tested). */
|
|
15
14
|
export declare const DiscoverySorts: {
|
|
16
15
|
readonly REPUTATION: "reputation";
|
package/dist/types/envelope.d.ts
CHANGED
|
@@ -112,16 +112,3 @@ export interface Envelope<TBody extends Body = Body> {
|
|
|
112
112
|
attachments?: Attachments;
|
|
113
113
|
sender_signature: Ed25519Sig;
|
|
114
114
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Server-side projection of an accepted event. Adds chain fields
|
|
117
|
-
* (server-assigned, NOT in signing input). Returned by the ingestion
|
|
118
|
-
* endpoint and persisted on the events table.
|
|
119
|
-
*/
|
|
120
|
-
export interface PersistedEvent<TBody extends Body = Body> extends Envelope<TBody> {
|
|
121
|
-
event_id: string;
|
|
122
|
-
relationship_event_index: number;
|
|
123
|
-
prev_server_event_hash: string | null;
|
|
124
|
-
server_event_hash: string;
|
|
125
|
-
signed_message_hash: string;
|
|
126
|
-
server_timestamp: string;
|
|
127
|
-
}
|
package/dist/types/inbox.d.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const INBOX_BLOCK_SCOPES: readonly ["account", "did"];
|
|
11
11
|
export type InboxBlockScope = (typeof INBOX_BLOCK_SCOPES)[number];
|
|
12
|
-
export declare function isInboxBlockScope(v: unknown): v is InboxBlockScope;
|
|
13
12
|
/** Named-member accessor for {@link InboxBlockScope} (vocab-tested). */
|
|
14
13
|
export declare const InboxBlockScopes: {
|
|
15
14
|
readonly ACCOUNT: "account";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Sha256Hex, Ed25519Sig, Did, ProtocolVersion, ProtectedBlock, Body, Attachments, EscrowLockAttachment, Envelope,
|
|
1
|
+
export type { Sha256Hex, Ed25519Sig, Did, ProtocolVersion, ProtectedBlock, Body, Attachments, EscrowLockAttachment, Envelope, } from './envelope';
|
|
2
2
|
export { SHA256_HEX_RE, isSha256Hex, ED25519_SIG_PREFIX, PROTOCOL_VERSIONS, CURRENT_PROTOCOL_VERSION } from './envelope';
|
|
3
3
|
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, HandshakeDecision, DelegationBody, DelegationContent, DelegationAction, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, ReceiptVerdict, AnyBody, BodyType, DeclineReason, AssetIdentifier, } from './body';
|
|
4
4
|
export { DECLINE_REASONS, isDeclineReason, HANDSHAKE_DECISIONS, HandshakeDecisions, isHandshakeDecision, DELEGATION_ACTIONS, DelegationActions, isDelegationAction, RECEIPT_VERDICTS, ReceiptVerdicts, isReceiptVerdict, BODY_TYPES, BodyTypes, isBodyType, } from './body';
|
|
@@ -11,9 +11,9 @@ export { WORK_LOG_STATES, WorkLogStates, isWorkLogState } from './work-log';
|
|
|
11
11
|
export type { ReadModelStatus } from './event';
|
|
12
12
|
export { READ_MODEL_STATUSES, ReadModelStatuses, isReadModelStatus } from './event';
|
|
13
13
|
export type { DiscoverySort, DiscoverySearchQuery, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
|
|
14
|
-
export { DISCOVERY_SORTS, DiscoverySorts
|
|
14
|
+
export { DISCOVERY_SORTS, DiscoverySorts } from './discovery';
|
|
15
15
|
export type { InboxBlockScope, InboxBlock, BlockInboxBody } from './inbox';
|
|
16
|
-
export { INBOX_BLOCK_SCOPES, InboxBlockScopes
|
|
16
|
+
export { INBOX_BLOCK_SCOPES, InboxBlockScopes } from './inbox';
|
|
17
17
|
export type { CliSessionCreated, CliTokenIssued, CliWhoami, MyAgentSummary, CliLoginSessionStoredState, CliLoginSessionWireState, } from './cli-auth';
|
|
18
18
|
export { CLI_LOGIN_SESSION_STORED_STATES, CLI_LOGIN_SESSION_STATES, CliLoginSessionStates, isCliLoginSessionWireState } from './cli-auth';
|
|
19
19
|
export type { AssetIdentifierWire, DelegationPublic, DisputeResolutionPublic, ReceiptPublic, RelationshipPublic, WorkLogPublic, EventPublic, IngestResult, SenderSequenceResponse, InboxUnblockResult, ListRelationshipsQuery, ListInboxQuery, ListEventsQuery, ListDelegationsQuery, ListWorkLogsQuery, ListReceiptsQuery, } from './read-model';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyanon-arp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "TypeScript SDK for the Agent Relationship Protocol — canonical JSON, Ed25519 envelope sign/verify, did:arp identity, scrypt key attestation, chain-audit helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token program detection helpers.
|
|
3
|
-
*
|
|
4
|
-
* ARP escrow settles in native SOL or a legacy SPL Token mint. The
|
|
5
|
-
* escrow contract dispatches transfer / close-account CPIs based on the
|
|
6
|
-
* mint's program kind, detected on-chain from the mint account's `owner`
|
|
7
|
-
* field; this helper mirrors that logic for off-chain consumers (tx
|
|
8
|
-
* builders, indexers, decoders).
|
|
9
|
-
*
|
|
10
|
-
* Token-2022 (the token-extensions program) is NOT supported — a mint
|
|
11
|
-
* owned by it is rejected here so it can never enter the escrow flow.
|
|
12
|
-
*
|
|
13
|
-
* The function takes the mint account's `owner` pubkey — the program
|
|
14
|
-
* that minted it — NOT the mint's mint_authority. Confusingly, both are
|
|
15
|
-
* called "owner" in different contexts.
|
|
16
|
-
*/
|
|
17
|
-
export { SPL_TOKEN_PROGRAM_ID_BASE58 } from './program-ids';
|
|
18
|
-
/**
|
|
19
|
-
* Token program kind. Maps to the contract's `token_program_kind` u8 on
|
|
20
|
-
* `LockCreated` events: `native` → 0, `legacy` → 1. (The contract also
|
|
21
|
-
* defines `2` for Token-2022, but ARP no longer supports it — such a
|
|
22
|
-
* lock is rejected before it is tracked, so this type never carries it.)
|
|
23
|
-
*
|
|
24
|
-
* `detectTokenProgramFromOwner` resolves the kind for a NON-native mint
|
|
25
|
-
* by looking at its `.owner` field; native locks are detected from the
|
|
26
|
-
* mint slot value, not from this helper.
|
|
27
|
-
*/
|
|
28
|
-
export type TokenProgramKind = 'legacy' | 'native';
|
|
29
|
-
/**
|
|
30
|
-
* Result of `detectTokenProgram`: the program kind + a typed branding for
|
|
31
|
-
* downstream consumers.
|
|
32
|
-
*/
|
|
33
|
-
export interface TokenProgramDetection {
|
|
34
|
-
kind: TokenProgramKind;
|
|
35
|
-
/** The detected program ID in base58 form (always the canonical address). */
|
|
36
|
-
programIdBase58: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Detect a mint's token program kind from its OWNER pubkey (the program
|
|
40
|
-
* that owns the mint account in Solana account terms).
|
|
41
|
-
*
|
|
42
|
-
* Returns `legacy` for a legacy SPL Token mint. Throws for a Token-2022
|
|
43
|
-
* mint (unsupported) or any other owner — escrow would otherwise
|
|
44
|
-
* dispatch a CPI to a surface it does not handle.
|
|
45
|
-
*
|
|
46
|
-
* @param mintAccountOwnerBase58 — the mint account's `.owner` field as
|
|
47
|
-
* a base58 string. From `connection.getAccountInfo(mintPubkey)`, this is
|
|
48
|
-
* `accountInfo.owner.toBase58()`.
|
|
49
|
-
*/
|
|
50
|
-
export declare function detectTokenProgramFromOwner(mintAccountOwnerBase58: string): TokenProgramDetection;
|
|
51
|
-
/**
|
|
52
|
-
* Same as `detectTokenProgramFromOwner` but accepts a 32-byte raw owner
|
|
53
|
-
* buffer instead of base58 string. Useful for callers that already have
|
|
54
|
-
* the binary owner bytes (e.g. from a parsed AccountInfo).
|
|
55
|
-
*/
|
|
56
|
-
export declare function detectTokenProgramFromOwnerBytes(mintAccountOwnerBytes: Uint8Array): TokenProgramDetection;
|