@oobe-protocol-labs/synapse-sap-sdk 0.6.3 → 0.8.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/dist/cjs/constants/seeds.js +9 -0
- package/dist/cjs/constants/seeds.js.map +1 -1
- package/dist/cjs/core/client.js +55 -0
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/idl/synapse_agent_sap.json +8571 -4106
- package/dist/cjs/index.js +29 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/escrow-v2.js +220 -0
- package/dist/cjs/modules/escrow-v2.js.map +1 -0
- package/dist/cjs/modules/escrow.js +4 -0
- package/dist/cjs/modules/escrow.js.map +1 -1
- package/dist/cjs/modules/index.js +9 -1
- package/dist/cjs/modules/index.js.map +1 -1
- package/dist/cjs/modules/receipt.js +144 -0
- package/dist/cjs/modules/receipt.js.map +1 -0
- package/dist/cjs/modules/staking.js +94 -0
- package/dist/cjs/modules/staking.js.map +1 -0
- package/dist/cjs/modules/subscription.js +96 -0
- package/dist/cjs/modules/subscription.js.map +1 -0
- package/dist/cjs/pda/index.js +166 -1
- package/dist/cjs/pda/index.js.map +1 -1
- package/dist/cjs/registries/x402.js +88 -51
- package/dist/cjs/registries/x402.js.map +1 -1
- package/dist/cjs/types/enums.js +96 -1
- package/dist/cjs/types/enums.js.map +1 -1
- package/dist/cjs/types/index.js +6 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/instructions.js.map +1 -1
- package/dist/cjs/utils/escrow-validation.js +219 -0
- package/dist/cjs/utils/escrow-validation.js.map +1 -0
- package/dist/cjs/utils/index.js +12 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/merchant-validator.js +246 -0
- package/dist/cjs/utils/merchant-validator.js.map +1 -0
- package/dist/cjs/utils/x402-direct.js +231 -0
- package/dist/cjs/utils/x402-direct.js.map +1 -0
- package/dist/esm/constants/seeds.js +9 -0
- package/dist/esm/constants/seeds.js.map +1 -1
- package/dist/esm/core/client.js +55 -0
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/idl/synapse_agent_sap.json +8571 -4106
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/escrow-v2.js +216 -0
- package/dist/esm/modules/escrow-v2.js.map +1 -0
- package/dist/esm/modules/escrow.js +4 -0
- package/dist/esm/modules/escrow.js.map +1 -1
- package/dist/esm/modules/index.js +4 -0
- package/dist/esm/modules/index.js.map +1 -1
- package/dist/esm/modules/receipt.js +140 -0
- package/dist/esm/modules/receipt.js.map +1 -0
- package/dist/esm/modules/staking.js +90 -0
- package/dist/esm/modules/staking.js.map +1 -0
- package/dist/esm/modules/subscription.js +92 -0
- package/dist/esm/modules/subscription.js.map +1 -0
- package/dist/esm/pda/index.js +157 -0
- package/dist/esm/pda/index.js.map +1 -1
- package/dist/esm/registries/x402.js +89 -52
- package/dist/esm/registries/x402.js.map +1 -1
- package/dist/esm/types/enums.js +95 -0
- package/dist/esm/types/enums.js.map +1 -1
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/instructions.js.map +1 -1
- package/dist/esm/utils/escrow-validation.js +212 -0
- package/dist/esm/utils/escrow-validation.js.map +1 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/merchant-validator.js +241 -0
- package/dist/esm/utils/merchant-validator.js.map +1 -0
- package/dist/esm/utils/x402-direct.js +228 -0
- package/dist/esm/utils/x402-direct.js.map +1 -0
- package/dist/types/constants/seeds.d.ts +9 -0
- package/dist/types/constants/seeds.d.ts.map +1 -1
- package/dist/types/core/client.d.ts +43 -0
- package/dist/types/core/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/escrow-v2.d.ts +58 -0
- package/dist/types/modules/escrow-v2.d.ts.map +1 -0
- package/dist/types/modules/escrow.d.ts +4 -0
- package/dist/types/modules/escrow.d.ts.map +1 -1
- package/dist/types/modules/index.d.ts +4 -0
- package/dist/types/modules/index.d.ts.map +1 -1
- package/dist/types/modules/receipt.d.ts +77 -0
- package/dist/types/modules/receipt.d.ts.map +1 -0
- package/dist/types/modules/staking.d.ts +32 -0
- package/dist/types/modules/staking.d.ts.map +1 -0
- package/dist/types/modules/subscription.d.ts +33 -0
- package/dist/types/modules/subscription.d.ts.map +1 -0
- package/dist/types/pda/index.d.ts +114 -0
- package/dist/types/pda/index.d.ts.map +1 -1
- package/dist/types/plugin/schemas.d.ts +2 -2
- package/dist/types/registries/x402.d.ts +14 -12
- package/dist/types/registries/x402.d.ts.map +1 -1
- package/dist/types/types/accounts.d.ts +201 -1
- package/dist/types/types/accounts.d.ts.map +1 -1
- package/dist/types/types/enums.d.ts +115 -0
- package/dist/types/types/enums.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +4 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/instructions.d.ts +34 -0
- package/dist/types/types/instructions.d.ts.map +1 -1
- package/dist/types/utils/escrow-validation.d.ts +145 -0
- package/dist/types/utils/escrow-validation.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/merchant-validator.d.ts +176 -0
- package/dist/types/utils/merchant-validator.d.ts.map +1 -0
- package/dist/types/utils/x402-direct.d.ts +114 -0
- package/dist/types/utils/x402-direct.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/constants/seeds.ts +9 -0
- package/src/core/client.ts +59 -0
- package/src/idl/synapse_agent_sap.json +8571 -4106
- package/src/index.ts +54 -0
- package/src/modules/escrow-v2.ts +375 -0
- package/src/modules/escrow.ts +4 -0
- package/src/modules/index.ts +4 -0
- package/src/modules/receipt.ts +207 -0
- package/src/modules/staking.ts +122 -0
- package/src/modules/subscription.ts +147 -0
- package/src/pda/index.ts +228 -0
- package/src/registries/x402.ts +108 -69
- package/src/types/accounts.ts +241 -1
- package/src/types/enums.ts +119 -0
- package/src/types/index.ts +20 -0
- package/src/types/instructions.ts +40 -0
- package/src/utils/escrow-validation.ts +301 -0
- package/src/utils/index.ts +28 -0
- package/src/utils/merchant-validator.ts +359 -0
- package/src/utils/x402-direct.ts +370 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/x402-direct
|
|
3
|
+
* @description Recognize x402 direct SPL token payments on an agent's ATA
|
|
4
|
+
* by scanning transaction history and filtering for x402 patterns.
|
|
5
|
+
*
|
|
6
|
+
* @category Utils
|
|
7
|
+
* @since v0.6.4
|
|
8
|
+
*/
|
|
9
|
+
import { PublicKey, } from "@solana/web3.js";
|
|
10
|
+
import { sha256 } from "../utils";
|
|
11
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
12
|
+
// Core
|
|
13
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
14
|
+
/** Recognized x402 memo prefixes. */
|
|
15
|
+
const X402_MEMO_PREFIXES = ["x402:", "SAP-x402:", "x402-direct:"];
|
|
16
|
+
/**
|
|
17
|
+
* @name extractSplTransfer
|
|
18
|
+
* @description Extract SPL Token transfer details from a parsed transaction.
|
|
19
|
+
*
|
|
20
|
+
* Looks for `transfer` or `transferChecked` inner instructions on the
|
|
21
|
+
* Token Program and returns source/dest/amount/mint.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
function extractSplTransfer(tx, payToAta) {
|
|
26
|
+
if (!tx.meta?.innerInstructions && !tx.transaction.message.instructions) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
// Check all instructions (outer + inner)
|
|
30
|
+
const allIxs = [
|
|
31
|
+
...tx.transaction.message.instructions,
|
|
32
|
+
...(tx.meta?.innerInstructions?.flatMap((g) => g.instructions) ?? []),
|
|
33
|
+
];
|
|
34
|
+
for (const ix of allIxs) {
|
|
35
|
+
// Only process parsed instructions with known program
|
|
36
|
+
if (!("parsed" in ix) || !("program" in ix))
|
|
37
|
+
continue;
|
|
38
|
+
const parsed = ix;
|
|
39
|
+
if (parsed.program !== "spl-token")
|
|
40
|
+
continue;
|
|
41
|
+
const info = parsed.parsed;
|
|
42
|
+
if (info.type !== "transfer" &&
|
|
43
|
+
info.type !== "transferChecked") {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const transferInfo = info.info;
|
|
47
|
+
if (!transferInfo?.source || !transferInfo?.destination)
|
|
48
|
+
continue;
|
|
49
|
+
// Check destination matches our payTo ATA
|
|
50
|
+
const destPk = new PublicKey(transferInfo.destination);
|
|
51
|
+
if (!destPk.equals(payToAta))
|
|
52
|
+
continue;
|
|
53
|
+
const amountStr = transferInfo.amount ?? transferInfo.tokenAmount?.amount ?? "0";
|
|
54
|
+
return {
|
|
55
|
+
amount: BigInt(amountStr),
|
|
56
|
+
source: new PublicKey(transferInfo.source),
|
|
57
|
+
destination: destPk,
|
|
58
|
+
mint: transferInfo.mint ? new PublicKey(transferInfo.mint) : destPk, // fallback
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @name extractMemo
|
|
65
|
+
* @description Extract memo data from a parsed transaction.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
function extractMemo(tx) {
|
|
69
|
+
const allIxs = [
|
|
70
|
+
...tx.transaction.message.instructions,
|
|
71
|
+
...(tx.meta?.innerInstructions?.flatMap((g) => g.instructions) ?? []),
|
|
72
|
+
];
|
|
73
|
+
for (const ix of allIxs) {
|
|
74
|
+
if (!("parsed" in ix) || !("program" in ix))
|
|
75
|
+
continue;
|
|
76
|
+
const parsed = ix;
|
|
77
|
+
if (parsed.program === "spl-memo" && typeof parsed.parsed === "string") {
|
|
78
|
+
return parsed.parsed;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Also check log messages for memo
|
|
82
|
+
if (tx.meta?.logMessages) {
|
|
83
|
+
for (const log of tx.meta.logMessages) {
|
|
84
|
+
if (log.startsWith("Program log: Memo")) {
|
|
85
|
+
const memoMatch = log.match(/Memo \(len \d+\): "(.*?)"/);
|
|
86
|
+
if (memoMatch?.[1])
|
|
87
|
+
return memoMatch[1];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @name matchesX402Pattern
|
|
95
|
+
* @description Check if a transfer matches an x402 payment pattern.
|
|
96
|
+
*
|
|
97
|
+
* Matches if:
|
|
98
|
+
* - A memo with recognized x402 prefix is present, OR
|
|
99
|
+
* - The transfer matches a known settlement payload (deterministic hash), OR
|
|
100
|
+
* - `requireMemo` is false (any SPL transfer to the ATA is included)
|
|
101
|
+
*
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
function matchesX402Pattern(transfer, memo, knownSettlements, requireMemo) {
|
|
105
|
+
// 1. Check memo prefix
|
|
106
|
+
if (memo) {
|
|
107
|
+
for (const prefix of X402_MEMO_PREFIXES) {
|
|
108
|
+
if (memo.startsWith(prefix))
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
// Try base64 JSON parse for embedded x402 payload
|
|
112
|
+
try {
|
|
113
|
+
const decoded = Buffer.from(memo, "base64").toString("utf-8");
|
|
114
|
+
const parsed = JSON.parse(decoded);
|
|
115
|
+
if (parsed.protocol === "x402" || parsed.protocol === "SAP-x402") {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Not base64 JSON — ignore
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// 2. Match against known settlements (deterministic hash)
|
|
124
|
+
for (const settlement of knownSettlements) {
|
|
125
|
+
const expected = BigInt(settlement.amount);
|
|
126
|
+
if (transfer.amount !== expected)
|
|
127
|
+
continue;
|
|
128
|
+
// Deterministic hash: sha256(agentWallet + depositor + amount + timestamp)
|
|
129
|
+
const hashInput = settlement.agentWallet +
|
|
130
|
+
settlement.depositorWallet +
|
|
131
|
+
settlement.amount +
|
|
132
|
+
settlement.timestamp.toString();
|
|
133
|
+
const expectedHash = Buffer.from(sha256(hashInput)).toString("hex");
|
|
134
|
+
const serviceHash = settlement.serviceHash;
|
|
135
|
+
if (expectedHash === serviceHash)
|
|
136
|
+
return settlement;
|
|
137
|
+
}
|
|
138
|
+
// 3. If requireMemo is false, accept any SPL transfer to the ATA
|
|
139
|
+
if (!requireMemo)
|
|
140
|
+
return true;
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @name getX402DirectPayments
|
|
145
|
+
* @description Scan an agent's ATA for x402 direct payments.
|
|
146
|
+
*
|
|
147
|
+
* Fetches recent transaction signatures for the given `payTo` ATA,
|
|
148
|
+
* inspects each transaction for SPL token transfers, and filters
|
|
149
|
+
* for x402 payment patterns (memo prefix, settlement hash match, etc.).
|
|
150
|
+
*
|
|
151
|
+
* @param connection - Solana RPC connection.
|
|
152
|
+
* @param payToAta - The agent's receiving ATA (e.g. USDC ATA of Syra).
|
|
153
|
+
* @param opts - Filter and pagination options.
|
|
154
|
+
* @returns Array of recognized x402 direct payments, newest first.
|
|
155
|
+
*
|
|
156
|
+
* @category Utils
|
|
157
|
+
* @since v0.6.4
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { getX402DirectPayments, findATA } from "@oobe-protocol-labs/synapse-sap-sdk";
|
|
162
|
+
*
|
|
163
|
+
* const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
164
|
+
* const payToAta = findATA(agentWallet, USDC_MINT);
|
|
165
|
+
*
|
|
166
|
+
* const payments = await getX402DirectPayments(connection, payToAta, {
|
|
167
|
+
* limit: 50,
|
|
168
|
+
* knownSettlements: savedSettlements, // from your API PAYMENT-RESPONSE logs
|
|
169
|
+
* });
|
|
170
|
+
*
|
|
171
|
+
* for (const p of payments) {
|
|
172
|
+
* console.log(`${p.signature}: ${p.amount} from ${p.payerAta.toBase58()}`);
|
|
173
|
+
* if (p.settlement) {
|
|
174
|
+
* console.log(` Matched settlement: ${p.settlement.serviceHash}`);
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export async function getX402DirectPayments(connection, payToAta, opts) {
|
|
180
|
+
const limit = opts?.limit ?? 100;
|
|
181
|
+
const knownSettlements = opts?.knownSettlements ?? [];
|
|
182
|
+
const requireMemo = opts?.requireMemo ?? false;
|
|
183
|
+
// 1. Fetch signatures
|
|
184
|
+
const sigOpts = { limit };
|
|
185
|
+
if (opts?.before)
|
|
186
|
+
sigOpts.before = opts.before;
|
|
187
|
+
if (opts?.until)
|
|
188
|
+
sigOpts.until = opts.until;
|
|
189
|
+
const sigs = await connection.getSignaturesForAddress(payToAta, sigOpts);
|
|
190
|
+
if (sigs.length === 0)
|
|
191
|
+
return [];
|
|
192
|
+
// 2. Fetch transactions (batch with getParsedTransactions if available)
|
|
193
|
+
const txs = await connection.getParsedTransactions(sigs.map((s) => s.signature), { maxSupportedTransactionVersion: 0 });
|
|
194
|
+
// 3. Extract and filter
|
|
195
|
+
const results = [];
|
|
196
|
+
for (let i = 0; i < txs.length; i++) {
|
|
197
|
+
const tx = txs[i];
|
|
198
|
+
if (!tx)
|
|
199
|
+
continue;
|
|
200
|
+
// Extract SPL transfer to our ATA
|
|
201
|
+
const transfer = extractSplTransfer(tx, payToAta);
|
|
202
|
+
if (!transfer)
|
|
203
|
+
continue;
|
|
204
|
+
// Filter by payer if specified
|
|
205
|
+
if (opts?.filterPayer && !transfer.source.equals(opts.filterPayer)) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
// Extract memo
|
|
209
|
+
const memo = extractMemo(tx);
|
|
210
|
+
// Match x402 pattern
|
|
211
|
+
const match = matchesX402Pattern(transfer, memo, knownSettlements, requireMemo);
|
|
212
|
+
if (match === false)
|
|
213
|
+
continue;
|
|
214
|
+
results.push({
|
|
215
|
+
signature: sigs[i].signature,
|
|
216
|
+
amount: transfer.amount,
|
|
217
|
+
payerAta: transfer.source,
|
|
218
|
+
payeeAta: transfer.destination,
|
|
219
|
+
mint: transfer.mint,
|
|
220
|
+
memo,
|
|
221
|
+
settlement: typeof match === "object" ? match : null,
|
|
222
|
+
blockTime: tx.blockTime ?? null,
|
|
223
|
+
slot: tx.slot,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return results;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=x402-direct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x402-direct.js","sourceRoot":"","sources":["../../../src/utils/x402-direct.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,SAAS,GAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA4ElC,sEAAsE;AACtE,QAAQ;AACR,sEAAsE;AAEtE,qCAAqC;AACrC,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AAElE;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CACzB,EAA6B,EAC7B,QAAmB;IAOnB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yCAAyC;IACzC,MAAM,MAAM,GAAG;QACb,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY;QACtC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAA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C,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACnE,SAAS;QACX,CAAC;QAED,eAAe;QACf,MAAM,IAAI,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAE7B,qBAAqB;QACrB,MAAM,KAAK,GAAG,kBAAkB,CAC9B,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,WAAW,CACZ,CAAC;QACF,IAAI,KAAK,KAAK,KAAK;YAAE,SAAS;QAE9B,OAAO,CAAC,IAAI,CAAC;YACX,SAAS,EAAE,IAAI,CAAC,CAAC,CAAE,CAAC,SAAS;YAC7B,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,QAAQ,EAAE,QAAQ,CAAC,WAAW;YAC9B,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI;YACJ,UAAU,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACpD,SAAS,EAAE,EAAE,CAAC,SAAS,IAAI,IAAI;YAC/B,IAAI,EAAE,EAAE,CAAC,IAAI;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -42,6 +42,7 @@ export declare const SEEDS: {
|
|
|
42
42
|
readonly TOOL: "sap_tool";
|
|
43
43
|
readonly CHECKPOINT: "sap_checkpoint";
|
|
44
44
|
readonly ESCROW: "sap_escrow";
|
|
45
|
+
readonly ESCROW_V2: "sap_escrow_v2";
|
|
45
46
|
readonly STATS: "sap_stats";
|
|
46
47
|
readonly TOOL_CATEGORY: "sap_tool_cat";
|
|
47
48
|
readonly ATTESTATION: "sap_attest";
|
|
@@ -49,6 +50,14 @@ export declare const SEEDS: {
|
|
|
49
50
|
readonly LEDGER_PAGE: "sap_page";
|
|
50
51
|
readonly BUFFER: "sap_buffer";
|
|
51
52
|
readonly DIGEST: "sap_digest";
|
|
53
|
+
readonly PENDING: "sap_pending";
|
|
54
|
+
readonly DISPUTE: "sap_dispute";
|
|
55
|
+
readonly STAKE: "sap_stake";
|
|
56
|
+
readonly SUBSCRIPTION: "sap_sub";
|
|
57
|
+
readonly SHARD: "sap_shard";
|
|
58
|
+
readonly INDEX_PAGE: "sap_idx_page";
|
|
59
|
+
/** @since v0.7.0 — Receipt batch merkle root PDA */
|
|
60
|
+
readonly RECEIPT: "sap_receipt";
|
|
52
61
|
};
|
|
53
62
|
/**
|
|
54
63
|
* Union type of all valid keys in the {@link SEEDS} object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../../../src/constants/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../../../src/constants/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BhB,oDAAoD;;CAE5C,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,KAAK,CAAC"}
|
|
@@ -31,6 +31,10 @@ import { IndexingModule } from "../modules/indexing";
|
|
|
31
31
|
import { ToolsModule } from "../modules/tools";
|
|
32
32
|
import { VaultModule } from "../modules/vault";
|
|
33
33
|
import { EscrowModule } from "../modules/escrow";
|
|
34
|
+
import { EscrowV2Module } from "../modules/escrow-v2";
|
|
35
|
+
import { ReceiptModule } from "../modules/receipt";
|
|
36
|
+
import { StakingModule } from "../modules/staking";
|
|
37
|
+
import { SubscriptionModule } from "../modules/subscription";
|
|
34
38
|
import { AttestationModule } from "../modules/attestation";
|
|
35
39
|
import { LedgerModule } from "../modules/ledger";
|
|
36
40
|
import { EventParser } from "../events";
|
|
@@ -210,6 +214,45 @@ export declare class SapClient {
|
|
|
210
214
|
* @see {@link EscrowModule}
|
|
211
215
|
*/
|
|
212
216
|
get escrow(): EscrowModule;
|
|
217
|
+
/**
|
|
218
|
+
* @name escrowV2
|
|
219
|
+
* @description V2 escrow settlement with dispute windows, co-signing,
|
|
220
|
+
* pending settlements, and migration from V1.
|
|
221
|
+
* @returns {EscrowV2Module} The lazily-instantiated `EscrowV2Module` singleton.
|
|
222
|
+
* @category Modules
|
|
223
|
+
* @since v0.7.0
|
|
224
|
+
* @see {@link EscrowV2Module}
|
|
225
|
+
*/
|
|
226
|
+
get escrowV2(): EscrowV2Module;
|
|
227
|
+
/**
|
|
228
|
+
* @name receipt
|
|
229
|
+
* @description Receipt batch inscriptions and automatic dispute resolution (v0.7).
|
|
230
|
+
* @returns {ReceiptModule} The lazily-instantiated `ReceiptModule` singleton.
|
|
231
|
+
* @category Modules
|
|
232
|
+
* @since v0.7.0
|
|
233
|
+
* @see {@link ReceiptModule}
|
|
234
|
+
*/
|
|
235
|
+
get receipt(): ReceiptModule;
|
|
236
|
+
/**
|
|
237
|
+
* @name staking
|
|
238
|
+
* @description Agent staking: init stake, deposit, request unstake,
|
|
239
|
+
* and complete unstake.
|
|
240
|
+
* @returns {StakingModule} The lazily-instantiated `StakingModule` singleton.
|
|
241
|
+
* @category Modules
|
|
242
|
+
* @since v0.7.0
|
|
243
|
+
* @see {@link StakingModule}
|
|
244
|
+
*/
|
|
245
|
+
get staking(): StakingModule;
|
|
246
|
+
/**
|
|
247
|
+
* @name subscription
|
|
248
|
+
* @description Recurring subscriptions: create, fund, cancel, and close
|
|
249
|
+
* subscriber-agent subscription accounts.
|
|
250
|
+
* @returns {SubscriptionModule} The lazily-instantiated `SubscriptionModule` singleton.
|
|
251
|
+
* @category Modules
|
|
252
|
+
* @since v0.7.0
|
|
253
|
+
* @see {@link SubscriptionModule}
|
|
254
|
+
*/
|
|
255
|
+
get subscription(): SubscriptionModule;
|
|
213
256
|
/**
|
|
214
257
|
* @name attestation
|
|
215
258
|
* @description Web of trust: create, revoke, and close on-chain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAKrD,4EAA4E;AAE5E,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,SAAS;;IACpB;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,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AI,WAAW,CAExB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAMD;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,SAAS,IAAI,iBAAiB,CAEjC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,IAAI,IAAI,YAAY,CAEvB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,OAAO,IAAI,cAAc,CAE5B;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,OAAO,IAAI,YAAY,CAE1B;CACF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
*/
|
|
46
46
|
export { SapClient, SapConnection, KeypairWallet } from "./core";
|
|
47
47
|
export type { SapCluster, SapConnectionConfig, SapWallet } from "./core";
|
|
48
|
-
export type { TokenTypeKind, PluginTypeKind, SettlementModeKind, ToolHttpMethodKind, ToolCategoryKind, DelegatePermissionBit, SchemaTypeValue, CompressionTypeValue, Capability, VolumeCurveBreakpoint, PricingTier, PluginRef, Settlement, AgentAccountData, FeedbackAccountData, CapabilityIndexData, ProtocolIndexData, GlobalRegistryData, MemoryVaultData, SessionLedgerData, EpochPageData, VaultDelegateData, ToolDescriptorData, SessionCheckpointData, EscrowAccountData, AgentStatsData, ToolCategoryIndexData, AgentAttestationData, MemoryLedgerData, LedgerPageData, RegisterAgentArgs, UpdateAgentArgs, GiveFeedbackArgs, UpdateFeedbackArgs, PublishToolArgs, UpdateToolArgs, InscribeMemoryArgs, CompactInscribeArgs, CreateEscrowArgs, CreateAttestationArgs, InscribeToolSchemaArgs, EndpointDescriptor, HealthCheckDescriptor, ToolManifestEntry, AgentManifest, EndpointValidationResult, } from "./types";
|
|
49
|
-
export { TokenType, PluginType, SettlementMode, ToolHttpMethod, ToolCategory, DelegatePermission, SchemaType, CompressionType, } from "./types";
|
|
48
|
+
export type { TokenTypeKind, PluginTypeKind, SettlementModeKind, ToolHttpMethodKind, ToolCategoryKind, DelegatePermissionBit, SchemaTypeValue, CompressionTypeValue, SettlementSecurityKind, DisputeOutcomeKind, BillingIntervalKind, DisputeTypeValue, ResolutionLayerKind, Capability, VolumeCurveBreakpoint, PricingTier, PluginRef, Settlement, AgentAccountData, FeedbackAccountData, CapabilityIndexData, ProtocolIndexData, GlobalRegistryData, MemoryVaultData, SessionLedgerData, EpochPageData, VaultDelegateData, ToolDescriptorData, SessionCheckpointData, EscrowAccountData, AgentStatsData, ToolCategoryIndexData, AgentAttestationData, MemoryLedgerData, LedgerPageData, EscrowAccountV2Data, PendingSettlementData, DisputeRecordData, ReceiptBatchData, AgentStakeData, SubscriptionData, CounterShardData, IndexPageData, RegisterAgentArgs, UpdateAgentArgs, GiveFeedbackArgs, UpdateFeedbackArgs, PublishToolArgs, UpdateToolArgs, InscribeMemoryArgs, CompactInscribeArgs, CreateEscrowArgs, CreateAttestationArgs, InscribeToolSchemaArgs, CreateEscrowV2Args, CreateSubscriptionArgs, EndpointDescriptor, HealthCheckDescriptor, ToolManifestEntry, AgentManifest, EndpointValidationResult, } from "./types";
|
|
49
|
+
export { TokenType, PluginType, SettlementMode, ToolHttpMethod, ToolCategory, DelegatePermission, SchemaType, CompressionType, SettlementSecurity, DisputeOutcome, BillingInterval, DisputeType, ResolutionLayer, } from "./types";
|
|
50
50
|
export { SAP_PROGRAM_ADDRESS, SAP_PROGRAM_ID, MAINNET_SAP_PROGRAM_ID, DEVNET_SAP_PROGRAM_ID, LOCALNET_SAP_PROGRAM_ID, SEEDS, LIMITS, AGENT_VERSION, VAULT_PROTOCOL_VERSION, TOOL_CATEGORY_VALUES, HTTP_METHOD_VALUES, SapNetwork, } from "./constants";
|
|
51
51
|
export type { SapNetworkId } from "./constants";
|
|
52
52
|
export { SAP_IDL, IDL_PROGRAM_ADDRESS, IDL_METADATA } from "./idl/index";
|
|
53
53
|
export type { SynapseAgentSapIDL } from "./idl/index";
|
|
54
|
-
export { deriveGlobalRegistry, deriveAgent, deriveAgentStats, deriveFeedback, deriveCapabilityIndex, deriveProtocolIndex, deriveToolCategoryIndex, deriveVault, deriveSession, deriveEpochPage, deriveVaultDelegate, deriveCheckpoint, deriveTool, deriveEscrow, deriveAttestation, deriveLedger, deriveLedgerPage, } from "./pda";
|
|
54
|
+
export { deriveGlobalRegistry, deriveAgent, deriveAgentStats, deriveFeedback, deriveCapabilityIndex, deriveProtocolIndex, deriveToolCategoryIndex, deriveVault, deriveSession, deriveEpochPage, deriveVaultDelegate, deriveCheckpoint, deriveTool, deriveEscrow, deriveEscrowV2, derivePendingSettlement, deriveDispute, deriveStake, deriveSubscription, deriveShard, deriveIndexPage, deriveAttestation, deriveLedger, deriveLedgerPage, deriveReceiptBatch, } from "./pda";
|
|
55
55
|
export { sha256, hashToArray, assert } from "./utils";
|
|
56
56
|
export { serializeAccount, serializeValue } from "./utils";
|
|
57
57
|
export { normalizeNetworkId, isNetworkEquivalent, getNetworkGenesisHash, getNetworkClusterName, isKnownNetwork, } from "./utils";
|
|
@@ -62,12 +62,14 @@ export type { RpcConfig, DualConnection, AtaResult } from "./utils";
|
|
|
62
62
|
export { createEnvSchema, createEndpointDescriptorSchema, createHealthCheckSchema, createToolManifestEntrySchema, createAgentManifestSchema, createPreparePaymentSchema, createRegisterAgentSchema, createCallArgsSchema, validateOrThrow, } from "./utils";
|
|
63
63
|
export { buildPriorityFeeIxs, buildRpcOptions, FAST_SETTLE_OPTIONS, FAST_BATCH_SETTLE_OPTIONS, DEFAULT_SETTLE_PRIORITY_FEE, DEFAULT_SETTLE_COMPUTE_UNITS, DEFAULT_BATCH_SETTLE_COMPUTE_UNITS, } from "./utils";
|
|
64
64
|
export type { PriorityFeeConfig, } from "./utils";
|
|
65
|
+
export { validateEscrowState, attachSplAccounts, toAccountMetas, MissingEscrowAtaError, SapMerchantValidator, parseX402Headers, getX402DirectPayments, } from "./utils";
|
|
66
|
+
export type { SplAccountMeta, EscrowValidationResult, ParsedX402Headers, MerchantValidationResult, X402DirectPayment, SettlementPayload, GetX402DirectOptions, } from "./utils";
|
|
65
67
|
export { SapError, SapValidationError, SapRpcError, SapAccountNotFoundError, SapTimeoutError, SapPermissionError, } from "./errors";
|
|
66
68
|
export { EventParser, SAP_EVENT_NAMES } from "./events";
|
|
67
69
|
export type { SapEvent, SapEventName, ParsedEvent, RegisteredEventData, UpdatedEventData, FeedbackEventData, MemoryInscribedEventData, PaymentSettledEventData, LedgerEntryEventData, } from "./events";
|
|
68
70
|
export { GeyserEventStream } from "./events/geyser";
|
|
69
71
|
export type { GeyserConfig, GeyserStreamEvents } from "./events/geyser";
|
|
70
|
-
export { AgentModule, FeedbackModule, IndexingModule, ToolsModule, VaultModule, EscrowModule, AttestationModule, LedgerModule, BaseModule, } from "./modules/index";
|
|
72
|
+
export { AgentModule, FeedbackModule, IndexingModule, ToolsModule, VaultModule, EscrowModule, EscrowV2Module, ReceiptModule, StakingModule, SubscriptionModule, AttestationModule, LedgerModule, BaseModule, } from "./modules/index";
|
|
71
73
|
export type { SapProgram, SapTransactionResult } from "./modules/base";
|
|
72
74
|
export { createSAPPlugin, SAPPlugin } from "./plugin/index";
|
|
73
75
|
export type { SAPPluginConfig, SynapsePlugin, PluginMeta, PluginContext, PluginInstallResult, } from "./plugin/index";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGzE,YAAY,EAEV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGzE,YAAY,EAEV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EAEnB,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,UAAU,EAEV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EAEd,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EAEb,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EAEtB,kBAAkB,EAClB,sBAAsB,EAEtB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,eAAe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,EACZ,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,uBAAuB,GACxB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module escrow-v2
|
|
3
|
+
* @description V2 escrow settlement layer — supports settlement security
|
|
4
|
+
* modes (CoSigned, DisputeWindow), receipt-based dispute resolution,
|
|
5
|
+
* pending settlements, and automatic resolution via merkle proofs.
|
|
6
|
+
*
|
|
7
|
+
* @category Modules
|
|
8
|
+
* @since v0.7.0
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import { type PublicKey, type TransactionSignature, type AccountMeta } from "@solana/web3.js";
|
|
12
|
+
import { BN } from "@coral-xyz/anchor";
|
|
13
|
+
import { BaseModule } from "./base";
|
|
14
|
+
import type { EscrowAccountV2Data, PendingSettlementData, DisputeRecordData, CreateEscrowV2Args } from "../types";
|
|
15
|
+
import type { SettleOptions } from "../utils/priority-fee";
|
|
16
|
+
/**
|
|
17
|
+
* @name EscrowV2Module
|
|
18
|
+
* @description Manages V2 escrow accounts with settlement security modes,
|
|
19
|
+
* dispute windows, and pending settlement flows.
|
|
20
|
+
*
|
|
21
|
+
* @category Modules
|
|
22
|
+
* @since v0.7.0
|
|
23
|
+
* @extends BaseModule
|
|
24
|
+
*/
|
|
25
|
+
export declare class EscrowV2Module extends BaseModule {
|
|
26
|
+
/** Convert BN | number | bigint → number for PDA seed functions. */
|
|
27
|
+
private toNum;
|
|
28
|
+
deriveEscrow(agentPda: PublicKey, depositor?: PublicKey, nonce?: BN | number | bigint): readonly [PublicKey, number];
|
|
29
|
+
derivePendingSettlement(escrowV2Pda: PublicKey, settlementIndex: BN | number | bigint): readonly [PublicKey, number];
|
|
30
|
+
deriveDispute(pendingSettlementPda: PublicKey): readonly [PublicKey, number];
|
|
31
|
+
create(agentWallet: PublicKey, args: CreateEscrowV2Args, splAccounts?: AccountMeta[]): Promise<TransactionSignature>;
|
|
32
|
+
deposit(agentWallet: PublicKey, nonce: BN | number | bigint, amount: BN | number | bigint, splAccounts?: AccountMeta[]): Promise<TransactionSignature>;
|
|
33
|
+
settle(depositorWallet: PublicKey, nonce: BN | number | bigint, callsToSettle: BN | number | bigint, serviceHash: number[], splAccounts?: AccountMeta[], opts?: SettleOptions): Promise<TransactionSignature>;
|
|
34
|
+
createPendingSettlement(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint, callsToSettle: BN | number | bigint, amount: BN | number | bigint, serviceHash: number[], receiptMerkleRoot?: number[]): Promise<TransactionSignature>;
|
|
35
|
+
finalizeSettlement(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint): Promise<TransactionSignature>;
|
|
36
|
+
fileDispute(agentWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint, evidenceHash: number[], disputeType?: number): Promise<TransactionSignature>;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Since v0.7.0 — Arbiter-based resolution removed.
|
|
39
|
+
* Use {@link ReceiptModule.submitReceiptProof} + {@link ReceiptModule.autoResolveDispute} instead.
|
|
40
|
+
*/
|
|
41
|
+
resolveDispute(_depositorWallet: PublicKey, _agentWallet: PublicKey, _nonce: BN | number | bigint, _settlementIndex: BN | number | bigint, _outcome: number): Promise<TransactionSignature>;
|
|
42
|
+
closeDispute(pendingSettlementPda: PublicKey): Promise<TransactionSignature>;
|
|
43
|
+
closePendingSettlement(pendingSettlementPda: PublicKey): Promise<TransactionSignature>;
|
|
44
|
+
withdraw(agentWallet: PublicKey, nonce: BN | number | bigint, amount: BN | number | bigint): Promise<TransactionSignature>;
|
|
45
|
+
close(agentWallet: PublicKey, nonce?: BN | number | bigint): Promise<TransactionSignature>;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Since v0.7.0 — Migration instruction removed from program.
|
|
48
|
+
*/
|
|
49
|
+
migrateFromV1(_agentWallet: PublicKey): Promise<TransactionSignature>;
|
|
50
|
+
fetch(agentPda: PublicKey, depositor?: PublicKey, nonce?: BN | number | bigint): Promise<EscrowAccountV2Data>;
|
|
51
|
+
fetchNullable(agentPda: PublicKey, depositor?: PublicKey, nonce?: BN | number | bigint): Promise<EscrowAccountV2Data | null>;
|
|
52
|
+
fetchByPda(escrowPda: PublicKey): Promise<EscrowAccountV2Data>;
|
|
53
|
+
fetchPendingSettlement(pendingPda: PublicKey): Promise<PendingSettlementData>;
|
|
54
|
+
fetchPendingSettlementNullable(pendingPda: PublicKey): Promise<PendingSettlementData | null>;
|
|
55
|
+
fetchDispute(disputePda: PublicKey): Promise<DisputeRecordData>;
|
|
56
|
+
fetchDisputeNullable(disputePda: PublicKey): Promise<DisputeRecordData | null>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=escrow-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-v2.d.ts","sourceRoot":"","sources":["../../../src/modules/escrow-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQpC,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAKlB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAG5C,oEAAoE;IAC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AE,SAAS,GACtB,OAAO,CAAC,oBAAoB,CAAC;IAM1B,KAAK,CACT,QAAQ,EAAE,SAAS,EACnB,SAAS,CAAC,EAAE,SAAS,EACrB,KAAK,GAAE,EAAE,GAAG,MAAM,GAAG,MAAU,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAKzB,aAAa,CACjB,QAAQ,EAAE,SAAS,EACnB,SAAS,CAAC,EAAE,SAAS,EACrB,KAAK,GAAE,EAAE,GAAG,MAAM,GAAG,MAAU,GAC9B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAKhC,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI9D,sBAAsB,CAC1B,UAAU,EAAE,SAAS,GACpB,OAAO,CAAC,qBAAqB,CAAC;IAI3B,8BAA8B,CAClC,UAAU,EAAE,SAAS,GACpB,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAIlC,YAAY,CAChB,UAAU,EAAE,SAAS,GACpB,OAAO,CAAC,iBAAiB,CAAC;IAIvB,oBAAoB,CACxB,UAAU,EAAE,SAAS,GACpB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;CAGrC"}
|
|
@@ -39,6 +39,10 @@ import type { SettleOptions } from "../utils/priority-fee";
|
|
|
39
39
|
* tokenDecimals: null,
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Since v0.7.0 — Use {@link EscrowV2Module} (`client.escrowV2`) instead.
|
|
44
|
+
* V1 escrows lack settlement security, dispute resolution, and staking integration.
|
|
45
|
+
* Existing V1 escrows can be migrated via `client.escrowV2.migrateFromV1()`.
|
|
42
46
|
*/
|
|
43
47
|
export declare class EscrowModule extends BaseModule {
|
|
44
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../../../src/modules/escrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAW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AM,GAAG,MAAM,EAC5B,WAAW,GAAE,WAAW,EAAO,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAehC;;;;;;;;;;;;OAYG;IACG,MAAM,CACV,eAAe,EAAE,SAAS,EAC1B,aAAa,EAAE,EAAE,GAAG,MAAM,GAAG,MAAM,EACnC,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,GAAE,WAAW,EAAO,EAC/B,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,oBAAoB,CAAC;IA0BhC;;;;;;;;OAQG;IACG,QAAQ,CACZ,WAAW,EAAE,SAAS,EACtB,MAAM,EAAE,EAAE,GAAG,MAAM,GAAG,MAAM,EAC5B,WAAW,GAAE,WAAW,EAAO,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAehC;;;;;;OAMG;IACG,KAAK,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAalE;;;;;;;;;;;OAWG;IACG,WAAW,CACf,eAAe,EAAE,SAAS,EAC1B,WAAW,EAAE,UAAU,EAAE,EACzB,WAAW,GAAE,WAAW,EAAO,EAC/B,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,oBAAoB,CAAC;IA4BhC;;;;;;;;OAQG;IACG,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAKnF;;;;;;;;OAQG;IACG,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAKlG;;;;;;;;OAQG;IACG,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAGnE"}
|
|
@@ -17,6 +17,10 @@ export { IndexingModule } from "./indexing";
|
|
|
17
17
|
export { ToolsModule } from "./tools";
|
|
18
18
|
export { VaultModule } from "./vault";
|
|
19
19
|
export { EscrowModule } from "./escrow";
|
|
20
|
+
export { EscrowV2Module } from "./escrow-v2";
|
|
21
|
+
export { ReceiptModule } from "./receipt";
|
|
22
|
+
export { StakingModule } from "./staking";
|
|
23
|
+
export { SubscriptionModule } from "./subscription";
|
|
20
24
|
export { AttestationModule } from "./attestation";
|
|
21
25
|
export { LedgerModule } from "./ledger";
|
|
22
26
|
export { BaseModule } from "./base";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module receipt
|
|
3
|
+
* @description Receipt-based trustless dispute resolution (v0.7).
|
|
4
|
+
*
|
|
5
|
+
* Agents inscribe merkle roots of call receipt batches on-chain.
|
|
6
|
+
* During disputes, agents submit merkle inclusion proofs to prove delivery.
|
|
7
|
+
* After the proof deadline, anyone can trigger automatic proportional resolution.
|
|
8
|
+
*
|
|
9
|
+
* @category Modules
|
|
10
|
+
* @since v0.7.0
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import { type PublicKey, type TransactionSignature } from "@solana/web3.js";
|
|
14
|
+
import { BN } from "@coral-xyz/anchor";
|
|
15
|
+
import { BaseModule } from "./base";
|
|
16
|
+
import type { ReceiptBatchData } from "../types";
|
|
17
|
+
/**
|
|
18
|
+
* @name ReceiptModule
|
|
19
|
+
* @description Manages receipt batch inscriptions, merkle proof submissions,
|
|
20
|
+
* and automatic dispute resolution for the v0.7 trustless settlement layer.
|
|
21
|
+
*
|
|
22
|
+
* @category Modules
|
|
23
|
+
* @since v0.7.0
|
|
24
|
+
* @extends BaseModule
|
|
25
|
+
*/
|
|
26
|
+
export declare class ReceiptModule extends BaseModule {
|
|
27
|
+
private toNum;
|
|
28
|
+
deriveReceiptBatch(escrowV2Pda: PublicKey, batchIndex: number): readonly [PublicKey, number];
|
|
29
|
+
/**
|
|
30
|
+
* Inscribe a receipt batch merkle root on-chain.
|
|
31
|
+
*
|
|
32
|
+
* Called by the **agent** to commit a cryptographic proof of calls delivered.
|
|
33
|
+
* The `merkleRoot` is the root of a merkle tree whose leaves are individual
|
|
34
|
+
* call receipt hashes.
|
|
35
|
+
*
|
|
36
|
+
* @param depositorWallet - The depositor's wallet (needed for escrow PDA derivation).
|
|
37
|
+
* @param nonce - Escrow nonce.
|
|
38
|
+
* @param batchIndex - Zero-based batch index (must equal escrow.receipt_batch_count).
|
|
39
|
+
* @param merkleRoot - 32-byte merkle root of the receipt batch.
|
|
40
|
+
* @param callCount - Number of calls in the batch.
|
|
41
|
+
* @param periodStart - Unix timestamp for the start of the covered period.
|
|
42
|
+
* @param periodEnd - Unix timestamp for the end of the covered period.
|
|
43
|
+
*/
|
|
44
|
+
inscribeReceiptBatch(depositorWallet: PublicKey, nonce: BN | number | bigint, batchIndex: number, merkleRoot: number[], callCount: BN | number | bigint, periodStart: BN | number | bigint, periodEnd: BN | number | bigint): Promise<TransactionSignature>;
|
|
45
|
+
/**
|
|
46
|
+
* Submit a merkle inclusion proof during a dispute.
|
|
47
|
+
*
|
|
48
|
+
* Called by the **agent** to prove delivery of specific calls.
|
|
49
|
+
* Each proof verifies that a set of receipt hashes are included
|
|
50
|
+
* in the previously inscribed merkle root.
|
|
51
|
+
*
|
|
52
|
+
* @param depositorWallet - The depositor's wallet.
|
|
53
|
+
* @param nonce - Escrow nonce.
|
|
54
|
+
* @param settlementIndex - Index of the disputed pending settlement.
|
|
55
|
+
* @param batchIndex - Receipt batch index containing the proof.
|
|
56
|
+
* @param provenCount - Number of calls proven in this proof submission.
|
|
57
|
+
* @param proof - Array of 32-byte merkle proof hashes.
|
|
58
|
+
* @param leaf - The 32-byte leaf hash being proven.
|
|
59
|
+
*/
|
|
60
|
+
submitReceiptProof(depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint, batchIndex: number, provenCount: BN | number | bigint, proof: number[][], leaf: number[]): Promise<TransactionSignature>;
|
|
61
|
+
/**
|
|
62
|
+
* Trigger automatic dispute resolution after the proof deadline.
|
|
63
|
+
*
|
|
64
|
+
* Permissionless crank — anyone can call this once the deadline has passed.
|
|
65
|
+
* Resolution is proportional: if the agent proved N of M claimed calls,
|
|
66
|
+
* N/M of the settlement amount goes to the agent, the rest is refunded.
|
|
67
|
+
*
|
|
68
|
+
* @param agentWallet - The agent's wallet.
|
|
69
|
+
* @param depositorWallet - The depositor's wallet.
|
|
70
|
+
* @param nonce - Escrow nonce.
|
|
71
|
+
* @param settlementIndex - Index of the disputed pending settlement.
|
|
72
|
+
*/
|
|
73
|
+
autoResolveDispute(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint): Promise<TransactionSignature>;
|
|
74
|
+
fetchReceiptBatch(escrowV2Pda: PublicKey, batchIndex: number): Promise<ReceiptBatchData>;
|
|
75
|
+
fetchReceiptBatchNullable(escrowV2Pda: PublicKey, batchIndex: number): Promise<ReceiptBatchData | null>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../../src/modules/receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AASpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,UAAU;IAG3C,OAAO,CAAC,KA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|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module staking
|
|
3
|
+
* @description Agent staking lifecycle — init, deposit, request unstake,
|
|
4
|
+
* complete unstake, and fetch stake accounts.
|
|
5
|
+
*
|
|
6
|
+
* @category Modules
|
|
7
|
+
* @since v0.7.0
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import { type PublicKey, type TransactionSignature } from "@solana/web3.js";
|
|
11
|
+
import { BN } from "@coral-xyz/anchor";
|
|
12
|
+
import { BaseModule } from "./base";
|
|
13
|
+
import type { AgentStakeData } from "../types";
|
|
14
|
+
/**
|
|
15
|
+
* @name StakingModule
|
|
16
|
+
* @description Manages agent stake accounts — init, deposit, unstake, and fetch.
|
|
17
|
+
*
|
|
18
|
+
* @category Modules
|
|
19
|
+
* @since v0.7.0
|
|
20
|
+
* @extends BaseModule
|
|
21
|
+
*/
|
|
22
|
+
export declare class StakingModule extends BaseModule {
|
|
23
|
+
deriveStake(agentPda: PublicKey): readonly [PublicKey, number];
|
|
24
|
+
initStake(agentWallet: PublicKey, initialDeposit: BN | number | bigint): Promise<TransactionSignature>;
|
|
25
|
+
deposit(agentWallet: PublicKey, amount: BN | number | bigint): Promise<TransactionSignature>;
|
|
26
|
+
requestUnstake(agentWallet: PublicKey, amount: BN | number | bigint): Promise<TransactionSignature>;
|
|
27
|
+
completeUnstake(agentWallet: PublicKey): Promise<TransactionSignature>;
|
|
28
|
+
fetch(agentPda: PublicKey): Promise<AgentStakeData>;
|
|
29
|
+
fetchNullable(agentPda: PublicKey): Promise<AgentStakeData | null>;
|
|
30
|
+
fetchByPda(stakePda: PublicKey): Promise<AgentStakeData>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=staking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../../src/modules/staking.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,UAAU;IAG3C,WAAW,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAMxD,SAAS,CACb,WAAW,EAAE,SAAS,EACtB,cAAc,EAAE,EAAE,GAAG,MAAM,GAAG,MAAM,GACnC,OAAO,CAAC,oBAAoB,CAAC;IAe1B,OAAO,CACX,WAAW,EAAE,SAAS,EACtB,MAAM,EAAE,EAAE,GAAG,MAAM,GAAG,MAAM,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAe1B,cAAc,CAClB,WAAW,EAAE,SAAS,EACtB,MAAM,EAAE,EAAE,GAAG,MAAM,GAAG,MAAM,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAc1B,eAAe,CACnB,WAAW,EAAE,SAAS,GACrB,OAAO,CAAC,oBAAoB,CAAC;IAgB1B,KAAK,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAKnD,aAAa,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAKlE,UAAU,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;CAG/D"}
|