@shodai-network/agreements-protocol-evm 0.1.4 → 0.2.0-rc.1
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/CHANGELOG.md +134 -0
- package/README.md +123 -0
- package/dist/cjs/AgreementEngine.d.ts +42 -15
- package/dist/cjs/AgreementEngine.d.ts.map +1 -1
- package/dist/cjs/AgreementEngine.js +68 -15
- package/dist/cjs/AgreementEngine.js.map +1 -1
- package/dist/cjs/AgreementFactory.d.ts +66 -13
- package/dist/cjs/AgreementFactory.d.ts.map +1 -1
- package/dist/cjs/AgreementFactory.js +153 -72
- package/dist/cjs/AgreementFactory.js.map +1 -1
- package/dist/cjs/deployments.d.ts +11 -0
- package/dist/cjs/deployments.d.ts.map +1 -1
- package/dist/cjs/deployments.js.map +1 -1
- package/dist/cjs/generated/AgreementEngineAbi.d.ts +88 -31
- package/dist/cjs/generated/AgreementEngineAbi.d.ts.map +1 -1
- package/dist/cjs/generated/AgreementEngineAbi.js +109 -34
- package/dist/cjs/generated/AgreementEngineAbi.js.map +1 -1
- package/dist/cjs/generated/AgreementFactoryAbi.d.ts +20 -42
- package/dist/cjs/generated/AgreementFactoryAbi.d.ts.map +1 -1
- package/dist/cjs/generated/AgreementFactoryAbi.js +24 -53
- package/dist/cjs/generated/AgreementFactoryAbi.js.map +1 -1
- package/dist/cjs/generated/DeploymentsRegistry.d.ts +13 -4
- package/dist/cjs/generated/DeploymentsRegistry.d.ts.map +1 -1
- package/dist/cjs/generated/DeploymentsRegistry.js +13 -4
- package/dist/cjs/generated/DeploymentsRegistry.js.map +1 -1
- package/dist/cjs/transformer.d.ts +5 -1
- package/dist/cjs/transformer.d.ts.map +1 -1
- package/dist/cjs/transformer.js +413 -3
- package/dist/cjs/transformer.js.map +1 -1
- package/dist/cjs/types.d.ts +47 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js +7 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/AgreementEngine.d.ts +42 -15
- package/dist/esm/AgreementEngine.d.ts.map +1 -1
- package/dist/esm/AgreementEngine.js +68 -15
- package/dist/esm/AgreementEngine.js.map +1 -1
- package/dist/esm/AgreementFactory.d.ts +66 -13
- package/dist/esm/AgreementFactory.d.ts.map +1 -1
- package/dist/esm/AgreementFactory.js +154 -73
- package/dist/esm/AgreementFactory.js.map +1 -1
- package/dist/esm/deployments.d.ts +11 -0
- package/dist/esm/deployments.d.ts.map +1 -1
- package/dist/esm/deployments.js.map +1 -1
- package/dist/esm/generated/AgreementEngineAbi.d.ts +88 -31
- package/dist/esm/generated/AgreementEngineAbi.d.ts.map +1 -1
- package/dist/esm/generated/AgreementEngineAbi.js +109 -34
- package/dist/esm/generated/AgreementEngineAbi.js.map +1 -1
- package/dist/esm/generated/AgreementFactoryAbi.d.ts +20 -42
- package/dist/esm/generated/AgreementFactoryAbi.d.ts.map +1 -1
- package/dist/esm/generated/AgreementFactoryAbi.js +24 -53
- package/dist/esm/generated/AgreementFactoryAbi.js.map +1 -1
- package/dist/esm/generated/DeploymentsRegistry.d.ts +13 -4
- package/dist/esm/generated/DeploymentsRegistry.d.ts.map +1 -1
- package/dist/esm/generated/DeploymentsRegistry.js +13 -4
- package/dist/esm/generated/DeploymentsRegistry.js.map +1 -1
- package/dist/esm/transformer.d.ts +5 -1
- package/dist/esm/transformer.d.ts.map +1 -1
- package/dist/esm/transformer.js +413 -3
- package/dist/esm/transformer.js.map +1 -1
- package/dist/esm/types.d.ts +47 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +7 -0
- package/dist/esm/types.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@shodai-network/agreements-protocol-evm` are recorded here.
|
|
4
|
+
|
|
5
|
+
## 0.2.0
|
|
6
|
+
|
|
7
|
+
The client for the V1.1 contracts. It does not work against V1.0 deployments:
|
|
8
|
+
the permit calls, `predictAddress` and the bundled ABIs all changed with the
|
|
9
|
+
contracts. The names exported from the package root are the same as in 0.1.4.
|
|
10
|
+
|
|
11
|
+
### Breaking changes
|
|
12
|
+
|
|
13
|
+
- **Permit signatures are a single hex string, not `{ v, r, s }`.**
|
|
14
|
+
`AgreementEngine.createPermitSignature` and
|
|
15
|
+
`AgreementFactory.createPermitSignature` now return `signature` as one `Hex`
|
|
16
|
+
value, and `AgreementEngine.submitInputWithPermit`,
|
|
17
|
+
`AgreementFactory.createAgreementWithPermit` and
|
|
18
|
+
`AgreementFactory.createAgreementDeterministicWithPermit` take it in that
|
|
19
|
+
form. The contracts accept the bytes as they are, either a normal wallet
|
|
20
|
+
signature or one that a smart-account signer (ERC-1271) accepts. The
|
|
21
|
+
`CreateAgreementPermitSignature` type is now `Hex`.
|
|
22
|
+
|
|
23
|
+
- **Every permit names its signer.** The signed message of all three permit
|
|
24
|
+
types starts with a `signer` address field. Permits signed with 0.1.4 are not
|
|
25
|
+
accepted by the V1.1 contracts, and the other way round.
|
|
26
|
+
An input permit is otherwise as before: it carries the signer's permit nonce
|
|
27
|
+
on that agreement and a deadline, and does not name a state. Several parties
|
|
28
|
+
can sign up front and have their permits submitted in whatever order the
|
|
29
|
+
agreement's transitions allow. One signer has one live input permit per
|
|
30
|
+
agreement at a time, because each permit uses the signer's current nonce.
|
|
31
|
+
A permit that has not been submitted stays usable until its deadline, so
|
|
32
|
+
keep deadlines short, or withdraw it with `cancelPermits` (below).
|
|
33
|
+
|
|
34
|
+
- **A direct input retires the sender's outstanding input permit.** In V1.1 an
|
|
35
|
+
input accepted through `submitInput` consumes the sender's permit nonce on
|
|
36
|
+
that agreement, as an accepted permit does. An input permit the sender signed
|
|
37
|
+
earlier and that was not submitted is then refused (`InvalidSignature`); sign
|
|
38
|
+
again with `createPermitSignature`, which reads the new nonce. Under V1.0 the
|
|
39
|
+
earlier permit stayed valid and could be submitted the next time the
|
|
40
|
+
agreement accepted its input. Permits signed by other parties are not
|
|
41
|
+
affected. The first direct input an account sends to an agreement costs about
|
|
42
|
+
22,000 more gas than under V1.0, and later ones about 5,000 more.
|
|
43
|
+
|
|
44
|
+
- **Deterministic creation has its own permit.** A signature from
|
|
45
|
+
`AgreementFactory.createPermitSignature` is no longer accepted by
|
|
46
|
+
`createAgreementDeterministicWithPermit`. Sign with the new
|
|
47
|
+
`AgreementFactory.createDeterministicPermitSignature(walletClient, agreement, salt, deadline, options)`,
|
|
48
|
+
which also binds the salt and the address the agreement will be deployed at.
|
|
49
|
+
|
|
50
|
+
- **Deterministic addresses belong to their creator.**
|
|
51
|
+
`AgreementFactory.predictAddress` now takes the creator first:
|
|
52
|
+
`predictAddress(creator, salt)`. The creator is the caller of
|
|
53
|
+
`createAgreementDeterministic`, or the signer of a deterministic permit. The
|
|
54
|
+
same salt gives a different address for a different creator, so knowing a
|
|
55
|
+
salt does not let another account deploy to the address it predicts. The
|
|
56
|
+
address does not depend on the agreement's terms: a creator can deploy any
|
|
57
|
+
one agreement at the address of a given salt, so verify a deployed agreement
|
|
58
|
+
before relying on an address that was only predicted. The addresses differ
|
|
59
|
+
from those the V1.0 factory derived for the same salt.
|
|
60
|
+
|
|
61
|
+
- **ABIs regenerated.** `AgreementEngineABI` and `AgreementFactoryABI` describe
|
|
62
|
+
the V1.1 contracts.
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
- `AgreementEngine.cancelPermits(waitForConfirmation?)` withdraws the input
|
|
67
|
+
permit the connected account signed for that agreement and that has not been
|
|
68
|
+
submitted yet (the contract's new `cancelPermits` function). It consumes the
|
|
69
|
+
account's permit nonce, must be sent by the signer itself, and affects no
|
|
70
|
+
other signer or agreement.
|
|
71
|
+
- `AgreementFactory.createDeterministicPermitSignature`, described above.
|
|
72
|
+
- **Time windows on inputs.** An input in the agreement JSON can carry
|
|
73
|
+
`time: { notBefore, before }`. `notBefore` accepts the input at that moment
|
|
74
|
+
and after it; `before` accepts it only before that moment. Each bound is a
|
|
75
|
+
fixed moment (seconds since 1970-01-01 UTC, or an ISO 8601 date-time with a
|
|
76
|
+
zone) or `"${variables.name}"`, a `uint256` variable that holds seconds and is
|
|
77
|
+
listed in `execution.initialize.data`. The transform turns the window into
|
|
78
|
+
conditions on the block time, which the V1.1 engine reads when the input is
|
|
79
|
+
submitted, directly or by permit. Refused when the agreement is transformed:
|
|
80
|
+
a bound the SDK does not know, anything but exactly one variable reference
|
|
81
|
+
in a bound that names a variable, a date-time without a zone or that does
|
|
82
|
+
not exist, a moment outside 2001 to 2286, a stored date whose value at
|
|
83
|
+
creation is not such a moment, and a window that could never be met (fixed
|
|
84
|
+
bounds in the wrong order, or the same variable on both bounds). An engine
|
|
85
|
+
from before time conditions, V1.0 included, does not enforce a window, and
|
|
86
|
+
an SDK from before them ignores `time`: create such an agreement on a V1.1
|
|
87
|
+
factory with this SDK. `transformInputs` takes an optional third argument,
|
|
88
|
+
the names of the variables stored at creation; it is needed only when a bound
|
|
89
|
+
names a variable. `agreements/delivery-deadline` is an example.
|
|
90
|
+
- **Checks and stored values on inputs.** An input can carry `checks`, a list
|
|
91
|
+
of comparisons of one `uint256` field (`equalTo`, `lessThan`,
|
|
92
|
+
`lessThanOrEqualTo`, `greaterThan`, `greaterThanOrEqualTo`) with a whole
|
|
93
|
+
number or a stored `uint256` variable, optionally `plus` or `minus` a whole
|
|
94
|
+
number, and `store`, the fields whose submitted value the agreement keeps.
|
|
95
|
+
With them an agreement can count rounds and repeat one set of states.
|
|
96
|
+
A checked or stored field must be required, and a check the SDK cannot read
|
|
97
|
+
is refused. Also refused: a variable in a check that has no value before the
|
|
98
|
+
check can run, a stored field of another type than the variable it replaces,
|
|
99
|
+
an empty `store` list, and a value at creation for a checked or stored
|
|
100
|
+
variable that is not a whole number written as digits. A check against a
|
|
101
|
+
stored variable, with or without `plus` or `minus`, uses the engine's offset
|
|
102
|
+
comparisons, so an engine from before them, V1.0 included, refuses to create
|
|
103
|
+
the agreement. An SDK from before checks ignores `checks` and `store` and
|
|
104
|
+
deploys the agreement with nothing checked and nothing stored: build such an
|
|
105
|
+
agreement with this version or a later one.
|
|
106
|
+
`agreements/counted-milestones` is an example.
|
|
107
|
+
|
|
108
|
+
### Limits
|
|
109
|
+
|
|
110
|
+
- **Actions cannot send native ETH.** A V1.1 agreement has no way to receive
|
|
111
|
+
ETH, so the contracts refuse to create an agreement whose action carries a
|
|
112
|
+
non-zero `value` (`ActionValueNotSupported`), and the SDK refuses to build
|
|
113
|
+
one. Token transfers and other calls with no ETH value are unaffected.
|
|
114
|
+
- **`block.timestamp` is a reserved field name.** The engine reads the block
|
|
115
|
+
time for a condition on that field, so an agreement cannot declare an input
|
|
116
|
+
field or a stored variable with it (`ReservedFieldId`), and the SDK refuses
|
|
117
|
+
to build one.
|
|
118
|
+
- **An action's target must be a deployed contract when its transition runs.**
|
|
119
|
+
If the target address has no code, the input reverts with
|
|
120
|
+
`ActionTargetHasNoCode` and the state does not move. The target may be
|
|
121
|
+
deployed after the agreement is created.
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
- `viem` moves from 2.43.2 to 2.57.20, which brings a patched `ws`. The pin is
|
|
126
|
+
still exact.
|
|
127
|
+
|
|
128
|
+
### Deployments
|
|
129
|
+
|
|
130
|
+
The bundled deployment registry (`getDeploymentByChainId` and related helpers)
|
|
131
|
+
lists V1.1 on Linea Sepolia (chain 59141). Its record keeps the V1.0 pair it
|
|
132
|
+
replaced under `legacy`. The other four networks still list their V1.0
|
|
133
|
+
deployments, which this client cannot drive with permits: until V1.1 is
|
|
134
|
+
deployed there, pass a V1.1 factory address explicitly on those networks.
|
package/README.md
CHANGED
|
@@ -97,6 +97,129 @@ const state = await readOnlyAgreement.getCurrentState();
|
|
|
97
97
|
const data = await readOnlyAgreement.getData();
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
### Time Windows
|
|
101
|
+
|
|
102
|
+
An input can be limited to a period of time. Add `time` to the input in the
|
|
103
|
+
agreement JSON:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
"deliver": {
|
|
107
|
+
"type": "VerifiedCredentialEIP712",
|
|
108
|
+
"data": { "deliveryNote": "${variables.deliveryNote}" },
|
|
109
|
+
"issuer": "${variables.supplier.value}",
|
|
110
|
+
"time": { "before": "${variables.dueDate}" }
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- `notBefore`: the input is accepted at that moment and after it.
|
|
115
|
+
- `before`: the input is accepted only before that moment.
|
|
116
|
+
|
|
117
|
+
Each bound is a fixed moment or a stored date:
|
|
118
|
+
|
|
119
|
+
- A fixed moment is a whole number of seconds since 1970-01-01 UTC, or an
|
|
120
|
+
ISO 8601 date-time with a zone, such as `"2027-03-01T00:00:00Z"`.
|
|
121
|
+
- A stored date is `"${variables.name}"`. The variable must have type
|
|
122
|
+
`uint256`, hold seconds since 1970-01-01 UTC, and be listed in
|
|
123
|
+
`execution.initialize.data`, so that the agreement stores it when it is
|
|
124
|
+
created.
|
|
125
|
+
|
|
126
|
+
A bound is exactly one of those forms. Arithmetic or text around a variable
|
|
127
|
+
reference, a date that does not exist, a moment outside 2001 to 2286 (usually
|
|
128
|
+
milliseconds given as seconds) and the same stored date on both bounds are
|
|
129
|
+
refused when the agreement is transformed.
|
|
130
|
+
|
|
131
|
+
The contract reads the block time when the input is submitted, directly or by
|
|
132
|
+
permit. What counts is the block the input lands in, not when it was signed: a
|
|
133
|
+
permit signed inside a window is refused if it is submitted after the window
|
|
134
|
+
has closed. A refused input reverts with `ComparisonFailed`.
|
|
135
|
+
|
|
136
|
+
The block time is set by the block producer and can differ from the clock by a
|
|
137
|
+
few seconds. Use windows for dates and deadlines, not to order inputs that
|
|
138
|
+
arrive seconds apart.
|
|
139
|
+
|
|
140
|
+
`agreements/delivery-deadline` in the repository is a complete example.
|
|
141
|
+
|
|
142
|
+
Time windows need both sides to know them:
|
|
143
|
+
|
|
144
|
+
- **The contracts.** Create the agreement on a V1.1 factory whose engine has
|
|
145
|
+
time conditions. An older engine, V1.0 included, accepts the agreement and
|
|
146
|
+
does not enforce the window: there the party submitting an input can state
|
|
147
|
+
the time itself.
|
|
148
|
+
- **The SDK.** A version of this SDK from before time windows ignores `time`
|
|
149
|
+
and deploys the agreement with no window, without an error.
|
|
150
|
+
|
|
151
|
+
### Checks And Stored Values
|
|
152
|
+
|
|
153
|
+
An input can check a submitted number against a constant or against a value the
|
|
154
|
+
agreement stores, and can store a number it submits. Together they let an
|
|
155
|
+
agreement repeat a set of steps a counted number of times with one set of
|
|
156
|
+
states.
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
"acceptMilestone": {
|
|
160
|
+
"type": "VerifiedCredentialEIP712",
|
|
161
|
+
"data": {
|
|
162
|
+
"reviewNote": "${variables.reviewNote}",
|
|
163
|
+
"milestone": "${variables.milestone}",
|
|
164
|
+
"currentMilestone": "${variables.currentMilestone}"
|
|
165
|
+
},
|
|
166
|
+
"issuer": "${variables.reviewer.value}",
|
|
167
|
+
"checks": [
|
|
168
|
+
{ "field": "milestone", "is": "equalTo", "to": "${variables.currentMilestone}" },
|
|
169
|
+
{ "field": "milestone", "is": "lessThan", "to": "${variables.milestoneCount}" },
|
|
170
|
+
{ "field": "currentMilestone", "is": "equalTo", "to": "${variables.currentMilestone}", "plus": 1 }
|
|
171
|
+
],
|
|
172
|
+
"store": ["currentMilestone"]
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- `checks`: each entry compares one `uint256` field of the input. `is` is one of
|
|
177
|
+
`equalTo`, `lessThan`, `lessThanOrEqualTo`, `greaterThan`,
|
|
178
|
+
`greaterThanOrEqualTo`. `to` is a whole number or `"${variables.name}"`, a
|
|
179
|
+
`uint256` variable the agreement stores. With a stored variable, `plus` or
|
|
180
|
+
`minus` adds or subtracts a whole number first. Every check must hold.
|
|
181
|
+
- `store`: the fields of the input whose submitted value the agreement keeps
|
|
182
|
+
when the input is accepted. The value replaces the stored variable of the
|
|
183
|
+
same name.
|
|
184
|
+
|
|
185
|
+
A checked field and a stored field must be required: the contract skips a check
|
|
186
|
+
on an optional field that is left out. Checks are evaluated against the values
|
|
187
|
+
stored before the input, so "the stored value plus one" in the example means one
|
|
188
|
+
more than the milestone the agreement was on.
|
|
189
|
+
|
|
190
|
+
In a loop, give every repeated step a field that names its round and check it
|
|
191
|
+
against the stored round, as `milestone` does above. A step that was signed for
|
|
192
|
+
an earlier round and never submitted is then refused in a later one.
|
|
193
|
+
|
|
194
|
+
Refused when the agreement is transformed, because the agreement could not work
|
|
195
|
+
as written:
|
|
196
|
+
|
|
197
|
+
- a variable in a check that has no value before the check can run: it is not
|
|
198
|
+
listed in `execution.initialize.data`, and every input that stores it also
|
|
199
|
+
checks against it;
|
|
200
|
+
- a stored field whose type is not that of the variable it replaces, or of the
|
|
201
|
+
field another input stores under the same name;
|
|
202
|
+
- an empty `store` list;
|
|
203
|
+
- a value at creation, for a variable that a check names or an input stores,
|
|
204
|
+
that is not a whole number written as digits (`""`, `" 2 "`, `"0x10"` and
|
|
205
|
+
`true` are refused, where they would otherwise be read as 0, 2, 16 and 1).
|
|
206
|
+
|
|
207
|
+
The SDK does not work out whether the checks of an input can be met together,
|
|
208
|
+
or whether a counter starts within its count: run the agreement once before it
|
|
209
|
+
is used.
|
|
210
|
+
|
|
211
|
+
`agreements/counted-milestones` is a complete example.
|
|
212
|
+
|
|
213
|
+
Checks and stored values need both sides to know them:
|
|
214
|
+
|
|
215
|
+
- **The contracts.** A check against a stored variable, with or without `plus`
|
|
216
|
+
or `minus`, is built with the engine's offset comparisons. An engine from
|
|
217
|
+
before them, V1.0 included, refuses to create the agreement.
|
|
218
|
+
- **The SDK.** A version of this SDK from before checks ignores `checks` and
|
|
219
|
+
`store` and deploys the agreement with nothing checked and nothing stored,
|
|
220
|
+
without an error. Build and deploy such an agreement with this version or a
|
|
221
|
+
later one.
|
|
222
|
+
|
|
100
223
|
## License
|
|
101
224
|
|
|
102
225
|
The SDK package is licensed under `Apache-2.0`. See [`LICENSE`](LICENSE), [`NOTICE`](NOTICE), [../licenses/Apache-2.0.txt](../licenses/Apache-2.0.txt), and [../LICENSING.md](../LICENSING.md).
|
|
@@ -87,6 +87,10 @@ export declare class AgreementEngine {
|
|
|
87
87
|
/**
|
|
88
88
|
* Submit an input to progress the agreement's state machine
|
|
89
89
|
*
|
|
90
|
+
* An accepted input consumes the sender's permit nonce on this agreement, so
|
|
91
|
+
* an input permit the sender signed earlier and that was not submitted is no
|
|
92
|
+
* longer accepted. Permits signed by other parties are not affected.
|
|
93
|
+
*
|
|
90
94
|
* @param agreement - The agreement JSON definition (for field type resolution)
|
|
91
95
|
* @param inputId - The input identifier (e.g., "grantorData")
|
|
92
96
|
* @param data - Plain object with field values
|
|
@@ -132,12 +136,23 @@ export declare class AgreementEngine {
|
|
|
132
136
|
/**
|
|
133
137
|
* Create an EIP-712 permit signature for submitting an input
|
|
134
138
|
*
|
|
135
|
-
*
|
|
139
|
+
* The permit names its signer (the wallet client's account) and carries the
|
|
140
|
+
* signer's current permit nonce on this agreement. It does not name a state:
|
|
141
|
+
* it stays usable until its deadline, in any state that accepts the input,
|
|
142
|
+
* until it or another permit of the same signer is accepted, the signer has
|
|
143
|
+
* an input accepted through `submitInput`, or the signer calls
|
|
144
|
+
* `cancelPermits`. Another party's input does not affect it, so several
|
|
145
|
+
* parties can sign up front and have their permits submitted in whatever
|
|
146
|
+
* order the agreement's transitions allow. Because each permit uses the
|
|
147
|
+
* signer's current nonce, one signer has one live permit per agreement at a
|
|
148
|
+
* time.
|
|
149
|
+
*
|
|
150
|
+
* @param walletClient - viem WalletClient that signs the typed data (must be connected to an account)
|
|
136
151
|
* @param agreement - The agreement JSON definition
|
|
137
152
|
* @param inputId - The input identifier (e.g., "grantorData")
|
|
138
153
|
* @param data - Plain object with field values
|
|
139
154
|
* @param deadline - Unix timestamp when the permit expires
|
|
140
|
-
* @returns The signature
|
|
155
|
+
* @returns The signature bytes and the signer address
|
|
141
156
|
*
|
|
142
157
|
* @example
|
|
143
158
|
* ```typescript
|
|
@@ -145,7 +160,7 @@ export declare class AgreementEngine {
|
|
|
145
160
|
* const deadline = Math.floor(Date.now() / 1000) + 3600; // 1 hour from now
|
|
146
161
|
*
|
|
147
162
|
* const { signature, signerAddress } = await agreement.createPermitSignature(
|
|
148
|
-
*
|
|
163
|
+
* walletClient,
|
|
149
164
|
* agreementJson,
|
|
150
165
|
* "grantorData",
|
|
151
166
|
* { grantorName: "Alice" },
|
|
@@ -154,11 +169,7 @@ export declare class AgreementEngine {
|
|
|
154
169
|
* ```
|
|
155
170
|
*/
|
|
156
171
|
createPermitSignature(walletClient: WalletClient, agreement: AgreementJson, inputId: string, data: Record<string, unknown>, deadline: number): Promise<{
|
|
157
|
-
signature:
|
|
158
|
-
v: number;
|
|
159
|
-
r: string;
|
|
160
|
-
s: string;
|
|
161
|
-
};
|
|
172
|
+
signature: Hex;
|
|
162
173
|
signerAddress: Hex;
|
|
163
174
|
}>;
|
|
164
175
|
/**
|
|
@@ -169,7 +180,7 @@ export declare class AgreementEngine {
|
|
|
169
180
|
* @param inputId - The input identifier
|
|
170
181
|
* @param data - Plain object with field values
|
|
171
182
|
* @param deadline - Unix timestamp when the permit expires
|
|
172
|
-
* @param signature - The permit signature (
|
|
183
|
+
* @param signature - The permit signature bytes (EOA signature, or bytes an ERC-1271 signer contract accepts)
|
|
173
184
|
* @param waitForConfirmation - Whether to wait for transaction confirmation (default: false)
|
|
174
185
|
* @returns Transaction hash, or receipt if waitForConfirmation is true
|
|
175
186
|
*
|
|
@@ -177,7 +188,7 @@ export declare class AgreementEngine {
|
|
|
177
188
|
* ```typescript
|
|
178
189
|
* // Signer creates permit off-chain
|
|
179
190
|
* const { signature, signerAddress } = await agreement.createPermitSignature(
|
|
180
|
-
*
|
|
191
|
+
* walletClient,
|
|
181
192
|
* agreementJson,
|
|
182
193
|
* "grantorData",
|
|
183
194
|
* { grantorName: "Alice" },
|
|
@@ -210,10 +221,26 @@ export declare class AgreementEngine {
|
|
|
210
221
|
* console.log(`Transaction confirmed in block ${receipt.blockNumber}`);
|
|
211
222
|
* ```
|
|
212
223
|
*/
|
|
213
|
-
submitInputWithPermit(signer: Hex, agreement: AgreementJson, inputId: string, data: Record<string, unknown>, deadline: number, signature:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
224
|
+
submitInputWithPermit(signer: Hex, agreement: AgreementJson, inputId: string, data: Record<string, unknown>, deadline: number, signature: Hex, waitForConfirmation?: boolean): Promise<Hash | TransactionReceipt>;
|
|
225
|
+
/**
|
|
226
|
+
* Cancel the input permit the connected account has signed for this
|
|
227
|
+
* agreement and that has not been submitted yet
|
|
228
|
+
*
|
|
229
|
+
* Consumes the account's current permit nonce on this agreement, so any
|
|
230
|
+
* unsubmitted permit it signed with that nonce is no longer accepted. Other
|
|
231
|
+
* signers and other agreements are not affected. The transaction must be sent
|
|
232
|
+
* by the signer itself: there is no relayed form.
|
|
233
|
+
*
|
|
234
|
+
* @param waitForConfirmation - If true, waits for confirmation and returns the receipt
|
|
235
|
+
* @returns Transaction hash, or the receipt when waiting for confirmation
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const agreement = new AgreementEngine("0x...", publicClient, walletClient);
|
|
240
|
+
* await agreement.cancelPermits(true);
|
|
241
|
+
* // Sign again with createPermitSignature: it reads the new nonce.
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
cancelPermits(waitForConfirmation?: boolean): Promise<Hash | TransactionReceipt>;
|
|
218
245
|
}
|
|
219
246
|
//# sourceMappingURL=AgreementEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgreementEngine.d.ts","sourceRoot":"","sources":["../../src/AgreementEngine.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,IAAI,EAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACG,qBAAqB,CACzB,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,GAAG,EACd,mBAAmB,GAAE,OAAe,GACnC,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC;IAqDrC;;;;;;;;;;;;;;;;;;OAkBG;IACG,aAAa,CACjB,mBAAmB,GAAE,OAAe,GACnC,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC;CAqCtC"}
|
|
@@ -199,6 +199,10 @@ class AgreementEngine {
|
|
|
199
199
|
/**
|
|
200
200
|
* Submit an input to progress the agreement's state machine
|
|
201
201
|
*
|
|
202
|
+
* An accepted input consumes the sender's permit nonce on this agreement, so
|
|
203
|
+
* an input permit the sender signed earlier and that was not submitted is no
|
|
204
|
+
* longer accepted. Permits signed by other parties are not affected.
|
|
205
|
+
*
|
|
202
206
|
* @param agreement - The agreement JSON definition (for field type resolution)
|
|
203
207
|
* @param inputId - The input identifier (e.g., "grantorData")
|
|
204
208
|
* @param data - Plain object with field values
|
|
@@ -289,12 +293,23 @@ class AgreementEngine {
|
|
|
289
293
|
/**
|
|
290
294
|
* Create an EIP-712 permit signature for submitting an input
|
|
291
295
|
*
|
|
292
|
-
*
|
|
296
|
+
* The permit names its signer (the wallet client's account) and carries the
|
|
297
|
+
* signer's current permit nonce on this agreement. It does not name a state:
|
|
298
|
+
* it stays usable until its deadline, in any state that accepts the input,
|
|
299
|
+
* until it or another permit of the same signer is accepted, the signer has
|
|
300
|
+
* an input accepted through `submitInput`, or the signer calls
|
|
301
|
+
* `cancelPermits`. Another party's input does not affect it, so several
|
|
302
|
+
* parties can sign up front and have their permits submitted in whatever
|
|
303
|
+
* order the agreement's transitions allow. Because each permit uses the
|
|
304
|
+
* signer's current nonce, one signer has one live permit per agreement at a
|
|
305
|
+
* time.
|
|
306
|
+
*
|
|
307
|
+
* @param walletClient - viem WalletClient that signs the typed data (must be connected to an account)
|
|
293
308
|
* @param agreement - The agreement JSON definition
|
|
294
309
|
* @param inputId - The input identifier (e.g., "grantorData")
|
|
295
310
|
* @param data - Plain object with field values
|
|
296
311
|
* @param deadline - Unix timestamp when the permit expires
|
|
297
|
-
* @returns The signature
|
|
312
|
+
* @returns The signature bytes and the signer address
|
|
298
313
|
*
|
|
299
314
|
* @example
|
|
300
315
|
* ```typescript
|
|
@@ -302,7 +317,7 @@ class AgreementEngine {
|
|
|
302
317
|
* const deadline = Math.floor(Date.now() / 1000) + 3600; // 1 hour from now
|
|
303
318
|
*
|
|
304
319
|
* const { signature, signerAddress } = await agreement.createPermitSignature(
|
|
305
|
-
*
|
|
320
|
+
* walletClient,
|
|
306
321
|
* agreementJson,
|
|
307
322
|
* "grantorData",
|
|
308
323
|
* { grantorName: "Alice" },
|
|
@@ -311,19 +326,19 @@ class AgreementEngine {
|
|
|
311
326
|
* ```
|
|
312
327
|
*/
|
|
313
328
|
async createPermitSignature(walletClient, agreement, inputId, data, deadline) {
|
|
314
|
-
// Get current nonce for the signer
|
|
315
329
|
const account = walletClient.account;
|
|
316
330
|
if (!account) {
|
|
317
331
|
throw new Error("WalletClient must be connected to an account to sign typed data");
|
|
318
332
|
}
|
|
319
333
|
const signerAddress = account.address;
|
|
334
|
+
// The signer's permit nonce on this agreement
|
|
320
335
|
const nonce = await this.getNonce(signerAddress);
|
|
321
336
|
// Build the payload
|
|
322
337
|
const payload = (0, payload_builder_js_1.buildInputPayload)(agreement, inputId, data);
|
|
323
338
|
const inputIdBytes32 = (0, payload_builder_js_1.inputToBytes32)(inputId);
|
|
324
339
|
// Get chain ID
|
|
325
340
|
const chainId = await this.publicClient.getChainId();
|
|
326
|
-
// EIP-712 domain & types
|
|
341
|
+
// EIP-712 domain & types. Must match AgreementEngine.sol exactly (PERMIT_TYPEHASH).
|
|
327
342
|
const domain = {
|
|
328
343
|
name: "AgreementEngine",
|
|
329
344
|
version: "1",
|
|
@@ -332,6 +347,7 @@ class AgreementEngine {
|
|
|
332
347
|
};
|
|
333
348
|
const types = {
|
|
334
349
|
PermitInput: [
|
|
350
|
+
{ name: "signer", type: "address" },
|
|
335
351
|
{ name: "inputId", type: "bytes32" },
|
|
336
352
|
{ name: "payload", type: "bytes" },
|
|
337
353
|
{ name: "nonce", type: "uint256" },
|
|
@@ -339,6 +355,7 @@ class AgreementEngine {
|
|
|
339
355
|
],
|
|
340
356
|
};
|
|
341
357
|
const message = {
|
|
358
|
+
signer: signerAddress,
|
|
342
359
|
inputId: inputIdBytes32,
|
|
343
360
|
payload: payload,
|
|
344
361
|
nonce: nonce,
|
|
@@ -352,12 +369,8 @@ class AgreementEngine {
|
|
|
352
369
|
primaryType: "PermitInput",
|
|
353
370
|
message,
|
|
354
371
|
});
|
|
355
|
-
// Split signature into v, r, s
|
|
356
|
-
const r = `0x${signature.slice(2, 66)}`;
|
|
357
|
-
const s = `0x${signature.slice(66, 130)}`;
|
|
358
|
-
const v = parseInt(signature.slice(130, 132), 16);
|
|
359
372
|
return {
|
|
360
|
-
signature
|
|
373
|
+
signature,
|
|
361
374
|
signerAddress,
|
|
362
375
|
};
|
|
363
376
|
}
|
|
@@ -369,7 +382,7 @@ class AgreementEngine {
|
|
|
369
382
|
* @param inputId - The input identifier
|
|
370
383
|
* @param data - Plain object with field values
|
|
371
384
|
* @param deadline - Unix timestamp when the permit expires
|
|
372
|
-
* @param signature - The permit signature (
|
|
385
|
+
* @param signature - The permit signature bytes (EOA signature, or bytes an ERC-1271 signer contract accepts)
|
|
373
386
|
* @param waitForConfirmation - Whether to wait for transaction confirmation (default: false)
|
|
374
387
|
* @returns Transaction hash, or receipt if waitForConfirmation is true
|
|
375
388
|
*
|
|
@@ -377,7 +390,7 @@ class AgreementEngine {
|
|
|
377
390
|
* ```typescript
|
|
378
391
|
* // Signer creates permit off-chain
|
|
379
392
|
* const { signature, signerAddress } = await agreement.createPermitSignature(
|
|
380
|
-
*
|
|
393
|
+
* walletClient,
|
|
381
394
|
* agreementJson,
|
|
382
395
|
* "grantorData",
|
|
383
396
|
* { grantorName: "Alice" },
|
|
@@ -435,9 +448,7 @@ class AgreementEngine {
|
|
|
435
448
|
inputIdBytes32,
|
|
436
449
|
payload,
|
|
437
450
|
BigInt(deadline),
|
|
438
|
-
signature
|
|
439
|
-
signature.r,
|
|
440
|
-
signature.s,
|
|
451
|
+
signature,
|
|
441
452
|
],
|
|
442
453
|
};
|
|
443
454
|
// Use executeTransaction utility for optional waiting
|
|
@@ -449,6 +460,48 @@ class AgreementEngine {
|
|
|
449
460
|
return result.transactionHash;
|
|
450
461
|
});
|
|
451
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Cancel the input permit the connected account has signed for this
|
|
465
|
+
* agreement and that has not been submitted yet
|
|
466
|
+
*
|
|
467
|
+
* Consumes the account's current permit nonce on this agreement, so any
|
|
468
|
+
* unsubmitted permit it signed with that nonce is no longer accepted. Other
|
|
469
|
+
* signers and other agreements are not affected. The transaction must be sent
|
|
470
|
+
* by the signer itself: there is no relayed form.
|
|
471
|
+
*
|
|
472
|
+
* @param waitForConfirmation - If true, waits for confirmation and returns the receipt
|
|
473
|
+
* @returns Transaction hash, or the receipt when waiting for confirmation
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const agreement = new AgreementEngine("0x...", publicClient, walletClient);
|
|
478
|
+
* await agreement.cancelPermits(true);
|
|
479
|
+
* // Sign again with createPermitSignature: it reads the new nonce.
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
async cancelPermits(waitForConfirmation = false) {
|
|
483
|
+
return await (0, telemetry_js_1.withSdkSpan)("agreement_engine.cancel_permits", {
|
|
484
|
+
"blockchain.chain_id": this.publicClient.chain?.id,
|
|
485
|
+
"agreement.address": this.address,
|
|
486
|
+
}, async () => {
|
|
487
|
+
if (!this.walletClient) {
|
|
488
|
+
throw new Error("WalletClient required for cancelling permits. Pass a walletClient to the constructor.");
|
|
489
|
+
}
|
|
490
|
+
const request = {
|
|
491
|
+
chain: null,
|
|
492
|
+
account: this.walletClient.account,
|
|
493
|
+
address: this.address,
|
|
494
|
+
abi: engineAbi,
|
|
495
|
+
functionName: 'cancelPermits',
|
|
496
|
+
args: [],
|
|
497
|
+
};
|
|
498
|
+
const result = await (0, transactions_js_1.executeTransaction)(request, this.publicClient, this.walletClient, waitForConfirmation);
|
|
499
|
+
if (waitForConfirmation) {
|
|
500
|
+
return result;
|
|
501
|
+
}
|
|
502
|
+
return result.transactionHash;
|
|
503
|
+
});
|
|
504
|
+
}
|
|
452
505
|
}
|
|
453
506
|
exports.AgreementEngine = AgreementEngine;
|
|
454
507
|
//# sourceMappingURL=AgreementEngine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgreementEngine.js","sourceRoot":"","sources":["../../src/AgreementEngine.ts"],"names":[],"mappings":";AAAA,sCAAsC;;;AAWtC,uDAA2E;AAE3E,6DAAyE;AACzE,qDAAkD;AAClD,iDAA6C;AAC7C,6EAAuE;AAEvE,2DAA2D;AAC3D,gEAAgE;AAChE,MAAM,SAAS,GAAQ,0CAAyB,CAAC;AAEjD;;;;;GAKG;AACH,MAAa,eAAe;IAK1B;;;;;;;;;;;;;;;;;OAiBG;IACH,YAAY,OAAY,EAAE,YAA0B,EAAE,YAA2B;QAC/E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,OAAO;QACX,OAAO,MAAM,IAAA,0BAAW,EACtB,2BAA2B,EAC3B;YACE,qBAAqB,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE;YAClD,mBAAmB,EAAE,IAA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