@telaro/sacp 1.0.1 → 1.0.2
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/agreement.d.ts +70 -0
- package/dist/agreement.d.ts.map +1 -0
- package/dist/agreement.js +122 -0
- package/dist/agreement.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +36 -29
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for `sacp_agreement` — the on-chain Proof-of-Agreement memo
|
|
3
|
+
* program. Phase 8b Step 1 surface.
|
|
4
|
+
*
|
|
5
|
+
* - `deriveAgreementPda(jobId)` — deterministic PDA lookup.
|
|
6
|
+
* - `buildPostAgreementIx(...)` — single-IX builder for buyer +
|
|
7
|
+
* provider to co-sign before any payment moves.
|
|
8
|
+
* - `fetchAgreement(conn, jobId)` — read + decode a posted PDA.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the conventions in `./validation.ts` so a sACP integrator
|
|
11
|
+
* can wire this in the same way they wire the validator IXs.
|
|
12
|
+
*/
|
|
13
|
+
import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
14
|
+
export declare const SACP_AGREEMENT_PROGRAM_ID: PublicKey;
|
|
15
|
+
export declare const SEED_AGREEMENT: Buffer<ArrayBuffer>;
|
|
16
|
+
export declare const MAX_SPEC_URI_LEN = 256;
|
|
17
|
+
/**
|
|
18
|
+
* Derive the PDA that holds a job's agreement memo. The seed pair is
|
|
19
|
+
* fixed by the program (`["agreement", job_id]`) so any consumer
|
|
20
|
+
* (gateway, web UI, dispute panel) can look the memo up without an
|
|
21
|
+
* indexer.
|
|
22
|
+
*/
|
|
23
|
+
export declare function deriveAgreementPda(jobId: Uint8Array): [PublicKey, number];
|
|
24
|
+
export interface PostAgreementParams {
|
|
25
|
+
buyer: PublicKey;
|
|
26
|
+
provider: PublicKey;
|
|
27
|
+
jobId: Uint8Array;
|
|
28
|
+
/** SHA-256 of the sample request, or 32 zeros if no sample committed. */
|
|
29
|
+
sampleRequestHash: Uint8Array;
|
|
30
|
+
/** SHA-256 of the sample deliverable, or 32 zeros if no sample committed. */
|
|
31
|
+
sampleDeliverableHash: Uint8Array;
|
|
32
|
+
/** Off-chain URL of the human-readable spec. ≤ 256 bytes. */
|
|
33
|
+
specUri: string;
|
|
34
|
+
/** Bond size the provider commits to post, in atoms. */
|
|
35
|
+
bondAtoms: bigint;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build the `post_agreement` instruction. Both buyer and provider
|
|
39
|
+
* must sign the resulting transaction — the program rejects anything
|
|
40
|
+
* else, since a one-sided memo would let either party lock in terms
|
|
41
|
+
* the other never saw.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildPostAgreementIx(params: PostAgreementParams): TransactionInstruction;
|
|
44
|
+
export interface FetchedAgreement {
|
|
45
|
+
buyer: PublicKey;
|
|
46
|
+
provider: PublicKey;
|
|
47
|
+
jobId: Uint8Array;
|
|
48
|
+
sampleRequestHash: Uint8Array;
|
|
49
|
+
sampleDeliverableHash: Uint8Array;
|
|
50
|
+
specUri: string;
|
|
51
|
+
bondAtoms: bigint;
|
|
52
|
+
signedAt: bigint;
|
|
53
|
+
bump: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Read + decode a previously posted agreement. Returns null when the
|
|
57
|
+
* PDA doesn't exist yet (i.e. the parties haven't signed). Throws if
|
|
58
|
+
* the account exists but isn't a well-formed `Agreement`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function fetchAgreement(conn: Connection, jobId: Uint8Array): Promise<FetchedAgreement | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Layout (matches programs/sacp_agreement/src/lib.rs):
|
|
63
|
+
* discriminator (8) +
|
|
64
|
+
* buyer (32) + provider (32) + job_id (32) +
|
|
65
|
+
* sample_request_hash (32) + sample_deliverable_hash (32) +
|
|
66
|
+
* spec_uri (4-byte len + utf8) +
|
|
67
|
+
* bond_atoms (8, u64 LE) + signed_at (8, i64 LE) + bump (1)
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseAgreementFromBuffer(data: Buffer): FetchedAgreement;
|
|
70
|
+
//# sourceMappingURL=agreement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agreement.d.ts","sourceRoot":"","sources":["../src/agreement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,UAAU,EACV,SAAS,EAET,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAQzB,eAAO,MAAM,yBAAyB,WAErC,CAAC;AAEF,eAAO,MAAM,cAAc,qBAA2B,CAAC;AACvD,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAQzE;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,yEAAyE;IACzE,iBAAiB,EAAE,UAAU,CAAC;IAC9B,6EAA6E;IAC7E,qBAAqB,EAAE,UAAU,CAAC;IAClC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,mBAAmB,GAC1B,sBAAsB,CA6BxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,iBAAiB,EAAE,UAAU,CAAC;IAC9B,qBAAqB,EAAE,UAAU,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAKlC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CA8CvE"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for `sacp_agreement` — the on-chain Proof-of-Agreement memo
|
|
3
|
+
* program. Phase 8b Step 1 surface.
|
|
4
|
+
*
|
|
5
|
+
* - `deriveAgreementPda(jobId)` — deterministic PDA lookup.
|
|
6
|
+
* - `buildPostAgreementIx(...)` — single-IX builder for buyer +
|
|
7
|
+
* provider to co-sign before any payment moves.
|
|
8
|
+
* - `fetchAgreement(conn, jobId)` — read + decode a posted PDA.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the conventions in `./validation.ts` so a sACP integrator
|
|
11
|
+
* can wire this in the same way they wire the validator IXs.
|
|
12
|
+
*/
|
|
13
|
+
import { PublicKey, SystemProgram, TransactionInstruction, } from "@solana/web3.js";
|
|
14
|
+
import { encodeBytes32, encodeInstruction, encodeString, encodeU64, } from "./codec.js";
|
|
15
|
+
export const SACP_AGREEMENT_PROGRAM_ID = new PublicKey("2tp9TSMeuDyK117VvW3t2hJwfLLBMgZX8h4NCUsBLtvU");
|
|
16
|
+
export const SEED_AGREEMENT = Buffer.from("agreement");
|
|
17
|
+
export const MAX_SPEC_URI_LEN = 256;
|
|
18
|
+
/**
|
|
19
|
+
* Derive the PDA that holds a job's agreement memo. The seed pair is
|
|
20
|
+
* fixed by the program (`["agreement", job_id]`) so any consumer
|
|
21
|
+
* (gateway, web UI, dispute panel) can look the memo up without an
|
|
22
|
+
* indexer.
|
|
23
|
+
*/
|
|
24
|
+
export function deriveAgreementPda(jobId) {
|
|
25
|
+
if (jobId.length !== 32) {
|
|
26
|
+
throw new Error(`jobId must be 32 bytes, got ${jobId.length}`);
|
|
27
|
+
}
|
|
28
|
+
return PublicKey.findProgramAddressSync([SEED_AGREEMENT, Buffer.from(jobId)], SACP_AGREEMENT_PROGRAM_ID);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build the `post_agreement` instruction. Both buyer and provider
|
|
32
|
+
* must sign the resulting transaction — the program rejects anything
|
|
33
|
+
* else, since a one-sided memo would let either party lock in terms
|
|
34
|
+
* the other never saw.
|
|
35
|
+
*/
|
|
36
|
+
export function buildPostAgreementIx(params) {
|
|
37
|
+
if (params.specUri.length === 0 || params.specUri.length > MAX_SPEC_URI_LEN) {
|
|
38
|
+
throw new Error(`specUri must be 1..${MAX_SPEC_URI_LEN} bytes, got ${params.specUri.length}`);
|
|
39
|
+
}
|
|
40
|
+
if (params.bondAtoms <= 0n) {
|
|
41
|
+
throw new Error("bondAtoms must be greater than zero");
|
|
42
|
+
}
|
|
43
|
+
const [agreementPda] = deriveAgreementPda(params.jobId);
|
|
44
|
+
const data = encodeInstruction("post_agreement", encodeBytes32(params.jobId), encodeBytes32(params.sampleRequestHash), encodeBytes32(params.sampleDeliverableHash), encodeString(params.specUri), encodeU64(params.bondAtoms));
|
|
45
|
+
return new TransactionInstruction({
|
|
46
|
+
programId: SACP_AGREEMENT_PROGRAM_ID,
|
|
47
|
+
keys: [
|
|
48
|
+
{ pubkey: params.buyer, isSigner: true, isWritable: true },
|
|
49
|
+
{ pubkey: params.provider, isSigner: true, isWritable: false },
|
|
50
|
+
{ pubkey: agreementPda, isSigner: false, isWritable: true },
|
|
51
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
52
|
+
],
|
|
53
|
+
data,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Read + decode a previously posted agreement. Returns null when the
|
|
58
|
+
* PDA doesn't exist yet (i.e. the parties haven't signed). Throws if
|
|
59
|
+
* the account exists but isn't a well-formed `Agreement`.
|
|
60
|
+
*/
|
|
61
|
+
export async function fetchAgreement(conn, jobId) {
|
|
62
|
+
const [pda] = deriveAgreementPda(jobId);
|
|
63
|
+
const info = await conn.getAccountInfo(pda, "confirmed");
|
|
64
|
+
if (!info)
|
|
65
|
+
return null;
|
|
66
|
+
return parseAgreementFromBuffer(info.data);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Layout (matches programs/sacp_agreement/src/lib.rs):
|
|
70
|
+
* discriminator (8) +
|
|
71
|
+
* buyer (32) + provider (32) + job_id (32) +
|
|
72
|
+
* sample_request_hash (32) + sample_deliverable_hash (32) +
|
|
73
|
+
* spec_uri (4-byte len + utf8) +
|
|
74
|
+
* bond_atoms (8, u64 LE) + signed_at (8, i64 LE) + bump (1)
|
|
75
|
+
*/
|
|
76
|
+
export function parseAgreementFromBuffer(data) {
|
|
77
|
+
let offset = 8; // skip Anchor discriminator
|
|
78
|
+
const readPubkey = () => {
|
|
79
|
+
const v = new PublicKey(data.subarray(offset, offset + 32));
|
|
80
|
+
offset += 32;
|
|
81
|
+
return v;
|
|
82
|
+
};
|
|
83
|
+
const readBytes32 = () => {
|
|
84
|
+
const v = new Uint8Array(data.subarray(offset, offset + 32));
|
|
85
|
+
offset += 32;
|
|
86
|
+
return v;
|
|
87
|
+
};
|
|
88
|
+
const readString = () => {
|
|
89
|
+
const len = data.readUInt32LE(offset);
|
|
90
|
+
offset += 4;
|
|
91
|
+
const v = data.subarray(offset, offset + len).toString("utf8");
|
|
92
|
+
offset += len;
|
|
93
|
+
return v;
|
|
94
|
+
};
|
|
95
|
+
const readU64 = () => {
|
|
96
|
+
const v = data.readBigUInt64LE(offset);
|
|
97
|
+
offset += 8;
|
|
98
|
+
return v;
|
|
99
|
+
};
|
|
100
|
+
const readI64 = () => {
|
|
101
|
+
const v = data.readBigInt64LE(offset);
|
|
102
|
+
offset += 8;
|
|
103
|
+
return v;
|
|
104
|
+
};
|
|
105
|
+
const readU8 = () => {
|
|
106
|
+
const v = data.readUInt8(offset);
|
|
107
|
+
offset += 1;
|
|
108
|
+
return v;
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
buyer: readPubkey(),
|
|
112
|
+
provider: readPubkey(),
|
|
113
|
+
jobId: readBytes32(),
|
|
114
|
+
sampleRequestHash: readBytes32(),
|
|
115
|
+
sampleDeliverableHash: readBytes32(),
|
|
116
|
+
specUri: readString(),
|
|
117
|
+
bondAtoms: readU64(),
|
|
118
|
+
signedAt: readI64(),
|
|
119
|
+
bump: readU8(),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=agreement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agreement.js","sourceRoot":"","sources":["../src/agreement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,SAAS,EACT,aAAa,EACb,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,SAAS,CACpD,8CAA8C,CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,SAAS,CAAC,sBAAsB,CACrC,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,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AC,MAAM,CAAC,CAAC;QAC/D,MAAM,IAAI,GAAG,CAAC;QACd,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,GAAW,EAAE;QAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,CAAC;QACZ,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,GAAW,EAAE;QAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,IAAI,CAAC,CAAC;QACZ,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,MAAM,MAAM,GAAG,GAAW,EAAE;QAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,IAAI,CAAC,CAAC;QACZ,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,UAAU,EAAE;QACnB,QAAQ,EAAE,UAAU,EAAE;QACtB,KAAK,EAAE,WAAW,EAAE;QACpB,iBAAiB,EAAE,WAAW,EAAE;QAChC,qBAAqB,EAAE,WAAW,EAAE;QACpC,OAAO,EAAE,UAAU,EAAE;QACrB,SAAS,EAAE,OAAO,EAAE;QACpB,QAAQ,EAAE,OAAO,EAAE;QACnB,IAAI,EAAE,MAAM,EAAE;KACf,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * as lst from "./lst.js";
|
|
|
25
25
|
export * as takeRate from "./take_rate.js";
|
|
26
26
|
export * as offering from "./offering.js";
|
|
27
27
|
export * as negotiation from "./negotiation.js";
|
|
28
|
+
export * as agreement from "./agreement.js";
|
|
28
29
|
export { SacpClient, JobSession, type JobActors, type JobSnapshot, type JobAction, type SacpClientConfig, } from "./runtime.js";
|
|
29
30
|
export { LocalSigner, RemoteSigner, WalletAdapterSigner, type SacpSigner, type RemoteSignTransport, type BrowserWalletAdapter, } from "./signer.js";
|
|
30
31
|
export { ProviderRuntime, EvaluatorRuntime, type ProviderRuntimeOptions, type EvaluatorRuntimeOptions, type WatcherCallbackContext, } from "./watcher.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EACL,UAAU,EACV,UAAU,EACV,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export * as lst from "./lst.js";
|
|
|
25
25
|
export * as takeRate from "./take_rate.js";
|
|
26
26
|
export * as offering from "./offering.js";
|
|
27
27
|
export * as negotiation from "./negotiation.js";
|
|
28
|
+
export * as agreement from "./agreement.js";
|
|
28
29
|
// v0.8 runtime layer — high-level client + session.
|
|
29
30
|
export { SacpClient, JobSession, } from "./runtime.js";
|
|
30
31
|
export { LocalSigner, RemoteSigner, WalletAdapterSigner, } from "./signer.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,oDAAoD;AACpD,OAAO,EACL,UAAU,EACV,UAAU,GAKX,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,GAIpB,MAAM,aAAa,CAAC;AAErB,8CAA8C;AAC9C,OAAO,EACL,eAAe,EACf,gBAAgB,GAIjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,sBAAsB,GAIvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,GAEf,MAAM,cAAc,CAAC;AAEtB,8CAA8C;AAC9C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GAEnB,MAAM,cAAc,CAAC;AAMtB,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telaro/sacp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Solana Agent Commerce Protocol (sACP) — TypeScript SDK. Job lifecycle escrow + bonded validator registry on Solana, ERC-8183 compatible. Reference implementation by Telaro Protocol.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,6 +62,10 @@
|
|
|
62
62
|
"./negotiation": {
|
|
63
63
|
"types": "./dist/negotiation.d.ts",
|
|
64
64
|
"import": "./dist/negotiation.js"
|
|
65
|
+
},
|
|
66
|
+
"./agreement": {
|
|
67
|
+
"types": "./dist/agreement.d.ts",
|
|
68
|
+
"import": "./dist/agreement.js"
|
|
65
69
|
}
|
|
66
70
|
},
|
|
67
71
|
"files": [
|
|
@@ -69,33 +73,9 @@
|
|
|
69
73
|
"README.md",
|
|
70
74
|
"INTEGRATION.md"
|
|
71
75
|
],
|
|
72
|
-
"scripts": {
|
|
73
|
-
"build": "tsc -p tsconfig.json",
|
|
74
|
-
"typecheck": "tsc --noEmit",
|
|
75
|
-
"clean": "rm -rf dist",
|
|
76
|
-
"prepublishOnly": "pnpm clean && pnpm build",
|
|
77
|
-
"smoke": "tsx tests/devnet-smoke.ts",
|
|
78
|
-
"smoke:validation": "tsx tests/devnet-validation.ts",
|
|
79
|
-
"smoke:dispute": "tsx tests/devnet-dispute.ts",
|
|
80
|
-
"smoke:reclaim": "tsx tests/devnet-reclaim.ts",
|
|
81
|
-
"smoke:all": "tsx tests/devnet-smoke.ts && tsx tests/devnet-dispute.ts && tsx tests/devnet-reclaim.ts && tsx tests/devnet-validation.ts",
|
|
82
|
-
"smoke:bonded": "tsx tests/devnet-bonded-evaluator.ts",
|
|
83
|
-
"smoke:negative": "tsx tests/devnet-negative.ts",
|
|
84
|
-
"smoke:wormhole": "tsx tests/devnet-wormhole.ts",
|
|
85
|
-
"smoke:jitosol": "tsx tests/devnet-jitosol.ts",
|
|
86
|
-
"smoke:wormhole-reclaim": "tsx tests/devnet-wormhole-reclaim.ts",
|
|
87
|
-
"smoke:take-rate": "tsx tests/devnet-take-rate.ts",
|
|
88
|
-
"smoke:runtime": "tsx tests/devnet-runtime.ts",
|
|
89
|
-
"smoke:v09": "tsx tests/devnet-v09.ts",
|
|
90
|
-
"smoke:v09-phase56": "tsx tests/devnet-v09-phase56.ts",
|
|
91
|
-
"smoke:phase7": "tsx tests/devnet-phase7.ts",
|
|
92
|
-
"smoke:phase8": "tsx tests/devnet-phase8.ts",
|
|
93
|
-
"smoke:phantom": "tsx tests/devnet-phantom.ts",
|
|
94
|
-
"smoke:x402": "tsx tests/devnet-x402.ts",
|
|
95
|
-
"smoke:mcp-server": "tsx tests/devnet-mcp-server.ts"
|
|
96
|
-
},
|
|
97
76
|
"dependencies": {
|
|
98
77
|
"@solana/web3.js": "^1.95.0",
|
|
78
|
+
"@solana/spl-token": "^0.4.0",
|
|
99
79
|
"@coral-xyz/anchor": "^0.31.0",
|
|
100
80
|
"@noble/hashes": "^1.5.0"
|
|
101
81
|
},
|
|
@@ -105,7 +85,6 @@
|
|
|
105
85
|
"typescript": "^5.5.0",
|
|
106
86
|
"tsx": "^4.16.0",
|
|
107
87
|
"express": "^4.21.0",
|
|
108
|
-
"@solana/spl-token": "^0.4.0",
|
|
109
88
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
110
89
|
},
|
|
111
90
|
"publishConfig": {
|
|
@@ -135,5 +114,33 @@
|
|
|
135
114
|
"telaro",
|
|
136
115
|
"validation-registry"
|
|
137
116
|
],
|
|
138
|
-
"type": "module"
|
|
139
|
-
|
|
117
|
+
"type": "module",
|
|
118
|
+
"scripts": {
|
|
119
|
+
"build": "tsc -p tsconfig.json",
|
|
120
|
+
"typecheck": "tsc --noEmit",
|
|
121
|
+
"clean": "rm -rf dist",
|
|
122
|
+
"smoke": "tsx tests/devnet-smoke.ts",
|
|
123
|
+
"smoke:validation": "tsx tests/devnet-validation.ts",
|
|
124
|
+
"smoke:dispute": "tsx tests/devnet-dispute.ts",
|
|
125
|
+
"smoke:reclaim": "tsx tests/devnet-reclaim.ts",
|
|
126
|
+
"smoke:all": "tsx tests/devnet-smoke.ts && tsx tests/devnet-dispute.ts && tsx tests/devnet-reclaim.ts && tsx tests/devnet-validation.ts",
|
|
127
|
+
"smoke:bonded": "tsx tests/devnet-bonded-evaluator.ts",
|
|
128
|
+
"smoke:negative": "tsx tests/devnet-negative.ts",
|
|
129
|
+
"smoke:wormhole": "tsx tests/devnet-wormhole.ts",
|
|
130
|
+
"smoke:jitosol": "tsx tests/devnet-jitosol.ts",
|
|
131
|
+
"smoke:wormhole-reclaim": "tsx tests/devnet-wormhole-reclaim.ts",
|
|
132
|
+
"smoke:take-rate": "tsx tests/devnet-take-rate.ts",
|
|
133
|
+
"smoke:runtime": "tsx tests/devnet-runtime.ts",
|
|
134
|
+
"smoke:v09": "tsx tests/devnet-v09.ts",
|
|
135
|
+
"smoke:v09-phase56": "tsx tests/devnet-v09-phase56.ts",
|
|
136
|
+
"smoke:phase7": "tsx tests/devnet-phase7.ts",
|
|
137
|
+
"smoke:phase8": "tsx tests/devnet-phase8.ts",
|
|
138
|
+
"smoke:agreement": "tsx tests/devnet-agreement.ts",
|
|
139
|
+
"smoke:phase8b": "tsx tests/devnet-phase8b.ts",
|
|
140
|
+
"smoke:jury-verdict": "tsx tests/devnet-jury-verdict.ts",
|
|
141
|
+
"smoke:resolver-routing": "tsx tests/devnet-resolver-routing.ts",
|
|
142
|
+
"smoke:phantom": "tsx tests/devnet-phantom.ts",
|
|
143
|
+
"smoke:x402": "tsx tests/devnet-x402.ts",
|
|
144
|
+
"smoke:mcp-server": "tsx tests/devnet-mcp-server.ts"
|
|
145
|
+
}
|
|
146
|
+
}
|