@oobe-protocol-labs/synapse-sap-sdk 0.7.0 → 0.9.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/constants/seeds.js +2 -0
- package/dist/cjs/constants/seeds.js.map +1 -1
- package/dist/cjs/core/client.js +44 -0
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/idl/synapse_agent_sap.json +1050 -629
- package/dist/cjs/index.js +8 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/escrow-v2.js +17 -38
- package/dist/cjs/modules/escrow-v2.js.map +1 -1
- package/dist/cjs/modules/index.js +3 -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/pda/index.js +24 -1
- package/dist/cjs/pda/index.js.map +1 -1
- package/dist/cjs/registries/index.js +3 -1
- package/dist/cjs/registries/index.js.map +1 -1
- package/dist/cjs/registries/metaplex-bridge.js +446 -0
- package/dist/cjs/registries/metaplex-bridge.js.map +1 -0
- package/dist/cjs/types/enums.js +47 -2
- package/dist/cjs/types/enums.js.map +1 -1
- package/dist/cjs/types/index.js +3 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/constants/seeds.js +2 -0
- package/dist/esm/constants/seeds.js.map +1 -1
- package/dist/esm/core/client.js +44 -0
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/idl/synapse_agent_sap.json +1050 -629
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/escrow-v2.js +18 -39
- package/dist/esm/modules/escrow-v2.js.map +1 -1
- package/dist/esm/modules/index.js +1 -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/pda/index.js +22 -0
- package/dist/esm/pda/index.js.map +1 -1
- package/dist/esm/registries/index.js +1 -0
- package/dist/esm/registries/index.js.map +1 -1
- package/dist/esm/registries/metaplex-bridge.js +409 -0
- package/dist/esm/registries/metaplex-bridge.js.map +1 -0
- package/dist/esm/types/enums.js +46 -1
- 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/types/constants/seeds.d.ts +2 -0
- package/dist/types/constants/seeds.d.ts.map +1 -1
- package/dist/types/core/client.d.ts +38 -0
- package/dist/types/core/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/escrow-v2.d.ts +13 -6
- package/dist/types/modules/escrow-v2.d.ts.map +1 -1
- package/dist/types/modules/index.d.ts +1 -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/pda/index.d.ts +15 -0
- package/dist/types/pda/index.d.ts.map +1 -1
- package/dist/types/registries/index.d.ts +2 -0
- package/dist/types/registries/index.d.ts.map +1 -1
- package/dist/types/registries/metaplex-bridge.d.ts +228 -0
- package/dist/types/registries/metaplex-bridge.d.ts.map +1 -0
- package/dist/types/types/accounts.d.ts +46 -2
- package/dist/types/types/accounts.d.ts.map +1 -1
- package/dist/types/types/enums.d.ts +52 -1
- package/dist/types/types/enums.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +3 -3
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +26 -6
- package/src/constants/seeds.ts +2 -0
- package/src/core/client.ts +46 -0
- package/src/idl/synapse_agent_sap.json +1050 -629
- package/src/index.ts +14 -0
- package/src/modules/escrow-v2.ts +21 -42
- package/src/modules/index.ts +1 -0
- package/src/modules/receipt.ts +207 -0
- package/src/pda/index.ts +32 -0
- package/src/registries/index.ts +10 -0
- package/src/registries/metaplex-bridge.ts +645 -0
- package/src/types/accounts.ts +51 -2
- package/src/types/enums.ts +55 -1
- package/src/types/index.ts +5 -0
package/src/types/accounts.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import type { PublicKey } from "@solana/web3.js";
|
|
13
13
|
import type BN from "bn.js";
|
|
14
|
-
import type { ToolHttpMethodKind, ToolCategoryKind, SettlementSecurityKind, DisputeOutcomeKind, BillingIntervalKind } from "./enums";
|
|
14
|
+
import type { ToolHttpMethodKind, ToolCategoryKind, SettlementSecurityKind, DisputeOutcomeKind, BillingIntervalKind, ResolutionLayerKind } from "./enums";
|
|
15
15
|
import type { Capability, PricingTier, PluginRef, VolumeCurveBreakpoint } from "./common";
|
|
16
16
|
|
|
17
17
|
// ═══════════════════════════════════════════════════════════════════
|
|
@@ -652,9 +652,12 @@ export interface EscrowAccountV2Data {
|
|
|
652
652
|
readonly disputeWindowSlots: BN;
|
|
653
653
|
readonly settlementIndex: BN;
|
|
654
654
|
readonly coSigner: PublicKey | null;
|
|
655
|
+
/** @deprecated Since v0.7.0 — arbiter role replaced by automatic receipt verification */
|
|
655
656
|
readonly arbiter: PublicKey | null;
|
|
656
657
|
readonly pendingAmount: BN;
|
|
657
658
|
readonly pendingCalls: BN;
|
|
659
|
+
/** @since v0.7.0 — Number of receipt batches inscribed against this escrow */
|
|
660
|
+
readonly receiptBatchCount: number;
|
|
658
661
|
}
|
|
659
662
|
|
|
660
663
|
// ═══════════════════════════════════════════════════════════════════
|
|
@@ -682,6 +685,8 @@ export interface PendingSettlementData {
|
|
|
682
685
|
readonly isFinalized: boolean;
|
|
683
686
|
readonly isDisputed: boolean;
|
|
684
687
|
readonly outcome: DisputeOutcomeKind;
|
|
688
|
+
/** @since v0.7.0 — Merkle root of receipts backing this settlement */
|
|
689
|
+
readonly receiptMerkleRoot: number[]; // [u8; 32]
|
|
685
690
|
}
|
|
686
691
|
|
|
687
692
|
// ═══════════════════════════════════════════════════════════════════
|
|
@@ -690,7 +695,7 @@ export interface PendingSettlementData {
|
|
|
690
695
|
|
|
691
696
|
/**
|
|
692
697
|
* @interface DisputeRecordData
|
|
693
|
-
* @description On-chain dispute with
|
|
698
|
+
* @description On-chain dispute with automatic receipt-based resolution (v0.7).
|
|
694
699
|
* @category Types
|
|
695
700
|
* @since v0.5.0
|
|
696
701
|
*/
|
|
@@ -702,12 +707,56 @@ export interface DisputeRecordData {
|
|
|
702
707
|
readonly agent: PublicKey;
|
|
703
708
|
readonly evidenceHash: number[]; // [u8; 32]
|
|
704
709
|
readonly agentEvidenceHash: number[]; // [u8; 32]
|
|
710
|
+
/** @deprecated Since v0.7.0 — arbiter role replaced by automatic resolution */
|
|
705
711
|
readonly arbiter: PublicKey;
|
|
706
712
|
readonly outcome: DisputeOutcomeKind;
|
|
707
713
|
readonly createdAt: BN;
|
|
708
714
|
readonly resolvedAt: BN;
|
|
709
715
|
readonly resolutionHash: number[]; // [u8; 32]
|
|
710
716
|
readonly slashAmount: BN;
|
|
717
|
+
/** @since v0.7.0 — Category of dispute (NonDelivery=0, PartialDelivery=1, Overcharge=2, Quality=3) */
|
|
718
|
+
readonly disputeType: number;
|
|
719
|
+
/** @since v0.7.0 — How the dispute was resolved (Pending/Auto/Governance) */
|
|
720
|
+
readonly resolutionLayer: ResolutionLayerKind;
|
|
721
|
+
/** @since v0.7.0 — Bond deposited by the disputer (lamports) */
|
|
722
|
+
readonly disputeBond: BN;
|
|
723
|
+
/** @since v0.7.0 — Number of calls the agent proved via merkle proofs */
|
|
724
|
+
readonly provenCalls: BN;
|
|
725
|
+
/** @since v0.7.0 — Number of calls the agent originally claimed */
|
|
726
|
+
readonly claimedCalls: BN;
|
|
727
|
+
/** @since v0.7.0 — Unix timestamp by which agent must submit proof */
|
|
728
|
+
readonly proofDeadline: BN;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
732
|
+
// Receipt Batch (v0.7)
|
|
733
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* @interface ReceiptBatchData
|
|
737
|
+
* @description Merkle root of a batch of call receipts inscribed by an agent.
|
|
738
|
+
*
|
|
739
|
+
* Seeds: `["sap_receipt", escrow_v2_pda, batch_index_u32_le]`
|
|
740
|
+
*
|
|
741
|
+
* @category Types
|
|
742
|
+
* @since v0.7.0
|
|
743
|
+
*/
|
|
744
|
+
export interface ReceiptBatchData {
|
|
745
|
+
readonly bump: number;
|
|
746
|
+
/** Parent escrow V2 PDA */
|
|
747
|
+
readonly escrow: PublicKey;
|
|
748
|
+
/** Zero-based batch index */
|
|
749
|
+
readonly batchIndex: number;
|
|
750
|
+
/** Merkle root of the receipt batch */
|
|
751
|
+
readonly merkleRoot: number[]; // [u8; 32]
|
|
752
|
+
/** Number of calls in the batch */
|
|
753
|
+
readonly callCount: BN;
|
|
754
|
+
/** Unix timestamp for the start of the period covered */
|
|
755
|
+
readonly periodStart: BN;
|
|
756
|
+
/** Unix timestamp for the end of the period covered */
|
|
757
|
+
readonly periodEnd: BN;
|
|
758
|
+
/** Unix timestamp when the batch was inscribed */
|
|
759
|
+
readonly inscribedAt: BN;
|
|
711
760
|
}
|
|
712
761
|
|
|
713
762
|
// ═══════════════════════════════════════════════════════════════════
|
package/src/types/enums.ts
CHANGED
|
@@ -221,7 +221,7 @@ export type ToolCategoryKind =
|
|
|
221
221
|
* @name SettlementSecurity
|
|
222
222
|
* @description Anchor-compatible enum variants for V2 escrow settlement security levels.
|
|
223
223
|
*
|
|
224
|
-
* - `SelfReport` — Agent settles unilaterally (
|
|
224
|
+
* - `SelfReport` — **DEPRECATED in v0.7** — Agent settles unilaterally (abuse vector).
|
|
225
225
|
* - `CoSigned` — Agent + client must co-sign every settlement.
|
|
226
226
|
* - `DisputeWindow` — Settlement enters pending state, depositor can dispute.
|
|
227
227
|
*
|
|
@@ -229,6 +229,7 @@ export type ToolCategoryKind =
|
|
|
229
229
|
* @since v0.5.0
|
|
230
230
|
*/
|
|
231
231
|
export const SettlementSecurity = {
|
|
232
|
+
/** @deprecated Removed in v0.7 — returns SelfReportDeprecated error */
|
|
232
233
|
SelfReport: { selfReport: {} },
|
|
233
234
|
CoSigned: { coSigned: {} },
|
|
234
235
|
DisputeWindow: { disputeWindow: {} },
|
|
@@ -253,11 +254,64 @@ export const DisputeOutcome = {
|
|
|
253
254
|
AutoReleased: { autoReleased: {} },
|
|
254
255
|
DepositorWins: { depositorWins: {} },
|
|
255
256
|
AgentWins: { agentWins: {} },
|
|
257
|
+
/** @since v0.7.0 — Proportional refund based on proven vs claimed calls */
|
|
258
|
+
PartialRefund: { partialRefund: {} },
|
|
259
|
+
/** @since v0.7.0 — 50/50 split for irresolvable quality disputes */
|
|
260
|
+
Split: { split: {} },
|
|
256
261
|
} as const;
|
|
257
262
|
|
|
258
263
|
export type DisputeOutcomeKind =
|
|
259
264
|
(typeof DisputeOutcome)[keyof typeof DisputeOutcome];
|
|
260
265
|
|
|
266
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
267
|
+
// Dispute Type (v0.7)
|
|
268
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @name DisputeType
|
|
272
|
+
* @description Categories of disputes that can be filed against a pending settlement.
|
|
273
|
+
*
|
|
274
|
+
* - `NonDelivery` — Agent took payment but delivered nothing.
|
|
275
|
+
* - `PartialDelivery` — Agent delivered fewer calls than claimed.
|
|
276
|
+
* - `Overcharge` — Agent charged more than the agreed price.
|
|
277
|
+
* - `Quality` — Agent delivered but output quality is disputed.
|
|
278
|
+
*
|
|
279
|
+
* @category Types
|
|
280
|
+
* @since v0.7.0
|
|
281
|
+
*/
|
|
282
|
+
export const DisputeType = {
|
|
283
|
+
NonDelivery: 0,
|
|
284
|
+
PartialDelivery: 1,
|
|
285
|
+
Overcharge: 2,
|
|
286
|
+
Quality: 3,
|
|
287
|
+
} as const;
|
|
288
|
+
|
|
289
|
+
export type DisputeTypeValue = (typeof DisputeType)[keyof typeof DisputeType];
|
|
290
|
+
|
|
291
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
292
|
+
// Resolution Layer (v0.7)
|
|
293
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @name ResolutionLayer
|
|
297
|
+
* @description How a dispute was resolved.
|
|
298
|
+
*
|
|
299
|
+
* - `Pending` — Not yet resolved.
|
|
300
|
+
* - `Auto` — Resolved automatically via receipt merkle proofs.
|
|
301
|
+
* - `Governance` — Resolved via protocol governance (quality disputes).
|
|
302
|
+
*
|
|
303
|
+
* @category Types
|
|
304
|
+
* @since v0.7.0
|
|
305
|
+
*/
|
|
306
|
+
export const ResolutionLayer = {
|
|
307
|
+
Pending: { pending: {} },
|
|
308
|
+
Auto: { auto: {} },
|
|
309
|
+
Governance: { governance: {} },
|
|
310
|
+
} as const;
|
|
311
|
+
|
|
312
|
+
export type ResolutionLayerKind =
|
|
313
|
+
(typeof ResolutionLayer)[keyof typeof ResolutionLayer];
|
|
314
|
+
|
|
261
315
|
// ═══════════════════════════════════════════════════════════════════
|
|
262
316
|
// Billing Interval (V2.1)
|
|
263
317
|
// ═══════════════════════════════════════════════════════════════════
|
package/src/types/index.ts
CHANGED
|
@@ -30,6 +30,8 @@ export {
|
|
|
30
30
|
SettlementSecurity,
|
|
31
31
|
DisputeOutcome,
|
|
32
32
|
BillingInterval,
|
|
33
|
+
DisputeType,
|
|
34
|
+
ResolutionLayer,
|
|
33
35
|
} from "./enums";
|
|
34
36
|
|
|
35
37
|
export type {
|
|
@@ -41,6 +43,8 @@ export type {
|
|
|
41
43
|
SettlementSecurityKind,
|
|
42
44
|
DisputeOutcomeKind,
|
|
43
45
|
BillingIntervalKind,
|
|
46
|
+
DisputeTypeValue,
|
|
47
|
+
ResolutionLayerKind,
|
|
44
48
|
} from "./enums";
|
|
45
49
|
|
|
46
50
|
// ── Common Structs ───────────────────────────────────
|
|
@@ -74,6 +78,7 @@ export type {
|
|
|
74
78
|
EscrowAccountV2Data,
|
|
75
79
|
PendingSettlementData,
|
|
76
80
|
DisputeRecordData,
|
|
81
|
+
ReceiptBatchData,
|
|
77
82
|
AgentStakeData,
|
|
78
83
|
SubscriptionData,
|
|
79
84
|
CounterShardData,
|