@oobe-protocol-labs/synapse-sap-sdk 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/client.js.map +1 -1
- package/dist/esm/client.js +1 -1
- package/dist/esm/client.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/instructions/memory.d.ts +0 -8
- package/dist/esm/instructions/memory.d.ts.map +0 -1
- package/dist/esm/instructions/memory.js +0 -234
- package/dist/esm/instructions/memory.js.map +0 -1
- package/dist/types/constants/addresses.d.ts +0 -117
- package/dist/types/constants/addresses.d.ts.map +0 -1
- package/dist/types/constants/index.d.ts +0 -31
- package/dist/types/constants/index.d.ts.map +0 -1
- package/dist/types/constants/limits.d.ts +0 -149
- package/dist/types/constants/limits.d.ts.map +0 -1
- package/dist/types/constants/network.d.ts +0 -81
- package/dist/types/constants/network.d.ts.map +0 -1
- package/dist/types/constants/payments.d.ts +0 -121
- package/dist/types/constants/payments.d.ts.map +0 -1
- package/dist/types/constants/programs.d.ts +0 -69
- package/dist/types/constants/programs.d.ts.map +0 -1
- package/dist/types/constants/seeds.d.ts +0 -82
- package/dist/types/constants/seeds.d.ts.map +0 -1
- package/dist/types/core/client.d.ts +0 -467
- package/dist/types/core/client.d.ts.map +0 -1
- package/dist/types/core/connection.d.ts +0 -305
- package/dist/types/core/connection.d.ts.map +0 -1
- package/dist/types/core/index.d.ts +0 -20
- package/dist/types/core/index.d.ts.map +0 -1
- package/dist/types/errors/index.d.ts +0 -335
- package/dist/types/errors/index.d.ts.map +0 -1
- package/dist/types/events/geyser.d.ts +0 -150
- package/dist/types/events/geyser.d.ts.map +0 -1
- package/dist/types/events/index.d.ts +0 -248
- package/dist/types/events/index.d.ts.map +0 -1
- package/dist/types/idl/index.d.ts +0 -70
- package/dist/types/idl/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -86
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/modules/agent.d.ts +0 -156
- package/dist/types/modules/agent.d.ts.map +0 -1
- package/dist/types/modules/attestation.d.ts +0 -96
- package/dist/types/modules/attestation.d.ts.map +0 -1
- package/dist/types/modules/base.d.ts +0 -215
- package/dist/types/modules/base.d.ts.map +0 -1
- package/dist/types/modules/escrow-v2.d.ts +0 -285
- package/dist/types/modules/escrow-v2.d.ts.map +0 -1
- package/dist/types/modules/feedback.d.ts +0 -105
- package/dist/types/modules/feedback.d.ts.map +0 -1
- package/dist/types/modules/index.d.ts +0 -27
- package/dist/types/modules/index.d.ts.map +0 -1
- package/dist/types/modules/indexing.d.ts +0 -200
- package/dist/types/modules/indexing.d.ts.map +0 -1
- package/dist/types/modules/ledger.d.ts +0 -150
- package/dist/types/modules/ledger.d.ts.map +0 -1
- package/dist/types/modules/receipt.d.ts +0 -91
- package/dist/types/modules/receipt.d.ts.map +0 -1
- package/dist/types/modules/staking.d.ts +0 -51
- package/dist/types/modules/staking.d.ts.map +0 -1
- package/dist/types/modules/subscription.d.ts +0 -33
- package/dist/types/modules/subscription.d.ts.map +0 -1
- package/dist/types/modules/tools.d.ts +0 -172
- package/dist/types/modules/tools.d.ts.map +0 -1
- package/dist/types/modules/vault.d.ts +0 -240
- package/dist/types/modules/vault.d.ts.map +0 -1
- package/dist/types/parser/client.d.ts +0 -123
- package/dist/types/parser/client.d.ts.map +0 -1
- package/dist/types/parser/complete.d.ts +0 -90
- package/dist/types/parser/complete.d.ts.map +0 -1
- package/dist/types/parser/index.d.ts +0 -40
- package/dist/types/parser/index.d.ts.map +0 -1
- package/dist/types/parser/inner.d.ts +0 -114
- package/dist/types/parser/inner.d.ts.map +0 -1
- package/dist/types/parser/instructions.d.ts +0 -76
- package/dist/types/parser/instructions.d.ts.map +0 -1
- package/dist/types/parser/transaction.d.ts +0 -77
- package/dist/types/parser/transaction.d.ts.map +0 -1
- package/dist/types/parser/types.d.ts +0 -154
- package/dist/types/parser/types.d.ts.map +0 -1
- package/dist/types/pda/index.d.ts +0 -527
- package/dist/types/pda/index.d.ts.map +0 -1
- package/dist/types/plugin/index.d.ts +0 -171
- package/dist/types/plugin/index.d.ts.map +0 -1
- package/dist/types/plugin/protocols.d.ts +0 -152
- package/dist/types/plugin/protocols.d.ts.map +0 -1
- package/dist/types/plugin/schemas.d.ts +0 -829
- package/dist/types/plugin/schemas.d.ts.map +0 -1
- package/dist/types/postgres/adapter.d.ts +0 -355
- package/dist/types/postgres/adapter.d.ts.map +0 -1
- package/dist/types/postgres/index.d.ts +0 -24
- package/dist/types/postgres/index.d.ts.map +0 -1
- package/dist/types/postgres/serializers.d.ts +0 -30
- package/dist/types/postgres/serializers.d.ts.map +0 -1
- package/dist/types/postgres/sync.d.ts +0 -156
- package/dist/types/postgres/sync.d.ts.map +0 -1
- package/dist/types/postgres/types.d.ts +0 -167
- package/dist/types/postgres/types.d.ts.map +0 -1
- package/dist/types/registries/builder.d.ts +0 -333
- package/dist/types/registries/builder.d.ts.map +0 -1
- package/dist/types/registries/discovery.d.ts +0 -333
- package/dist/types/registries/discovery.d.ts.map +0 -1
- package/dist/types/registries/fairscale.d.ts +0 -680
- package/dist/types/registries/fairscale.d.ts.map +0 -1
- package/dist/types/registries/index.d.ts +0 -52
- package/dist/types/registries/index.d.ts.map +0 -1
- package/dist/types/registries/metaplex-bridge.d.ts +0 -488
- package/dist/types/registries/metaplex-bridge.d.ts.map +0 -1
- package/dist/types/registries/session.d.ts +0 -317
- package/dist/types/registries/session.d.ts.map +0 -1
- package/dist/types/registries/x402.d.ts +0 -523
- package/dist/types/registries/x402.d.ts.map +0 -1
- package/dist/types/types/accounts.d.ts +0 -817
- package/dist/types/types/accounts.d.ts.map +0 -1
- package/dist/types/types/common.d.ts +0 -166
- package/dist/types/types/common.d.ts.map +0 -1
- package/dist/types/types/endpoint.d.ts +0 -161
- package/dist/types/types/endpoint.d.ts.map +0 -1
- package/dist/types/types/enums.d.ts +0 -353
- package/dist/types/types/enums.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -29
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/types/instructions.d.ts +0 -400
- package/dist/types/types/instructions.d.ts.map +0 -1
- package/dist/types/utils/anchor-errors.d.ts +0 -61
- package/dist/types/utils/anchor-errors.d.ts.map +0 -1
- package/dist/types/utils/endpoint-validator.d.ts +0 -110
- package/dist/types/utils/endpoint-validator.d.ts.map +0 -1
- package/dist/types/utils/escrow-validation.d.ts +0 -145
- package/dist/types/utils/escrow-validation.d.ts.map +0 -1
- package/dist/types/utils/hash.d.ts +0 -75
- package/dist/types/utils/hash.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -36
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/merchant-validator.d.ts +0 -176
- package/dist/types/utils/merchant-validator.d.ts.map +0 -1
- package/dist/types/utils/network-normalizer.d.ts +0 -120
- package/dist/types/utils/network-normalizer.d.ts.map +0 -1
- package/dist/types/utils/priority-fee.d.ts +0 -205
- package/dist/types/utils/priority-fee.d.ts.map +0 -1
- package/dist/types/utils/rpc-strategy.d.ts +0 -179
- package/dist/types/utils/rpc-strategy.d.ts.map +0 -1
- package/dist/types/utils/schemas.d.ts +0 -351
- package/dist/types/utils/schemas.d.ts.map +0 -1
- package/dist/types/utils/serialization.d.ts +0 -69
- package/dist/types/utils/serialization.d.ts.map +0 -1
- package/dist/types/utils/validation.d.ts +0 -29
- package/dist/types/utils/validation.d.ts.map +0 -1
- package/dist/types/utils/volume-curve.d.ts +0 -60
- package/dist/types/utils/volume-curve.d.ts.map +0 -1
- package/dist/types/utils/x402-direct.d.ts +0 -114
- package/dist/types/utils/x402-direct.d.ts.map +0 -1
|
@@ -1,285 +0,0 @@
|
|
|
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, type Signer } 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
|
-
* Sentinel error subclass marking a settle call as ALREADY SETTLED on-chain.
|
|
18
|
-
*
|
|
19
|
-
* Thrown by {@link EscrowV2Module.settle} (and {@link EscrowV2Module.fullSettle})
|
|
20
|
-
* when the `settlement_receipt` PDA derived from `(escrow, serviceHash)`
|
|
21
|
-
* already exists. Re-emitting `settle_calls_v2` in that state would fail
|
|
22
|
-
* with `Allocate: account already in use` (custom program error 0x0)
|
|
23
|
-
* **after** bumping `escrow.pending_amount` — i.e. silent double-charge
|
|
24
|
-
* with no PDA created. This preflight makes that race impossible.
|
|
25
|
-
*
|
|
26
|
-
* Callers (especially batch workers) should treat this as a non-fatal
|
|
27
|
-
* idempotent success and DROP the queued entry instead of retrying.
|
|
28
|
-
*
|
|
29
|
-
* @since v0.13.1
|
|
30
|
-
*/
|
|
31
|
-
export declare class AlreadySettledError extends Error {
|
|
32
|
-
readonly name = "AlreadySettledError";
|
|
33
|
-
readonly receiptPda: string;
|
|
34
|
-
readonly serviceHash: string;
|
|
35
|
-
constructor(receiptPda: string, serviceHash: string);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Sentinel error subclass marking a settle/finalize failure as PERMANENT
|
|
39
|
-
* (the escrow is unusable). Emitted on `EscrowExpired`,
|
|
40
|
-
* `AccountNotInitialized: escrow_v2`, `InsufficientEscrowBalance`, and
|
|
41
|
-
* `MaxCallsReached` — none of which are recoverable by retry.
|
|
42
|
-
*
|
|
43
|
-
* Callers should DROP the queued entry. If using
|
|
44
|
-
* {@link EscrowV2Module.fullSettle}, also evict any depositor-nonce cache.
|
|
45
|
-
*
|
|
46
|
-
* @since v0.13.1
|
|
47
|
-
*/
|
|
48
|
-
export declare class FatalSettleError extends Error {
|
|
49
|
-
readonly name = "FatalSettleError";
|
|
50
|
-
readonly code: string;
|
|
51
|
-
readonly stage: "settle" | "finalize";
|
|
52
|
-
constructor(code: string, stage: "settle" | "finalize", message: string);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @name EscrowV2Module
|
|
56
|
-
* @description Manages V2 escrow accounts with settlement security modes,
|
|
57
|
-
* dispute windows, and pending settlement flows.
|
|
58
|
-
*
|
|
59
|
-
* @category Modules
|
|
60
|
-
* @since v0.7.0
|
|
61
|
-
* @extends BaseModule
|
|
62
|
-
*/
|
|
63
|
-
export declare class EscrowV2Module extends BaseModule {
|
|
64
|
-
/** Convert BN | number | bigint → number for PDA seed functions. */
|
|
65
|
-
private toNum;
|
|
66
|
-
deriveEscrow(agentPda: PublicKey, depositor?: PublicKey, nonce?: BN | number | bigint): readonly [PublicKey, number];
|
|
67
|
-
derivePendingSettlement(escrowV2Pda: PublicKey, settlementIndex: BN | number | bigint): readonly [PublicKey, number];
|
|
68
|
-
deriveDispute(pendingSettlementPda: PublicKey): readonly [PublicKey, number];
|
|
69
|
-
create(agentWallet: PublicKey, args: CreateEscrowV2Args, splAccounts?: AccountMeta[]): Promise<TransactionSignature>;
|
|
70
|
-
deposit(agentWallet: PublicKey, nonce: BN | number | bigint, amount: BN | number | bigint, splAccounts?: AccountMeta[]): Promise<TransactionSignature>;
|
|
71
|
-
/**
|
|
72
|
-
* Settle a batch of calls against a V2 escrow.
|
|
73
|
-
*
|
|
74
|
-
* **v0.13.0 — Auto-bundle DisputeWindow:** when the escrow's
|
|
75
|
-
* `settlementSecurity` is `DisputeWindow`, this method now bundles
|
|
76
|
-
* **`settleCallsV2` + `createPendingSettlement`** into the SAME
|
|
77
|
-
* transaction. This eliminates the foot-gun where a caller would call
|
|
78
|
-
* `createPendingSettlement` directly without a preceding `settleCallsV2`,
|
|
79
|
-
* leaving `escrow.pending_amount = 0` and causing `finalizeSettlement`
|
|
80
|
-
* to abort with `ArithmeticOverflow` (6075).
|
|
81
|
-
*
|
|
82
|
-
* Flow per security mode:
|
|
83
|
-
* - **CoSigned** — single IX (`settleCallsV2`) with co-signer in
|
|
84
|
-
* remaining accounts; funds move immediately.
|
|
85
|
-
* - **DisputeWindow** — two IXs in one tx:
|
|
86
|
-
* 1. `settleCallsV2` — bumps `pending_amount` and `settlement_index`
|
|
87
|
-
* 2. `createPendingSettlement(idx)` — locks the dispute tracker PDA
|
|
88
|
-
*
|
|
89
|
-
* After this tx confirms, wait `escrow.disputeWindowSlots` slots and
|
|
90
|
-
* call {@link finalizeSettlement} with the index returned via
|
|
91
|
-
* `SettlementPendingEvent` or readable from `escrow.settlement_index - 1`.
|
|
92
|
-
*
|
|
93
|
-
* Pass `opts.skipAutoPending = true` to opt out of the auto-bundle (e.g.
|
|
94
|
-
* if you want to drive `createPendingSettlement` separately for advanced
|
|
95
|
-
* flows like batched off-chain receipt aggregation).
|
|
96
|
-
*
|
|
97
|
-
* @param depositorWallet - Depositor of the escrow being settled.
|
|
98
|
-
* @param nonce - Escrow nonce (default 0 for the canonical escrow).
|
|
99
|
-
* @param callsToSettle - Number of calls to settle in this batch.
|
|
100
|
-
* @param serviceHash - 32-byte sha256 of the service payload.
|
|
101
|
-
* @param splAccounts - Optional remaining accounts (SPL transfer + co-signer).
|
|
102
|
-
* @param opts - Priority-fee + auto-pending options.
|
|
103
|
-
* @param coSigner - Required for CoSigned escrows.
|
|
104
|
-
* @returns The transaction signature.
|
|
105
|
-
* @since v0.7.0 — initial release
|
|
106
|
-
* @since v0.13.0 — auto-bundles `createPendingSettlement` for DisputeWindow
|
|
107
|
-
*/
|
|
108
|
-
settle(depositorWallet: PublicKey, nonce: BN | number | bigint, callsToSettle: BN | number | bigint, serviceHash: number[], splAccounts?: AccountMeta[], opts?: SettleOptions & {
|
|
109
|
-
/**
|
|
110
|
-
* v0.13.0 — Opt out of the DisputeWindow auto-bundle. When `true`,
|
|
111
|
-
* `settle()` only emits `settleCallsV2` and the caller is responsible
|
|
112
|
-
* for sending `createPendingSettlement` afterwards (legacy 2-tx flow).
|
|
113
|
-
* Default: `false` (auto-bundle is on).
|
|
114
|
-
*/
|
|
115
|
-
skipAutoPending?: boolean;
|
|
116
|
-
/**
|
|
117
|
-
* v0.13.0 — `receiptMerkleRoot` to inscribe in the auto-bundled
|
|
118
|
-
* `createPendingSettlement`. Defaults to 32 zero bytes (no receipt
|
|
119
|
-
* batch). Ignored when `skipAutoPending = true`.
|
|
120
|
-
*/
|
|
121
|
-
receiptMerkleRoot?: number[];
|
|
122
|
-
/**
|
|
123
|
-
* v0.13.1 — Skip the receipt-PDA existence preflight that throws
|
|
124
|
-
* {@link AlreadySettledError}. Only set when you have an upstream
|
|
125
|
-
* idempotency layer that's already verified the call hasn't been
|
|
126
|
-
* settled. Default: `false` (preflight is on).
|
|
127
|
-
*/
|
|
128
|
-
skipIdempotencyCheck?: boolean;
|
|
129
|
-
}, coSigner?: Signer): Promise<TransactionSignature>;
|
|
130
|
-
/**
|
|
131
|
-
* Read the current `escrow.settlement_index` from chain.
|
|
132
|
-
*
|
|
133
|
-
* In DisputeWindow mode (`settlementSecurity = 2`), every successful
|
|
134
|
-
* `settleCallsV2` increments this value. The PRE-increment value is the
|
|
135
|
-
* one to pass to {@link createPendingSettlement} for that batch.
|
|
136
|
-
*
|
|
137
|
-
* @returns the current `settlementIndex` as `bigint` (next index to use
|
|
138
|
-
* for `createPendingSettlement` if you have NOT yet called `settle` for
|
|
139
|
-
* it; if you HAVE just settled, subtract 1 — but prefer the event
|
|
140
|
-
* `SettlementPendingEvent.settlement_index` over arithmetic).
|
|
141
|
-
* @since v0.12.8
|
|
142
|
-
*/
|
|
143
|
-
nextSettlementIndex(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint): Promise<bigint>;
|
|
144
|
-
/**
|
|
145
|
-
* Create the PendingSettlement PDA for a DisputeWindow batch.
|
|
146
|
-
*
|
|
147
|
-
* **v0.13.0 NOTE:** in almost all cases you should call
|
|
148
|
-
* {@link settle} instead — it auto-bundles `settleCallsV2 +
|
|
149
|
-
* createPendingSettlement` in a single transaction so the two
|
|
150
|
-
* cannot drift out of sync. Use this method standalone ONLY when
|
|
151
|
-
* you intentionally pass `skipAutoPending: true` to `settle()`
|
|
152
|
-
* (e.g. batched receipt-merkle aggregation across multiple
|
|
153
|
-
* `settleCallsV2` runs).
|
|
154
|
-
*
|
|
155
|
-
* Calling this without a preceding `settleCallsV2` (which bumps
|
|
156
|
-
* `escrow.pending_amount`) creates an orphan PDA whose
|
|
157
|
-
* `pending.amount > escrow.pending_amount` — `finalizeSettlement`
|
|
158
|
-
* will then abort with `ArithmeticOverflow` (6075) forever.
|
|
159
|
-
*
|
|
160
|
-
* @since v0.7.0
|
|
161
|
-
*/
|
|
162
|
-
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>;
|
|
163
|
-
finalizeSettlement(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint): Promise<TransactionSignature>;
|
|
164
|
-
/**
|
|
165
|
-
* Wrap {@link finalizeSettlement} with bounded exponential-ish retries
|
|
166
|
-
* tuned for the dispute-window race: the pending PDA is already
|
|
167
|
-
* confirmed on-chain, but downstream RPC nodes may serve a stale view
|
|
168
|
-
* for several hundred ms. Also handles `not found on-chain` returned
|
|
169
|
-
* by stale read replicas.
|
|
170
|
-
*
|
|
171
|
-
* @param attempts - max attempts (default 8).
|
|
172
|
-
* @param delayMs - constant delay between attempts (default 600ms).
|
|
173
|
-
* @throws {FatalSettleError} on `EscrowExpired` / `MaxCallsReached` /
|
|
174
|
-
* `InsufficientEscrowBalance` — DO NOT RETRY.
|
|
175
|
-
* @throws The original error after `attempts` exhausted.
|
|
176
|
-
* @since v0.13.1
|
|
177
|
-
*/
|
|
178
|
-
finalizeWithRetry(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint, attempts?: number, delayMs?: number): Promise<TransactionSignature>;
|
|
179
|
-
/**
|
|
180
|
-
* Scan a window of settlement indices and finalize any orphan
|
|
181
|
-
* PendingSettlement PDAs that were left behind by aborted prior runs.
|
|
182
|
-
*
|
|
183
|
-
* An "orphan" here means a pending PDA that exists on-chain, is NOT
|
|
184
|
-
* finalized, and is NOT disputed — i.e. a previous settle landed
|
|
185
|
-
* (escrow.pending_amount was bumped) but the followup finalize never
|
|
186
|
-
* landed. Until reconciled, those lamports remain locked in
|
|
187
|
-
* `pending_amount` and the agent can't withdraw them.
|
|
188
|
-
*
|
|
189
|
-
* Swallows `DisputeWindowNotExpired` (still in window — try later) and
|
|
190
|
-
* orphan-amount inconsistencies surfaced by the finalize preflight.
|
|
191
|
-
*
|
|
192
|
-
* @param window - how many indices back to scan (default 32, max 256).
|
|
193
|
-
* @returns Array of `{ index, signature?, skipped?, reason? }` records.
|
|
194
|
-
* @since v0.13.1
|
|
195
|
-
*/
|
|
196
|
-
reconcileOrphanPendings(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, window?: number): Promise<Array<{
|
|
197
|
-
index: string;
|
|
198
|
-
signature?: string;
|
|
199
|
-
skipped?: true;
|
|
200
|
-
reason?: string;
|
|
201
|
-
}>>;
|
|
202
|
-
/**
|
|
203
|
-
* One-call settle + finalize orchestration with all v0.13.1 safety rails:
|
|
204
|
-
*
|
|
205
|
-
* 1. **Idempotency preflight** — receipt PDA must NOT exist (else
|
|
206
|
-
* `AlreadySettledError`).
|
|
207
|
-
* 2. **Orphan reconcile** — finalize any stuck pendings in the last
|
|
208
|
-
* `orphanWindow` indices BEFORE creating a new one.
|
|
209
|
-
* 3. **Atomic settle** — `settleCallsV2 + createPendingSettlement` in
|
|
210
|
-
* one tx (already provided by {@link settle}).
|
|
211
|
-
* 4. **Post-settle index** — refetch escrow AFTER settle confirms,
|
|
212
|
-
* derive `index = settlementIndex - 1` (NEVER trust pre-read).
|
|
213
|
-
* 5. **Bounded finalize retry** — up to `finalizeAttempts` tries, then
|
|
214
|
-
* surface fatal vs. retryable distinction to the caller.
|
|
215
|
-
*
|
|
216
|
-
* Returns BOTH signatures and the index that was just settled — the
|
|
217
|
-
* batch worker uses the index for receipt accumulators.
|
|
218
|
-
*
|
|
219
|
-
* @since v0.13.1
|
|
220
|
-
*/
|
|
221
|
-
fullSettle(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, callsToSettle: BN | number | bigint, serviceHash: number[], splAccounts?: AccountMeta[], opts?: Parameters<EscrowV2Module["settle"]>[5] & {
|
|
222
|
-
/** Reconcile orphan pendings before settling. Default true. */
|
|
223
|
-
reconcileOrphans?: boolean;
|
|
224
|
-
/** Window size for orphan scan. Default 32. */
|
|
225
|
-
orphanWindow?: number;
|
|
226
|
-
/** Max finalize retries. Default 8. */
|
|
227
|
-
finalizeAttempts?: number;
|
|
228
|
-
/** Delay between finalize retries in ms. Default 600. */
|
|
229
|
-
finalizeDelayMs?: number;
|
|
230
|
-
}, coSigner?: Signer): Promise<{
|
|
231
|
-
settleSignature: TransactionSignature;
|
|
232
|
-
finalizeSignature: TransactionSignature;
|
|
233
|
-
settlementIndex: string;
|
|
234
|
-
reconciled: number;
|
|
235
|
-
}>;
|
|
236
|
-
/**
|
|
237
|
-
*
|
|
238
|
-
* @returns `null` if the PDA is finalizable (or already finalized / disputed).
|
|
239
|
-
* Otherwise an object describing the inconsistency, suitable for
|
|
240
|
-
* logging or feeding into a quarantine list. Use this from a
|
|
241
|
-
* recovery script to scan a range of `settlement_index` values:
|
|
242
|
-
*
|
|
243
|
-
* ```ts
|
|
244
|
-
* for (let idx = 0n; idx < currentIdx; idx++) {
|
|
245
|
-
* const orphan = await sap.escrowV2.diagnoseOrphanPending(
|
|
246
|
-
* agentWallet, depositorWallet, nonce, idx,
|
|
247
|
-
* );
|
|
248
|
-
* if (orphan) log.warn({ idx, ...orphan }, "skip orphan");
|
|
249
|
-
* }
|
|
250
|
-
* ```
|
|
251
|
-
*
|
|
252
|
-
* @since v0.12.9
|
|
253
|
-
*/
|
|
254
|
-
diagnoseOrphanPending(agentWallet: PublicKey, depositorWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint): Promise<{
|
|
255
|
-
pendingPda: PublicKey;
|
|
256
|
-
psAmount: bigint;
|
|
257
|
-
escrowPendingAmount: bigint;
|
|
258
|
-
escrowBalance: bigint;
|
|
259
|
-
isFinalized: boolean;
|
|
260
|
-
isDisputed: boolean;
|
|
261
|
-
reason: "ok" | "missing" | "amount_exceeds_pending" | "amount_exceeds_balance" | "already_finalized" | "disputed";
|
|
262
|
-
} | null>;
|
|
263
|
-
fileDispute(agentWallet: PublicKey, nonce: BN | number | bigint, settlementIndex: BN | number | bigint, evidenceHash: number[], disputeType?: number): Promise<TransactionSignature>;
|
|
264
|
-
/**
|
|
265
|
-
* @deprecated Since v0.7.0 — Arbiter-based resolution removed.
|
|
266
|
-
* Use {@link ReceiptModule.submitReceiptProof} + {@link ReceiptModule.autoResolveDispute} instead.
|
|
267
|
-
*/
|
|
268
|
-
resolveDispute(_depositorWallet: PublicKey, _agentWallet: PublicKey, _nonce: BN | number | bigint, _settlementIndex: BN | number | bigint, _outcome: number): Promise<TransactionSignature>;
|
|
269
|
-
closeDispute(pendingSettlementPda: PublicKey): Promise<TransactionSignature>;
|
|
270
|
-
closePendingSettlement(pendingSettlementPda: PublicKey): Promise<TransactionSignature>;
|
|
271
|
-
withdraw(agentWallet: PublicKey, nonce: BN | number | bigint, amount: BN | number | bigint): Promise<TransactionSignature>;
|
|
272
|
-
close(agentWallet: PublicKey, nonce?: BN | number | bigint): Promise<TransactionSignature>;
|
|
273
|
-
/**
|
|
274
|
-
* @deprecated Since v0.7.0 — Migration instruction removed from program.
|
|
275
|
-
*/
|
|
276
|
-
migrateFromV1(_agentWallet: PublicKey): Promise<TransactionSignature>;
|
|
277
|
-
fetch(agentPda: PublicKey, depositor?: PublicKey, nonce?: BN | number | bigint): Promise<EscrowAccountV2Data>;
|
|
278
|
-
fetchNullable(agentPda: PublicKey, depositor?: PublicKey, nonce?: BN | number | bigint): Promise<EscrowAccountV2Data | null>;
|
|
279
|
-
fetchByPda(escrowPda: PublicKey): Promise<EscrowAccountV2Data>;
|
|
280
|
-
fetchPendingSettlement(pendingPda: PublicKey): Promise<PendingSettlementData>;
|
|
281
|
-
fetchPendingSettlementNullable(pendingPda: PublicKey): Promise<PendingSettlementData | null>;
|
|
282
|
-
fetchDispute(disputePda: PublicKey): Promise<DisputeRecordData>;
|
|
283
|
-
fetchDisputeNullable(disputePda: PublicKey): Promise<DisputeRecordData | null>;
|
|
284
|
-
}
|
|
285
|
-
//# sourceMappingURL=escrow-v2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAChB,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAWpC,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAKlB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,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|
3
|
-
* @description Trustless reputation system — give, update, revoke, and close
|
|
4
|
-
* on-chain feedback entries for agents.
|
|
5
|
-
*
|
|
6
|
-
* Feedback entries are PDA-based reviews tied to an agent and a reviewer wallet,
|
|
7
|
-
* enabling permissionless, verifiable reputation on Solana.
|
|
8
|
-
*
|
|
9
|
-
* @category Modules
|
|
10
|
-
* @since v0.1.0
|
|
11
|
-
* @packageDocumentation
|
|
12
|
-
*/
|
|
13
|
-
import { type PublicKey, type TransactionSignature } from "@solana/web3.js";
|
|
14
|
-
import { BaseModule } from "./base";
|
|
15
|
-
import type { FeedbackAccountData, GiveFeedbackArgs, UpdateFeedbackArgs } from "../types";
|
|
16
|
-
/**
|
|
17
|
-
* @name FeedbackModule
|
|
18
|
-
* @description Manages on-chain feedback entries for the Synapse Agent Protocol.
|
|
19
|
-
* Provides methods to give, update, revoke, close, and fetch feedback PDAs
|
|
20
|
-
* that form the trustless reputation layer.
|
|
21
|
-
*
|
|
22
|
-
* @category Modules
|
|
23
|
-
* @since v0.1.0
|
|
24
|
-
* @extends BaseModule
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const sap = new SapClient(provider);
|
|
29
|
-
* const sig = await sap.feedback.give(agentWallet, {
|
|
30
|
-
* score: 5,
|
|
31
|
-
* tag: { quality: {} },
|
|
32
|
-
* commentHash: null,
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare class FeedbackModule extends BaseModule {
|
|
37
|
-
/**
|
|
38
|
-
* @name deriveFeedback
|
|
39
|
-
* @description Derive the `FeedbackAccount` PDA for a given agent and reviewer.
|
|
40
|
-
* @param agentPda - The agent account PDA to review.
|
|
41
|
-
* @param reviewer - The reviewer wallet. Defaults to the connected wallet.
|
|
42
|
-
* @returns A tuple of `[PublicKey, bump]` for the feedback PDA.
|
|
43
|
-
* @see {@link deriveFeedback} from `pda/` module for the underlying derivation.
|
|
44
|
-
* @since v0.1.0
|
|
45
|
-
*/
|
|
46
|
-
deriveFeedback(agentPda: PublicKey, reviewer?: PublicKey): readonly [PublicKey, number];
|
|
47
|
-
/**
|
|
48
|
-
* @name give
|
|
49
|
-
* @description Leave on-chain feedback for an agent. Creates a new
|
|
50
|
-
* `FeedbackAccount` PDA owned by the reviewer.
|
|
51
|
-
* @param agentWallet - The wallet that owns the target agent.
|
|
52
|
-
* @param args - Feedback parameters (score, tag, optional comment hash).
|
|
53
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
54
|
-
* @since v0.1.0
|
|
55
|
-
*/
|
|
56
|
-
give(agentWallet: PublicKey, args: GiveFeedbackArgs): Promise<TransactionSignature>;
|
|
57
|
-
/**
|
|
58
|
-
* @name update
|
|
59
|
-
* @description Update an existing feedback entry. Only the original reviewer
|
|
60
|
-
* may update their feedback.
|
|
61
|
-
* @param agentWallet - The wallet that owns the target agent.
|
|
62
|
-
* @param args - Updated feedback parameters (new score, optional new tag, optional comment hash).
|
|
63
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
64
|
-
* @since v0.1.0
|
|
65
|
-
*/
|
|
66
|
-
update(agentWallet: PublicKey, args: UpdateFeedbackArgs): Promise<TransactionSignature>;
|
|
67
|
-
/**
|
|
68
|
-
* @name revoke
|
|
69
|
-
* @description Revoke a feedback entry, marking it as revoked and excluding
|
|
70
|
-
* it from reputation calculations.
|
|
71
|
-
* @param agentWallet - The wallet that owns the target agent.
|
|
72
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
73
|
-
* @since v0.1.0
|
|
74
|
-
*/
|
|
75
|
-
revoke(agentWallet: PublicKey): Promise<TransactionSignature>;
|
|
76
|
-
/**
|
|
77
|
-
* @name close
|
|
78
|
-
* @description Close a revoked feedback PDA and reclaim rent to the reviewer.
|
|
79
|
-
* @param agentWallet - The wallet that owns the target agent.
|
|
80
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
81
|
-
* @since v0.1.0
|
|
82
|
-
*/
|
|
83
|
-
close(agentWallet: PublicKey): Promise<TransactionSignature>;
|
|
84
|
-
/**
|
|
85
|
-
* @name fetch
|
|
86
|
-
* @description Fetch a deserialized `FeedbackAccount`.
|
|
87
|
-
* @param agentPda - The agent account PDA.
|
|
88
|
-
* @param reviewer - The reviewer wallet. Defaults to the connected wallet.
|
|
89
|
-
* @returns {Promise<FeedbackAccountData>} The feedback account data.
|
|
90
|
-
* @throws Will throw if the feedback account does not exist.
|
|
91
|
-
* @since v0.1.0
|
|
92
|
-
*/
|
|
93
|
-
fetch(agentPda: PublicKey, reviewer?: PublicKey): Promise<FeedbackAccountData>;
|
|
94
|
-
/**
|
|
95
|
-
* @name fetchNullable
|
|
96
|
-
* @description Fetch a deserialized `FeedbackAccount`, or `null` if it
|
|
97
|
-
* does not exist on-chain.
|
|
98
|
-
* @param agentPda - The agent account PDA.
|
|
99
|
-
* @param reviewer - The reviewer wallet. Defaults to the connected wallet.
|
|
100
|
-
* @returns {Promise<FeedbackAccountData | null>} The feedback data or `null`.
|
|
101
|
-
* @since v0.1.0
|
|
102
|
-
*/
|
|
103
|
-
fetchNullable(agentPda: PublicKey, reviewer?: PublicKey): Promise<FeedbackAccountData | null>;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../../src/modules/feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE1F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAG5C;;;;;;;;OAQG;IACH,cAAc,CACZ,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,SAAS,GACnB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAM/B;;;;;;;;OAQG;IACG,IAAI,CACR,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,oBAAoB,CAAC;IAiBhC;;;;;;;;OAQG;IACG,MAAM,CACV,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC;IAchC;;;;;;;OAOG;IACG,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAcnE;;;;;;OAMG;IACG,KAAK,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAelE;;;;;;;;OAQG;IACG,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAKpF;;;;;;;;OAQG;IACG,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAIpG"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module modules
|
|
3
|
-
* @description Barrel export for all domain modules of the `@synapse-sap/sdk`.
|
|
4
|
-
*
|
|
5
|
-
* Re-exports every module class so consumers can import from a single entry point:
|
|
6
|
-
* ```ts
|
|
7
|
-
* import { AgentModule, VaultModule } from "@synapse-sap/sdk/modules";
|
|
8
|
-
* ```
|
|
9
|
-
*
|
|
10
|
-
* @category Modules
|
|
11
|
-
* @since v0.1.0
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
export { AgentModule } from "./agent";
|
|
15
|
-
export { FeedbackModule } from "./feedback";
|
|
16
|
-
export { IndexingModule } from "./indexing";
|
|
17
|
-
export { ToolsModule } from "./tools";
|
|
18
|
-
export { VaultModule } from "./vault";
|
|
19
|
-
export { EscrowV2Module, AlreadySettledError, FatalSettleError } from "./escrow-v2";
|
|
20
|
-
export { ReceiptModule } from "./receipt";
|
|
21
|
-
export { StakingModule } from "./staking";
|
|
22
|
-
export { SubscriptionModule } from "./subscription";
|
|
23
|
-
export { AttestationModule } from "./attestation";
|
|
24
|
-
export { LedgerModule } from "./ledger";
|
|
25
|
-
export { BaseModule } from "./base";
|
|
26
|
-
export type { SapProgram, SapTransactionResult } from "./base";
|
|
27
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpF,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"}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module indexing
|
|
3
|
-
* @description Scalable discovery layer — capability indexes, protocol indexes,
|
|
4
|
-
* and tool category indexes for the Synapse Agent Protocol.
|
|
5
|
-
*
|
|
6
|
-
* Indexes are shared PDA-based registries that map agents and tools to
|
|
7
|
-
* discovery dimensions, enabling efficient on-chain lookups.
|
|
8
|
-
*
|
|
9
|
-
* @category Modules
|
|
10
|
-
* @since v0.1.0
|
|
11
|
-
* @packageDocumentation
|
|
12
|
-
*/
|
|
13
|
-
import { type PublicKey, type TransactionSignature } from "@solana/web3.js";
|
|
14
|
-
import { BaseModule } from "./base";
|
|
15
|
-
import type { CapabilityIndexData, ProtocolIndexData, ToolCategoryIndexData } from "../types";
|
|
16
|
-
/**
|
|
17
|
-
* @name IndexingModule
|
|
18
|
-
* @description Manages on-chain discovery indexes for the Synapse Agent Protocol.
|
|
19
|
-
* Provides methods to create, populate, prune, close, and fetch capability
|
|
20
|
-
* indexes, protocol indexes, and tool category indexes.
|
|
21
|
-
*
|
|
22
|
-
* @category Modules
|
|
23
|
-
* @since v0.1.0
|
|
24
|
-
* @extends BaseModule
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const sap = new SapClient(provider);
|
|
29
|
-
* // Create a capability index and add your agent
|
|
30
|
-
* await sap.indexing.initCapabilityIndex("text-generation");
|
|
31
|
-
* // Query agents by capability
|
|
32
|
-
* const idx = await sap.indexing.fetchCapabilityIndex("text-generation");
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare class IndexingModule extends BaseModule {
|
|
36
|
-
/**
|
|
37
|
-
* @name hash
|
|
38
|
-
* @description Hash a capability or protocol ID string for use as a PDA seed.
|
|
39
|
-
* Uses SHA-256 internally.
|
|
40
|
-
* @param id - The capability or protocol identifier string.
|
|
41
|
-
* @returns {Uint8Array} The 32-byte SHA-256 hash.
|
|
42
|
-
* @since v0.1.0
|
|
43
|
-
*/
|
|
44
|
-
hash(id: string): Uint8Array;
|
|
45
|
-
/**
|
|
46
|
-
* @name initCapabilityIndex
|
|
47
|
-
* @description Create a new capability index and register the caller’s agent.
|
|
48
|
-
* The capability ID is hashed to derive the PDA.
|
|
49
|
-
* @param capabilityId - Human-readable capability identifier (e.g. `"text-generation"`).
|
|
50
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
51
|
-
* @since v0.1.0
|
|
52
|
-
*/
|
|
53
|
-
initCapabilityIndex(capabilityId: string): Promise<TransactionSignature>;
|
|
54
|
-
/**
|
|
55
|
-
* @name addToCapabilityIndex
|
|
56
|
-
* @description Add the caller’s agent to an existing capability index.
|
|
57
|
-
* @param capabilityId - The capability identifier string.
|
|
58
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
59
|
-
* @since v0.1.0
|
|
60
|
-
*/
|
|
61
|
-
addToCapabilityIndex(capabilityId: string): Promise<TransactionSignature>;
|
|
62
|
-
/**
|
|
63
|
-
* @name removeFromCapabilityIndex
|
|
64
|
-
* @description Remove the caller’s agent from a capability index.
|
|
65
|
-
* @param capabilityId - The capability identifier string.
|
|
66
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
67
|
-
* @since v0.1.0
|
|
68
|
-
*/
|
|
69
|
-
removeFromCapabilityIndex(capabilityId: string): Promise<TransactionSignature>;
|
|
70
|
-
/**
|
|
71
|
-
* @name closeCapabilityIndex
|
|
72
|
-
* @description Close an empty capability index PDA and reclaim rent.
|
|
73
|
-
* @param capabilityId - The capability identifier string.
|
|
74
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
75
|
-
* @since v0.1.0
|
|
76
|
-
*/
|
|
77
|
-
closeCapabilityIndex(capabilityId: string): Promise<TransactionSignature>;
|
|
78
|
-
/**
|
|
79
|
-
* @name initProtocolIndex
|
|
80
|
-
* @description Create a new protocol index and register the caller’s agent.
|
|
81
|
-
* The protocol ID is hashed to derive the PDA.
|
|
82
|
-
* @param protocolId - Human-readable protocol identifier (e.g. `"mcp-v1"`).
|
|
83
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
84
|
-
* @since v0.1.0
|
|
85
|
-
*/
|
|
86
|
-
initProtocolIndex(protocolId: string): Promise<TransactionSignature>;
|
|
87
|
-
/**
|
|
88
|
-
* @name addToProtocolIndex
|
|
89
|
-
* @description Add the caller’s agent to an existing protocol index.
|
|
90
|
-
* @param protocolId - The protocol identifier string.
|
|
91
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
92
|
-
* @since v0.1.0
|
|
93
|
-
*/
|
|
94
|
-
addToProtocolIndex(protocolId: string): Promise<TransactionSignature>;
|
|
95
|
-
/**
|
|
96
|
-
* @name removeFromProtocolIndex
|
|
97
|
-
* @description Remove the caller’s agent from a protocol index.
|
|
98
|
-
* @param protocolId - The protocol identifier string.
|
|
99
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
100
|
-
* @since v0.1.0
|
|
101
|
-
*/
|
|
102
|
-
removeFromProtocolIndex(protocolId: string): Promise<TransactionSignature>;
|
|
103
|
-
/**
|
|
104
|
-
* @name closeProtocolIndex
|
|
105
|
-
* @description Close an empty protocol index PDA and reclaim rent.
|
|
106
|
-
* @param protocolId - The protocol identifier string.
|
|
107
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
108
|
-
* @since v0.1.0
|
|
109
|
-
*/
|
|
110
|
-
closeProtocolIndex(protocolId: string): Promise<TransactionSignature>;
|
|
111
|
-
/**
|
|
112
|
-
* @name initToolCategoryIndex
|
|
113
|
-
* @description Create a new tool category index PDA.
|
|
114
|
-
* @param category - Numeric tool category enum value.
|
|
115
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
116
|
-
* @since v0.1.0
|
|
117
|
-
*/
|
|
118
|
-
initToolCategoryIndex(category: number): Promise<TransactionSignature>;
|
|
119
|
-
/**
|
|
120
|
-
* @name addToToolCategory
|
|
121
|
-
* @description Add a tool to its matching category index.
|
|
122
|
-
* @param category - Numeric tool category enum value.
|
|
123
|
-
* @param toolPda - The tool descriptor PDA to add.
|
|
124
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
125
|
-
* @since v0.1.0
|
|
126
|
-
*/
|
|
127
|
-
addToToolCategory(category: number, toolPda: PublicKey): Promise<TransactionSignature>;
|
|
128
|
-
/**
|
|
129
|
-
* @name removeFromToolCategory
|
|
130
|
-
* @description Remove a tool from a category index.
|
|
131
|
-
* @param category - Numeric tool category enum value.
|
|
132
|
-
* @param toolPda - The tool descriptor PDA to remove.
|
|
133
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
134
|
-
* @since v0.1.0
|
|
135
|
-
*/
|
|
136
|
-
removeFromToolCategory(category: number, toolPda: PublicKey): Promise<TransactionSignature>;
|
|
137
|
-
/**
|
|
138
|
-
* @name closeToolCategoryIndex
|
|
139
|
-
* @description Close an empty tool category index PDA and reclaim rent.
|
|
140
|
-
* @param category - Numeric tool category enum value.
|
|
141
|
-
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
142
|
-
* @since v0.1.0
|
|
143
|
-
*/
|
|
144
|
-
closeToolCategoryIndex(category: number): Promise<TransactionSignature>;
|
|
145
|
-
/**
|
|
146
|
-
* @name fetchCapabilityIndex
|
|
147
|
-
* @description Fetch a deserialized `CapabilityIndex` account by capability ID.
|
|
148
|
-
* @param capabilityId - The capability identifier string.
|
|
149
|
-
* @returns {Promise<CapabilityIndexData>} The capability index data.
|
|
150
|
-
* @throws Will throw if the capability index does not exist.
|
|
151
|
-
* @since v0.1.0
|
|
152
|
-
*/
|
|
153
|
-
fetchCapabilityIndex(capabilityId: string): Promise<CapabilityIndexData>;
|
|
154
|
-
/**
|
|
155
|
-
* @name fetchCapabilityIndexNullable
|
|
156
|
-
* @description Fetch a deserialized `CapabilityIndex` account, or `null`
|
|
157
|
-
* if it does not exist on-chain.
|
|
158
|
-
* @param capabilityId - The capability identifier string.
|
|
159
|
-
* @returns {Promise<CapabilityIndexData | null>} The capability index data or `null`.
|
|
160
|
-
* @since v0.1.0
|
|
161
|
-
*/
|
|
162
|
-
fetchCapabilityIndexNullable(capabilityId: string): Promise<CapabilityIndexData | null>;
|
|
163
|
-
/**
|
|
164
|
-
* @name fetchProtocolIndex
|
|
165
|
-
* @description Fetch a deserialized `ProtocolIndex` account by protocol ID.
|
|
166
|
-
* @param protocolId - The protocol identifier string.
|
|
167
|
-
* @returns {Promise<ProtocolIndexData>} The protocol index data.
|
|
168
|
-
* @throws Will throw if the protocol index does not exist.
|
|
169
|
-
* @since v0.1.0
|
|
170
|
-
*/
|
|
171
|
-
fetchProtocolIndex(protocolId: string): Promise<ProtocolIndexData>;
|
|
172
|
-
/**
|
|
173
|
-
* @name fetchProtocolIndexNullable
|
|
174
|
-
* @description Fetch a deserialized `ProtocolIndex` account, or `null`
|
|
175
|
-
* if it does not exist on-chain.
|
|
176
|
-
* @param protocolId - The protocol identifier string.
|
|
177
|
-
* @returns {Promise<ProtocolIndexData | null>} The protocol index data or `null`.
|
|
178
|
-
* @since v0.1.0
|
|
179
|
-
*/
|
|
180
|
-
fetchProtocolIndexNullable(protocolId: string): Promise<ProtocolIndexData | null>;
|
|
181
|
-
/**
|
|
182
|
-
* @name fetchToolCategoryIndex
|
|
183
|
-
* @description Fetch a deserialized `ToolCategoryIndex` account by category number.
|
|
184
|
-
* @param category - Numeric tool category enum value.
|
|
185
|
-
* @returns {Promise<ToolCategoryIndexData>} The tool category index data.
|
|
186
|
-
* @throws Will throw if the tool category index does not exist.
|
|
187
|
-
* @since v0.1.0
|
|
188
|
-
*/
|
|
189
|
-
fetchToolCategoryIndex(category: number): Promise<ToolCategoryIndexData>;
|
|
190
|
-
/**
|
|
191
|
-
* @name fetchToolCategoryIndexNullable
|
|
192
|
-
* @description Fetch a deserialized `ToolCategoryIndex` account, or `null`
|
|
193
|
-
* if it does not exist on-chain.
|
|
194
|
-
* @param category - Numeric tool category enum value.
|
|
195
|
-
* @returns {Promise<ToolCategoryIndexData | null>} The tool category index data or `null`.
|
|
196
|
-
* @since v0.1.0
|
|
197
|
-
*/
|
|
198
|
-
fetchToolCategoryIndexNullable(category: number): Promise<ToolCategoryIndexData | null>;
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=indexing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../../../src/modules/indexing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQpC,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAGlB;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAG5C;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAM5B;;;;;;;OAOG;IACG,mBAAmB,CACvB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAkBhC;;;;;;OAMG;IACG,oBAAoB,CACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAehC;;;;;;OAMG;IACG,yBAAyB,CAC7B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAehC;;;;;;OAMG;IACG,oBAAoB,CACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAiBhC;;;;;;;OAOG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,CAAC;IAkBhC;;;;;;OAMG;IACG,kBAAkB,CACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,CAAC;IAehC;;;;;;OAMG;IACG,uBAAuB,CAC3B,UAAU,EAAE,MAAM,GACjB,O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