@integraledger/terms 0.1.0 → 0.3.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/README.md +135 -65
- package/dist/agreement.d.ts +21 -17
- package/dist/agreement.js +279 -85
- package/dist/channels.d.ts +35 -12
- package/dist/channels.js +152 -70
- package/dist/gate.d.ts +41 -18
- package/dist/gate.js +81 -47
- package/dist/index.d.ts +1 -1
- package/dist/pairings/batch.d.ts +2 -5
- package/dist/pairings/batch.js +3 -13
- package/dist/pairings/card.js +0 -2
- package/dist/pairings/common.d.ts +7 -1
- package/dist/pairings/common.js +17 -2
- package/dist/pairings/evm-x402.js +3 -3
- package/dist/pairings/lightning.js +1 -1
- package/dist/pairings/lnbtc-request.d.ts +1 -1
- package/dist/pairings/lnbtc-request.js +1 -1
- package/dist/pairings/mpp-charge-hedera.d.ts +7 -7
- package/dist/pairings/mpp-charge-hedera.js +1 -1
- package/dist/pairings/mpp-charge-stellar.js +1 -1
- package/dist/pairings/mpp-charge-tempo-memo.d.ts +1 -9
- package/dist/pairings/mpp-charge-tempo-memo.js +3 -7
- package/dist/pairings/mpp-charge-tempo-push.d.ts +0 -1
- package/dist/pairings/mpp-charge-tempo-push.js +2 -10
- package/dist/pairings/mpp-charge-xrpl.js +3 -3
- package/dist/pairings/mpp-rails.d.ts +1 -1
- package/dist/pairings/mpp-session-solana.js +2 -2
- package/dist/pairings/mpp-session-xrpl.js +3 -4
- package/dist/pairings/mpp-session.js +1 -1
- package/dist/pairings/mpp.d.ts +12 -16
- package/dist/pairings/mpp.js +32 -109
- package/dist/pairings/protocol-groups.d.ts +1 -1
- package/dist/pairings/x402-account-rails.d.ts +1 -1
- package/dist/pairings/x402-batch-settlement-eip155.js +1 -1
- package/dist/pairings/x402-batch-settlement-solana.d.ts +2 -0
- package/dist/pairings/x402-batch-settlement-solana.js +3 -2
- package/dist/pairings/x402-exact-casper.js +3 -3
- package/dist/pairings/x402-exact-ccd.js +3 -3
- package/dist/pairings/x402-exact-hedera.d.ts +4 -1
- package/dist/pairings/x402-exact-hedera.js +5 -2
- package/dist/pairings/x402-exact-solana.d.ts +4 -4
- package/dist/pairings/x402-exact-solana.js +3 -2
- package/dist/pairings/x402-exact-stellar.js +1 -1
- package/dist/pairings/x402-exact-sui.js +3 -1
- package/dist/pairings/x402-exact-tvm.js +10 -2
- package/dist/pairings/x402-exact-xrpl.js +2 -4
- package/dist/pairings/x402-rail.d.ts +1 -1
- package/dist/transact.d.ts +14 -9
- package/dist/transact.js +30 -24
- package/dist/types.d.ts +43 -18
- package/package.json +11 -12
package/dist/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { TvmUnsigned } from "@integraledger/lcp/tvm";
|
|
|
19
19
|
import type { Unsigned as UcpUnsigned } from "@integraledger/lcp/ucp";
|
|
20
20
|
import type { Unsigned as Ap2Unsigned } from "@integraledger/lcp/ap2";
|
|
21
21
|
import type { Unsigned as AcpUnsigned } from "@integraledger/lcp/acp";
|
|
22
|
-
import type { X402Unsigned } from "@integraledger/lcp/x402";
|
|
22
|
+
import type { PaymentRequired, PaymentRequirements, X402Unsigned } from "@integraledger/lcp/x402";
|
|
23
23
|
import type { SigningRequest as BatchRequest } from "@integraledger/lcp/x402-batch-settlement";
|
|
24
24
|
import type { SvmUnsigned } from "@integraledger/lcp/x402-exact-solana";
|
|
25
25
|
import type { XrplUnsigned } from "@integraledger/lcp/xrpl";
|
|
@@ -68,22 +68,12 @@ export type SigningRequest = Extract<X402Unsigned, unknown>["request"] | Extract
|
|
|
68
68
|
requests: readonly (BatchRequest | WithinSigningRequest)[];
|
|
69
69
|
} | Extract<BatchRequest, {
|
|
70
70
|
kind: "ed25519-raw";
|
|
71
|
-
}
|
|
72
|
-
/** Several calls in one Tempo `0x76` transaction, in order, signed by the payer; broadcast by it where `broadcast`. */
|
|
73
|
-
export interface TempoCalls {
|
|
74
|
-
kind: "tempo-calls";
|
|
75
|
-
chainId: number;
|
|
76
|
-
calls: readonly {
|
|
77
|
-
to: `0x${string}`;
|
|
78
|
-
data: `0x${string}`;
|
|
79
|
-
}[];
|
|
80
|
-
validBefore: number;
|
|
81
|
-
broadcast: boolean;
|
|
82
|
-
}
|
|
71
|
+
}>;
|
|
83
72
|
/**
|
|
84
|
-
* The signer's answer, as JSON.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
73
|
+
* The signer's answer, as JSON. Each kind's form is its buyer piece's: a signature for the kinds whose payment takes one
|
|
74
|
+
* signature, an object for the kinds whose payment takes several values, and a list, in order, for `batch`. Byte strings
|
|
75
|
+
* are `0x` hex, except where the signers guide names another form for the kind: base58, base64, or hex digits without
|
|
76
|
+
* `0x`.
|
|
87
77
|
*/
|
|
88
78
|
export type Signature = Json;
|
|
89
79
|
export interface Signer {
|
|
@@ -96,11 +86,15 @@ export interface Signer {
|
|
|
96
86
|
export type Inputs = {
|
|
97
87
|
readonly [k: string]: Json;
|
|
98
88
|
};
|
|
99
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* What the gate chose to pay, as plain JSON data, so `finish` can rebuild the same request. `agreement` is the agreement
|
|
91
|
+
* URL the seller's offer names, for a pairing whose payment is not itself a public proof of the ATR hash.
|
|
92
|
+
*/
|
|
100
93
|
export interface Chosen {
|
|
101
94
|
pairing: string;
|
|
102
95
|
choice: Json;
|
|
103
96
|
ref: string;
|
|
97
|
+
agreement?: string;
|
|
104
98
|
}
|
|
105
99
|
export type DeclineCode = "pairing-not-supported" | "offer-unreadable" | "no-payable-option" | "link-not-https" | "atr-unfetchable" | "atr-too-large" | "hash-mismatch" | "signer-failed" | "signed-not-bound" | "agreement-not-offered" | "agreement-pending" | "agreement-failed";
|
|
106
100
|
export interface Reason {
|
|
@@ -119,10 +113,25 @@ export type Declined = {
|
|
|
119
113
|
readonly h: AtrHash;
|
|
120
114
|
};
|
|
121
115
|
};
|
|
122
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* `transact`'s optional members: the buyer's own chain values; the signer that pays the agreement; the agreement payment
|
|
118
|
+
* the agent approved, exactly as `transact` or `agree` returned it in `approve`; and a signal that ends the agreement
|
|
119
|
+
* exchange.
|
|
120
|
+
*/
|
|
123
121
|
export interface TransactOptions {
|
|
124
122
|
readonly inputs?: Inputs | undefined;
|
|
125
123
|
readonly agreementSigner?: Signer | undefined;
|
|
124
|
+
readonly approved?: AgreementPayment | undefined;
|
|
125
|
+
readonly signal?: AbortSignal | undefined;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* `agree`'s optional members: the agreement payment the agent approved, exactly as it was returned in `approve`; the
|
|
129
|
+
* buyer's own chain values; and a signal that ends the exchange.
|
|
130
|
+
*/
|
|
131
|
+
export interface AgreeOptions {
|
|
132
|
+
readonly approved?: AgreementPayment | undefined;
|
|
133
|
+
readonly inputs?: Inputs | undefined;
|
|
134
|
+
readonly signal?: AbortSignal | undefined;
|
|
126
135
|
}
|
|
127
136
|
/** The next request of a pairing signed in steps. */
|
|
128
137
|
export interface Next {
|
|
@@ -134,6 +143,22 @@ export interface Read {
|
|
|
134
143
|
link: string;
|
|
135
144
|
offer?: unknown;
|
|
136
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The agreement payment, for the buyer's agent to approve before anything is signed: the agreement URL; `option`, the
|
|
148
|
+
* option of the agreement URL's payment request that the gate pays, whose `amount`, `asset`, `payTo` and `network` are
|
|
149
|
+
* the terms the agent approves; and `required`, that payment request as the agreement URL served it.
|
|
150
|
+
*/
|
|
151
|
+
export interface AgreementPayment {
|
|
152
|
+
readonly url: string;
|
|
153
|
+
readonly option: PaymentRequirements;
|
|
154
|
+
readonly required: PaymentRequired;
|
|
155
|
+
}
|
|
156
|
+
/** An agreement payment the agent approves before it is signed, with the ATR bytes the gate compared and their hash. */
|
|
157
|
+
export interface ToApprove {
|
|
158
|
+
readonly approve: AgreementPayment;
|
|
159
|
+
readonly bytes: Uint8Array;
|
|
160
|
+
readonly h: AtrHash;
|
|
161
|
+
}
|
|
137
162
|
/** The agreement resource's answer once the agreement payment carrying the ATR hash is recorded. */
|
|
138
163
|
export interface AgreementReceipt {
|
|
139
164
|
atrHash: AtrHash;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integraledger/terms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Buyer gate: compare the ATR hash with the served bytes, and build the payment with that hash, before signing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentic-commerce",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=26.
|
|
19
|
+
"node": ">=26.11.1"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -39,22 +39,21 @@
|
|
|
39
39
|
"dist",
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
|
-
"
|
|
43
|
-
"@integraledger/lcp": "0.
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@integraledger/lcp": "~0.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@stacks/transactions": "7.6.0",
|
|
51
|
-
"@stellar/stellar-sdk": "17.1.0",
|
|
46
|
+
"@integraledger/lcp": "0.4.0",
|
|
47
|
+
"@mysten/sui": "2.35.0",
|
|
48
|
+
"@solana/kit": "8.4.0",
|
|
49
|
+
"@stellar/stellar-sdk": "17.2.1",
|
|
52
50
|
"@ton/core": "0.63.1",
|
|
53
51
|
"algosdk": "3.8.0",
|
|
54
|
-
"borsh": "
|
|
52
|
+
"borsh": "2.0.0",
|
|
55
53
|
"esbuild": "0.28.2",
|
|
54
|
+
"near-api-js": "7.3.1",
|
|
56
55
|
"ripple-binary-codec": "2.11.0",
|
|
57
|
-
"viem": "2.
|
|
56
|
+
"viem": "2.57.4"
|
|
58
57
|
},
|
|
59
58
|
"scripts": {
|
|
60
59
|
"build": "tsc -p tsconfig.json",
|