@oobe-protocol-labs/synapse-sap-sdk 0.6.0 → 0.6.3
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/README.md +107 -3
- package/dist/cjs/events/geyser.js +295 -0
- package/dist/cjs/events/geyser.js.map +1 -0
- package/dist/cjs/index.js +14 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/escrow.js +23 -8
- package/dist/cjs/modules/escrow.js.map +1 -1
- package/dist/cjs/plugin/index.js +18 -2
- package/dist/cjs/plugin/index.js.map +1 -1
- package/dist/cjs/plugin/schemas.js +32 -0
- package/dist/cjs/plugin/schemas.js.map +1 -1
- package/dist/cjs/postgres/sync.js +72 -4
- package/dist/cjs/postgres/sync.js.map +1 -1
- package/dist/cjs/registries/index.js.map +1 -1
- package/dist/cjs/registries/x402.js +51 -8
- package/dist/cjs/registries/x402.js.map +1 -1
- package/dist/cjs/utils/index.js +10 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/priority-fee.js +163 -0
- package/dist/cjs/utils/priority-fee.js.map +1 -0
- package/dist/esm/events/geyser.js +258 -0
- package/dist/esm/events/geyser.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/escrow.js +23 -8
- package/dist/esm/modules/escrow.js.map +1 -1
- package/dist/esm/plugin/index.js +18 -2
- package/dist/esm/plugin/index.js.map +1 -1
- package/dist/esm/plugin/schemas.js +32 -0
- package/dist/esm/plugin/schemas.js.map +1 -1
- package/dist/esm/postgres/sync.js +72 -4
- package/dist/esm/postgres/sync.js.map +1 -1
- package/dist/esm/registries/index.js.map +1 -1
- package/dist/esm/registries/x402.js +51 -8
- package/dist/esm/registries/x402.js.map +1 -1
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/priority-fee.js +158 -0
- package/dist/esm/utils/priority-fee.js.map +1 -0
- package/dist/types/events/geyser.d.ts +150 -0
- package/dist/types/events/geyser.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/escrow.d.ts +7 -2
- package/dist/types/modules/escrow.d.ts.map +1 -1
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/schemas.d.ts +6 -0
- package/dist/types/plugin/schemas.d.ts.map +1 -1
- package/dist/types/postgres/sync.d.ts +26 -2
- package/dist/types/postgres/sync.d.ts.map +1 -1
- package/dist/types/registries/index.d.ts +1 -1
- package/dist/types/registries/index.d.ts.map +1 -1
- package/dist/types/registries/x402.d.ts +34 -2
- package/dist/types/registries/x402.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/priority-fee.d.ts +185 -0
- package/dist/types/utils/priority-fee.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/events/geyser.ts +384 -0
- package/src/events/yellowstone.d.ts +7 -0
- package/src/index.ts +19 -0
- package/src/modules/escrow.ts +33 -6
- package/src/plugin/index.ts +20 -0
- package/src/plugin/schemas.ts +32 -0
- package/src/postgres/sync.ts +90 -4
- package/src/registries/index.ts +1 -0
- package/src/registries/x402.ts +63 -6
- package/src/utils/index.ts +15 -0
- package/src/utils/priority-fee.ts +270 -0
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
- [Features](#features)
|
|
14
14
|
- [Installation](#installation)
|
|
15
|
+
- [CLI — `synapse-sap`](#cli--synapse-sap)
|
|
15
16
|
- [Quick Start](#quick-start)
|
|
16
17
|
- [Architecture](#architecture)
|
|
17
18
|
- [Core — Client & Connection](#core--client--connection)
|
|
@@ -67,6 +68,109 @@ npm install @synapse-sap/sdk @coral-xyz/anchor @solana/web3.js
|
|
|
67
68
|
|
|
68
69
|
---
|
|
69
70
|
|
|
71
|
+
## CLI — `synapse-sap`
|
|
72
|
+
|
|
73
|
+
The SDK ships with a full-featured CLI for interacting with the SAP network from
|
|
74
|
+
your terminal.
|
|
75
|
+
|
|
76
|
+
### Install the CLI
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# From the monorepo
|
|
80
|
+
cd synapse-sap-sdk/cli
|
|
81
|
+
npm install
|
|
82
|
+
npm run build
|
|
83
|
+
npm link # makes "synapse-sap" available globally
|
|
84
|
+
|
|
85
|
+
# Or install globally from npm (when published separately)
|
|
86
|
+
npm install -g @oobe-protocol-labs/synapse-sap-cli
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Initial Setup
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Generate a .env from template
|
|
93
|
+
synapse-sap env init --template devnet
|
|
94
|
+
|
|
95
|
+
# Set your RPC (OOBE Protocol recommended)
|
|
96
|
+
# Edit .env or use config:
|
|
97
|
+
synapse-sap config set rpcUrl "https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=sk_example123"
|
|
98
|
+
|
|
99
|
+
# Generate or import a keypair
|
|
100
|
+
synapse-sap env keypair generate --out keys/my-agent.json
|
|
101
|
+
synapse-sap env keypair import ./my-existing-key.json --out keys/agent.json
|
|
102
|
+
|
|
103
|
+
# Verify everything works
|
|
104
|
+
synapse-sap doctor run
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Usage Examples
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# ─── Agent Discovery ──────────────────────────────────
|
|
111
|
+
synapse-sap agent list --active --protocol kamiyo
|
|
112
|
+
synapse-sap agent info <WALLET> --fetch-tools --fetch-endpoints
|
|
113
|
+
synapse-sap agent health <WALLET> --timeout 5000
|
|
114
|
+
synapse-sap discovery scan --limit 50 --sort reputation --output json
|
|
115
|
+
synapse-sap discovery validate --wallet <WALLET>
|
|
116
|
+
|
|
117
|
+
# ─── Escrow & Payments ────────────────────────────────
|
|
118
|
+
synapse-sap escrow open <AGENT_WALLET> \
|
|
119
|
+
--deposit 100000 --max-calls 100 --token sol
|
|
120
|
+
synapse-sap escrow deposit <AGENT_WALLET> --amount 50000
|
|
121
|
+
synapse-sap escrow list
|
|
122
|
+
synapse-sap escrow monitor <AGENT_WALLET>
|
|
123
|
+
|
|
124
|
+
# ─── x402 Calls ──────────────────────────────────────
|
|
125
|
+
synapse-sap x402 headers <AGENT_WALLET> --network solana:mainnet-beta
|
|
126
|
+
synapse-sap x402 call <AGENT_WALLET> swap \
|
|
127
|
+
--args '{"inputMint":"SOL","outputMint":"USDC","amount":1}' \
|
|
128
|
+
--endpoint https://agent.example.com/x402 \
|
|
129
|
+
--save
|
|
130
|
+
synapse-sap x402 settle <CLIENT_WALLET> --calls 5 --service "batch-result"
|
|
131
|
+
|
|
132
|
+
# ─── Tools & Manifests ────────────────────────────────
|
|
133
|
+
synapse-sap tools manifest generate <WALLET> --out manifest.json --include-schema
|
|
134
|
+
synapse-sap tools manifest validate manifest.json
|
|
135
|
+
synapse-sap tools typify manifest.json --out types/agent.ts
|
|
136
|
+
synapse-sap tools compare <WALLET_A> <WALLET_B>
|
|
137
|
+
|
|
138
|
+
# ─── Diagnostics ──────────────────────────────────────
|
|
139
|
+
synapse-sap doctor run --quick
|
|
140
|
+
synapse-sap env check
|
|
141
|
+
synapse-sap config show
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Global Flags
|
|
145
|
+
|
|
146
|
+
| Flag | Description |
|
|
147
|
+
|------|-------------|
|
|
148
|
+
| `--rpc <url>` | Override primary RPC (e.g. `https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=sk_...`) |
|
|
149
|
+
| `--fallback-rpc <url>` | Override fallback RPC |
|
|
150
|
+
| `--cluster <cluster>` | `mainnet-beta` \| `devnet` \| `localnet` |
|
|
151
|
+
| `--json` | JSON output for scripting |
|
|
152
|
+
| `--silent` | Suppress log output |
|
|
153
|
+
| `--env-file <path>` | Custom `.env` file path |
|
|
154
|
+
|
|
155
|
+
### 10 Command Groups
|
|
156
|
+
|
|
157
|
+
| Group | Subcommands | Description |
|
|
158
|
+
|-------|-------------|-------------|
|
|
159
|
+
| `agent` | `list`, `info`, `tools`, `health`, `register` | Agent lifecycle |
|
|
160
|
+
| `discovery` | `scan`, `validate`, `cache` | Network scanning |
|
|
161
|
+
| `escrow` | `open`, `deposit`, `withdraw`, `close`, `dump`, `list`, `monitor` | Escrow management |
|
|
162
|
+
| `x402` | `headers`, `call`, `sign`, `verify`, `settle`, `replay` | Payment flows |
|
|
163
|
+
| `tools` | `manifest generate/validate`, `typify`, `publish`, `compare`, `doc` | Manifest & schema |
|
|
164
|
+
| `env` | `init`, `check`, `keypair show/generate/import` | Environment setup |
|
|
165
|
+
| `config` | `show`, `set`, `edit`, `reset`, `path` | Configuration |
|
|
166
|
+
| `doctor` | `run` | 8 diagnostic checks |
|
|
167
|
+
| `tmp` | `list`, `cat`, `diff`, `clean`, `archive` | Artifact management |
|
|
168
|
+
| `plugin` | `list`, `install`, `create`, `validate` | Plugin system |
|
|
169
|
+
|
|
170
|
+
> Full CLI reference: [`cli/README.md`](cli/README.md)
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
70
174
|
## Quick Start
|
|
71
175
|
|
|
72
176
|
### Option A — Anchor Provider (classic)
|
|
@@ -98,14 +202,14 @@ console.log(agent.name, agent.isActive);
|
|
|
98
202
|
import { SapConnection } from "@synapse-sap/sdk";
|
|
99
203
|
import { Keypair } from "@solana/web3.js";
|
|
100
204
|
|
|
101
|
-
// One-liner:
|
|
205
|
+
// One-liner (OOBE Protocol RPC):
|
|
102
206
|
const { client } = SapConnection.fromKeypair(
|
|
103
|
-
"https://
|
|
207
|
+
"https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=sk_example123",
|
|
104
208
|
Keypair.generate(),
|
|
105
209
|
);
|
|
106
210
|
|
|
107
211
|
// Or step-by-step:
|
|
108
|
-
const conn = SapConnection.
|
|
212
|
+
const conn = SapConnection.mainnet("https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=sk_example123");
|
|
109
213
|
const client = conn.fromKeypair(myKeypair);
|
|
110
214
|
|
|
111
215
|
// Use exactly the same API:
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module events/geyser
|
|
4
|
+
* @description Yellowstone gRPC (Geyser) event stream for SAP v2.
|
|
5
|
+
*
|
|
6
|
+
* Drop-in alternative to the WebSocket `connection.onLogs()` pipeline.
|
|
7
|
+
* Uses Triton / Helius / any Yellowstone-compatible gRPC endpoint to
|
|
8
|
+
* receive program transaction updates with sub-second latency and
|
|
9
|
+
* automatic reconnection.
|
|
10
|
+
*
|
|
11
|
+
* @category Events
|
|
12
|
+
* @since v0.6.3
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { GeyserEventStream } from "@oobe-protocol-labs/synapse-sap-sdk";
|
|
17
|
+
* import { EventParser } from "@oobe-protocol-labs/synapse-sap-sdk";
|
|
18
|
+
*
|
|
19
|
+
* const stream = new GeyserEventStream({
|
|
20
|
+
* endpoint: "https://grpc.triton.one",
|
|
21
|
+
* token: process.env.GEYSER_TOKEN!,
|
|
22
|
+
* programId: "SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ",
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const parser = new EventParser(program);
|
|
26
|
+
*
|
|
27
|
+
* stream.on("logs", (logs, signature, slot) => {
|
|
28
|
+
* const events = parser.parseLogs(logs);
|
|
29
|
+
* for (const event of events) {
|
|
30
|
+
* console.log(event.name, event.data);
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* stream.on("error", (err) => console.error("gRPC error:", err));
|
|
35
|
+
*
|
|
36
|
+
* await stream.connect();
|
|
37
|
+
* // ... later
|
|
38
|
+
* await stream.disconnect();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
42
|
+
if (k2 === undefined) k2 = k;
|
|
43
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
44
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
45
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
46
|
+
}
|
|
47
|
+
Object.defineProperty(o, k2, desc);
|
|
48
|
+
}) : (function(o, m, k, k2) {
|
|
49
|
+
if (k2 === undefined) k2 = k;
|
|
50
|
+
o[k2] = m[k];
|
|
51
|
+
}));
|
|
52
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
53
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
54
|
+
}) : function(o, v) {
|
|
55
|
+
o["default"] = v;
|
|
56
|
+
});
|
|
57
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
58
|
+
var ownKeys = function(o) {
|
|
59
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
60
|
+
var ar = [];
|
|
61
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
62
|
+
return ar;
|
|
63
|
+
};
|
|
64
|
+
return ownKeys(o);
|
|
65
|
+
};
|
|
66
|
+
return function (mod) {
|
|
67
|
+
if (mod && mod.__esModule) return mod;
|
|
68
|
+
var result = {};
|
|
69
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
70
|
+
__setModuleDefault(result, mod);
|
|
71
|
+
return result;
|
|
72
|
+
};
|
|
73
|
+
})();
|
|
74
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
+
exports.GeyserEventStream = void 0;
|
|
76
|
+
const events_1 = require("events");
|
|
77
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
78
|
+
// Constants
|
|
79
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
80
|
+
const SAP_PROGRAM_ID = "SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ";
|
|
81
|
+
const COMMITMENT_MAP = {
|
|
82
|
+
processed: 0,
|
|
83
|
+
confirmed: 1,
|
|
84
|
+
finalized: 2,
|
|
85
|
+
};
|
|
86
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
87
|
+
// GeyserEventStream
|
|
88
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
89
|
+
/**
|
|
90
|
+
* Yellowstone gRPC event stream for SAP v2 programs.
|
|
91
|
+
*
|
|
92
|
+
* Wraps `@triton-one/yellowstone-grpc` and emits parsed log lines
|
|
93
|
+
* compatible with the existing {@link EventParser}.
|
|
94
|
+
*
|
|
95
|
+
* @name GeyserEventStream
|
|
96
|
+
* @category Events
|
|
97
|
+
* @since v0.6.3
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const stream = new GeyserEventStream({
|
|
102
|
+
* endpoint: "https://grpc.triton.one",
|
|
103
|
+
* token: process.env.GEYSER_TOKEN!,
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* stream.on("logs", (logs, sig, slot) => {
|
|
107
|
+
* const events = parser.parseLogs(logs);
|
|
108
|
+
* events.forEach(e => db.insertEvent(e));
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* await stream.connect();
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
class GeyserEventStream extends events_1.EventEmitter {
|
|
115
|
+
config;
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
client = null;
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
stream = null;
|
|
120
|
+
reconnectAttempts = 0;
|
|
121
|
+
_connected = false;
|
|
122
|
+
_stopped = false;
|
|
123
|
+
constructor(config) {
|
|
124
|
+
super();
|
|
125
|
+
this.config = {
|
|
126
|
+
endpoint: config.endpoint,
|
|
127
|
+
token: config.token,
|
|
128
|
+
programId: config.programId ?? SAP_PROGRAM_ID,
|
|
129
|
+
commitment: config.commitment ?? "confirmed",
|
|
130
|
+
autoReconnect: config.autoReconnect ?? true,
|
|
131
|
+
reconnectDelayMs: config.reconnectDelayMs ?? 3_000,
|
|
132
|
+
maxReconnectAttempts: config.maxReconnectAttempts ?? 0,
|
|
133
|
+
includeFailedTxs: config.includeFailedTxs ?? false,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/** Whether the gRPC stream is currently connected. */
|
|
137
|
+
get connected() {
|
|
138
|
+
return this._connected;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Connect to the Yellowstone gRPC endpoint and start streaming.
|
|
142
|
+
*
|
|
143
|
+
* @throws If `@triton-one/yellowstone-grpc` is not installed.
|
|
144
|
+
*/
|
|
145
|
+
async connect() {
|
|
146
|
+
this._stopped = false;
|
|
147
|
+
this.reconnectAttempts = 0;
|
|
148
|
+
// Dynamic import — yellowstone is an optional peer dependency
|
|
149
|
+
let YellowstoneClient;
|
|
150
|
+
try {
|
|
151
|
+
const mod = await Promise.resolve().then(() => __importStar(require("@triton-one/yellowstone-grpc")));
|
|
152
|
+
YellowstoneClient = mod.default ?? mod.Client;
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
throw new Error("Missing dependency: @triton-one/yellowstone-grpc\n" +
|
|
156
|
+
"Install it with: npm i @triton-one/yellowstone-grpc");
|
|
157
|
+
}
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
this.client = new YellowstoneClient(this.config.endpoint, this.config.token, undefined);
|
|
160
|
+
await this.subscribe();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Disconnect from the gRPC stream and stop reconnection.
|
|
164
|
+
*/
|
|
165
|
+
async disconnect() {
|
|
166
|
+
this._stopped = true;
|
|
167
|
+
this._connected = false;
|
|
168
|
+
if (this.stream) {
|
|
169
|
+
try {
|
|
170
|
+
this.stream.cancel?.();
|
|
171
|
+
this.stream = null;
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// ignore cancel errors
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
this.emit("disconnected", "manual");
|
|
178
|
+
}
|
|
179
|
+
// ─── Internal ──────────────────────────────────────
|
|
180
|
+
async subscribe() {
|
|
181
|
+
if (!this.client || this._stopped)
|
|
182
|
+
return;
|
|
183
|
+
try {
|
|
184
|
+
this.stream = await this.client.subscribe();
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
188
|
+
await this.maybeReconnect();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
// Build the subscription request
|
|
192
|
+
const request = {
|
|
193
|
+
accounts: {},
|
|
194
|
+
slots: {},
|
|
195
|
+
transactions: {
|
|
196
|
+
sap: {
|
|
197
|
+
vote: false,
|
|
198
|
+
failed: this.config.includeFailedTxs,
|
|
199
|
+
signature: undefined,
|
|
200
|
+
accountInclude: [this.config.programId],
|
|
201
|
+
accountExclude: [],
|
|
202
|
+
accountRequired: [],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
transactionsStatus: {},
|
|
206
|
+
blocks: {},
|
|
207
|
+
blocksMeta: {},
|
|
208
|
+
entry: {},
|
|
209
|
+
commitment: COMMITMENT_MAP[this.config.commitment] ?? 1,
|
|
210
|
+
accountsDataSlice: [],
|
|
211
|
+
ping: { id: 1 },
|
|
212
|
+
};
|
|
213
|
+
// Send subscription
|
|
214
|
+
try {
|
|
215
|
+
await new Promise((resolve, reject) => {
|
|
216
|
+
this.stream.write(request, (err) => {
|
|
217
|
+
if (err)
|
|
218
|
+
reject(err);
|
|
219
|
+
else
|
|
220
|
+
resolve();
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
226
|
+
await this.maybeReconnect();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
this._connected = true;
|
|
230
|
+
this.reconnectAttempts = 0;
|
|
231
|
+
this.emit("connected");
|
|
232
|
+
// Listen for data
|
|
233
|
+
this.stream.on("data", (data) => {
|
|
234
|
+
try {
|
|
235
|
+
this.handleMessage(data);
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
this.stream.on("error", (err) => {
|
|
242
|
+
this.emit("error", err);
|
|
243
|
+
});
|
|
244
|
+
this.stream.on("end", () => {
|
|
245
|
+
this._connected = false;
|
|
246
|
+
this.emit("disconnected", "stream-end");
|
|
247
|
+
this.maybeReconnect();
|
|
248
|
+
});
|
|
249
|
+
this.stream.on("close", () => {
|
|
250
|
+
this._connected = false;
|
|
251
|
+
this.emit("disconnected", "stream-close");
|
|
252
|
+
this.maybeReconnect();
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
handleMessage(data) {
|
|
256
|
+
// Respond to pings to keep the stream alive
|
|
257
|
+
if (data.ping) {
|
|
258
|
+
this.stream?.write({ ping: { id: data.ping.id } }, () => { });
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
// Extract transaction data
|
|
262
|
+
const tx = data.transaction;
|
|
263
|
+
if (!tx?.transaction?.transaction)
|
|
264
|
+
return;
|
|
265
|
+
const meta = tx.transaction.meta;
|
|
266
|
+
if (!meta)
|
|
267
|
+
return;
|
|
268
|
+
// Extract log messages from the transaction meta
|
|
269
|
+
const logs = meta.logMessages ?? [];
|
|
270
|
+
if (logs.length === 0)
|
|
271
|
+
return;
|
|
272
|
+
const signature = tx.transaction.signature
|
|
273
|
+
? Buffer.from(tx.transaction.signature).toString("base64")
|
|
274
|
+
: "unknown";
|
|
275
|
+
const slot = Number(tx.slot ?? 0);
|
|
276
|
+
this.emit("logs", logs, signature, slot);
|
|
277
|
+
}
|
|
278
|
+
async maybeReconnect() {
|
|
279
|
+
if (this._stopped || !this.config.autoReconnect)
|
|
280
|
+
return;
|
|
281
|
+
const max = this.config.maxReconnectAttempts;
|
|
282
|
+
if (max > 0 && this.reconnectAttempts >= max) {
|
|
283
|
+
this.emit("error", new Error(`Max reconnect attempts (${max}) exceeded`));
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
this.reconnectAttempts++;
|
|
287
|
+
this.emit("reconnecting", this.reconnectAttempts);
|
|
288
|
+
await new Promise((r) => setTimeout(r, this.config.reconnectDelayMs));
|
|
289
|
+
if (!this._stopped) {
|
|
290
|
+
await this.subscribe();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
exports.GeyserEventStream = GeyserEventStream;
|
|
295
|
+
//# sourceMappingURL=geyser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geyser.js","sourceRoot":"","sources":["../../../src/events/geyser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mCAAsC;AA+EtC,sEAAsE;AACtE,aAAa;AACb,sEAAsE;AAEtE,MAAM,cAAc,GAAG,6CAA6C,CAAC;AAErE,MAAM,cAAc,GAA2B;IAC7C,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;CACb,CAAC;AAEF,sEAAsE;AACtE,qBAAqB;AACrB,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,iBAAkB,SAAQ,qBAAY;IAChC,MAAM,CAAyB;IAChD,8DAA8D;IACtD,MAAM,GAAQ,IAAI,CAAC;IAC3B,8DAA8D;IACtD,MAAM,GAAQ,IAAI,CAAC;IACnB,iBAAiB,GAAG,CAAC,CAAC;IACtB,UAAU,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AI,CAAC,SAAS,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AA/MD,8CA+MC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
*/
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.isNetworkEquivalent = exports.normalizeNetworkId = exports.serializeValue = exports.serializeAccount = exports.assert = exports.hashToArray = exports.sha256 = exports.deriveLedgerPage = exports.deriveLedger = exports.deriveAttestation = exports.deriveEscrow = exports.deriveTool = exports.deriveCheckpoint = exports.deriveVaultDelegate = exports.deriveEpochPage = exports.deriveSession = exports.deriveVault = exports.deriveToolCategoryIndex = exports.deriveProtocolIndex = exports.deriveCapabilityIndex = exports.deriveFeedback = exports.deriveAgentStats = exports.deriveAgent = exports.deriveGlobalRegistry = exports.IDL_METADATA = exports.IDL_PROGRAM_ADDRESS = exports.SAP_IDL = exports.SapNetwork = exports.HTTP_METHOD_VALUES = exports.TOOL_CATEGORY_VALUES = exports.VAULT_PROTOCOL_VERSION = exports.AGENT_VERSION = exports.LIMITS = exports.SEEDS = exports.LOCALNET_SAP_PROGRAM_ID = exports.DEVNET_SAP_PROGRAM_ID = exports.MAINNET_SAP_PROGRAM_ID = exports.SAP_PROGRAM_ID = exports.SAP_PROGRAM_ADDRESS = exports.CompressionType = exports.SchemaType = exports.DelegatePermission = exports.ToolCategory = exports.ToolHttpMethod = exports.SettlementMode = exports.PluginType = exports.TokenType = exports.KeypairWallet = exports.SapConnection = exports.SapClient = void 0;
|
|
49
|
-
exports.
|
|
50
|
-
exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = exports.TransactionParser = exports.extractAccountKeys = exports.filterSapInnerInstructions = exports.decodeInnerInstructions = exports.parseSapTransactionBatch = exports.parseSapTransactionComplete = void 0;
|
|
49
|
+
exports.SAP_PROTOCOLS = exports.SAPPlugin = exports.createSAPPlugin = exports.BaseModule = exports.LedgerModule = exports.AttestationModule = exports.EscrowModule = exports.VaultModule = exports.ToolsModule = exports.IndexingModule = exports.FeedbackModule = exports.AgentModule = exports.GeyserEventStream = exports.SAP_EVENT_NAMES = exports.EventParser = exports.SapPermissionError = exports.SapTimeoutError = exports.SapAccountNotFoundError = exports.SapRpcError = exports.SapValidationError = exports.SapError = exports.DEFAULT_BATCH_SETTLE_COMPUTE_UNITS = exports.DEFAULT_SETTLE_COMPUTE_UNITS = exports.DEFAULT_SETTLE_PRIORITY_FEE = exports.FAST_BATCH_SETTLE_OPTIONS = exports.FAST_SETTLE_OPTIONS = exports.buildRpcOptions = exports.buildPriorityFeeIxs = exports.validateOrThrow = exports.createCallArgsSchema = exports.createRegisterAgentSchema = exports.createPreparePaymentSchema = exports.createAgentManifestSchema = exports.createToolManifestEntrySchema = exports.createHealthCheckSchema = exports.createEndpointDescriptorSchema = exports.createEnvSchema = exports.extractAnchorErrorCode = exports.classifyAnchorError = exports.findATA = exports.createDualConnection = exports.getFallbackRpcUrl = exports.getRpcUrl = exports.validateAgentEndpoints = exports.validateHealthCheck = exports.validateEndpointDescriptor = exports.validateEndpoint = exports.isKnownNetwork = exports.getNetworkClusterName = exports.getNetworkGenesisHash = void 0;
|
|
50
|
+
exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = exports.TransactionParser = exports.extractAccountKeys = exports.filterSapInnerInstructions = exports.decodeInnerInstructions = exports.parseSapTransactionBatch = exports.parseSapTransactionComplete = exports.containsSapInstruction = exports.parseSapInstructionNamesFromList = exports.parseSapInstructionsFromList = exports.parseSapInstructionNamesFromTransaction = exports.parseSapInstructionsFromTransaction = exports.SAP_TABLE_MAP = exports.SapSyncEngine = exports.SapPostgres = void 0;
|
|
51
51
|
// ── Core ─────────────────────────────────────────────
|
|
52
52
|
var core_1 = require("./core");
|
|
53
53
|
Object.defineProperty(exports, "SapClient", { enumerable: true, get: function () { return core_1.SapClient; } });
|
|
@@ -140,6 +140,15 @@ Object.defineProperty(exports, "createPreparePaymentSchema", { enumerable: true,
|
|
|
140
140
|
Object.defineProperty(exports, "createRegisterAgentSchema", { enumerable: true, get: function () { return utils_6.createRegisterAgentSchema; } });
|
|
141
141
|
Object.defineProperty(exports, "createCallArgsSchema", { enumerable: true, get: function () { return utils_6.createCallArgsSchema; } });
|
|
142
142
|
Object.defineProperty(exports, "validateOrThrow", { enumerable: true, get: function () { return utils_6.validateOrThrow; } });
|
|
143
|
+
// v0.6.2 — Priority fee & settle options
|
|
144
|
+
var utils_7 = require("./utils");
|
|
145
|
+
Object.defineProperty(exports, "buildPriorityFeeIxs", { enumerable: true, get: function () { return utils_7.buildPriorityFeeIxs; } });
|
|
146
|
+
Object.defineProperty(exports, "buildRpcOptions", { enumerable: true, get: function () { return utils_7.buildRpcOptions; } });
|
|
147
|
+
Object.defineProperty(exports, "FAST_SETTLE_OPTIONS", { enumerable: true, get: function () { return utils_7.FAST_SETTLE_OPTIONS; } });
|
|
148
|
+
Object.defineProperty(exports, "FAST_BATCH_SETTLE_OPTIONS", { enumerable: true, get: function () { return utils_7.FAST_BATCH_SETTLE_OPTIONS; } });
|
|
149
|
+
Object.defineProperty(exports, "DEFAULT_SETTLE_PRIORITY_FEE", { enumerable: true, get: function () { return utils_7.DEFAULT_SETTLE_PRIORITY_FEE; } });
|
|
150
|
+
Object.defineProperty(exports, "DEFAULT_SETTLE_COMPUTE_UNITS", { enumerable: true, get: function () { return utils_7.DEFAULT_SETTLE_COMPUTE_UNITS; } });
|
|
151
|
+
Object.defineProperty(exports, "DEFAULT_BATCH_SETTLE_COMPUTE_UNITS", { enumerable: true, get: function () { return utils_7.DEFAULT_BATCH_SETTLE_COMPUTE_UNITS; } });
|
|
143
152
|
// ── Errors ───────────────────────────────────────────
|
|
144
153
|
var errors_1 = require("./errors");
|
|
145
154
|
Object.defineProperty(exports, "SapError", { enumerable: true, get: function () { return errors_1.SapError; } });
|
|
@@ -152,6 +161,9 @@ Object.defineProperty(exports, "SapPermissionError", { enumerable: true, get: fu
|
|
|
152
161
|
var events_1 = require("./events");
|
|
153
162
|
Object.defineProperty(exports, "EventParser", { enumerable: true, get: function () { return events_1.EventParser; } });
|
|
154
163
|
Object.defineProperty(exports, "SAP_EVENT_NAMES", { enumerable: true, get: function () { return events_1.SAP_EVENT_NAMES; } });
|
|
164
|
+
// ── Geyser (Yellowstone gRPC) ────────────────────────
|
|
165
|
+
var geyser_1 = require("./events/geyser");
|
|
166
|
+
Object.defineProperty(exports, "GeyserEventStream", { enumerable: true, get: function () { return geyser_1.GeyserEventStream; } });
|
|
155
167
|
// ── Modules (for advanced usage / tree-shaking) ──────
|
|
156
168
|
var index_2 = require("./modules/index");
|
|
157
169
|
Object.defineProperty(exports, "AgentModule", { enumerable: true, get: function () { return index_2.AgentModule; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;;;;AAEH,wDAAwD;AACxD,+BAAiE;AAAxD,iGAAA,SAAS,OAAA;AAAE,qGAAA,aAAa,OAAA;AAAE,qGAAA,aAAa,OAAA;AA0DhD,iCASiB;AARf,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,2GAAA,kBAAkB,OAAA;AAClB,mGAAA,UAAU,OAAA;AACV,wGAAA,eAAe,OAAA;AAGjB,wDAAwD;AACxD,yCAaqB;AAZnB,gHAAA,mBAAmB,OAAA;AACnB,2GAAA,cAAc,OAAA;AACd,mHAAA,sBAAsB,OAAA;AACtB,kHAAA,qBAAqB,OAAA;AACrB,oHAAA,uBAAuB,OAAA;AACvB,kGAAA,KAAK,OAAA;AACL,mGAAA,MAAM,OAAA;AACN,0GAAA,aAAa,OAAA;AACb,mHAAA,sBAA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uGAAA,WAAW,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAelD,0DAA0D;AAC1D,mCAYkB;AAXhB,6HAAA,mCAAmC,OAAA;AACnC,iIAAA,uCAAuC,OAAA;AACvC,sHAAA,4BAA4B,OAAA;AAC5B,0HAAA,gCAAgC,OAAA;AAChC,gHAAA,sBAAsB,OAAA;AACtB,qHAAA,2BAA2B,OAAA;AAC3B,kHAAA,wBAAwB,OAAA;AACxB,iHAAA,uBAAuB,OAAA;AACvB,oHAAA,0BAA0B,OAAA;AAC1B,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AAYnB,yDAAyD;AACzD,4CAK4B;AAJ1B,0GAAA,iBAAiB,OAAA;AACjB,qGAAA,YAAY,OAAA;AACZ,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA"}
|
|
@@ -16,6 +16,7 @@ exports.EscrowModule = void 0;
|
|
|
16
16
|
const web3_js_1 = require("@solana/web3.js");
|
|
17
17
|
const base_1 = require("./base");
|
|
18
18
|
const pda_1 = require("../pda");
|
|
19
|
+
const priority_fee_1 = require("../utils/priority-fee");
|
|
19
20
|
/**
|
|
20
21
|
* @name EscrowModule
|
|
21
22
|
* @description Manages x402-compatible escrow accounts for agent micropayments.
|
|
@@ -117,14 +118,18 @@ class EscrowModule extends base_1.BaseModule {
|
|
|
117
118
|
* @param callsToSettle - Number of calls to settle payment for.
|
|
118
119
|
* @param serviceHash - A 32-byte SHA-256 hash identifying the service rendered.
|
|
119
120
|
* @param splAccounts - Remaining accounts for SPL token transfers. Defaults to `[]`.
|
|
121
|
+
* @param opts - Optional {@link SettleOptions} for priority fees and RPC tuning.
|
|
120
122
|
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
121
123
|
* @since v0.1.0
|
|
124
|
+
* @updated v0.6.2 — Added optional `opts` parameter for priority fees.
|
|
122
125
|
*/
|
|
123
|
-
async settle(depositorWallet, callsToSettle, serviceHash, splAccounts = []) {
|
|
126
|
+
async settle(depositorWallet, callsToSettle, serviceHash, splAccounts = [], opts) {
|
|
124
127
|
const [agentPda] = (0, pda_1.deriveAgent)(this.walletPubkey);
|
|
125
128
|
const [escrowPda] = (0, pda_1.deriveEscrow)(agentPda, depositorWallet);
|
|
126
129
|
const [statsPda] = (0, pda_1.deriveAgentStats)(agentPda);
|
|
127
|
-
|
|
130
|
+
const preIxs = (0, priority_fee_1.buildPriorityFeeIxs)(opts);
|
|
131
|
+
const rpcOpts = (0, priority_fee_1.buildRpcOptions)(opts);
|
|
132
|
+
let builder = this.methods
|
|
128
133
|
.settleCalls(this.bn(callsToSettle), serviceHash)
|
|
129
134
|
.accounts({
|
|
130
135
|
wallet: this.walletPubkey,
|
|
@@ -133,8 +138,11 @@ class EscrowModule extends base_1.BaseModule {
|
|
|
133
138
|
escrow: escrowPda,
|
|
134
139
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
135
140
|
})
|
|
136
|
-
.remainingAccounts(splAccounts)
|
|
137
|
-
|
|
141
|
+
.remainingAccounts(splAccounts);
|
|
142
|
+
if (preIxs.length > 0) {
|
|
143
|
+
builder = builder.preInstructions(preIxs);
|
|
144
|
+
}
|
|
145
|
+
return builder.rpc(rpcOpts);
|
|
138
146
|
}
|
|
139
147
|
/**
|
|
140
148
|
* @name withdraw
|
|
@@ -183,14 +191,18 @@ class EscrowModule extends base_1.BaseModule {
|
|
|
183
191
|
* @param depositorWallet - The wallet of the client who funded the escrow.
|
|
184
192
|
* @param settlements - Array of settlement entries (up to 10).
|
|
185
193
|
* @param splAccounts - Remaining accounts for SPL token transfers. Defaults to `[]`.
|
|
194
|
+
* @param opts - Optional {@link SettleOptions} for priority fees and RPC tuning.
|
|
186
195
|
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
187
196
|
* @since v0.1.0
|
|
197
|
+
* @updated v0.6.2 — Added optional `opts` parameter for priority fees.
|
|
188
198
|
*/
|
|
189
|
-
async settleBatch(depositorWallet, settlements, splAccounts = []) {
|
|
199
|
+
async settleBatch(depositorWallet, settlements, splAccounts = [], opts) {
|
|
190
200
|
const [agentPda] = (0, pda_1.deriveAgent)(this.walletPubkey);
|
|
191
201
|
const [escrowPda] = (0, pda_1.deriveEscrow)(agentPda, depositorWallet);
|
|
192
202
|
const [statsPda] = (0, pda_1.deriveAgentStats)(agentPda);
|
|
193
|
-
|
|
203
|
+
const preIxs = (0, priority_fee_1.buildPriorityFeeIxs)(opts);
|
|
204
|
+
const rpcOpts = (0, priority_fee_1.buildRpcOptions)(opts);
|
|
205
|
+
let builder = this.methods
|
|
194
206
|
.settleBatch(settlements)
|
|
195
207
|
.accounts({
|
|
196
208
|
wallet: this.walletPubkey,
|
|
@@ -199,8 +211,11 @@ class EscrowModule extends base_1.BaseModule {
|
|
|
199
211
|
escrow: escrowPda,
|
|
200
212
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
201
213
|
})
|
|
202
|
-
.remainingAccounts(splAccounts)
|
|
203
|
-
|
|
214
|
+
.remainingAccounts(splAccounts);
|
|
215
|
+
if (preIxs.length > 0) {
|
|
216
|
+
builder = builder.preInstructions(preIxs);
|
|
217
|
+
}
|
|
218
|
+
return builder.rpc(rpcOpts);
|
|
204
219
|
}
|
|
205
220
|
// ── Fetchers ─────────────────────────────────────────
|
|
206
221
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.js","sourceRoot":"","sources":["../../../src/modules/escrow.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,6CAKyB;AAEzB,iCAAoC;AACpC,gCAIgB;
|
|
1
|
+
{"version":3,"file":"escrow.js","sourceRoot":"","sources":["../../../src/modules/escrow.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,6CAKyB;AAEzB,iCAAoC;AACpC,gCAIgB;AAMhB,wDAG+B;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,YAAa,SAAQ,iBAAU;I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KAAK,CAAC,UAAU,CAAC,SAAoB;QACnC,OAAO,IAAI,CAAC,YAAY,CAAoB,eAAe,EAAE,SAAS,CAAC,CAAC;IAC1E,CAAC;CACF;AAhRD,oCAgRC"}
|
package/dist/cjs/plugin/index.js
CHANGED
|
@@ -567,7 +567,15 @@ async function executeEscrow(client, name, input) {
|
|
|
567
567
|
return { txSignature: tx };
|
|
568
568
|
}
|
|
569
569
|
case "settleEscrow": {
|
|
570
|
-
|
|
570
|
+
// Build settle options from optional priority fee fields
|
|
571
|
+
const settleOpts = (input.priorityFeeMicroLamports || input.computeUnits || input.skipPreflight)
|
|
572
|
+
? {
|
|
573
|
+
priorityFeeMicroLamports: input.priorityFeeMicroLamports ?? undefined,
|
|
574
|
+
computeUnits: input.computeUnits ?? undefined,
|
|
575
|
+
skipPreflight: input.skipPreflight ?? undefined,
|
|
576
|
+
}
|
|
577
|
+
: undefined;
|
|
578
|
+
const tx = await client.escrow.settle(new web3_js_1.PublicKey(input.depositorWallet), new bn_js_1.default(input.callsToSettle), input.serviceHash, [], settleOpts);
|
|
571
579
|
return { txSignature: tx };
|
|
572
580
|
}
|
|
573
581
|
case "withdrawEscrow": {
|
|
@@ -581,7 +589,15 @@ async function executeEscrow(client, name, input) {
|
|
|
581
589
|
callsToSettle: new bn_js_1.default(s.callsToSettle),
|
|
582
590
|
serviceHash: s.serviceHash,
|
|
583
591
|
}));
|
|
584
|
-
|
|
592
|
+
// Build settle options from optional priority fee fields
|
|
593
|
+
const batchOpts = (input.priorityFeeMicroLamports || input.computeUnits || input.skipPreflight)
|
|
594
|
+
? {
|
|
595
|
+
priorityFeeMicroLamports: input.priorityFeeMicroLamports ?? undefined,
|
|
596
|
+
computeUnits: input.computeUnits ?? undefined,
|
|
597
|
+
skipPreflight: input.skipPreflight ?? undefined,
|
|
598
|
+
}
|
|
599
|
+
: undefined;
|
|
600
|
+
const tx = await client.escrow.settleBatch(new web3_js_1.PublicKey(input.depositorWallet), settlements, [], batchOpts);
|
|
585
601
|
return { txSignature: tx };
|
|
586
602
|
}
|
|
587
603
|
case "fetchEscrow": {
|