@heyanon-arp/sdk 0.0.35 → 0.0.37
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 +14 -0
- package/dist/index.js +104 -78
- package/dist/index.mjs +101 -79
- package/dist/types/agent.d.ts +60 -0
- package/dist/types/discovery.d.ts +41 -0
- package/dist/types/index.d.ts +3 -3
- package/package.json +1 -1
package/dist/assets.d.ts
CHANGED
|
@@ -91,6 +91,20 @@ export declare function findAssetByAssetId(assetId: string): {
|
|
|
91
91
|
cluster: SolanaCluster;
|
|
92
92
|
key: string;
|
|
93
93
|
} | null;
|
|
94
|
+
/**
|
|
95
|
+
* Best-effort mint → display metadata, for labelling settlement-volume buckets.
|
|
96
|
+
* - native SOL sentinel → `{ SOL, 9 }` (assetId null: the `slip44` CAIP-19 is
|
|
97
|
+
* cluster-specific and the bare mint can't disambiguate devnet/mainnet);
|
|
98
|
+
* - SPL mint → the EXACT whitelist entry (an SPL mint is cluster-unique, so
|
|
99
|
+
* symbol + decimals + asset_id are precise);
|
|
100
|
+
* - unrecognised mint → all null (the caller still has the raw mint + the
|
|
101
|
+
* base-unit sum, so the figure is never lost — just unlabelled).
|
|
102
|
+
*/
|
|
103
|
+
export declare function findAssetMetaByMint(mint: string): {
|
|
104
|
+
assetId: string | null;
|
|
105
|
+
symbol: string | null;
|
|
106
|
+
decimals: number | null;
|
|
107
|
+
};
|
|
94
108
|
/**
|
|
95
109
|
* Membership check. With `cluster` the asset must be listed for THAT
|
|
96
110
|
* cluster; without it, listed for any cluster.
|
package/dist/index.js
CHANGED
|
@@ -502,6 +502,16 @@ var DiscoverySorts = {
|
|
|
502
502
|
RECENT: "recent",
|
|
503
503
|
CREATED: "created"
|
|
504
504
|
};
|
|
505
|
+
var AGENT_BADGES = ["proven", "limited", "new", "flagged"];
|
|
506
|
+
var AgentBadges = {
|
|
507
|
+
PROVEN: "proven",
|
|
508
|
+
LIMITED: "limited",
|
|
509
|
+
NEW: "new",
|
|
510
|
+
FLAGGED: "flagged"
|
|
511
|
+
};
|
|
512
|
+
function isAgentBadge(v) {
|
|
513
|
+
return typeof v === "string" && AGENT_BADGES.includes(v);
|
|
514
|
+
}
|
|
505
515
|
|
|
506
516
|
// src/types/inbox.ts
|
|
507
517
|
var INBOX_BLOCK_SCOPES = ["account", "did"];
|
|
@@ -559,6 +569,84 @@ function isReservedName(name) {
|
|
|
559
569
|
function isValidAgentName(name) {
|
|
560
570
|
return AGENT_NAME_REGEX.test(normalizeName(name));
|
|
561
571
|
}
|
|
572
|
+
var LOCK_ACCOUNT_SIZE = 269;
|
|
573
|
+
var LOCK_ACCOUNT_DISCRIMINATOR = new Uint8Array([8, 255, 36, 202, 210, 22, 57, 137]);
|
|
574
|
+
var LOCK_STATE_NAMES = ["created", "canceled", "in_progress", "submitted", "paid", "revoked", "disputing", "dispute_resolved", "dispute_closed"];
|
|
575
|
+
var LOCK_TERMINAL_STATES = ["canceled", "paid", "revoked", "dispute_resolved", "dispute_closed"];
|
|
576
|
+
var LockTerminalStates = {
|
|
577
|
+
CANCELED: "canceled",
|
|
578
|
+
PAID: "paid",
|
|
579
|
+
REVOKED: "revoked",
|
|
580
|
+
DISPUTE_RESOLVED: "dispute_resolved",
|
|
581
|
+
DISPUTE_CLOSED: "dispute_closed"
|
|
582
|
+
};
|
|
583
|
+
var ESCROW_RELEASE_METHODS = ["buyer_approved", "review_timeout"];
|
|
584
|
+
function isEscrowReleaseMethod(v) {
|
|
585
|
+
return typeof v === "string" && ESCROW_RELEASE_METHODS.includes(v);
|
|
586
|
+
}
|
|
587
|
+
var LockStates = {
|
|
588
|
+
CREATED: "created",
|
|
589
|
+
CANCELED: "canceled",
|
|
590
|
+
IN_PROGRESS: "in_progress",
|
|
591
|
+
SUBMITTED: "submitted",
|
|
592
|
+
PAID: "paid",
|
|
593
|
+
REVOKED: "revoked",
|
|
594
|
+
DISPUTING: "disputing",
|
|
595
|
+
DISPUTE_RESOLVED: "dispute_resolved",
|
|
596
|
+
DISPUTE_CLOSED: "dispute_closed"
|
|
597
|
+
};
|
|
598
|
+
var EscrowReleaseMethods = {
|
|
599
|
+
BUYER_APPROVED: "buyer_approved",
|
|
600
|
+
REVIEW_TIMEOUT: "review_timeout"
|
|
601
|
+
};
|
|
602
|
+
var NATIVE_SOL_MINT_BASE58 = "11111111111111111111111111111111";
|
|
603
|
+
function decodeLockAccount(data) {
|
|
604
|
+
if (data.length !== LOCK_ACCOUNT_SIZE) {
|
|
605
|
+
throw new Error(`decodeLockAccount: expected ${LOCK_ACCOUNT_SIZE} bytes, got ${data.length}`);
|
|
606
|
+
}
|
|
607
|
+
for (let i = 0; i < 8; i++) {
|
|
608
|
+
if (data[i] !== LOCK_ACCOUNT_DISCRIMINATOR[i]) {
|
|
609
|
+
throw new Error("decodeLockAccount: account discriminator is not Lock");
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
const stateByte = data[185];
|
|
613
|
+
const state = LOCK_STATE_NAMES[stateByte];
|
|
614
|
+
if (state === void 0) {
|
|
615
|
+
throw new Error(`decodeLockAccount: unknown LockState discriminant ${stateByte}`);
|
|
616
|
+
}
|
|
617
|
+
const mint = base.base58.encode(data.slice(113, 145));
|
|
618
|
+
return {
|
|
619
|
+
lockId: toHex(data.subarray(8, 40)),
|
|
620
|
+
version: data[40],
|
|
621
|
+
payer: base.base58.encode(data.slice(41, 73)),
|
|
622
|
+
payee: base.base58.encode(data.slice(73, 105)),
|
|
623
|
+
amount: readU64LE(data, 105),
|
|
624
|
+
mint,
|
|
625
|
+
isNative: mint === NATIVE_SOL_MINT_BASE58,
|
|
626
|
+
conditionHash: toHex(data.subarray(145, 177)),
|
|
627
|
+
expiry: readU64LE(data, 177),
|
|
628
|
+
state,
|
|
629
|
+
stateByte,
|
|
630
|
+
feeBpsAtLock: data[186] | data[187] << 8,
|
|
631
|
+
feeRecipientAtLock: base.base58.encode(data.slice(188, 220)),
|
|
632
|
+
workerStakeAtLock: readU64LE(data, 220),
|
|
633
|
+
operatorDisputeFeeAtLock: readU64LE(data, 228),
|
|
634
|
+
treasuryAtLock: base.base58.encode(data.slice(236, 268)),
|
|
635
|
+
bump: data[268]
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
function toHex(bytes) {
|
|
639
|
+
let hex = "";
|
|
640
|
+
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
641
|
+
return hex;
|
|
642
|
+
}
|
|
643
|
+
function readU64LE(buf, off) {
|
|
644
|
+
let v = 0n;
|
|
645
|
+
for (let i = 0; i < 8; i++) {
|
|
646
|
+
v |= BigInt(buf[off + i]) << BigInt(8 * i);
|
|
647
|
+
}
|
|
648
|
+
return v;
|
|
649
|
+
}
|
|
562
650
|
|
|
563
651
|
// src/assets.ts
|
|
564
652
|
var SOLANA_CLUSTER_IDS = {
|
|
@@ -621,6 +709,18 @@ function findAssetByAssetId(assetId) {
|
|
|
621
709
|
}
|
|
622
710
|
return null;
|
|
623
711
|
}
|
|
712
|
+
function findAssetMetaByMint(mint) {
|
|
713
|
+
if (mint === NATIVE_SOL_MINT_BASE58) return { assetId: null, symbol: "SOL", decimals: 9 };
|
|
714
|
+
for (const assets of Object.values(ASSET_WHITELIST)) {
|
|
715
|
+
for (const asset of assets) {
|
|
716
|
+
const splIdx = asset.asset_id.indexOf("/spl:");
|
|
717
|
+
if (splIdx !== -1 && asset.asset_id.slice(splIdx + "/spl:".length) === mint) {
|
|
718
|
+
return { assetId: asset.asset_id, symbol: asset.symbol ?? null, decimals: asset.decimals };
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return { assetId: null, symbol: null, decimals: null };
|
|
723
|
+
}
|
|
624
724
|
function isWhitelistedAssetId(assetId, cluster) {
|
|
625
725
|
const hit = findAssetByAssetId(assetId);
|
|
626
726
|
if (!hit) return false;
|
|
@@ -801,84 +901,6 @@ function buildResolveDisputeIxData(args, opts = {}) {
|
|
|
801
901
|
out.set(args.disputeId, 41);
|
|
802
902
|
return out;
|
|
803
903
|
}
|
|
804
|
-
var LOCK_ACCOUNT_SIZE = 269;
|
|
805
|
-
var LOCK_ACCOUNT_DISCRIMINATOR = new Uint8Array([8, 255, 36, 202, 210, 22, 57, 137]);
|
|
806
|
-
var LOCK_STATE_NAMES = ["created", "canceled", "in_progress", "submitted", "paid", "revoked", "disputing", "dispute_resolved", "dispute_closed"];
|
|
807
|
-
var LOCK_TERMINAL_STATES = ["canceled", "paid", "revoked", "dispute_resolved", "dispute_closed"];
|
|
808
|
-
var LockTerminalStates = {
|
|
809
|
-
CANCELED: "canceled",
|
|
810
|
-
PAID: "paid",
|
|
811
|
-
REVOKED: "revoked",
|
|
812
|
-
DISPUTE_RESOLVED: "dispute_resolved",
|
|
813
|
-
DISPUTE_CLOSED: "dispute_closed"
|
|
814
|
-
};
|
|
815
|
-
var ESCROW_RELEASE_METHODS = ["buyer_approved", "review_timeout"];
|
|
816
|
-
function isEscrowReleaseMethod(v) {
|
|
817
|
-
return typeof v === "string" && ESCROW_RELEASE_METHODS.includes(v);
|
|
818
|
-
}
|
|
819
|
-
var LockStates = {
|
|
820
|
-
CREATED: "created",
|
|
821
|
-
CANCELED: "canceled",
|
|
822
|
-
IN_PROGRESS: "in_progress",
|
|
823
|
-
SUBMITTED: "submitted",
|
|
824
|
-
PAID: "paid",
|
|
825
|
-
REVOKED: "revoked",
|
|
826
|
-
DISPUTING: "disputing",
|
|
827
|
-
DISPUTE_RESOLVED: "dispute_resolved",
|
|
828
|
-
DISPUTE_CLOSED: "dispute_closed"
|
|
829
|
-
};
|
|
830
|
-
var EscrowReleaseMethods = {
|
|
831
|
-
BUYER_APPROVED: "buyer_approved",
|
|
832
|
-
REVIEW_TIMEOUT: "review_timeout"
|
|
833
|
-
};
|
|
834
|
-
var NATIVE_SOL_MINT_BASE58 = "11111111111111111111111111111111";
|
|
835
|
-
function decodeLockAccount(data) {
|
|
836
|
-
if (data.length !== LOCK_ACCOUNT_SIZE) {
|
|
837
|
-
throw new Error(`decodeLockAccount: expected ${LOCK_ACCOUNT_SIZE} bytes, got ${data.length}`);
|
|
838
|
-
}
|
|
839
|
-
for (let i = 0; i < 8; i++) {
|
|
840
|
-
if (data[i] !== LOCK_ACCOUNT_DISCRIMINATOR[i]) {
|
|
841
|
-
throw new Error("decodeLockAccount: account discriminator is not Lock");
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
const stateByte = data[185];
|
|
845
|
-
const state = LOCK_STATE_NAMES[stateByte];
|
|
846
|
-
if (state === void 0) {
|
|
847
|
-
throw new Error(`decodeLockAccount: unknown LockState discriminant ${stateByte}`);
|
|
848
|
-
}
|
|
849
|
-
const mint = base.base58.encode(data.slice(113, 145));
|
|
850
|
-
return {
|
|
851
|
-
lockId: toHex(data.subarray(8, 40)),
|
|
852
|
-
version: data[40],
|
|
853
|
-
payer: base.base58.encode(data.slice(41, 73)),
|
|
854
|
-
payee: base.base58.encode(data.slice(73, 105)),
|
|
855
|
-
amount: readU64LE(data, 105),
|
|
856
|
-
mint,
|
|
857
|
-
isNative: mint === NATIVE_SOL_MINT_BASE58,
|
|
858
|
-
conditionHash: toHex(data.subarray(145, 177)),
|
|
859
|
-
expiry: readU64LE(data, 177),
|
|
860
|
-
state,
|
|
861
|
-
stateByte,
|
|
862
|
-
feeBpsAtLock: data[186] | data[187] << 8,
|
|
863
|
-
feeRecipientAtLock: base.base58.encode(data.slice(188, 220)),
|
|
864
|
-
workerStakeAtLock: readU64LE(data, 220),
|
|
865
|
-
operatorDisputeFeeAtLock: readU64LE(data, 228),
|
|
866
|
-
treasuryAtLock: base.base58.encode(data.slice(236, 268)),
|
|
867
|
-
bump: data[268]
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
function toHex(bytes) {
|
|
871
|
-
let hex = "";
|
|
872
|
-
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
873
|
-
return hex;
|
|
874
|
-
}
|
|
875
|
-
function readU64LE(buf, off) {
|
|
876
|
-
let v = 0n;
|
|
877
|
-
for (let i = 0; i < 8; i++) {
|
|
878
|
-
v |= BigInt(buf[off + i]) << BigInt(8 * i);
|
|
879
|
-
}
|
|
880
|
-
return v;
|
|
881
|
-
}
|
|
882
904
|
var SPL_TOKEN_PROGRAM_ID = new web3_js.PublicKey(SPL_TOKEN_PROGRAM_ID_BASE58);
|
|
883
905
|
var ASSOCIATED_TOKEN_PROGRAM_ID = new web3_js.PublicKey(ASSOCIATED_TOKEN_PROGRAM_ID_BASE58);
|
|
884
906
|
var NATIVE_SOL_MINT = new web3_js.PublicKey(NATIVE_SOL_MINT_BASE58);
|
|
@@ -1200,6 +1222,7 @@ var CliAuthTokenErrorCodes = {
|
|
|
1200
1222
|
REQUIRED: "AUTH_TOKEN_REQUIRED"
|
|
1201
1223
|
};
|
|
1202
1224
|
|
|
1225
|
+
exports.AGENT_BADGES = AGENT_BADGES;
|
|
1203
1226
|
exports.AGENT_NAME_REGEX = AGENT_NAME_REGEX;
|
|
1204
1227
|
exports.AGENT_TAG_REGEX = AGENT_TAG_REGEX;
|
|
1205
1228
|
exports.ASSET_DECIMALS_MAX = ASSET_DECIMALS_MAX;
|
|
@@ -1209,6 +1232,7 @@ exports.ASSET_SYMBOL_MIN_LEN = ASSET_SYMBOL_MIN_LEN;
|
|
|
1209
1232
|
exports.ASSET_WHITELIST = ASSET_WHITELIST;
|
|
1210
1233
|
exports.ASSOCIATED_TOKEN_PROGRAM_ID = ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
1211
1234
|
exports.ASSOCIATED_TOKEN_PROGRAM_ID_BASE58 = ASSOCIATED_TOKEN_PROGRAM_ID_BASE58;
|
|
1235
|
+
exports.AgentBadges = AgentBadges;
|
|
1212
1236
|
exports.BODY_TYPES = BODY_TYPES;
|
|
1213
1237
|
exports.BodyTypes = BodyTypes;
|
|
1214
1238
|
exports.CAIP19_REGEX = CAIP19_REGEX;
|
|
@@ -1314,11 +1338,13 @@ exports.deriveStakeVaultPda = deriveStakeVaultPda;
|
|
|
1314
1338
|
exports.expiresAt = expiresAt;
|
|
1315
1339
|
exports.fetchLockAccount = fetchLockAccount;
|
|
1316
1340
|
exports.findAssetByAssetId = findAssetByAssetId;
|
|
1341
|
+
exports.findAssetMetaByMint = findAssetMetaByMint;
|
|
1317
1342
|
exports.findFirstChainDivergence = findFirstChainDivergence;
|
|
1318
1343
|
exports.formatDid = formatDid;
|
|
1319
1344
|
exports.generateKeyPair = generateKeyPair;
|
|
1320
1345
|
exports.getPublicKey = getPublicKey2;
|
|
1321
1346
|
exports.instructionDiscriminator = instructionDiscriminator;
|
|
1347
|
+
exports.isAgentBadge = isAgentBadge;
|
|
1322
1348
|
exports.isAssetIdentifier = isAssetIdentifier;
|
|
1323
1349
|
exports.isBodyType = isBodyType;
|
|
1324
1350
|
exports.isCliLoginSessionWireState = isCliLoginSessionWireState;
|
package/dist/index.mjs
CHANGED
|
@@ -477,6 +477,16 @@ var DiscoverySorts = {
|
|
|
477
477
|
RECENT: "recent",
|
|
478
478
|
CREATED: "created"
|
|
479
479
|
};
|
|
480
|
+
var AGENT_BADGES = ["proven", "limited", "new", "flagged"];
|
|
481
|
+
var AgentBadges = {
|
|
482
|
+
PROVEN: "proven",
|
|
483
|
+
LIMITED: "limited",
|
|
484
|
+
NEW: "new",
|
|
485
|
+
FLAGGED: "flagged"
|
|
486
|
+
};
|
|
487
|
+
function isAgentBadge(v) {
|
|
488
|
+
return typeof v === "string" && AGENT_BADGES.includes(v);
|
|
489
|
+
}
|
|
480
490
|
|
|
481
491
|
// src/types/inbox.ts
|
|
482
492
|
var INBOX_BLOCK_SCOPES = ["account", "did"];
|
|
@@ -534,6 +544,84 @@ function isReservedName(name) {
|
|
|
534
544
|
function isValidAgentName(name) {
|
|
535
545
|
return AGENT_NAME_REGEX.test(normalizeName(name));
|
|
536
546
|
}
|
|
547
|
+
var LOCK_ACCOUNT_SIZE = 269;
|
|
548
|
+
var LOCK_ACCOUNT_DISCRIMINATOR = new Uint8Array([8, 255, 36, 202, 210, 22, 57, 137]);
|
|
549
|
+
var LOCK_STATE_NAMES = ["created", "canceled", "in_progress", "submitted", "paid", "revoked", "disputing", "dispute_resolved", "dispute_closed"];
|
|
550
|
+
var LOCK_TERMINAL_STATES = ["canceled", "paid", "revoked", "dispute_resolved", "dispute_closed"];
|
|
551
|
+
var LockTerminalStates = {
|
|
552
|
+
CANCELED: "canceled",
|
|
553
|
+
PAID: "paid",
|
|
554
|
+
REVOKED: "revoked",
|
|
555
|
+
DISPUTE_RESOLVED: "dispute_resolved",
|
|
556
|
+
DISPUTE_CLOSED: "dispute_closed"
|
|
557
|
+
};
|
|
558
|
+
var ESCROW_RELEASE_METHODS = ["buyer_approved", "review_timeout"];
|
|
559
|
+
function isEscrowReleaseMethod(v) {
|
|
560
|
+
return typeof v === "string" && ESCROW_RELEASE_METHODS.includes(v);
|
|
561
|
+
}
|
|
562
|
+
var LockStates = {
|
|
563
|
+
CREATED: "created",
|
|
564
|
+
CANCELED: "canceled",
|
|
565
|
+
IN_PROGRESS: "in_progress",
|
|
566
|
+
SUBMITTED: "submitted",
|
|
567
|
+
PAID: "paid",
|
|
568
|
+
REVOKED: "revoked",
|
|
569
|
+
DISPUTING: "disputing",
|
|
570
|
+
DISPUTE_RESOLVED: "dispute_resolved",
|
|
571
|
+
DISPUTE_CLOSED: "dispute_closed"
|
|
572
|
+
};
|
|
573
|
+
var EscrowReleaseMethods = {
|
|
574
|
+
BUYER_APPROVED: "buyer_approved",
|
|
575
|
+
REVIEW_TIMEOUT: "review_timeout"
|
|
576
|
+
};
|
|
577
|
+
var NATIVE_SOL_MINT_BASE58 = "11111111111111111111111111111111";
|
|
578
|
+
function decodeLockAccount(data) {
|
|
579
|
+
if (data.length !== LOCK_ACCOUNT_SIZE) {
|
|
580
|
+
throw new Error(`decodeLockAccount: expected ${LOCK_ACCOUNT_SIZE} bytes, got ${data.length}`);
|
|
581
|
+
}
|
|
582
|
+
for (let i = 0; i < 8; i++) {
|
|
583
|
+
if (data[i] !== LOCK_ACCOUNT_DISCRIMINATOR[i]) {
|
|
584
|
+
throw new Error("decodeLockAccount: account discriminator is not Lock");
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const stateByte = data[185];
|
|
588
|
+
const state = LOCK_STATE_NAMES[stateByte];
|
|
589
|
+
if (state === void 0) {
|
|
590
|
+
throw new Error(`decodeLockAccount: unknown LockState discriminant ${stateByte}`);
|
|
591
|
+
}
|
|
592
|
+
const mint = base58.encode(data.slice(113, 145));
|
|
593
|
+
return {
|
|
594
|
+
lockId: toHex(data.subarray(8, 40)),
|
|
595
|
+
version: data[40],
|
|
596
|
+
payer: base58.encode(data.slice(41, 73)),
|
|
597
|
+
payee: base58.encode(data.slice(73, 105)),
|
|
598
|
+
amount: readU64LE(data, 105),
|
|
599
|
+
mint,
|
|
600
|
+
isNative: mint === NATIVE_SOL_MINT_BASE58,
|
|
601
|
+
conditionHash: toHex(data.subarray(145, 177)),
|
|
602
|
+
expiry: readU64LE(data, 177),
|
|
603
|
+
state,
|
|
604
|
+
stateByte,
|
|
605
|
+
feeBpsAtLock: data[186] | data[187] << 8,
|
|
606
|
+
feeRecipientAtLock: base58.encode(data.slice(188, 220)),
|
|
607
|
+
workerStakeAtLock: readU64LE(data, 220),
|
|
608
|
+
operatorDisputeFeeAtLock: readU64LE(data, 228),
|
|
609
|
+
treasuryAtLock: base58.encode(data.slice(236, 268)),
|
|
610
|
+
bump: data[268]
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function toHex(bytes) {
|
|
614
|
+
let hex = "";
|
|
615
|
+
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
616
|
+
return hex;
|
|
617
|
+
}
|
|
618
|
+
function readU64LE(buf, off) {
|
|
619
|
+
let v = 0n;
|
|
620
|
+
for (let i = 0; i < 8; i++) {
|
|
621
|
+
v |= BigInt(buf[off + i]) << BigInt(8 * i);
|
|
622
|
+
}
|
|
623
|
+
return v;
|
|
624
|
+
}
|
|
537
625
|
|
|
538
626
|
// src/assets.ts
|
|
539
627
|
var SOLANA_CLUSTER_IDS = {
|
|
@@ -596,6 +684,18 @@ function findAssetByAssetId(assetId) {
|
|
|
596
684
|
}
|
|
597
685
|
return null;
|
|
598
686
|
}
|
|
687
|
+
function findAssetMetaByMint(mint) {
|
|
688
|
+
if (mint === NATIVE_SOL_MINT_BASE58) return { assetId: null, symbol: "SOL", decimals: 9 };
|
|
689
|
+
for (const assets of Object.values(ASSET_WHITELIST)) {
|
|
690
|
+
for (const asset of assets) {
|
|
691
|
+
const splIdx = asset.asset_id.indexOf("/spl:");
|
|
692
|
+
if (splIdx !== -1 && asset.asset_id.slice(splIdx + "/spl:".length) === mint) {
|
|
693
|
+
return { assetId: asset.asset_id, symbol: asset.symbol ?? null, decimals: asset.decimals };
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return { assetId: null, symbol: null, decimals: null };
|
|
698
|
+
}
|
|
599
699
|
function isWhitelistedAssetId(assetId, cluster) {
|
|
600
700
|
const hit = findAssetByAssetId(assetId);
|
|
601
701
|
if (!hit) return false;
|
|
@@ -776,84 +876,6 @@ function buildResolveDisputeIxData(args, opts = {}) {
|
|
|
776
876
|
out.set(args.disputeId, 41);
|
|
777
877
|
return out;
|
|
778
878
|
}
|
|
779
|
-
var LOCK_ACCOUNT_SIZE = 269;
|
|
780
|
-
var LOCK_ACCOUNT_DISCRIMINATOR = new Uint8Array([8, 255, 36, 202, 210, 22, 57, 137]);
|
|
781
|
-
var LOCK_STATE_NAMES = ["created", "canceled", "in_progress", "submitted", "paid", "revoked", "disputing", "dispute_resolved", "dispute_closed"];
|
|
782
|
-
var LOCK_TERMINAL_STATES = ["canceled", "paid", "revoked", "dispute_resolved", "dispute_closed"];
|
|
783
|
-
var LockTerminalStates = {
|
|
784
|
-
CANCELED: "canceled",
|
|
785
|
-
PAID: "paid",
|
|
786
|
-
REVOKED: "revoked",
|
|
787
|
-
DISPUTE_RESOLVED: "dispute_resolved",
|
|
788
|
-
DISPUTE_CLOSED: "dispute_closed"
|
|
789
|
-
};
|
|
790
|
-
var ESCROW_RELEASE_METHODS = ["buyer_approved", "review_timeout"];
|
|
791
|
-
function isEscrowReleaseMethod(v) {
|
|
792
|
-
return typeof v === "string" && ESCROW_RELEASE_METHODS.includes(v);
|
|
793
|
-
}
|
|
794
|
-
var LockStates = {
|
|
795
|
-
CREATED: "created",
|
|
796
|
-
CANCELED: "canceled",
|
|
797
|
-
IN_PROGRESS: "in_progress",
|
|
798
|
-
SUBMITTED: "submitted",
|
|
799
|
-
PAID: "paid",
|
|
800
|
-
REVOKED: "revoked",
|
|
801
|
-
DISPUTING: "disputing",
|
|
802
|
-
DISPUTE_RESOLVED: "dispute_resolved",
|
|
803
|
-
DISPUTE_CLOSED: "dispute_closed"
|
|
804
|
-
};
|
|
805
|
-
var EscrowReleaseMethods = {
|
|
806
|
-
BUYER_APPROVED: "buyer_approved",
|
|
807
|
-
REVIEW_TIMEOUT: "review_timeout"
|
|
808
|
-
};
|
|
809
|
-
var NATIVE_SOL_MINT_BASE58 = "11111111111111111111111111111111";
|
|
810
|
-
function decodeLockAccount(data) {
|
|
811
|
-
if (data.length !== LOCK_ACCOUNT_SIZE) {
|
|
812
|
-
throw new Error(`decodeLockAccount: expected ${LOCK_ACCOUNT_SIZE} bytes, got ${data.length}`);
|
|
813
|
-
}
|
|
814
|
-
for (let i = 0; i < 8; i++) {
|
|
815
|
-
if (data[i] !== LOCK_ACCOUNT_DISCRIMINATOR[i]) {
|
|
816
|
-
throw new Error("decodeLockAccount: account discriminator is not Lock");
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
const stateByte = data[185];
|
|
820
|
-
const state = LOCK_STATE_NAMES[stateByte];
|
|
821
|
-
if (state === void 0) {
|
|
822
|
-
throw new Error(`decodeLockAccount: unknown LockState discriminant ${stateByte}`);
|
|
823
|
-
}
|
|
824
|
-
const mint = base58.encode(data.slice(113, 145));
|
|
825
|
-
return {
|
|
826
|
-
lockId: toHex(data.subarray(8, 40)),
|
|
827
|
-
version: data[40],
|
|
828
|
-
payer: base58.encode(data.slice(41, 73)),
|
|
829
|
-
payee: base58.encode(data.slice(73, 105)),
|
|
830
|
-
amount: readU64LE(data, 105),
|
|
831
|
-
mint,
|
|
832
|
-
isNative: mint === NATIVE_SOL_MINT_BASE58,
|
|
833
|
-
conditionHash: toHex(data.subarray(145, 177)),
|
|
834
|
-
expiry: readU64LE(data, 177),
|
|
835
|
-
state,
|
|
836
|
-
stateByte,
|
|
837
|
-
feeBpsAtLock: data[186] | data[187] << 8,
|
|
838
|
-
feeRecipientAtLock: base58.encode(data.slice(188, 220)),
|
|
839
|
-
workerStakeAtLock: readU64LE(data, 220),
|
|
840
|
-
operatorDisputeFeeAtLock: readU64LE(data, 228),
|
|
841
|
-
treasuryAtLock: base58.encode(data.slice(236, 268)),
|
|
842
|
-
bump: data[268]
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
function toHex(bytes) {
|
|
846
|
-
let hex = "";
|
|
847
|
-
for (const b of bytes) hex += b.toString(16).padStart(2, "0");
|
|
848
|
-
return hex;
|
|
849
|
-
}
|
|
850
|
-
function readU64LE(buf, off) {
|
|
851
|
-
let v = 0n;
|
|
852
|
-
for (let i = 0; i < 8; i++) {
|
|
853
|
-
v |= BigInt(buf[off + i]) << BigInt(8 * i);
|
|
854
|
-
}
|
|
855
|
-
return v;
|
|
856
|
-
}
|
|
857
879
|
var SPL_TOKEN_PROGRAM_ID = new PublicKey(SPL_TOKEN_PROGRAM_ID_BASE58);
|
|
858
880
|
var ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey(ASSOCIATED_TOKEN_PROGRAM_ID_BASE58);
|
|
859
881
|
var NATIVE_SOL_MINT = new PublicKey(NATIVE_SOL_MINT_BASE58);
|
|
@@ -1175,4 +1197,4 @@ var CliAuthTokenErrorCodes = {
|
|
|
1175
1197
|
REQUIRED: "AUTH_TOKEN_REQUIRED"
|
|
1176
1198
|
};
|
|
1177
1199
|
|
|
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 };
|
|
1200
|
+
export { AGENT_BADGES, 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, AgentBadges, 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, findAssetMetaByMint, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAgentBadge, 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/types/agent.d.ts
CHANGED
|
@@ -144,6 +144,66 @@ export interface AgentReputation {
|
|
|
144
144
|
computed: boolean;
|
|
145
145
|
lastComputedAt?: string | null;
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Settled on-chain volume for ONE asset, from one role (earned as payee /
|
|
149
|
+
* paid as payer). Amounts are exact integer base-units (string, never a
|
|
150
|
+
* float); `amountDecimal` is the human form, present only when the asset's
|
|
151
|
+
* decimals are known. `mint` is always the unambiguous identifier — `assetId`
|
|
152
|
+
* /`symbol`/`decimals` are best-effort labels (null for an unrecognised mint).
|
|
153
|
+
*/
|
|
154
|
+
export interface AssetVolume {
|
|
155
|
+
mint: string;
|
|
156
|
+
assetId: string | null;
|
|
157
|
+
symbol: string | null;
|
|
158
|
+
decimals: number | null;
|
|
159
|
+
amountBaseUnits: string;
|
|
160
|
+
amountDecimal: string | null;
|
|
161
|
+
lockCount: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Per-agent settled-escrow volume, split by role and bucketed by asset.
|
|
165
|
+
*
|
|
166
|
+
* SCOPE (v1): covers the happy-path `paid` settlement only. Payouts that came
|
|
167
|
+
* through ARBITRATION (a `dispute_resolved` lock won by the payee) are NOT yet
|
|
168
|
+
* in these figures — they ARE reflected in the reputation counters
|
|
169
|
+
* (`settledEscrows`/`disputedEscrows`), so for a heavily-disputed agent the
|
|
170
|
+
* volume can under-report relative to the settled-escrow count.
|
|
171
|
+
*/
|
|
172
|
+
export interface AgentSettlementVolume {
|
|
173
|
+
/** Received as payee (the worker side) — the headline trust signal. */
|
|
174
|
+
earnedByAsset: AssetVolume[];
|
|
175
|
+
/** Spent as payer (the buyer side). */
|
|
176
|
+
paidByAsset: AssetVolume[];
|
|
177
|
+
/** Span of settled activity (a Paid lock's last on-chain transition). */
|
|
178
|
+
firstSettledAt: string | null;
|
|
179
|
+
lastSettledAt: string | null;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Derived ratios from the reputation counters. Each is `null` when its
|
|
183
|
+
* denominator is 0 (no basis to compute), never a misleading 0.
|
|
184
|
+
*/
|
|
185
|
+
export interface AgentStatsRates {
|
|
186
|
+
/** completed / (completed + failed) delegations. */
|
|
187
|
+
completionRate: number | null;
|
|
188
|
+
/** disputed / onchainCycles — share of terminal cycles that hit a dispute. */
|
|
189
|
+
disputeRate: number | null;
|
|
190
|
+
/** disputesAdverse / disputed — share of disputes ruled against. */
|
|
191
|
+
adverseDisputeRate: number | null;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Quantitative per-agent stats — `GET /v1/agents/:did/stats`. PUBLIC, no-auth.
|
|
195
|
+
* Counters/scores reuse the materialised reputation row (single source of truth
|
|
196
|
+
* with `/reputation`); rates are derived; volume is aggregated live from the
|
|
197
|
+
* on-chain escrow-lock mirror (cached). `computed: false` ⇒ no settled cycle yet.
|
|
198
|
+
*/
|
|
199
|
+
export interface AgentStats {
|
|
200
|
+
did: string;
|
|
201
|
+
computed: boolean;
|
|
202
|
+
counters: ReputationCounters;
|
|
203
|
+
scores: ReputationScores;
|
|
204
|
+
rates: AgentStatsRates;
|
|
205
|
+
volume: AgentSettlementVolume;
|
|
206
|
+
}
|
|
147
207
|
/**
|
|
148
208
|
* Agent capability-tag charset — lowercase alphanumeric + dash +
|
|
149
209
|
* underscore, 1-40 chars. Single source of truth for the server's
|
|
@@ -16,6 +16,29 @@ export declare const DiscoverySorts: {
|
|
|
16
16
|
readonly RECENT: "recent";
|
|
17
17
|
readonly CREATED: "created";
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Earned-evidence discovery badge — a coarse "how much real on-chain
|
|
21
|
+
* history" signal carried on every search row + profile, DISTINCT from
|
|
22
|
+
* the manual platform `trusted` flag. Same vocab shape as the protocol
|
|
23
|
+
* sets (as-const array + union + guard + named-member const-object).
|
|
24
|
+
*
|
|
25
|
+
* `proven` = enough completed payee cycles across distinct owners;
|
|
26
|
+
* `limited` = some real on-chain cycles, below the proven bar;
|
|
27
|
+
* `new` = zero settled cycles (escrow/stake-backed but unproven);
|
|
28
|
+
* `flagged` = adverse evidence (a lost dispute or a no-show/revoke) —
|
|
29
|
+
* dominates the positive ladder, never masked by a high score or `trusted`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const AGENT_BADGES: readonly ["proven", "limited", "new", "flagged"];
|
|
32
|
+
export type AgentBadge = (typeof AGENT_BADGES)[number];
|
|
33
|
+
/** Named-member accessor for {@link AgentBadge} (vocab-tested). */
|
|
34
|
+
export declare const AgentBadges: {
|
|
35
|
+
readonly PROVEN: "proven";
|
|
36
|
+
readonly LIMITED: "limited";
|
|
37
|
+
readonly NEW: "new";
|
|
38
|
+
readonly FLAGGED: "flagged";
|
|
39
|
+
};
|
|
40
|
+
/** Type guard for {@link AgentBadge} (rejects non-members + non-strings). */
|
|
41
|
+
export declare function isAgentBadge(v: unknown): v is AgentBadge;
|
|
19
42
|
/**
|
|
20
43
|
* Query for `GET /v1/discovery/search` (server DTO
|
|
21
44
|
* `DiscoverySearchQueryDto`). Every field optional; filters AND-compose.
|
|
@@ -32,6 +55,16 @@ export interface DiscoverySearchQuery {
|
|
|
32
55
|
accepts?: string;
|
|
33
56
|
/** Only agents seen within the liveness window. */
|
|
34
57
|
online?: boolean;
|
|
58
|
+
/** Return ONLY platform-trusted agents (the manual `trusted` allow-list flag). */
|
|
59
|
+
trustedOnly?: boolean;
|
|
60
|
+
/** Include unproven (zero settled cycle) agents — default true; `false` hard-excludes cold-start. */
|
|
61
|
+
includeUnproven?: boolean;
|
|
62
|
+
/** Hard filter: minimum settled on-chain cycles. */
|
|
63
|
+
minOnchainCycles?: number;
|
|
64
|
+
/** Hard filter: minimum completed delegations AS THE PAYEE (paid work delivered). */
|
|
65
|
+
minCompletedAsPayee?: number;
|
|
66
|
+
/** Hard filter: minimum distinct (owner-resolved) counterparts. */
|
|
67
|
+
minDistinctCounterparts?: number;
|
|
35
68
|
/** `reputation` (composite desc, default) | `recent` | `created` (cursor). */
|
|
36
69
|
sort?: DiscoverySort;
|
|
37
70
|
/** Zero-based page index (offset = page × limit) — reputation/recent sorts. */
|
|
@@ -73,6 +106,10 @@ export interface DiscoveryResult {
|
|
|
73
106
|
reputation: DiscoveryReputation;
|
|
74
107
|
liveness: DiscoveryLiveness;
|
|
75
108
|
registeredAt: string;
|
|
109
|
+
/** Platform-curated trust flag (manual DB allow-list) — NOT earned reputation. */
|
|
110
|
+
trusted: boolean;
|
|
111
|
+
/** Earned-evidence badge derived from on-chain history (see {@link AgentBadge}). */
|
|
112
|
+
badge: AgentBadge;
|
|
76
113
|
}
|
|
77
114
|
/** Pagination envelope metadata on a discovery search page. */
|
|
78
115
|
export interface DiscoveryPagination {
|
|
@@ -104,6 +141,10 @@ export interface DiscoveryProfile {
|
|
|
104
141
|
tags: string[];
|
|
105
142
|
acceptPrefs?: AcceptPrefs;
|
|
106
143
|
registeredAt: string;
|
|
144
|
+
/** Platform-curated trust flag (manual DB allow-list) — NOT earned reputation. */
|
|
145
|
+
trusted: boolean;
|
|
146
|
+
/** Earned-evidence badge derived from on-chain history (see {@link AgentBadge}). */
|
|
147
|
+
badge: AgentBadge;
|
|
107
148
|
reputation: AgentReputation;
|
|
108
149
|
/** Liveness, plus `lastEventAt` (last protocol event either side). */
|
|
109
150
|
liveness: DiscoveryLiveness & {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export type { WorkLogState } from './work-log';
|
|
|
10
10
|
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
|
-
export type { DiscoverySort, DiscoverySearchQuery, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
|
|
14
|
-
export { DISCOVERY_SORTS, DiscoverySorts } from './discovery';
|
|
13
|
+
export type { DiscoverySort, AgentBadge, DiscoverySearchQuery, DiscoveryReputation, DiscoveryLiveness, DiscoveryResult, DiscoveryPagination, DiscoverySearchResponse, DiscoveryProfile, } from './discovery';
|
|
14
|
+
export { DISCOVERY_SORTS, DiscoverySorts, AGENT_BADGES, AgentBadges, isAgentBadge } from './discovery';
|
|
15
15
|
export type { InboxBlockScope, InboxBlock, BlockInboxBody } from './inbox';
|
|
16
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';
|
|
20
|
-
export type { AcceptPrefs, AcceptCurrency, AgentRegisteredResponse, AgentPublic, UpdateAgentBody, RegisterAgentRequest, ChallengeResponse, ReputationScores, ReputationCounters, AgentReputation, } from './agent';
|
|
20
|
+
export type { AcceptPrefs, AcceptCurrency, AgentRegisteredResponse, AgentPublic, UpdateAgentBody, RegisterAgentRequest, ChallengeResponse, ReputationScores, ReputationCounters, AgentReputation, AssetVolume, AgentSettlementVolume, AgentStatsRates, AgentStats, } from './agent';
|
|
21
21
|
export { AGENT_TAG_REGEX, AGENT_NAME_REGEX, RESERVED_NAMES, isReservedName, isValidAgentName, normalizeName } from './agent';
|
|
22
22
|
export type { OwnerSigningMethod, KeyLinkPayload, ScryptPasswordAttestation } from './identity';
|
|
23
23
|
export { SCRYPT_PARAMS, OWNER_SIGNING_METHODS } from './identity';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyanon-arp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
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": [
|