@integraledger/terms 0.1.0 → 0.2.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/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";
@@ -96,11 +96,15 @@ export interface Signer {
96
96
  export type Inputs = {
97
97
  readonly [k: string]: Json;
98
98
  };
99
- /** What the gate chose to pay, as plain JSON data, so `finish` can rebuild the same request. */
99
+ /**
100
+ * What the gate chose to pay, as plain JSON data, so `finish` can rebuild the same request. `agreement` is the agreement
101
+ * URL the seller's offer names, for a pairing whose payment is not itself a public proof of the ATR hash.
102
+ */
100
103
  export interface Chosen {
101
104
  pairing: string;
102
105
  choice: Json;
103
106
  ref: string;
107
+ agreement?: string;
104
108
  }
105
109
  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
110
  export interface Reason {
@@ -119,10 +123,25 @@ export type Declined = {
119
123
  readonly h: AtrHash;
120
124
  };
121
125
  };
122
- /** `transact`'s optional members: the buyer's own chain values, and the signer that pays the agreement. */
126
+ /**
127
+ * `transact`'s optional members: the buyer's own chain values; the signer that pays the agreement; the agreement payment
128
+ * the agent approved, exactly as `transact` or `agree` returned it in `approve`; and a signal that ends the agreement
129
+ * exchange.
130
+ */
123
131
  export interface TransactOptions {
124
132
  readonly inputs?: Inputs | undefined;
125
133
  readonly agreementSigner?: Signer | undefined;
134
+ readonly approved?: AgreementPayment | undefined;
135
+ readonly signal?: AbortSignal | undefined;
136
+ }
137
+ /**
138
+ * `agree`'s optional members: the agreement payment the agent approved, exactly as it was returned in `approve`; the
139
+ * buyer's own chain values; and a signal that ends the exchange.
140
+ */
141
+ export interface AgreeOptions {
142
+ readonly approved?: AgreementPayment | undefined;
143
+ readonly inputs?: Inputs | undefined;
144
+ readonly signal?: AbortSignal | undefined;
126
145
  }
127
146
  /** The next request of a pairing signed in steps. */
128
147
  export interface Next {
@@ -134,6 +153,22 @@ export interface Read {
134
153
  link: string;
135
154
  offer?: unknown;
136
155
  }
156
+ /**
157
+ * The agreement payment, for the buyer's agent to approve before anything is signed: the agreement URL; `option`, the
158
+ * option of the agreement URL's payment request that the gate pays, whose `amount`, `asset`, `payTo` and `network` are
159
+ * what the payment moves; and `required`, that payment request as the agreement URL served it.
160
+ */
161
+ export interface AgreementPayment {
162
+ readonly url: string;
163
+ readonly option: PaymentRequirements;
164
+ readonly required: PaymentRequired;
165
+ }
166
+ /** An agreement payment the agent approves before it is signed, with the ATR bytes the gate compared and their hash. */
167
+ export interface ToApprove {
168
+ readonly approve: AgreementPayment;
169
+ readonly bytes: Uint8Array;
170
+ readonly h: AtrHash;
171
+ }
137
172
  /** The agreement resource's answer once the agreement payment carrying the ATR hash is recorded. */
138
173
  export interface AgreementReceipt {
139
174
  atrHash: AtrHash;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraledger/terms",
3
- "version": "0.1.0",
3
+ "version": "0.2.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",
@@ -40,7 +40,7 @@
40
40
  "LICENSE"
41
41
  ],
42
42
  "dependencies": {
43
- "@integraledger/lcp": "0.1.0"
43
+ "@integraledger/lcp": "0.2.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@mysten/sui": "2.31.3",