@telaro/sacp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INTEGRATION.md +238 -0
- package/README.md +253 -0
- package/dist/codec.d.ts +35 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +63 -0
- package/dist/codec.js.map +1 -0
- package/dist/constants.d.ts +50 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +50 -0
- package/dist/constants.js.map +1 -0
- package/dist/dispatcher.d.ts +87 -0
- package/dist/dispatcher.d.ts.map +1 -0
- package/dist/dispatcher.js +175 -0
- package/dist/dispatcher.js.map +1 -0
- package/dist/events.d.ts +93 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +142 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/job.d.ts +99 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +297 -0
- package/dist/job.js.map +1 -0
- package/dist/lst.d.ts +52 -0
- package/dist/lst.d.ts.map +1 -0
- package/dist/lst.js +58 -0
- package/dist/lst.js.map +1 -0
- package/dist/negotiation.d.ts +66 -0
- package/dist/negotiation.d.ts.map +1 -0
- package/dist/negotiation.js +184 -0
- package/dist/negotiation.js.map +1 -0
- package/dist/offering.d.ts +65 -0
- package/dist/offering.d.ts.map +1 -0
- package/dist/offering.js +190 -0
- package/dist/offering.js.map +1 -0
- package/dist/pdas.d.ts +44 -0
- package/dist/pdas.d.ts.map +1 -0
- package/dist/pdas.js +95 -0
- package/dist/pdas.js.map +1 -0
- package/dist/runtime.d.ts +244 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +481 -0
- package/dist/runtime.js.map +1 -0
- package/dist/signer.d.ts +107 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +94 -0
- package/dist/signer.js.map +1 -0
- package/dist/take_rate.d.ts +44 -0
- package/dist/take_rate.d.ts.map +1 -0
- package/dist/take_rate.js +141 -0
- package/dist/take_rate.js.map +1 -0
- package/dist/timeout.d.ts +35 -0
- package/dist/timeout.d.ts.map +1 -0
- package/dist/timeout.js +113 -0
- package/dist/timeout.js.map +1 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +133 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +315 -0
- package/dist/validation.js.map +1 -0
- package/dist/watcher.d.ts +67 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +176 -0
- package/dist/watcher.js.map +1 -0
- package/dist/wormhole.d.ts +88 -0
- package/dist/wormhole.d.ts.map +1 -0
- package/dist/wormhole.js +152 -0
- package/dist/wormhole.js.map +1 -0
- package/package.json +138 -0
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { PublicKey, } from "@solana/web3.js";
|
|
2
|
+
import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, } from "@solana/spl-token";
|
|
3
|
+
import { buildCreateJobIx, buildFundJobIx, buildSubmitWorkIx, buildAcceptWorkIx, buildDisputeWorkIx, buildSubmitVerdictIx, buildRecordVerdictIx, buildReclaimEscrowIx, fetchJob, fetchVerdict, } from "./job.js";
|
|
4
|
+
import { buildRegisterOfferingIx, buildUpdateOfferingIx, buildCloseOfferingIx, fetchOffering, listOfferings, } from "./offering.js";
|
|
5
|
+
import { buildProposeTermsIx, buildCounterTermsIx, buildAcceptTermsIx, buildCancelNegotiationIx, buildMaterializeJobIx, fetchNegotiation, } from "./negotiation.js";
|
|
6
|
+
import { findSacpConfigPda } from "./pdas.js";
|
|
7
|
+
import { fetchSacpConfig, } from "./take_rate.js";
|
|
8
|
+
/**
|
|
9
|
+
* Top-level entry point. One instance per RPC connection; spin up new
|
|
10
|
+
* `JobSession`s for each Job you create or attach to.
|
|
11
|
+
*/
|
|
12
|
+
export class SacpClient {
|
|
13
|
+
connection;
|
|
14
|
+
payer;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.connection = config.connection;
|
|
17
|
+
this.payer = config.payer;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a new Job and return a session you can drive through its
|
|
21
|
+
* lifecycle. Combines `create_job` + the first `fund_job` into the
|
|
22
|
+
* caller's hands — the session begins in the `Open` state, and the
|
|
23
|
+
* client funds it via `session.fund()`.
|
|
24
|
+
*/
|
|
25
|
+
async createJob(params) {
|
|
26
|
+
const { ix } = buildCreateJobIx({
|
|
27
|
+
jobId: params.jobId,
|
|
28
|
+
roles: {
|
|
29
|
+
client: params.actors.client.publicKey,
|
|
30
|
+
provider: params.actors.provider?.publicKey ?? PublicKey.default,
|
|
31
|
+
evaluator: params.actors.evaluator?.publicKey ?? PublicKey.default,
|
|
32
|
+
},
|
|
33
|
+
bondMint: params.bondMint,
|
|
34
|
+
amount: params.amount,
|
|
35
|
+
workUri: params.workUri,
|
|
36
|
+
submitWindowSecs: params.submitWindowSecs,
|
|
37
|
+
});
|
|
38
|
+
if (!params.actors.provider ||
|
|
39
|
+
params.actors.provider.publicKey.equals(PublicKey.default)) {
|
|
40
|
+
throw new Error("createJob requires actors.provider");
|
|
41
|
+
}
|
|
42
|
+
if (!params.actors.evaluator ||
|
|
43
|
+
params.actors.evaluator.publicKey.equals(PublicKey.default)) {
|
|
44
|
+
throw new Error("createJob requires actors.evaluator");
|
|
45
|
+
}
|
|
46
|
+
await params.actors.client.sendAndConfirm(this.connection, [ix]);
|
|
47
|
+
return JobSession.attach(this, {
|
|
48
|
+
jobId: params.jobId,
|
|
49
|
+
actors: params.actors,
|
|
50
|
+
bondMint: params.bondMint,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Attach to an existing Job. Use this on the provider/evaluator side
|
|
55
|
+
* after they receive a Job ID off-band (webhook, queue, watcher).
|
|
56
|
+
*/
|
|
57
|
+
async openJob(args) {
|
|
58
|
+
const job = await fetchJob(this.connection, args.jobId);
|
|
59
|
+
if (!job) {
|
|
60
|
+
throw new Error(`job ${args.jobId} not found on chain`);
|
|
61
|
+
}
|
|
62
|
+
return JobSession.attach(this, {
|
|
63
|
+
jobId: args.jobId,
|
|
64
|
+
actors: args.actors,
|
|
65
|
+
bondMint: args.bondMint ?? job.bondMint,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** v0.9 — Offering registry namespace. Provider operations
|
|
69
|
+
* (register / update / close) plus buyer-side discovery (browse /
|
|
70
|
+
* createJobFromOffering). */
|
|
71
|
+
get offering() {
|
|
72
|
+
return new OfferingNamespace(this);
|
|
73
|
+
}
|
|
74
|
+
/** v1.0 Phase 8 — Negotiation namespace. propose / counter /
|
|
75
|
+
* accept / materialize / cancel + session helper. */
|
|
76
|
+
get negotiation() {
|
|
77
|
+
return new NegotiationNamespace(this);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Ensure the protocol Treasury ATA exists for `bondMint`. Idempotent.
|
|
81
|
+
* Pre-v0.6 there was nothing to do; v0.6+ every settlement reads
|
|
82
|
+
* this account, so call once per mint before the first settle.
|
|
83
|
+
*
|
|
84
|
+
* Works with any `SacpSigner` (`LocalSigner`, `RemoteSigner`,
|
|
85
|
+
* `WalletAdapterSigner`) — builds the create-ATA instruction and
|
|
86
|
+
* delegates the send to the signer. Skips the network call entirely
|
|
87
|
+
* when the ATA already exists.
|
|
88
|
+
*/
|
|
89
|
+
async ensureTreasuryAta(bondMint, payer) {
|
|
90
|
+
const signer = payer ?? this.payer;
|
|
91
|
+
if (!signer) {
|
|
92
|
+
throw new Error("ensureTreasuryAta needs a payer (set SacpClientConfig.payer or pass one explicitly)");
|
|
93
|
+
}
|
|
94
|
+
const [configPda] = findSacpConfigPda();
|
|
95
|
+
const ata = getAssociatedTokenAddressSync(bondMint, configPda, true);
|
|
96
|
+
const existing = await this.connection.getAccountInfo(ata, "confirmed");
|
|
97
|
+
if (existing)
|
|
98
|
+
return ata;
|
|
99
|
+
const ix = createAssociatedTokenAccountIdempotentInstruction(signer.publicKey, ata, configPda, bondMint);
|
|
100
|
+
await signer.sendAndConfirm(this.connection, [ix]);
|
|
101
|
+
return ata;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Stateful handle to one Job. Tracks role keys, derived ATAs, and
|
|
106
|
+
* fetches the current on-chain state on demand. Each lifecycle action
|
|
107
|
+
* (fund, submitWork, accept, dispute, submitVerdict, reclaim) is a
|
|
108
|
+
* single SDK call.
|
|
109
|
+
*/
|
|
110
|
+
export class JobSession {
|
|
111
|
+
client;
|
|
112
|
+
jobId;
|
|
113
|
+
bondMint;
|
|
114
|
+
actors;
|
|
115
|
+
clientAta;
|
|
116
|
+
providerAta;
|
|
117
|
+
evaluatorAta;
|
|
118
|
+
treasuryAta;
|
|
119
|
+
cached = null;
|
|
120
|
+
constructor(args) {
|
|
121
|
+
this.client = args.client;
|
|
122
|
+
this.jobId = args.jobId;
|
|
123
|
+
this.bondMint = args.bondMint;
|
|
124
|
+
this.actors = args.actors;
|
|
125
|
+
const [configPda] = findSacpConfigPda();
|
|
126
|
+
this.clientAta = getAssociatedTokenAddressSync(args.bondMint, args.actors.client.publicKey);
|
|
127
|
+
this.providerAta = args.actors.provider
|
|
128
|
+
? getAssociatedTokenAddressSync(args.bondMint, args.actors.provider.publicKey)
|
|
129
|
+
: PublicKey.default;
|
|
130
|
+
this.evaluatorAta = args.actors.evaluator
|
|
131
|
+
? getAssociatedTokenAddressSync(args.bondMint, args.actors.evaluator.publicKey, true)
|
|
132
|
+
: PublicKey.default;
|
|
133
|
+
this.treasuryAta = getAssociatedTokenAddressSync(args.bondMint, configPda, true);
|
|
134
|
+
}
|
|
135
|
+
static attach(client, args) {
|
|
136
|
+
return new JobSession({
|
|
137
|
+
client,
|
|
138
|
+
jobId: args.jobId,
|
|
139
|
+
bondMint: args.bondMint,
|
|
140
|
+
actors: args.actors,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** Force-refresh the on-chain Job state + Config (take rate may
|
|
144
|
+
* have shifted between settlement calls). */
|
|
145
|
+
async refresh() {
|
|
146
|
+
const [job, config] = await Promise.all([
|
|
147
|
+
fetchJob(this.client.connection, this.jobId),
|
|
148
|
+
fetchSacpConfig(this.client.connection),
|
|
149
|
+
]);
|
|
150
|
+
if (!job)
|
|
151
|
+
throw new Error(`job ${this.jobId} not found`);
|
|
152
|
+
if (!config)
|
|
153
|
+
throw new Error("sACP Config PDA not initialized — run sacp:bootstrap");
|
|
154
|
+
this.cached = { job, config };
|
|
155
|
+
return {
|
|
156
|
+
job,
|
|
157
|
+
config,
|
|
158
|
+
clientAta: this.clientAta,
|
|
159
|
+
providerAta: this.providerAta,
|
|
160
|
+
evaluatorAta: this.evaluatorAta,
|
|
161
|
+
treasuryAta: this.treasuryAta,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** Most recently fetched Job snapshot, or `null` if `refresh()`
|
|
165
|
+
* hasn't been called yet. */
|
|
166
|
+
get snapshot() {
|
|
167
|
+
if (!this.cached)
|
|
168
|
+
return null;
|
|
169
|
+
return {
|
|
170
|
+
job: this.cached.job,
|
|
171
|
+
config: this.cached.config,
|
|
172
|
+
clientAta: this.clientAta,
|
|
173
|
+
providerAta: this.providerAta,
|
|
174
|
+
evaluatorAta: this.evaluatorAta,
|
|
175
|
+
treasuryAta: this.treasuryAta,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* What this session's actors can do right now. Returns one entry
|
|
180
|
+
* per (role, action) pair so a UI can drive the right button per
|
|
181
|
+
* connected wallet.
|
|
182
|
+
*/
|
|
183
|
+
async availableActions() {
|
|
184
|
+
const { job } = await this.refresh();
|
|
185
|
+
const state = job.state;
|
|
186
|
+
const out = [];
|
|
187
|
+
switch (state) {
|
|
188
|
+
case "Open":
|
|
189
|
+
out.push({ role: "client", action: "fund" });
|
|
190
|
+
break;
|
|
191
|
+
case "Funded":
|
|
192
|
+
out.push({ role: "provider", action: "submit_work" });
|
|
193
|
+
out.push({ role: "client", action: "reclaim" }); // after deadline
|
|
194
|
+
break;
|
|
195
|
+
case "Submitted":
|
|
196
|
+
out.push({ role: "client", action: "accept" });
|
|
197
|
+
out.push({ role: "client", action: "dispute" });
|
|
198
|
+
break;
|
|
199
|
+
case "Disputed":
|
|
200
|
+
out.push({ role: "evaluator", action: "submit_verdict" });
|
|
201
|
+
break;
|
|
202
|
+
case "Settled":
|
|
203
|
+
out.push({ role: "anyone", action: "record_verdict" });
|
|
204
|
+
out.push({ role: "anyone", action: "publish_settlement" });
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
return out;
|
|
208
|
+
}
|
|
209
|
+
// ─── lifecycle actions ────────────────────────────────────────────
|
|
210
|
+
async fund(amount) {
|
|
211
|
+
const { job } = await this.refresh();
|
|
212
|
+
const ix = buildFundJobIx({
|
|
213
|
+
client: this.actors.client.publicKey,
|
|
214
|
+
jobId: this.jobId,
|
|
215
|
+
amount: amount ?? job.amount,
|
|
216
|
+
clientTokenAccount: this.clientAta,
|
|
217
|
+
});
|
|
218
|
+
return this.actors.client.sendAndConfirm(this.client.connection, [ix]);
|
|
219
|
+
}
|
|
220
|
+
async submitWork(submissionUri) {
|
|
221
|
+
if (!this.actors.provider) {
|
|
222
|
+
throw new Error("submitWork needs actors.provider");
|
|
223
|
+
}
|
|
224
|
+
const ix = buildSubmitWorkIx(this.actors.provider.publicKey, this.jobId, submissionUri);
|
|
225
|
+
return this.actors.provider.sendAndConfirm(this.client.connection, [ix]);
|
|
226
|
+
}
|
|
227
|
+
async accept() {
|
|
228
|
+
if (!this.actors.provider) {
|
|
229
|
+
throw new Error("accept needs actors.provider (its pubkey)");
|
|
230
|
+
}
|
|
231
|
+
const ix = buildAcceptWorkIx({
|
|
232
|
+
client: this.actors.client.publicKey,
|
|
233
|
+
provider: this.actors.provider.publicKey,
|
|
234
|
+
jobId: this.jobId,
|
|
235
|
+
bondMint: this.bondMint,
|
|
236
|
+
providerTokenAccount: this.providerAta,
|
|
237
|
+
});
|
|
238
|
+
return this.actors.client.sendAndConfirm(this.client.connection, [ix]);
|
|
239
|
+
}
|
|
240
|
+
async dispute(reasonHash) {
|
|
241
|
+
const ix = buildDisputeWorkIx(this.actors.client.publicKey, this.jobId, reasonHash);
|
|
242
|
+
return this.actors.client.sendAndConfirm(this.client.connection, [ix]);
|
|
243
|
+
}
|
|
244
|
+
async submitVerdict(winner, options) {
|
|
245
|
+
if (!this.actors.evaluator) {
|
|
246
|
+
throw new Error("submitVerdict needs actors.evaluator");
|
|
247
|
+
}
|
|
248
|
+
if (!this.actors.provider) {
|
|
249
|
+
throw new Error("submitVerdict needs actors.provider (its pubkey)");
|
|
250
|
+
}
|
|
251
|
+
const verdictIx = buildSubmitVerdictIx({
|
|
252
|
+
evaluator: this.actors.evaluator.publicKey,
|
|
253
|
+
client: this.actors.client.publicKey,
|
|
254
|
+
provider: this.actors.provider.publicKey,
|
|
255
|
+
jobId: this.jobId,
|
|
256
|
+
bondMint: this.bondMint,
|
|
257
|
+
winner,
|
|
258
|
+
clientTokenAccount: this.clientAta,
|
|
259
|
+
providerTokenAccount: this.providerAta,
|
|
260
|
+
evaluatorTokenAccount: this.evaluatorAta,
|
|
261
|
+
});
|
|
262
|
+
const ixs = [verdictIx];
|
|
263
|
+
if (options?.evidenceUri) {
|
|
264
|
+
const { ix: recordIx } = buildRecordVerdictIx({
|
|
265
|
+
payer: this.actors.evaluator.publicKey,
|
|
266
|
+
jobId: this.jobId,
|
|
267
|
+
evidenceUri: options.evidenceUri,
|
|
268
|
+
});
|
|
269
|
+
ixs.push(recordIx);
|
|
270
|
+
}
|
|
271
|
+
return this.actors.evaluator.sendAndConfirm(this.client.connection, ixs);
|
|
272
|
+
}
|
|
273
|
+
async reclaim() {
|
|
274
|
+
const ix = buildReclaimEscrowIx({
|
|
275
|
+
client: this.actors.client.publicKey,
|
|
276
|
+
jobId: this.jobId,
|
|
277
|
+
clientTokenAccount: this.clientAta,
|
|
278
|
+
});
|
|
279
|
+
return this.actors.client.sendAndConfirm(this.client.connection, [ix]);
|
|
280
|
+
}
|
|
281
|
+
async fetchVerdict() {
|
|
282
|
+
return fetchVerdict(this.client.connection, this.jobId);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* v0.9 — Offering helpers grouped behind `sacp.offering.*`. Each
|
|
287
|
+
* method is a one-shot thin wrapper around the low-level builders so
|
|
288
|
+
* providers register a catalog entry, browse / discover other
|
|
289
|
+
* providers, and buyers turn an Offering into a `JobSession` in a
|
|
290
|
+
* single call.
|
|
291
|
+
*/
|
|
292
|
+
export class OfferingNamespace {
|
|
293
|
+
client;
|
|
294
|
+
constructor(client) {
|
|
295
|
+
this.client = client;
|
|
296
|
+
}
|
|
297
|
+
/** Register a new Offering as the provider. Returns the offering
|
|
298
|
+
* PDA + the signed tx signature. */
|
|
299
|
+
async register(provider, params) {
|
|
300
|
+
const { ix, offeringPda } = buildRegisterOfferingIx({
|
|
301
|
+
...params,
|
|
302
|
+
provider: provider.publicKey,
|
|
303
|
+
});
|
|
304
|
+
const sig = await provider.sendAndConfirm(this.client.connection, [ix]);
|
|
305
|
+
return { pda: offeringPda, signature: sig };
|
|
306
|
+
}
|
|
307
|
+
async update(provider, params) {
|
|
308
|
+
const ix = buildUpdateOfferingIx({
|
|
309
|
+
...params,
|
|
310
|
+
provider: provider.publicKey,
|
|
311
|
+
});
|
|
312
|
+
return provider.sendAndConfirm(this.client.connection, [ix]);
|
|
313
|
+
}
|
|
314
|
+
async close(provider, slotId) {
|
|
315
|
+
const ix = buildCloseOfferingIx({
|
|
316
|
+
provider: provider.publicKey,
|
|
317
|
+
slotId,
|
|
318
|
+
});
|
|
319
|
+
return provider.sendAndConfirm(this.client.connection, [ix]);
|
|
320
|
+
}
|
|
321
|
+
async fetch(provider, slotId) {
|
|
322
|
+
return fetchOffering(this.client.connection, provider, slotId);
|
|
323
|
+
}
|
|
324
|
+
async browse(filter) {
|
|
325
|
+
return listOfferings(this.client.connection, filter);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Turn an Offering into a Job in one call. Pulls bond_mint and
|
|
329
|
+
* default_evaluator from the Offering, lets the buyer override the
|
|
330
|
+
* evaluator and supply work_uri + amount. Validates amount falls
|
|
331
|
+
* within the Offering's min/max band.
|
|
332
|
+
*
|
|
333
|
+
* The returned `JobSession` is already in the `Open` state — call
|
|
334
|
+
* `.fund()` immediately to lock the escrow.
|
|
335
|
+
*/
|
|
336
|
+
async createJobFrom(offering, args) {
|
|
337
|
+
if (!offering.active) {
|
|
338
|
+
throw new Error(`Offering ${offering.pda.toBase58()} is inactive`);
|
|
339
|
+
}
|
|
340
|
+
if (args.amount < offering.minAmount ||
|
|
341
|
+
args.amount > offering.maxAmount) {
|
|
342
|
+
throw new Error(`amount ${args.amount} out of offering band [${offering.minAmount}, ${offering.maxAmount}]`);
|
|
343
|
+
}
|
|
344
|
+
if (!args.provider.publicKey.equals(offering.provider)) {
|
|
345
|
+
throw new Error("provider signer does not match offering.provider — pass the offering owner's signer");
|
|
346
|
+
}
|
|
347
|
+
return this.client.createJob({
|
|
348
|
+
jobId: args.jobId,
|
|
349
|
+
actors: {
|
|
350
|
+
client: args.client,
|
|
351
|
+
provider: args.provider,
|
|
352
|
+
evaluator: args.evaluator,
|
|
353
|
+
},
|
|
354
|
+
bondMint: offering.bondMint,
|
|
355
|
+
amount: args.amount,
|
|
356
|
+
workUri: args.workUri,
|
|
357
|
+
submitWindowSecs: args.submitWindowSecs,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* v1.0 Phase 8 — Negotiation namespace + NegotiationSession.
|
|
363
|
+
*
|
|
364
|
+
* `sacp.negotiation.propose(...)` opens a Negotiation. The returned
|
|
365
|
+
* session exposes counter / accept / cancel / materialize, plus
|
|
366
|
+
* `availableActions()` so a UI knows whose turn it is.
|
|
367
|
+
*/
|
|
368
|
+
export class NegotiationNamespace {
|
|
369
|
+
client;
|
|
370
|
+
constructor(client) {
|
|
371
|
+
this.client = client;
|
|
372
|
+
}
|
|
373
|
+
async propose(buyer, args) {
|
|
374
|
+
const { ix } = buildProposeTermsIx({
|
|
375
|
+
buyer: buyer.publicKey,
|
|
376
|
+
provider: args.provider,
|
|
377
|
+
evaluator: args.evaluator,
|
|
378
|
+
bondMint: args.bondMint,
|
|
379
|
+
negotiationId: args.negotiationId,
|
|
380
|
+
amount: args.amount,
|
|
381
|
+
workUri: args.workUri,
|
|
382
|
+
submitWindowSecs: args.submitWindowSecs,
|
|
383
|
+
});
|
|
384
|
+
await buyer.sendAndConfirm(this.client.connection, [ix]);
|
|
385
|
+
return new NegotiationSession({
|
|
386
|
+
client: this.client,
|
|
387
|
+
buyer: buyer.publicKey,
|
|
388
|
+
negotiationId: args.negotiationId,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
attach(args) {
|
|
392
|
+
return new NegotiationSession({
|
|
393
|
+
client: this.client,
|
|
394
|
+
buyer: args.buyer,
|
|
395
|
+
negotiationId: args.negotiationId,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
async fetch(buyer, negotiationId) {
|
|
399
|
+
return fetchNegotiation(this.client.connection, buyer, negotiationId);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
export class NegotiationSession {
|
|
403
|
+
client;
|
|
404
|
+
buyer;
|
|
405
|
+
negotiationId;
|
|
406
|
+
constructor(args) {
|
|
407
|
+
this.client = args.client;
|
|
408
|
+
this.buyer = args.buyer;
|
|
409
|
+
this.negotiationId = args.negotiationId;
|
|
410
|
+
}
|
|
411
|
+
async refresh() {
|
|
412
|
+
const n = await fetchNegotiation(this.client.connection, this.buyer, this.negotiationId);
|
|
413
|
+
if (!n) {
|
|
414
|
+
throw new Error(`negotiation ${this.negotiationId} for ${this.buyer.toBase58()} not found`);
|
|
415
|
+
}
|
|
416
|
+
return n;
|
|
417
|
+
}
|
|
418
|
+
async counter(signer, terms) {
|
|
419
|
+
const ix = buildCounterTermsIx({
|
|
420
|
+
signer: signer.publicKey,
|
|
421
|
+
buyer: this.buyer,
|
|
422
|
+
negotiationId: this.negotiationId,
|
|
423
|
+
amount: terms.amount,
|
|
424
|
+
workUri: terms.workUri,
|
|
425
|
+
submitWindowSecs: terms.submitWindowSecs,
|
|
426
|
+
});
|
|
427
|
+
return signer.sendAndConfirm(this.client.connection, [ix]);
|
|
428
|
+
}
|
|
429
|
+
async accept(signer) {
|
|
430
|
+
const ix = buildAcceptTermsIx({
|
|
431
|
+
signer: signer.publicKey,
|
|
432
|
+
buyer: this.buyer,
|
|
433
|
+
negotiationId: this.negotiationId,
|
|
434
|
+
});
|
|
435
|
+
return signer.sendAndConfirm(this.client.connection, [ix]);
|
|
436
|
+
}
|
|
437
|
+
async cancel(signer) {
|
|
438
|
+
const ix = buildCancelNegotiationIx({
|
|
439
|
+
signer: signer.publicKey,
|
|
440
|
+
buyer: this.buyer,
|
|
441
|
+
negotiationId: this.negotiationId,
|
|
442
|
+
});
|
|
443
|
+
return signer.sendAndConfirm(this.client.connection, [ix]);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Buyer-only. After the negotiation is Accepted, mint the Job +
|
|
447
|
+
* escrow vault. Returns the created jobId so callers can attach a
|
|
448
|
+
* `JobSession` immediately.
|
|
449
|
+
*/
|
|
450
|
+
async materialize(buyer, args) {
|
|
451
|
+
if (!buyer.publicKey.equals(this.buyer)) {
|
|
452
|
+
throw new Error("only the buyer can materialize");
|
|
453
|
+
}
|
|
454
|
+
const { ix } = buildMaterializeJobIx({
|
|
455
|
+
buyer: this.buyer,
|
|
456
|
+
bondMint: args.bondMint,
|
|
457
|
+
negotiationId: this.negotiationId,
|
|
458
|
+
jobId: args.jobId,
|
|
459
|
+
});
|
|
460
|
+
await buyer.sendAndConfirm(this.client.connection, [ix]);
|
|
461
|
+
return args.jobId;
|
|
462
|
+
}
|
|
463
|
+
/** Returns which side(s) can act, given the current state + last
|
|
464
|
+
* proposer. UIs use this to enable / disable buttons. */
|
|
465
|
+
async availableActions() {
|
|
466
|
+
const n = await this.refresh();
|
|
467
|
+
if (n.state === "Accepted") {
|
|
468
|
+
return [{ role: "buyer", action: "materialize" }];
|
|
469
|
+
}
|
|
470
|
+
if (n.state === "Cancelled")
|
|
471
|
+
return [];
|
|
472
|
+
const counterParty = n.lastProposer.equals(n.buyer) ? "provider" : "buyer";
|
|
473
|
+
return [
|
|
474
|
+
{ role: counterParty, action: "counter" },
|
|
475
|
+
{ role: counterParty, action: "accept" },
|
|
476
|
+
{ role: "buyer", action: "cancel" },
|
|
477
|
+
{ role: "provider", action: "cancel" },
|
|
478
|
+
];
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iDAAiD,EACjD,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,QAAQ,EACR,YAAY,GAGb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,aAAa,GAId,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,GAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAA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;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;6DACyD;IACzD,KAAK,CAAC,gBAAgB;QACpB,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;YAC3B,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,CAAC,KAAK,KAAK,WAAW;YAAE,OAAO,EAAE,CAAC;QACvC,MAAM,YAAY,GAChB,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;QACxD,OAAO;YACL,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE;YACzC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE;YACxC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;YACnC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE;SACvC,CAAC;IACJ,CAAC;CACF"}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Connection, Keypair, PublicKey, Transaction, type Signer, type TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Signer abstraction for the v0.8 runtime layer.
|
|
4
|
+
*
|
|
5
|
+
* Most callers pass a `Keypair` directly via `LocalSigner` and never
|
|
6
|
+
* think about this. The interface exists so backend operators that
|
|
7
|
+
* keep the key inside a KMS / HSM / remote signing service can supply
|
|
8
|
+
* their own implementation without rewriting the SDK.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the idolly-acp operator-signer pattern: every authority
|
|
11
|
+
* (Client, Provider, Evaluator, Validator authority) becomes a
|
|
12
|
+
* `SacpSigner`, and the runtime never sees raw private bytes for the
|
|
13
|
+
* remote case.
|
|
14
|
+
*/
|
|
15
|
+
export interface SacpSigner {
|
|
16
|
+
/** Public key the signer represents on chain. */
|
|
17
|
+
readonly publicKey: PublicKey;
|
|
18
|
+
/**
|
|
19
|
+
* Build, sign, and submit a transaction with the given instructions.
|
|
20
|
+
* `coSigners` are additional keypairs that must also sign (e.g. the
|
|
21
|
+
* fresh `wormhole_message` ephemeral key for publishSettlementVaa).
|
|
22
|
+
*
|
|
23
|
+
* Implementations decide whether to sign in-process (LocalSigner) or
|
|
24
|
+
* hand the message off to a remote signer (RemoteSigner).
|
|
25
|
+
*/
|
|
26
|
+
sendAndConfirm(connection: Connection, instructions: TransactionInstruction[], coSigners?: Signer[]): Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
/** Local-keypair signer. Default for SDK consumers running in-process. */
|
|
29
|
+
export declare class LocalSigner implements SacpSigner {
|
|
30
|
+
readonly keypair: Keypair;
|
|
31
|
+
constructor(keypair: Keypair);
|
|
32
|
+
get publicKey(): PublicKey;
|
|
33
|
+
sendAndConfirm(connection: Connection, instructions: TransactionInstruction[], coSigners?: Signer[]): Promise<string>;
|
|
34
|
+
/** Convenience for runtimes that want raw Signer access (e.g. for
|
|
35
|
+
* `@solana/spl-token` helpers that demand `Signer` not just pubkey). */
|
|
36
|
+
asWeb3Signer(): Signer;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Remote-signer adapter. Defers the actual `partialSign` to an external
|
|
40
|
+
* service over a request/response transport you provide. The SDK
|
|
41
|
+
* builds + serializes the transaction, hands the raw message bytes to
|
|
42
|
+
* `signMessage`, and submits the assembled signed transaction.
|
|
43
|
+
*
|
|
44
|
+
* The transport itself is your concern — HTTPS + mTLS + HMAC, an
|
|
45
|
+
* internal gRPC, a queue-and-poll bridge to a Turnkey/Fireblocks
|
|
46
|
+
* vault. The SDK only needs the contract `signMessage(bytes) -> bytes`.
|
|
47
|
+
*/
|
|
48
|
+
export interface RemoteSignTransport {
|
|
49
|
+
/** Returns the 64-byte ed25519 signature for the given message. */
|
|
50
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
51
|
+
}
|
|
52
|
+
export declare class RemoteSigner implements SacpSigner {
|
|
53
|
+
readonly publicKey: PublicKey;
|
|
54
|
+
private readonly transport;
|
|
55
|
+
constructor(publicKey: PublicKey, transport: RemoteSignTransport);
|
|
56
|
+
sendAndConfirm(connection: Connection, instructions: TransactionInstruction[], coSigners?: Signer[]): Promise<string>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Structural subset of a Solana wallet adapter (Phantom, Backpack,
|
|
60
|
+
* Solflare, etc.). Defined here so the SDK doesn't need to depend on
|
|
61
|
+
* `@solana/wallet-adapter-base` directly — any object with this shape
|
|
62
|
+
* works, including the real `WalletAdapter` from that package.
|
|
63
|
+
*
|
|
64
|
+
* Phantom's `window.solana` exposes the same `sendTransaction`
|
|
65
|
+
* signature once `window.solana.connect()` has resolved.
|
|
66
|
+
*/
|
|
67
|
+
export interface BrowserWalletAdapter {
|
|
68
|
+
/** Set after the user connects. SDK throws if null when signing. */
|
|
69
|
+
publicKey: PublicKey | null;
|
|
70
|
+
/**
|
|
71
|
+
* Sign + send the transaction. The wallet handles user prompts.
|
|
72
|
+
* Co-signers (ephemeral keypairs for Wormhole message accounts,
|
|
73
|
+
* fresh PDAs, etc.) are passed via `options.signers`.
|
|
74
|
+
*/
|
|
75
|
+
sendTransaction(transaction: Transaction, connection: Connection, options?: {
|
|
76
|
+
signers?: Signer[];
|
|
77
|
+
skipPreflight?: boolean;
|
|
78
|
+
}): Promise<string>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Browser signer that delegates signing to a connected wallet
|
|
82
|
+
* (Phantom, Backpack, Solflare, anything that follows the
|
|
83
|
+
* `@solana/wallet-adapter-base` `WalletAdapter` interface).
|
|
84
|
+
*
|
|
85
|
+
* Typical Phantom usage:
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* await window.solana.connect();
|
|
89
|
+
* const signer = new WalletAdapterSigner(window.solana);
|
|
90
|
+
* const sacp = new SacpClient({ connection });
|
|
91
|
+
* const session = await sacp.openJob({
|
|
92
|
+
* jobId,
|
|
93
|
+
* actors: { client: signer, provider: ..., evaluator: ... },
|
|
94
|
+
* });
|
|
95
|
+
* await session.fund();
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Co-signers (ephemeral keypairs) are forwarded to the wallet's
|
|
99
|
+
* `sendTransaction` option. Phantom + Backpack both honor it.
|
|
100
|
+
*/
|
|
101
|
+
export declare class WalletAdapterSigner implements SacpSigner {
|
|
102
|
+
private readonly adapter;
|
|
103
|
+
constructor(adapter: BrowserWalletAdapter);
|
|
104
|
+
get publicKey(): PublicKey;
|
|
105
|
+
sendAndConfirm(connection: Connection, instructions: TransactionInstruction[], coSigners?: Signer[]): Promise<string>;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,KAAK,MAAM,EACX,KAAK,sBAAsB,EAE5B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B;;;;;;;OAOG;IACH,cAAc,CACZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,sBAAsB,EAAE,EACtC,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,0EAA0E;AAC1E,qBAAa,WAAY,YAAW,UAAU;aAChB,OAAO,EAAE,OAAO;gBAAhB,OAAO,EAAE,O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