@hazbase/simplicity 0.0.4 → 0.0.5
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 +140 -0
- package/dist/cli.js +297 -0
- package/dist/client/SimplicityClient.d.ts +267 -2
- package/dist/client/SimplicityClient.js +20 -0
- package/dist/core/types.d.ts +34 -1
- package/dist/domain/bond.d.ts +1993 -1
- package/dist/domain/bond.js +914 -0
- package/dist/domain/bondSettlementValidation.d.ts +18 -0
- package/dist/domain/bondSettlementValidation.js +122 -0
- package/dist/domain/bondValidation.d.ts +20 -0
- package/dist/domain/bondValidation.js +216 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -170,6 +170,34 @@ For Bond issuance, the recommended shape is:
|
|
|
170
170
|
}
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
+
To move from an issued bond into a redemption state, the SDK now also supports a minimal state transition model:
|
|
174
|
+
|
|
175
|
+
- `ISSUED -> PARTIALLY_REDEEMED`
|
|
176
|
+
- `ISSUED/PARTIALLY_REDEEMED -> REDEEMED`
|
|
177
|
+
|
|
178
|
+
The next state records:
|
|
179
|
+
|
|
180
|
+
- `previousStateHash`
|
|
181
|
+
- `lastTransition.type`
|
|
182
|
+
- `lastTransition.amount`
|
|
183
|
+
- `lastTransition.at`
|
|
184
|
+
|
|
185
|
+
and the SDK verifies the principal invariant:
|
|
186
|
+
|
|
187
|
+
- `issuedPrincipal = outstandingPrincipal + redeemedPrincipal`
|
|
188
|
+
|
|
189
|
+
On top of that, the SDK can now build a `BondSettlementDescriptor`, which bundles the intended settlement envelope into one canonical document:
|
|
190
|
+
|
|
191
|
+
- `definitionHash`
|
|
192
|
+
- `previousStateHash`
|
|
193
|
+
- `nextStateHash`
|
|
194
|
+
- `nextContractAddress`
|
|
195
|
+
- `nextAmountSat`
|
|
196
|
+
- `maxFeeSat`
|
|
197
|
+
- status progression and principal deltas
|
|
198
|
+
|
|
199
|
+
The redemption machine commits that settlement descriptor hash as an additional anchor. This does not yet mean full runtime output introspection, but it does mean the machine can now honestly claim a committed settlement envelope instead of just a scattered set of fields.
|
|
200
|
+
|
|
173
201
|
Minimal TypeScript flow:
|
|
174
202
|
|
|
175
203
|
```ts
|
|
@@ -190,6 +218,49 @@ console.log(verification.crossChecks.principalInvariantValid);
|
|
|
190
218
|
console.log(verification.issuance.trust.effectiveMode);
|
|
191
219
|
```
|
|
192
220
|
|
|
221
|
+
Minimal redemption flow:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
const preview = await sdk.bonds.buildBondRedemption({
|
|
225
|
+
definitionPath: "./docs/definitions/bond-definition.json",
|
|
226
|
+
previousIssuancePath: "./docs/definitions/bond-issuance-state.json",
|
|
227
|
+
amount: 250000,
|
|
228
|
+
redeemedAt: "2027-03-10T00:00:00Z",
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const compiled = await sdk.bonds.redeemBond({
|
|
232
|
+
definitionPath: "./docs/definitions/bond-definition.json",
|
|
233
|
+
previousIssuancePath: "./docs/definitions/bond-issuance-state.json",
|
|
234
|
+
amount: 250000,
|
|
235
|
+
redeemedAt: "2027-03-10T00:00:00Z",
|
|
236
|
+
simfPath: "./docs/definitions/bond-issuance-anchor.simf",
|
|
237
|
+
artifactPath: "./bond-redemption.artifact.json",
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
const transition = await sdk.bonds.verifyBondTransition({
|
|
241
|
+
previousIssuancePath: "./docs/definitions/bond-issuance-state.json",
|
|
242
|
+
nextIssuancePath: "./docs/definitions/bond-issuance-state-partial-redemption.json",
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
const payload = await sdk.bonds.buildBondPayload({
|
|
246
|
+
artifactPath: "./bond-redemption.artifact.json",
|
|
247
|
+
definitionPath: "./docs/definitions/bond-definition.json",
|
|
248
|
+
issuancePath: "./docs/definitions/bond-issuance-state-partial-redemption.json",
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const transitionPayload = await sdk.bonds.buildBondTransitionPayload({
|
|
252
|
+
definitionPath: "./docs/definitions/bond-definition.json",
|
|
253
|
+
previousIssuancePath: "./docs/definitions/bond-issuance-state.json",
|
|
254
|
+
nextIssuancePath: "./docs/definitions/bond-issuance-state-partial-redemption.json",
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
console.log(preview.nextHash);
|
|
258
|
+
console.log(compiled.state()?.hash);
|
|
259
|
+
console.log(transition.transition.statusProgressionValid);
|
|
260
|
+
console.log(payload.payload);
|
|
261
|
+
console.log(transitionPayload.payload.redeemAmount);
|
|
262
|
+
```
|
|
263
|
+
|
|
193
264
|
CLI equivalents:
|
|
194
265
|
|
|
195
266
|
```bash
|
|
@@ -208,6 +279,65 @@ simplicity-cli bond verify \
|
|
|
208
279
|
--artifact ./bond-issuance.artifact.json \
|
|
209
280
|
--definition-json ./docs/definitions/bond-definition.json \
|
|
210
281
|
--issuance-json ./docs/definitions/bond-issuance-state.json
|
|
282
|
+
|
|
283
|
+
simplicity-cli bond redeem \
|
|
284
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
285
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
286
|
+
--amount 250000 \
|
|
287
|
+
--redeemed-at 2027-03-10T00:00:00Z \
|
|
288
|
+
--simf ./docs/definitions/bond-issuance-anchor.simf \
|
|
289
|
+
--next-issuance-out ./next-bond-issuance-state.json \
|
|
290
|
+
--artifact ./bond-redemption.artifact.json
|
|
291
|
+
|
|
292
|
+
simplicity-cli bond verify-transition \
|
|
293
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
294
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json
|
|
295
|
+
|
|
296
|
+
simplicity-cli bond compile-transition \
|
|
297
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
298
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
299
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json \
|
|
300
|
+
--simf ./docs/definitions/bond-redemption-transition.simf \
|
|
301
|
+
--artifact ./bond-transition.artifact.json
|
|
302
|
+
|
|
303
|
+
simplicity-cli bond compile-redemption-machine \
|
|
304
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
305
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
306
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json \
|
|
307
|
+
--simf ./docs/definitions/bond-redemption-state-machine.simf \
|
|
308
|
+
--artifact ./bond-redemption-machine.artifact.json
|
|
309
|
+
|
|
310
|
+
simplicity-cli bond verify-machine \
|
|
311
|
+
--artifact ./bond-redemption-machine.artifact.json \
|
|
312
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
313
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
314
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json
|
|
315
|
+
|
|
316
|
+
simplicity-cli bond plan-rollover \
|
|
317
|
+
--current-artifact ./bond-issuance.artifact.json \
|
|
318
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
319
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
320
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json \
|
|
321
|
+
--next-simf ./docs/definitions/bond-issuance-anchor.simf \
|
|
322
|
+
--next-artifact ./bond-next.artifact.json
|
|
323
|
+
|
|
324
|
+
simplicity-cli bond plan-machine-rollover \
|
|
325
|
+
--current-artifact ./bond-issuance.artifact.json \
|
|
326
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
327
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
328
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json \
|
|
329
|
+
--machine-simf ./docs/definitions/bond-redemption-state-machine.simf \
|
|
330
|
+
--machine-artifact ./bond-redemption-machine.artifact.json
|
|
331
|
+
|
|
332
|
+
simplicity-cli bond transition-payload \
|
|
333
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
334
|
+
--previous-issuance-json ./docs/definitions/bond-issuance-state.json \
|
|
335
|
+
--next-issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json
|
|
336
|
+
|
|
337
|
+
simplicity-cli bond payload \
|
|
338
|
+
--artifact ./bond-redemption.artifact.json \
|
|
339
|
+
--definition-json ./docs/definitions/bond-definition.json \
|
|
340
|
+
--issuance-json ./docs/definitions/bond-issuance-state-partial-redemption.json
|
|
211
341
|
```
|
|
212
342
|
|
|
213
343
|
## Install
|
|
@@ -890,6 +1020,16 @@ These examples are included to help you jump to the right workflow quickly.
|
|
|
890
1020
|
- [define-bond-issuance.ts](./examples/define-bond-issuance.ts): compile a bond example with both trusted definition and issuance state anchors.
|
|
891
1021
|
- [show-bond-issuance.ts](./examples/show-bond-issuance.ts): load a bond artifact together with its verified issuance state.
|
|
892
1022
|
- [verify-bond-issuance.ts](./examples/verify-bond-issuance.ts): run combined Bond definition/state verification and invariant checks.
|
|
1023
|
+
- [redeem-bond-issuance.ts](./examples/redeem-bond-issuance.ts): build the next redemption state and compile a new anchored artifact.
|
|
1024
|
+
- [verify-bond-transition.ts](./examples/verify-bond-transition.ts): verify a previous/next issuance state transition.
|
|
1025
|
+
- [compile-bond-transition.ts](./examples/compile-bond-transition.ts): compile a transition contract that commits both previous and next issuance state hashes.
|
|
1026
|
+
- [compile-bond-redemption-machine.ts](./examples/compile-bond-redemption-machine.ts): compile a redemption transition contract that also commits redeem amount and transition kind.
|
|
1027
|
+
- [verify-bond-redemption-machine.ts](./examples/verify-bond-redemption-machine.ts): verify a compiled redemption machine artifact against definition, previous state, and next state inputs.
|
|
1028
|
+
- [plan-bond-rollover.ts](./examples/plan-bond-rollover.ts): build a runtime rollover plan that spends the current state UTXO into the next state's contract address.
|
|
1029
|
+
- [show-bond-transition-payload.ts](./examples/show-bond-transition-payload.ts): emit a bridge-ready payload for a previous/next redemption transition.
|
|
1030
|
+
- [show-bond-payload.ts](./examples/show-bond-payload.ts): emit a bridge-ready payload from a verified bond artifact.
|
|
1031
|
+
- [redeem-bond-issuance.ts](./examples/redeem-bond-issuance.ts): build a partially redeemed bond issuance state and anchor it in a new artifact.
|
|
1032
|
+
- [verify-bond-transition.ts](./examples/verify-bond-transition.ts): verify a redemption transition between two issuance state documents.
|
|
893
1033
|
|
|
894
1034
|
In addition to the in-repo examples, the package has also been validated from a blank external consumer project with:
|
|
895
1035
|
- `npm install @hazbase/simplicity`
|
package/dist/cli.js
CHANGED
|
@@ -662,6 +662,303 @@ async function main() {
|
|
|
662
662
|
printJson(result);
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
|
+
if (command === "bond" && subcommand === "redeem") {
|
|
666
|
+
const preview = await sdk.bonds.buildBondRedemption({
|
|
667
|
+
definitionPath: getArg("definition-json"),
|
|
668
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
669
|
+
amount: Number(requireArg("amount")),
|
|
670
|
+
redeemedAt: requireArg("redeemed-at"),
|
|
671
|
+
});
|
|
672
|
+
const nextIssuanceOut = getArg("next-issuance-out");
|
|
673
|
+
if (nextIssuanceOut) {
|
|
674
|
+
const resolved = node_path_1.default.resolve(nextIssuanceOut);
|
|
675
|
+
await (0, promises_1.mkdir)(node_path_1.default.dirname(resolved), { recursive: true });
|
|
676
|
+
await (0, promises_1.writeFile)(`${resolved}`, `${JSON.stringify(preview.next, null, 2)}\n`, "utf8");
|
|
677
|
+
}
|
|
678
|
+
const result = await sdk.bonds.redeemBond({
|
|
679
|
+
definitionPath: getArg("definition-json"),
|
|
680
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
681
|
+
amount: Number(requireArg("amount")),
|
|
682
|
+
redeemedAt: requireArg("redeemed-at"),
|
|
683
|
+
simfPath: getArg("simf"),
|
|
684
|
+
artifactPath: getArg("artifact"),
|
|
685
|
+
});
|
|
686
|
+
printJson({
|
|
687
|
+
artifact: result.artifact,
|
|
688
|
+
deployment: result.deployment(),
|
|
689
|
+
previousHash: preview.previousHash,
|
|
690
|
+
nextHash: preview.nextHash,
|
|
691
|
+
transition: preview.transition,
|
|
692
|
+
nextIssuanceState: preview.next,
|
|
693
|
+
nextIssuanceOut: nextIssuanceOut ? node_path_1.default.resolve(nextIssuanceOut) : undefined,
|
|
694
|
+
});
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
if (command === "bond" && subcommand === "verify-transition") {
|
|
698
|
+
const result = await sdk.bonds.verifyBondTransition({
|
|
699
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
700
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
701
|
+
});
|
|
702
|
+
printJson(result);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
if (command === "bond" && subcommand === "compile-transition") {
|
|
706
|
+
const result = await sdk.bonds.compileBondTransition({
|
|
707
|
+
definitionPath: getArg("definition-json"),
|
|
708
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
709
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
710
|
+
simfPath: getArg("simf"),
|
|
711
|
+
artifactPath: getArg("artifact"),
|
|
712
|
+
});
|
|
713
|
+
printJson({
|
|
714
|
+
artifact: result.compiled.artifact,
|
|
715
|
+
deployment: result.compiled.deployment(),
|
|
716
|
+
previousHash: result.previousHash,
|
|
717
|
+
nextHash: result.nextHash,
|
|
718
|
+
transition: result.transition,
|
|
719
|
+
payload: result.payload,
|
|
720
|
+
});
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (command === "bond" && subcommand === "compile-redemption-machine") {
|
|
724
|
+
const result = await sdk.bonds.compileBondRedemptionMachine({
|
|
725
|
+
definitionPath: getArg("definition-json"),
|
|
726
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
727
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
728
|
+
nextStateSimfPath: getArg("next-state-simf"),
|
|
729
|
+
nextAmountSat: getArg("next-amount-sat") ? Number(getArg("next-amount-sat")) : undefined,
|
|
730
|
+
maxFeeSat: getArg("max-fee-sat") ? Number(getArg("max-fee-sat")) : undefined,
|
|
731
|
+
simfPath: getArg("simf"),
|
|
732
|
+
artifactPath: getArg("artifact"),
|
|
733
|
+
});
|
|
734
|
+
printJson({
|
|
735
|
+
artifact: result.compiled.artifact,
|
|
736
|
+
deployment: result.compiled.deployment(),
|
|
737
|
+
previousHash: result.previousHash,
|
|
738
|
+
nextHash: result.nextHash,
|
|
739
|
+
redeemAmount: result.redeemAmount,
|
|
740
|
+
transitionKind: result.transitionKind,
|
|
741
|
+
nextStateContractAddress: result.nextStateContractAddress,
|
|
742
|
+
nextStateContractAddressHash: result.nextStateContractAddressHash,
|
|
743
|
+
settlementDescriptor: result.settlementDescriptor,
|
|
744
|
+
settlementDescriptorHash: result.settlementDescriptorHash,
|
|
745
|
+
transition: result.transition,
|
|
746
|
+
payload: result.payload,
|
|
747
|
+
});
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (command === "bond" && subcommand === "verify-machine") {
|
|
751
|
+
const result = await sdk.bonds.verifyBondRedemptionMachineArtifact({
|
|
752
|
+
artifactPath: requireArg("artifact"),
|
|
753
|
+
definitionPath: getArg("definition-json"),
|
|
754
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
755
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
756
|
+
nextStateSimfPath: getArg("next-state-simf"),
|
|
757
|
+
nextAmountSat: getArg("next-amount-sat") ? Number(getArg("next-amount-sat")) : undefined,
|
|
758
|
+
maxFeeSat: getArg("max-fee-sat") ? Number(getArg("max-fee-sat")) : undefined,
|
|
759
|
+
});
|
|
760
|
+
printJson(result);
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
if (command === "bond" && subcommand === "settlement-payload") {
|
|
764
|
+
const result = await sdk.bonds.buildBondSettlementPayload({
|
|
765
|
+
definitionPath: getArg("definition-json"),
|
|
766
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
767
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
768
|
+
nextStateSimfPath: getArg("next-state-simf"),
|
|
769
|
+
nextAmountSat: Number(requireArg("next-amount-sat")),
|
|
770
|
+
maxFeeSat: getArg("max-fee-sat") ? Number(getArg("max-fee-sat")) : undefined,
|
|
771
|
+
});
|
|
772
|
+
printJson(result);
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
if (command === "bond" && subcommand === "verify-settlement") {
|
|
776
|
+
const result = await sdk.bonds.verifyBondSettlementDescriptor({
|
|
777
|
+
descriptorPath: getArg("descriptor-json"),
|
|
778
|
+
definitionPath: getArg("definition-json"),
|
|
779
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
780
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
781
|
+
nextStateSimfPath: getArg("next-state-simf"),
|
|
782
|
+
nextAmountSat: getArg("next-amount-sat") ? Number(getArg("next-amount-sat")) : undefined,
|
|
783
|
+
maxFeeSat: getArg("max-fee-sat") ? Number(getArg("max-fee-sat")) : undefined,
|
|
784
|
+
});
|
|
785
|
+
printJson(result);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
if (command === "bond" && subcommand === "plan-rollover") {
|
|
789
|
+
const result = await sdk.bonds.buildBondRolloverPlan({
|
|
790
|
+
currentArtifactPath: requireArg("current-artifact"),
|
|
791
|
+
definitionPath: getArg("definition-json"),
|
|
792
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
793
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
794
|
+
nextSimfPath: getArg("next-simf"),
|
|
795
|
+
nextArtifactPath: getArg("next-artifact"),
|
|
796
|
+
});
|
|
797
|
+
printJson({
|
|
798
|
+
currentArtifact: result.currentArtifact,
|
|
799
|
+
nextArtifact: result.nextCompiled.artifact,
|
|
800
|
+
nextDeployment: result.nextCompiled.deployment(),
|
|
801
|
+
nextContractAddress: result.nextContractAddress,
|
|
802
|
+
transitionPayload: result.transitionPayload,
|
|
803
|
+
});
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
if (command === "bond" && subcommand === "plan-machine-rollover") {
|
|
807
|
+
const result = await sdk.bonds.buildBondMachineRolloverPlan({
|
|
808
|
+
currentArtifactPath: requireArg("current-artifact"),
|
|
809
|
+
definitionPath: getArg("definition-json"),
|
|
810
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
811
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
812
|
+
nextStateSimfPath: getArg("next-state-simf"),
|
|
813
|
+
machineSimfPath: getArg("machine-simf"),
|
|
814
|
+
machineArtifactPath: getArg("machine-artifact"),
|
|
815
|
+
});
|
|
816
|
+
printJson({
|
|
817
|
+
currentArtifact: result.currentArtifact,
|
|
818
|
+
machineArtifact: result.machineCompiled.compiled.artifact,
|
|
819
|
+
machineDeployment: result.machineCompiled.compiled.deployment(),
|
|
820
|
+
machineVerification: result.machineVerification,
|
|
821
|
+
nextContractAddress: result.nextContractAddress,
|
|
822
|
+
transitionPayload: result.transitionPayload,
|
|
823
|
+
});
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
if (command === "bond" && subcommand === "inspect-rollover") {
|
|
827
|
+
const result = await sdk.bonds.inspectBondStateRollover({
|
|
828
|
+
currentArtifactPath: requireArg("current-artifact"),
|
|
829
|
+
definitionPath: getArg("definition-json"),
|
|
830
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
831
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
832
|
+
nextSimfPath: getArg("next-simf"),
|
|
833
|
+
nextArtifactPath: getArg("next-artifact"),
|
|
834
|
+
wallet: requireArg("wallet"),
|
|
835
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
836
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
837
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
838
|
+
});
|
|
839
|
+
printJson(result);
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
if (command === "bond" && subcommand === "inspect-machine-rollover") {
|
|
843
|
+
const result = await sdk.bonds.inspectBondMachineRollover({
|
|
844
|
+
currentArtifactPath: requireArg("current-artifact"),
|
|
845
|
+
definitionPath: getArg("definition-json"),
|
|
846
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
847
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
848
|
+
machineSimfPath: getArg("machine-simf"),
|
|
849
|
+
machineArtifactPath: getArg("machine-artifact"),
|
|
850
|
+
wallet: requireArg("wallet"),
|
|
851
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
852
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
853
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
854
|
+
});
|
|
855
|
+
printJson(result);
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if (command === "bond" && subcommand === "execute-rollover") {
|
|
859
|
+
const result = await sdk.bonds.executeBondStateRollover({
|
|
860
|
+
currentArtifactPath: requireArg("current-artifact"),
|
|
861
|
+
definitionPath: getArg("definition-json"),
|
|
862
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
863
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
864
|
+
nextSimfPath: getArg("next-simf"),
|
|
865
|
+
nextArtifactPath: getArg("next-artifact"),
|
|
866
|
+
wallet: requireArg("wallet"),
|
|
867
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
868
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
869
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
870
|
+
broadcast: hasFlag("broadcast"),
|
|
871
|
+
});
|
|
872
|
+
printJson(result);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
if (command === "bond" && subcommand === "execute-machine-rollover") {
|
|
876
|
+
const result = await sdk.bonds.executeBondMachineRollover({
|
|
877
|
+
currentArtifactPath: requireArg("current-artifact"),
|
|
878
|
+
definitionPath: getArg("definition-json"),
|
|
879
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
880
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
881
|
+
machineSimfPath: getArg("machine-simf"),
|
|
882
|
+
machineArtifactPath: getArg("machine-artifact"),
|
|
883
|
+
wallet: requireArg("wallet"),
|
|
884
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
885
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
886
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
887
|
+
broadcast: hasFlag("broadcast"),
|
|
888
|
+
});
|
|
889
|
+
printJson(result);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
if (command === "bond" && subcommand === "plan-machine-settlement") {
|
|
893
|
+
const result = await sdk.bonds.buildBondMachineSettlementPlan({
|
|
894
|
+
currentMachineArtifactPath: requireArg("current-machine-artifact"),
|
|
895
|
+
definitionPath: getArg("definition-json"),
|
|
896
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
897
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
898
|
+
nextSimfPath: getArg("next-simf"),
|
|
899
|
+
nextArtifactPath: getArg("next-artifact"),
|
|
900
|
+
});
|
|
901
|
+
printJson({
|
|
902
|
+
currentMachineArtifact: result.currentMachineArtifact,
|
|
903
|
+
machineVerification: result.machineVerification,
|
|
904
|
+
nextArtifact: result.nextCompiled.artifact,
|
|
905
|
+
nextDeployment: result.nextCompiled.deployment(),
|
|
906
|
+
nextContractAddress: result.nextContractAddress,
|
|
907
|
+
transitionPayload: result.transitionPayload,
|
|
908
|
+
});
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
if (command === "bond" && subcommand === "inspect-machine-settlement") {
|
|
912
|
+
const result = await sdk.bonds.inspectBondMachineSettlement({
|
|
913
|
+
currentMachineArtifactPath: requireArg("current-machine-artifact"),
|
|
914
|
+
definitionPath: getArg("definition-json"),
|
|
915
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
916
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
917
|
+
nextSimfPath: getArg("next-simf"),
|
|
918
|
+
nextArtifactPath: getArg("next-artifact"),
|
|
919
|
+
wallet: requireArg("wallet"),
|
|
920
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
921
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
922
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
923
|
+
});
|
|
924
|
+
printJson(result);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
if (command === "bond" && subcommand === "execute-machine-settlement") {
|
|
928
|
+
const result = await sdk.bonds.executeBondMachineSettlement({
|
|
929
|
+
currentMachineArtifactPath: requireArg("current-machine-artifact"),
|
|
930
|
+
definitionPath: getArg("definition-json"),
|
|
931
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
932
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
933
|
+
nextSimfPath: getArg("next-simf"),
|
|
934
|
+
nextArtifactPath: getArg("next-artifact"),
|
|
935
|
+
wallet: requireArg("wallet"),
|
|
936
|
+
signer: { type: "schnorrPrivkeyHex", privkeyHex: requireArg("privkey") },
|
|
937
|
+
feeSat: getArg("fee-sat") ? Number(getArg("fee-sat")) : undefined,
|
|
938
|
+
utxoPolicy: getArg("utxo-policy"),
|
|
939
|
+
broadcast: hasFlag("broadcast"),
|
|
940
|
+
});
|
|
941
|
+
printJson(result);
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
if (command === "bond" && subcommand === "transition-payload") {
|
|
945
|
+
const result = await sdk.bonds.buildBondTransitionPayload({
|
|
946
|
+
definitionPath: getArg("definition-json"),
|
|
947
|
+
previousIssuancePath: getArg("previous-issuance-json"),
|
|
948
|
+
nextIssuancePath: getArg("next-issuance-json"),
|
|
949
|
+
});
|
|
950
|
+
printJson(result);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (command === "bond" && subcommand === "payload") {
|
|
954
|
+
const result = await sdk.bonds.buildBondPayload({
|
|
955
|
+
artifactPath: requireArg("artifact"),
|
|
956
|
+
definitionPath: getArg("definition-json"),
|
|
957
|
+
issuancePath: getArg("issuance-json"),
|
|
958
|
+
});
|
|
959
|
+
printJson(result);
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
665
962
|
if (command === "contract" && subcommand === "wait-funding") {
|
|
666
963
|
const compiled = await sdk.loadArtifact(requireArg("artifact"));
|
|
667
964
|
const utxos = await compiled.at().waitForFunding({
|