@agoric/orchestration 0.2.0 → 0.2.1-upgrade-23-dev-bd79330.0.bd79330
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/index.js +0 -4
- package/package.json +27 -27
- package/src/axelar-types.d.ts +2 -0
- package/src/axelar-types.d.ts.map +1 -1
- package/src/axelar-types.js +2 -0
- package/src/cctp-chain-info.js +4 -1
- package/src/chain-info.d.ts +21 -6
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +9 -8
- package/src/cosmos-api.d.ts +102 -29
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.js +585 -0
- package/src/{ethereum-api.ts → ethereum-api.js} +1 -1
- package/src/examples/auto-stake-it-tap-kit.d.ts +4 -3
- package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
- package/src/examples/auto-stake-it-tap-kit.js +3 -4
- package/src/examples/auto-stake-it.contract.d.ts +6 -4
- package/src/examples/auto-stake-it.contract.d.ts.map +1 -1
- package/src/examples/auto-stake-it.contract.js +3 -1
- package/src/examples/auto-stake-it.flows.d.ts +2 -1
- package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
- package/src/examples/auto-stake-it.flows.js +1 -0
- package/src/examples/axelar-gmp-account-kit.d.ts +6 -4
- package/src/examples/axelar-gmp-account-kit.d.ts.map +1 -1
- package/src/examples/axelar-gmp-account-kit.js +4 -2
- package/src/examples/axelar-gmp.contract.d.ts +8 -8
- package/src/examples/axelar-gmp.contract.d.ts.map +1 -1
- package/src/examples/axelar-gmp.contract.js +2 -2
- package/src/examples/axelar-gmp.flows.d.ts +1 -1
- package/src/examples/basic-flows.contract.d.ts +7 -5
- package/src/examples/basic-flows.contract.d.ts.map +1 -1
- package/src/examples/basic-flows.contract.js +3 -1
- package/src/examples/basic-flows.flows.d.ts +2 -1
- package/src/examples/basic-flows.flows.d.ts.map +1 -1
- package/src/examples/basic-flows.flows.js +1 -0
- package/src/examples/send-anywhere.contract.d.ts +12 -6
- package/src/examples/send-anywhere.contract.d.ts.map +1 -1
- package/src/examples/send-anywhere.contract.js +4 -1
- package/src/examples/send-anywhere.flows.d.ts +3 -2
- package/src/examples/send-anywhere.flows.d.ts.map +1 -1
- package/src/examples/send-anywhere.flows.js +3 -6
- package/src/examples/stake-bld.contract.d.ts +206 -25
- package/src/examples/stake-bld.contract.d.ts.map +1 -1
- package/src/examples/stake-bld.contract.js +19 -4
- package/src/examples/stake-ica.contract.d.ts +434 -71
- package/src/examples/stake-ica.contract.d.ts.map +1 -1
- package/src/examples/stake-ica.contract.js +28 -6
- package/src/examples/staking-combinations.contract.d.ts +4 -2
- package/src/examples/staking-combinations.contract.d.ts.map +1 -1
- package/src/examples/staking-combinations.contract.js +5 -3
- package/src/examples/staking-combinations.flows.d.ts +3 -2
- package/src/examples/staking-combinations.flows.d.ts.map +1 -1
- package/src/examples/staking-combinations.flows.js +7 -6
- package/src/examples/swap-anything.contract.d.ts +14 -7
- package/src/examples/swap-anything.contract.d.ts.map +1 -1
- package/src/examples/swap-anything.contract.js +12 -8
- package/src/examples/swap.contract.d.ts +18 -6
- package/src/examples/swap.contract.d.ts.map +1 -1
- package/src/examples/swap.contract.js +9 -3
- package/src/examples/swap.flows.d.ts +2 -0
- package/src/examples/swap.flows.d.ts.map +1 -1
- package/src/examples/swap.flows.js +2 -0
- package/src/examples/unbond.contract.d.ts +7 -4
- package/src/examples/unbond.contract.d.ts.map +1 -1
- package/src/examples/unbond.contract.js +6 -3
- package/src/exos/chain-hub-admin.d.ts +1 -19
- package/src/exos/chain-hub-admin.d.ts.map +1 -1
- package/src/exos/chain-hub-admin.js +1 -1
- package/src/exos/chain-hub.d.ts +4 -2
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +2 -1
- package/src/exos/combine-invitation-makers.d.ts +2 -1
- package/src/exos/combine-invitation-makers.d.ts.map +1 -1
- package/src/exos/combine-invitation-makers.js +2 -1
- package/src/exos/cosmos-orchestration-account.d.ts +615 -98
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +695 -306
- package/src/exos/exo-interfaces.js +35 -0
- package/src/exos/ibc-packet.d.ts +11 -9
- package/src/exos/ibc-packet.d.ts.map +1 -1
- package/src/exos/ibc-packet.js +33 -8
- package/src/exos/ica-account-kit.d.ts +4 -9
- package/src/exos/ica-account-kit.d.ts.map +1 -1
- package/src/exos/ica-account-kit.js +10 -7
- package/src/exos/icq-connection-kit.d.ts +1 -1
- package/src/exos/local-chain-facade.d.ts +1542 -5
- package/src/exos/local-chain-facade.d.ts.map +1 -1
- package/src/exos/local-chain-facade.js +4 -2
- package/src/exos/local-orchestration-account.d.ts +201 -56
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +260 -51
- package/src/exos/orchestrator.d.ts +35813 -73
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +7 -10
- package/src/exos/packet-tools.d.ts +19 -8
- package/src/exos/packet-tools.d.ts.map +1 -1
- package/src/exos/packet-tools.js +92 -9
- package/src/exos/portfolio-holder-kit.d.ts +90 -2
- package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
- package/src/exos/remote-chain-facade.d.ts +1499 -1
- package/src/exos/remote-chain-facade.d.ts.map +1 -1
- package/src/exos/remote-chain-facade.js +8 -3
- package/src/facade.d.ts +1 -0
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +4 -6
- package/src/fixtures/query-flows.contract.d.ts +8 -6
- package/src/fixtures/query-flows.contract.d.ts.map +1 -1
- package/src/fixtures/query-flows.contract.js +3 -1
- package/src/fixtures/query-flows.flows.d.ts +1 -0
- package/src/fixtures/query-flows.flows.d.ts.map +1 -1
- package/src/fixtures/query-flows.flows.js +1 -0
- package/src/orchestration-api.d.ts +46 -16
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.js +410 -0
- package/src/proposals/init-chain-info.js +10 -2
- package/src/proposals/orchestration-proposal.js +3 -0
- package/src/proposals/revise-chain-info.js +4 -1
- package/src/proposals/start-auto-stake-it.js +1 -0
- package/src/proposals/start-axelar-gmp.js +2 -2
- package/src/proposals/start-basic-flows.js +5 -0
- package/src/proposals/start-send-anywhere.js +4 -2
- package/src/proposals/start-stakeAtom.js +5 -4
- package/src/proposals/start-stakeBld.js +8 -6
- package/src/proposals/start-stakeOsmo.js +5 -4
- package/src/proposals/start-swap-anything.js +4 -2
- package/src/stubs/{viem-abi.d.ts → viem-typedData.js} +10 -4
- package/src/typeGuards.d.ts +38 -5
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +92 -22
- package/src/types.d.ts +1 -0
- package/src/types.d.ts.map +1 -1
- package/src/types.js +27 -0
- package/src/utils/abitype.d.ts +6 -0
- package/src/utils/abitype.d.ts.map +1 -0
- package/src/utils/abitype.js +13 -0
- package/src/utils/address.d.ts +3 -1
- package/src/utils/address.d.ts.map +1 -1
- package/src/utils/address.js +24 -2
- package/src/utils/agd-lib.d.ts +1 -51
- package/src/utils/agd-lib.d.ts.map +1 -1
- package/src/utils/agd-lib.js +1 -1
- package/src/utils/amounts.d.ts +1 -0
- package/src/utils/amounts.d.ts.map +1 -1
- package/src/utils/amounts.js +1 -0
- package/src/utils/asset.d.ts +1 -0
- package/src/utils/asset.d.ts.map +1 -1
- package/src/utils/asset.js +1 -0
- package/src/utils/chain-hub-helper.d.ts +1 -0
- package/src/utils/chain-hub-helper.d.ts.map +1 -1
- package/src/utils/chain-hub-helper.js +1 -0
- package/src/utils/codecs.d.ts +145 -0
- package/src/utils/codecs.d.ts.map +1 -0
- package/src/utils/codecs.js +206 -0
- package/src/utils/cosmos.d.ts +5 -4
- package/src/utils/cosmos.d.ts.map +1 -1
- package/src/utils/cosmos.js +29 -9
- package/src/utils/exo-helpers.d.ts +156 -0
- package/src/utils/exo-helpers.d.ts.map +1 -0
- package/src/utils/exo-helpers.js +241 -0
- package/src/utils/gmp.d.ts +2 -2
- package/src/utils/gmp.d.ts.map +1 -1
- package/src/utils/gmp.js +31 -15
- package/src/utils/orchestrationAccount.d.ts +79 -0
- package/src/utils/orchestrationAccount.d.ts.map +1 -1
- package/src/utils/orchestrationAccount.js +210 -6
- package/src/utils/packet.d.ts.map +1 -1
- package/src/utils/packet.js +5 -0
- package/src/utils/permit2/signatureTransfer.d.ts +221 -0
- package/src/utils/permit2/signatureTransfer.d.ts.map +1 -0
- package/src/utils/permit2/signatureTransfer.js +265 -0
- package/src/utils/permit2/signatureTransferHelpers.d.ts +334 -0
- package/src/utils/permit2/signatureTransferHelpers.d.ts.map +1 -0
- package/src/utils/permit2/signatureTransferHelpers.js +270 -0
- package/src/utils/permit2.d.ts +11 -0
- package/src/utils/permit2.d.ts.map +1 -0
- package/src/utils/permit2.js +11 -0
- package/src/utils/progress.d.ts +41 -0
- package/src/utils/progress.d.ts.map +1 -0
- package/src/utils/progress.js +180 -0
- package/src/utils/start-helper.d.ts +28 -10
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +30 -7
- package/src/utils/time.d.ts +2 -2
- package/src/utils/time.d.ts.map +1 -1
- package/src/utils/time.js +1 -1
- package/src/utils/viem-utils/hashTypedData.d.ts +21 -0
- package/src/utils/viem-utils/hashTypedData.d.ts.map +1 -0
- package/src/utils/viem-utils/hashTypedData.js +61 -0
- package/src/utils/viem-utils/types.d.ts +6 -0
- package/src/utils/viem-utils/types.d.ts.map +1 -0
- package/src/utils/viem-utils/types.js +18 -0
- package/src/utils/viem.d.ts +11 -0
- package/src/utils/viem.d.ts.map +1 -0
- package/src/utils/viem.js +11 -0
- package/src/utils/zcf-tools.d.ts +15 -1
- package/src/utils/zcf-tools.d.ts.map +1 -1
- package/src/utils/zcf-tools.js +19 -3
- package/src/utils/zoe-tools.d.ts +5 -2
- package/src/utils/zoe-tools.d.ts.map +1 -1
- package/src/utils/zoe-tools.js +8 -2
- package/src/vat-orchestration.d.ts +5 -3
- package/src/vat-orchestration.d.ts.map +1 -1
- package/src/vat-orchestration.js +4 -3
- package/src/vendor/viem/{_esm-YOAV66U4.js → _esm-OKAICHVC.js} +2 -2
- package/src/vendor/viem/{ccip-AAQDZF3N.js → ccip-34BSSMV5.js} +1 -2
- package/src/vendor/viem/{chunk-4EF4K2MH.js → chunk-GCI53Z2G.js} +35 -1
- package/src/vendor/viem/chunk-ZKSIP2AM.js +326 -0
- package/src/vendor/viem/viem-abi.js +2 -2
- package/src/vendor/viem/viem-typedData.d.ts +19 -0
- package/src/vendor/viem/viem-typedData.js +59 -0
- package/tools/contract-tests.d.ts +34 -19
- package/tools/contract-tests.d.ts.map +1 -1
- package/tools/contract-tests.ts +15 -3
- package/tools/ibc-mock-fixtures.d.ts +49 -0
- package/tools/ibc-mock-fixtures.d.ts.map +1 -0
- package/tools/ibc-mock-fixtures.ts +161 -0
- package/tools/ibc-mocks.d.ts +2 -3
- package/tools/ibc-mocks.d.ts.map +1 -1
- package/tools/ibc-mocks.ts +2 -1
- package/tools/make-test-address.d.ts +1 -1
- package/tools/make-test-address.d.ts.map +1 -1
- package/tools/make-test-address.js +1 -2
- package/tools/network-fakes.d.ts +142 -0
- package/tools/network-fakes.d.ts.map +1 -0
- package/tools/network-fakes.ts +388 -0
- package/tsup.config.ts +3 -1
- package/src/cosmos-api.ts +0 -469
- package/src/exos/exo-interfaces.ts +0 -35
- package/src/orchestration-api.ts +0 -365
- package/src/stubs/viem-abi.d.ts.map +0 -1
- package/src/types.ts +0 -26
- package/src/vendor/viem/chunk-XN4LUOIH.js +0 -253
- package/src/vendor/viem/secp256k1-WHBDSQB2.js +0 -1914
- /package/src/stubs/{viem-abi.ts → viem-abi.js} +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Utilities for working with ResultMeta<T>.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { isVow } from '@agoric/vow/src/vow-utils.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @import {EVow, VowTools, Fulfilled} from '@agoric/vow';
|
|
9
|
+
* @import {Zone} from '@agoric/base-zone';
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Record<string, any>} ProgressReport
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @template T
|
|
18
|
+
* @typedef {object} PublicationInternals
|
|
19
|
+
* @property {T} value
|
|
20
|
+
* @property {EVow<PublicationInternals<T>>} tail
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @template T
|
|
25
|
+
* @template [A=unknown]
|
|
26
|
+
* @callback PublicationReducer Called on the value of each linked T. This
|
|
27
|
+
* function should perform any side-effects it can when it receives a new
|
|
28
|
+
* value, since there is no guarantee that the ProgressRecord tail will be
|
|
29
|
+
* prompt (it may take a long time with cross-chain communication) or ever
|
|
30
|
+
* fulfill (it may result in a rejection).
|
|
31
|
+
* @param {T | undefined | null} value `value == null` is a sentinel for the
|
|
32
|
+
* final reducer call.
|
|
33
|
+
* @param {A} accum previous reduction value
|
|
34
|
+
* @returns {EVow<A | null>} Returning `null` exits the reduction
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Utilities for working with ResultMeta within an async flow.
|
|
39
|
+
*/
|
|
40
|
+
export const progressTrackerAsyncFlowUtils = {
|
|
41
|
+
/**
|
|
42
|
+
* Converts a specimen to a Promise. Since the use of Vows is only needed
|
|
43
|
+
* outside of async-flows, we currently reject if we encounter one.
|
|
44
|
+
*
|
|
45
|
+
* @template T
|
|
46
|
+
* @param {T} specimen
|
|
47
|
+
* @returns {Promise<Fulfilled<T>>}
|
|
48
|
+
*/
|
|
49
|
+
promiseFromVow: async specimen => {
|
|
50
|
+
const maybeVow = await specimen;
|
|
51
|
+
!isVow(maybeVow) ||
|
|
52
|
+
assert.Fail`Unexpected Vow ${maybeVow}; only use progress utilities within async flows (withOrchestration)`;
|
|
53
|
+
|
|
54
|
+
return /** @type {Fulfilled<T>} */ (maybeVow);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Extracts reports from a tracker, calling `reducer` on each.
|
|
59
|
+
*
|
|
60
|
+
* @template [A=unknown]
|
|
61
|
+
* @param {ProgressTracker} tracker
|
|
62
|
+
* @param {PublicationReducer<ProgressReport, A>} reducer
|
|
63
|
+
* @param {A} initialAccum accumulator to pass to the reducer on the first
|
|
64
|
+
* call. Providing the initial accumulator avoids having to deal with
|
|
65
|
+
* `undefined` values in the reducer or explicitly specify the desired
|
|
66
|
+
* type.
|
|
67
|
+
* @returns {Promise<A>} the accumulated result
|
|
68
|
+
*/
|
|
69
|
+
reduceProgressReports: async (tracker, reducer, initialAccum) => {
|
|
70
|
+
const { promiseFromVow } = progressTrackerAsyncFlowUtils;
|
|
71
|
+
|
|
72
|
+
/** @type {PublicationInternals<ProgressReport> | null} */
|
|
73
|
+
let nextReport = await promiseFromVow(tracker.exposePublicationInternals());
|
|
74
|
+
let accum = harden(initialAccum);
|
|
75
|
+
|
|
76
|
+
while (true) {
|
|
77
|
+
const reduction = await promiseFromVow(
|
|
78
|
+
reducer(nextReport?.value ?? null, accum),
|
|
79
|
+
);
|
|
80
|
+
harden(reduction);
|
|
81
|
+
|
|
82
|
+
if (reduction == null) {
|
|
83
|
+
nextReport = null;
|
|
84
|
+
} else {
|
|
85
|
+
accum = /** @type {A} */ (reduction);
|
|
86
|
+
}
|
|
87
|
+
if (nextReport == null) {
|
|
88
|
+
return accum;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
nextReport = (await promiseFromVow(nextReport?.tail)) ?? null;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
harden(progressTrackerAsyncFlowUtils);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A helper for ProgressPublication operations via VowTools.
|
|
100
|
+
*
|
|
101
|
+
* @param {Zone} zone
|
|
102
|
+
* @param {object} powers
|
|
103
|
+
* @param {Pick<VowTools, 'makeVowKit'>} powers.vowTools
|
|
104
|
+
*/
|
|
105
|
+
export const prepareProgressTracker = (zone, { vowTools: { makeVowKit } }) => {
|
|
106
|
+
const makeProgressTrackerKit = zone.exoClassKit(
|
|
107
|
+
'ProgressTrackerKit',
|
|
108
|
+
undefined,
|
|
109
|
+
() => {
|
|
110
|
+
const { vow: nextReport, resolver: tailResolver } = makeVowKit();
|
|
111
|
+
|
|
112
|
+
/** @type {PublicationInternals<ProgressReport>} */
|
|
113
|
+
const currentPublication = harden({
|
|
114
|
+
value: {},
|
|
115
|
+
tail: nextReport,
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
currentPublication,
|
|
119
|
+
done: false,
|
|
120
|
+
tailResolver,
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
helper: {},
|
|
125
|
+
public: {
|
|
126
|
+
getCurrentProgressReport() {
|
|
127
|
+
const { currentPublication } = this.state;
|
|
128
|
+
return currentPublication.value;
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* @param {ProgressReport} progressReport
|
|
132
|
+
*/
|
|
133
|
+
update(progressReport) {
|
|
134
|
+
const { currentPublication, tailResolver, done } = this.state;
|
|
135
|
+
if (done) {
|
|
136
|
+
return currentPublication.value;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const { vow: nextTail, resolver: nextTailResolver } = makeVowKit();
|
|
140
|
+
|
|
141
|
+
const tail = harden({ value: progressReport, tail: nextTail });
|
|
142
|
+
this.state.currentPublication = tail;
|
|
143
|
+
tailResolver.resolve(tail);
|
|
144
|
+
this.state.tailResolver = nextTailResolver;
|
|
145
|
+
return progressReport;
|
|
146
|
+
},
|
|
147
|
+
finish() {
|
|
148
|
+
const { currentPublication, tailResolver, done } = this.state;
|
|
149
|
+
if (!done) {
|
|
150
|
+
tailResolver.resolve(null);
|
|
151
|
+
this.state.done = true;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return currentPublication.value;
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* CAVEAT: Intended for use only by `progress.js` utilities.
|
|
158
|
+
*
|
|
159
|
+
* @returns {PublicationInternals<ProgressReport>}
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
exposePublicationInternals() {
|
|
163
|
+
return this.state.currentPublication;
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const makeProgressTracker = () => makeProgressTrackerKit().public;
|
|
170
|
+
return harden(makeProgressTracker);
|
|
171
|
+
};
|
|
172
|
+
harden(prepareProgressTracker);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @typedef {ReturnType<typeof prepareProgressTracker>} MakeProgressTracker
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @typedef {ReturnType<MakeProgressTracker>} ProgressTracker
|
|
180
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: OrchestrationPowers,
|
|
1
|
+
export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: OrchestrationPowers, remoteMarshaller: Remote<Marshaller>, opts?: {
|
|
2
2
|
chainInfoValueShape?: WithOrchestrationOpts["chainInfoValueShape"];
|
|
3
3
|
}): {
|
|
4
4
|
makeOrchestrateKit: (zone: Zone) => {
|
|
@@ -8,6 +8,17 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
8
8
|
}>(guestFns: GFM, hostCtx: HC) => { [N in keyof GFM]: HostForGuest<GFM[N]>; };
|
|
9
9
|
};
|
|
10
10
|
baggage: Baggage;
|
|
11
|
+
cachingMarshaller: {
|
|
12
|
+
serialize: (val?: import("@endo/pass-style").Passable) => import("@agoric/vow").ERef<import("@endo/marshal").CapData<unknown>>;
|
|
13
|
+
unserialize: (data: import("@endo/marshal").CapData<unknown>) => any;
|
|
14
|
+
toCapData: (val?: import("@endo/pass-style").Passable) => import("@agoric/vow").ERef<import("@endo/marshal").CapData<unknown>>;
|
|
15
|
+
fromCapData: (data: import("@endo/marshal").CapData<unknown>) => any;
|
|
16
|
+
} & import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
17
|
+
serialize: (val?: import("@endo/pass-style").Passable) => import("@agoric/vow").ERef<import("@endo/marshal").CapData<unknown>>;
|
|
18
|
+
unserialize: (data: import("@endo/marshal").CapData<unknown>) => any;
|
|
19
|
+
toCapData: (val?: import("@endo/pass-style").Passable) => import("@agoric/vow").ERef<import("@endo/marshal").CapData<unknown>>;
|
|
20
|
+
fromCapData: (data: import("@endo/marshal").CapData<unknown>) => any;
|
|
21
|
+
}>;
|
|
11
22
|
chainHub: import("@endo/exo").Guarded<{
|
|
12
23
|
registerChain(name: string, chainInfo: import("../orchestration-api.js").ChainInfo): void;
|
|
13
24
|
updateChain(chainName: string, chainInfo: import("../orchestration-api.js").ChainInfo): void;
|
|
@@ -24,7 +35,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
24
35
|
registerAsset(denom: import("../orchestration-api.js").Denom, detail: DenomDetail): void;
|
|
25
36
|
updateAsset(denom: import("../orchestration-api.js").Denom, detail: DenomDetail): void;
|
|
26
37
|
getAsset(denom: import("../orchestration-api.js").Denom, srcChainName: string): DenomDetail | undefined;
|
|
27
|
-
getDenom(brand: Brand): import("../orchestration-api.js").Denom | undefined;
|
|
38
|
+
getDenom(brand: import("@agoric/ertp").Brand): import("../orchestration-api.js").Denom | undefined;
|
|
28
39
|
resolveAccountId(partialId: import("../orchestration-api.js").AccountId | import("../cosmos-api.js").Bech32Address): import("../orchestration-api.js").AccountId;
|
|
29
40
|
coerceCosmosAddress(partialId: import("../orchestration-api.js").AccountIdArg | import("../cosmos-api.js").Bech32Address): import("../orchestration-api.js").CosmosChainAddress;
|
|
30
41
|
makeTransferRoute(destination: import("../orchestration-api.js").AccountIdArg | import("../cosmos-api.js").Bech32Address, denomAmount: import("../orchestration-api.js").DenomAmount, srcChainName: string, forwardOpts?: import("../cosmos-api.js").IBCMsgTransferOptions["forwardOpts"]): import("../cosmos-api.js").TransferRoute;
|
|
@@ -40,7 +51,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
40
51
|
restart(eager?: boolean): void;
|
|
41
52
|
wake(): void;
|
|
42
53
|
getOutcome(): import("@agoric/vow").Vow<any>;
|
|
43
|
-
dump(): ([op: "doFulfill", vow: import("@agoric/vow").Vow<Passable>, fulfillment: Passable] | [op: "doReject", vow: import("@agoric/vow").Vow<Passable>, reason: Passable] | [op: "doReturn", callIndex: number, result: Passable] | [op: "doThrow", callIndex: number, problem: Passable] | [op: "checkCall", target: Passable, optVerb: PropertyKey | undefined, args: Passable[], callIndex: number] | [op: "checkSendOnly", target: Passable, optVerb: PropertyKey | undefined, args: Passable[], callIndex: number] | [op: "checkSend", target: Passable, optVerb: PropertyKey | undefined, args: Passable[], callIndex: number])[];
|
|
54
|
+
dump(): ([op: "doFulfill", vow: import("@agoric/vow").Vow<import("@endo/pass-style").Passable>, fulfillment: import("@endo/pass-style").Passable] | [op: "doReject", vow: import("@agoric/vow").Vow<import("@endo/pass-style").Passable>, reason: import("@endo/pass-style").Passable] | [op: "doReturn", callIndex: number, result: import("@endo/pass-style").Passable] | [op: "doThrow", callIndex: number, problem: import("@endo/pass-style").Passable] | [op: "checkCall", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number] | [op: "checkSendOnly", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number] | [op: "checkSend", target: import("@endo/pass-style").Passable, optVerb: PropertyKey | undefined, args: import("@endo/pass-style").Passable[], callIndex: number])[];
|
|
44
55
|
getOptFatalProblem(): any;
|
|
45
56
|
};
|
|
46
57
|
admin: {
|
|
@@ -57,17 +68,21 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
57
68
|
startEager?: boolean;
|
|
58
69
|
}) => import("@agoric/async-flow").HostOf<F>;
|
|
59
70
|
adminAsyncFlow: import("@endo/exo").Guarded<{
|
|
60
|
-
getFailures(): import("@endo/patterns").CopyMap<any, Passable>;
|
|
71
|
+
getFailures(): import("@endo/patterns").CopyMap<any, import("@endo/pass-style").Passable>;
|
|
61
72
|
wakeAll(): void;
|
|
62
73
|
getFlowForOutcomeVow(outcomeVow: any): any;
|
|
63
74
|
}>;
|
|
64
75
|
allWokenP: Promise<void>;
|
|
65
76
|
prepareEndowment: (zone: Zone, tag: string, e: unknown) => any;
|
|
66
77
|
};
|
|
67
|
-
zcfTools:
|
|
78
|
+
zcfTools: {
|
|
79
|
+
assertUniqueKeyword: (keyword: string) => void;
|
|
80
|
+
atomicRearrange: (transfers: import("@agoric/zoe").TransferPart[]) => void;
|
|
81
|
+
makeInvitation: <R, A = undefined>(offerHandler: import("@agoric/zoe").OfferHandler<import("@agoric/vow").ERef<R>, A>, description: string, customDetails?: object, proposalShape?: Pattern) => import("@agoric/vow").Vow<import("@agoric/zoe").Invitation<R, A>>;
|
|
82
|
+
};
|
|
68
83
|
zoeTools: {
|
|
69
|
-
localTransfer: (srcSeat:
|
|
70
|
-
withdrawToSeat: (localAccount: import("../cosmos-api.js").LocalAccountMethods, destSeat:
|
|
84
|
+
localTransfer: (srcSeat: import("@agoric/zoe").ZCFSeat, localAccount: import("../cosmos-api.js").LocalAccountMethods, amounts: import("@agoric/zoe").AmountKeywordRecord) => import("@agoric/vow").Vow<void>;
|
|
85
|
+
withdrawToSeat: (localAccount: import("../cosmos-api.js").LocalAccountMethods, destSeat: import("@agoric/zoe").ZCFSeat, amounts: import("@agoric/zoe").AmountKeywordRecord) => import("@agoric/vow").Vow<void>;
|
|
71
86
|
};
|
|
72
87
|
zone: Zone;
|
|
73
88
|
orchestrate: <HC, GF extends import("../orchestration-api.js").OrchestrationFlow<import("@agoric/async-flow").GuestInterface<HC>>>(durableName: string, hostCtx: HC, guestFn: GF) => HostForGuest<GF>;
|
|
@@ -76,7 +91,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
76
91
|
}>(guestFns: GFM, hostCtx: HC) => { [N in keyof GFM]: HostForGuest<GFM[N]>; };
|
|
77
92
|
};
|
|
78
93
|
export function withOrchestration<CT extends Record<string, unknown>, PA extends OrchestrationPowers & {
|
|
79
|
-
marshaller: Marshaller
|
|
94
|
+
marshaller: Remote<Marshaller>;
|
|
80
95
|
}, R>(contractFn: (zcf: ZCF<CT>, privateArgs: PA, zone: Zone, tools: OrchestrationTools) => Promise<R>, opts?: WithOrchestrationOpts): (zcf: ZCF<CT>, privateArgs: PA, baggage: Baggage) => Promise<R>;
|
|
81
96
|
export type OrchestrationPowers = {
|
|
82
97
|
localchain: Remote<LocalChain>;
|
|
@@ -100,12 +115,15 @@ export type WithOrchestrationOpts = {
|
|
|
100
115
|
chainInfoValueShape?: Pattern;
|
|
101
116
|
};
|
|
102
117
|
export type OrchestrationTools = Omit<ReturnType<typeof provideOrchestration>, "zone">;
|
|
118
|
+
import type { ZCF } from '@agoric/zoe';
|
|
103
119
|
import type { Baggage } from '@agoric/vat-data';
|
|
120
|
+
import type { Marshaller } from '@agoric/internal/src/lib-chainStorage.js';
|
|
121
|
+
import type { Remote } from '@agoric/vow';
|
|
104
122
|
import type { Zone } from '@agoric/zone';
|
|
123
|
+
import type { Pattern } from '@endo/patterns';
|
|
105
124
|
import type { LocalChain } from '@agoric/vats/src/localchain.js';
|
|
106
|
-
import type { Remote } from '@agoric/vow';
|
|
107
125
|
import type { CosmosInterchainService } from '../exos/exo-interfaces.js';
|
|
126
|
+
import type { StorageNode } from '@agoric/internal/src/lib-chainStorage.js';
|
|
108
127
|
import type { TimerService } from '@agoric/time';
|
|
109
128
|
import type { NameHub } from '@agoric/vats';
|
|
110
|
-
import type { Pattern } from '@endo/patterns';
|
|
111
129
|
//# sourceMappingURL=start-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAiEO,0CARI,GAAG,WACH,OAAO,gBACP,mBAAmB,oBACnB,OAAO,UAAU,CAAC,SAE1B;IAA4D,mBAAmB,GAAvE,qBAAqB,CAAC,qBAAqB,CAAC;CACpD;+BA6GU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAnFH,CAAC;;;;;;;;;;;;;;;;;;;;;sBAyK6sV,CAAC;;;;;;;;;;;;;;;;;;;;;;;;EApD5tV;AA+BM,kCAfgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IAC/B,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;CAC/B,EACQ,CAAC,cACH,CACN,GAAG,EAAE,IAAI,EAAE,CAAC,EACZ,WAAW,EAAE,EAAE,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,SACP,qBAAqB,GACnB,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAsBzE;kCAhOU;IACR,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;IAC/B,oBAAoB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,OAAO,WAAW,CAAC,CAAC;IAClC,YAAY,EAAE,OAAO,YAAY,CAAC,CAAC;IACnC,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;;;;;;;;;;;;;0BAQU,OAAO;;iCAmKP,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;yBArL7C,aAAa;6BANT,kBAAkB;gCAJF,0CAA0C;4BAM3D,aAAa;0BACf,cAAc;6BACX,gBAAgB;gCANb,gCAAgC;6CAOnB,2BAA2B;iCAT3B,0CAA0C;kCAGrD,cAAc;6BAEnB,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { prepareAsyncFlowTools } from '@agoric/async-flow';
|
|
2
|
+
import { wrapRemoteMarshaller } from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
2
3
|
import { prepareVowTools } from '@agoric/vow';
|
|
3
4
|
import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
4
5
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
@@ -6,6 +7,7 @@ import { makeChainHub } from '../exos/chain-hub.js';
|
|
|
6
7
|
import { prepareCosmosOrchestrationAccount } from '../exos/cosmos-orchestration-account.js';
|
|
7
8
|
import { prepareLocalChainFacade } from '../exos/local-chain-facade.js';
|
|
8
9
|
import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
|
|
10
|
+
import { prepareProgressTracker } from './progress.js';
|
|
9
11
|
import { prepareOrchestrator } from '../exos/orchestrator.js';
|
|
10
12
|
import { prepareRemoteChainFacade } from '../exos/remote-chain-facade.js';
|
|
11
13
|
import { makeOrchestrationFacade } from '../facade.js';
|
|
@@ -13,6 +15,9 @@ import { makeZoeTools } from './zoe-tools.js';
|
|
|
13
15
|
import { makeZcfTools } from './zcf-tools.js';
|
|
14
16
|
|
|
15
17
|
/**
|
|
18
|
+
* @import {ERemote} from '@agoric/internal';
|
|
19
|
+
* @import {Marshaller, StorageNode} from '@agoric/internal/src/lib-chainStorage.js';
|
|
20
|
+
* @import {EMarshaller} from '@agoric/internal/src/marshal/wrap-marshaller.js';
|
|
16
21
|
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
17
22
|
* @import {TimerService} from '@agoric/time';
|
|
18
23
|
* @import {Baggage} from '@agoric/vat-data';
|
|
@@ -21,6 +26,7 @@ import { makeZcfTools } from './zcf-tools.js';
|
|
|
21
26
|
* @import {Zone} from '@agoric/zone';
|
|
22
27
|
* @import {Pattern} from '@endo/patterns';
|
|
23
28
|
* @import {CosmosInterchainService} from '../exos/exo-interfaces.js';
|
|
29
|
+
* @import {ZCF} from '@agoric/zoe';
|
|
24
30
|
*/
|
|
25
31
|
|
|
26
32
|
/**
|
|
@@ -52,7 +58,7 @@ import { makeZcfTools } from './zcf-tools.js';
|
|
|
52
58
|
* @param {ZCF} zcf
|
|
53
59
|
* @param {Baggage} baggage
|
|
54
60
|
* @param {OrchestrationPowers} remotePowers
|
|
55
|
-
* @param {Marshaller}
|
|
61
|
+
* @param {Remote<Marshaller>} remoteMarshaller
|
|
56
62
|
* @param {object} [opts]
|
|
57
63
|
* @param {WithOrchestrationOpts['chainInfoValueShape']} [opts.chainInfoValueShape]
|
|
58
64
|
* @internal
|
|
@@ -61,7 +67,7 @@ export const provideOrchestration = (
|
|
|
61
67
|
zcf,
|
|
62
68
|
baggage,
|
|
63
69
|
remotePowers,
|
|
64
|
-
|
|
70
|
+
remoteMarshaller,
|
|
65
71
|
opts = {},
|
|
66
72
|
) => {
|
|
67
73
|
// separate zones
|
|
@@ -93,10 +99,19 @@ export const provideOrchestration = (
|
|
|
93
99
|
|
|
94
100
|
const zcfTools = makeZcfTools(zcf, vowTools);
|
|
95
101
|
|
|
96
|
-
const
|
|
102
|
+
const cachingMarshaller = wrapRemoteMarshaller(remoteMarshaller);
|
|
103
|
+
|
|
104
|
+
const { makeRecorderKit } = prepareRecorderKitMakers(
|
|
105
|
+
baggage,
|
|
106
|
+
cachingMarshaller,
|
|
107
|
+
);
|
|
108
|
+
const makeProgressTracker = prepareProgressTracker(zones.orchestration, {
|
|
109
|
+
vowTools,
|
|
110
|
+
});
|
|
97
111
|
const makeLocalOrchestrationAccountKit = prepareLocalOrchestrationAccountKit(
|
|
98
112
|
zones.orchestration,
|
|
99
113
|
{
|
|
114
|
+
makeProgressTracker,
|
|
100
115
|
makeRecorderKit,
|
|
101
116
|
zcf,
|
|
102
117
|
timerService,
|
|
@@ -115,6 +130,7 @@ export const provideOrchestration = (
|
|
|
115
130
|
zones.orchestration,
|
|
116
131
|
{
|
|
117
132
|
chainHub,
|
|
133
|
+
makeProgressTracker,
|
|
118
134
|
makeRecorderKit,
|
|
119
135
|
timerService,
|
|
120
136
|
vowTools,
|
|
@@ -180,6 +196,7 @@ export const provideOrchestration = (
|
|
|
180
196
|
...defaultOrchestrateKit,
|
|
181
197
|
makeOrchestrateKit,
|
|
182
198
|
baggage,
|
|
199
|
+
cachingMarshaller,
|
|
183
200
|
chainHub,
|
|
184
201
|
vowTools,
|
|
185
202
|
asyncFlowTools,
|
|
@@ -205,7 +222,7 @@ harden(provideOrchestration);
|
|
|
205
222
|
*
|
|
206
223
|
* @template {Record<string, unknown>} CT
|
|
207
224
|
* @template {OrchestrationPowers & {
|
|
208
|
-
* marshaller: Marshaller
|
|
225
|
+
* marshaller: Remote<Marshaller>;
|
|
209
226
|
* }} PA
|
|
210
227
|
* @template R
|
|
211
228
|
* @param {(
|
|
@@ -220,16 +237,22 @@ harden(provideOrchestration);
|
|
|
220
237
|
*/
|
|
221
238
|
export const withOrchestration =
|
|
222
239
|
(contractFn, opts) => async (zcf, privateArgs, baggage) => {
|
|
223
|
-
const { marshaller, ...allOrchPowers } = privateArgs;
|
|
240
|
+
const { marshaller: remoteMarshaller, ...allOrchPowers } = privateArgs;
|
|
224
241
|
const { storageNode: _, ...requiredOrchPowers } = allOrchPowers;
|
|
225
242
|
const { publishAccountInfo, chainInfoValueShape } = opts ?? {};
|
|
243
|
+
|
|
226
244
|
const { zone, ...tools } = provideOrchestration(
|
|
227
245
|
zcf,
|
|
228
246
|
baggage,
|
|
229
247
|
publishAccountInfo ? allOrchPowers : requiredOrchPowers,
|
|
230
|
-
|
|
248
|
+
remoteMarshaller,
|
|
231
249
|
{ chainInfoValueShape },
|
|
232
250
|
);
|
|
233
|
-
|
|
251
|
+
const [startResult] = await Promise.all([
|
|
252
|
+
contractFn(zcf, privateArgs, zone, tools),
|
|
253
|
+
// Make sure that any errors in async-flow awake abort contract start
|
|
254
|
+
tools.asyncFlowTools.allWokenP,
|
|
255
|
+
]);
|
|
256
|
+
return startResult;
|
|
234
257
|
};
|
|
235
258
|
harden(withOrchestration);
|
package/src/utils/time.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function makeTimestampHelper(timer: Remote<TimerService>): {
|
|
|
23
23
|
* @import {TimerService} from '@agoric/time';
|
|
24
24
|
* @import {Remote} from '@agoric/internal';
|
|
25
25
|
* @import {EReturn} from '@endo/far';
|
|
26
|
-
* @import {IBCMsgTransferOptions} from '../cosmos-api';
|
|
26
|
+
* @import {IBCMsgTransferOptions} from '../cosmos-api.js';
|
|
27
27
|
* @import {MsgTransfer} from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
28
28
|
*/
|
|
29
29
|
export const SECONDS_PER_MINUTE: 60n;
|
|
@@ -33,6 +33,6 @@ export const NANOSECONDS_PER_SECOND: 1000000000n;
|
|
|
33
33
|
export type TimestampHelper = EReturn<typeof makeTimestampHelper>;
|
|
34
34
|
import type { TimerService } from '@agoric/time';
|
|
35
35
|
import type { Remote } from '@agoric/internal';
|
|
36
|
-
import type { IBCMsgTransferOptions } from '../cosmos-api';
|
|
36
|
+
import type { IBCMsgTransferOptions } from '../cosmos-api.js';
|
|
37
37
|
import type { EReturn } from '@endo/far';
|
|
38
38
|
//# sourceMappingURL=time.d.ts.map
|
package/src/utils/time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["time.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,2CAFW,OAAO,YAAY,CAAC;IAI3B;;;;;;;;;;OAUG;4CAHQ,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC;IAc5B,4CAA4C;8BAAhC,qBAAqB;EAYpC;AAtDD;;;;;;GAMG;AAEH,iCAAkC,GAAG,CAAC;AACtC,sCAAuC,KAAK,CAAC;AAC7C,0CAA2C,QAAU,CAAC;AACtD,qCAAsC,WAAc,CAAC;8BA6CvC,QAAQ,OAAO,mBAAmB,CAAC;kCAvDlB,cAAc;4BACpB,kBAAkB;2CAEH,
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["time.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,2CAFW,OAAO,YAAY,CAAC;IAI3B;;;;;;;;;;OAUG;4CAHQ,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC;IAc5B,4CAA4C;8BAAhC,qBAAqB;EAYpC;AAtDD;;;;;;GAMG;AAEH,iCAAkC,GAAG,CAAC;AACtC,sCAAuC,KAAK,CAAC;AAC7C,0CAA2C,QAAU,CAAC;AACtD,qCAAsC,WAAc,CAAC;8BA6CvC,QAAQ,OAAO,mBAAmB,CAAC;kCAvDlB,cAAc;4BACpB,kBAAkB;2CAEH,kBAAkB;6BADhC,WAAW"}
|
package/src/utils/time.js
CHANGED
|
@@ -5,7 +5,7 @@ import { TimeMath } from '@agoric/time';
|
|
|
5
5
|
* @import {TimerService} from '@agoric/time';
|
|
6
6
|
* @import {Remote} from '@agoric/internal';
|
|
7
7
|
* @import {EReturn} from '@endo/far';
|
|
8
|
-
* @import {IBCMsgTransferOptions} from '../cosmos-api';
|
|
8
|
+
* @import {IBCMsgTransferOptions} from '../cosmos-api.js';
|
|
9
9
|
* @import {MsgTransfer} from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file viem internal typedData utils exported for direct usage
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* Copyright (c) 2023-present weth, LLC
|
|
6
|
+
* Copied from https://github.com/wevm/viem/blob/ea0b9d4c391567dd811acbfd889121bb9cb1c26c/src/utils/signature/hashTypedData.ts
|
|
7
|
+
*/
|
|
8
|
+
type MessageTypeProperty = {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Serialize an EIP-712 struct definition to a string per
|
|
14
|
+
* https://eips.ethereum.org/EIPS/eip-712#definition-of-encodetype
|
|
15
|
+
*/
|
|
16
|
+
export declare function encodeType({ primaryType, types, }: {
|
|
17
|
+
primaryType: string;
|
|
18
|
+
types: Record<string, readonly MessageTypeProperty[]>;
|
|
19
|
+
}): string;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=hashTypedData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashTypedData.d.ts","sourceRoot":"","sources":["hashTypedData.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,WAAW,EACX,KAAK,GACN,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,CAAC;CACvD,UAaA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file viem internal typedData utils exported for direct usage
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* Copyright (c) 2023-present weth, LLC
|
|
6
|
+
* Copied from https://github.com/wevm/viem/blob/ea0b9d4c391567dd811acbfd889121bb9cb1c26c/src/utils/signature/hashTypedData.ts
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Serialize an EIP-712 struct definition to a string per
|
|
16
|
+
* https://eips.ethereum.org/EIPS/eip-712#definition-of-encodetype
|
|
17
|
+
*/
|
|
18
|
+
export function encodeType({
|
|
19
|
+
primaryType,
|
|
20
|
+
types,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
) {
|
|
25
|
+
let result = '';
|
|
26
|
+
const unsortedDeps = findTypeDependencies({ primaryType, types });
|
|
27
|
+
unsortedDeps.delete(primaryType);
|
|
28
|
+
|
|
29
|
+
const deps = [primaryType, ...Array.from(unsortedDeps).sort()];
|
|
30
|
+
for (const type of deps) {
|
|
31
|
+
result += `${type}(${types[type]
|
|
32
|
+
.map(({ name, type: t }) => `${t} ${name}`)
|
|
33
|
+
.join(',')})`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function findTypeDependencies(
|
|
40
|
+
{
|
|
41
|
+
primaryType: primaryType_,
|
|
42
|
+
types,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
,
|
|
47
|
+
results = new Set(),
|
|
48
|
+
) {
|
|
49
|
+
const match = primaryType_.match(/^\w*/u);
|
|
50
|
+
const primaryType = match?.[0] ;
|
|
51
|
+
if (results.has(primaryType) || types[primaryType] === undefined) {
|
|
52
|
+
return results;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
results.add(primaryType);
|
|
56
|
+
|
|
57
|
+
for (const field of types[primaryType]) {
|
|
58
|
+
findTypeDependencies({ primaryType: field.type, types }, results);
|
|
59
|
+
}
|
|
60
|
+
return results;
|
|
61
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ByteArray, Hex, Signature, TypedData, TypedDataDefinition } from 'viem';
|
|
2
|
+
export type WithSignature<T> = T & {
|
|
3
|
+
signature: Hex | ByteArray | Signature;
|
|
4
|
+
};
|
|
5
|
+
export type SignedTypedDataDefinition<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData, primaryTypes = typedData extends TypedData ? keyof typedData : string> = WithSignature<TypedDataDefinition<typedData, primaryType, primaryTypes>>;
|
|
6
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,GAAG,EACH,SAAS,EACT,SAAS,EACT,mBAAmB,EACpB,MAAM,MAAM,CAAC;AAEd,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG;IACjC,SAAS,EAAE,GAAG,GAAG,SAAS,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,yBAAyB,CACnC,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjE,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,GAAG,MAAM,SAAS,EAEtE,YAAY,GAAG,SAAS,SAAS,SAAS,GAAG,MAAM,SAAS,GAAG,MAAM,IACnE,aAAa,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file entry point for some common viem utils
|
|
3
|
+
*
|
|
4
|
+
* This file should eventually become a `.js` file once we can strip types from
|
|
5
|
+
* `.ts` files and rewrite relative import specifiers in `.js` files.
|
|
6
|
+
*
|
|
7
|
+
* NPM consumers could use jsr.io to consume this in the meantime.
|
|
8
|
+
*/
|
|
9
|
+
export * from './viem-utils/hashTypedData.js';
|
|
10
|
+
export * from './viem-utils/types.js';
|
|
11
|
+
//# sourceMappingURL=viem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["viem.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file entry point for some common viem utils
|
|
3
|
+
*
|
|
4
|
+
* This file should eventually become a `.js` file once we can strip types from
|
|
5
|
+
* `.ts` files and rewrite relative import specifiers in `.js` files.
|
|
6
|
+
*
|
|
7
|
+
* NPM consumers could use jsr.io to consume this in the meantime.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export * from './viem-utils/hashTypedData.js';
|
|
11
|
+
export * from './viem-utils/types.js';
|
package/src/utils/zcf-tools.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
export function makeZcfTools(zcf: ZCF, vowTools: VowTools): HostInterface<ZcfTools>;
|
|
1
|
+
export function makeZcfTools(zcf: ZCF, vowTools: VowTools): HostInterface<ZcfTools, GenericZcfToolsOverrides>;
|
|
2
|
+
/**
|
|
3
|
+
* ZcfTools methods that are generic currently don't survive the HostInterface
|
|
4
|
+
* type below. So, we manually define their Vow transformation here and supply
|
|
5
|
+
* them as the Overrides type parameter.
|
|
6
|
+
*/
|
|
7
|
+
export type GenericZcfToolsOverrides = {
|
|
8
|
+
makeInvitation: <R, A = undefined>(offerHandler: OfferHandler<ERef<R>, A>, description: string, customDetails?: object, proposalShape?: Pattern) => Vow<Invitation<R, A>>;
|
|
9
|
+
};
|
|
10
|
+
import type { ZCF } from '@agoric/zoe';
|
|
2
11
|
import type { VowTools } from '@agoric/vow';
|
|
3
12
|
import type { ZcfTools } from '../types.js';
|
|
4
13
|
import type { HostInterface } from '@agoric/async-flow';
|
|
14
|
+
import type { ERef } from '@agoric/vow';
|
|
15
|
+
import type { OfferHandler } from '@agoric/zoe';
|
|
16
|
+
import type { Pattern } from '@endo/patterns';
|
|
17
|
+
import type { Invitation } from '@agoric/zoe';
|
|
18
|
+
import type { Vow } from '@agoric/vow';
|
|
5
19
|
//# sourceMappingURL=zcf-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcf-tools.d.ts","sourceRoot":"","sources":["zcf-tools.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zcf-tools.d.ts","sourceRoot":"","sources":["zcf-tools.js"],"names":[],"mappings":"AA+BO,kCAJI,GAAG,YACH,QAAQ,GACN,cAAc,QAAQ,EAAE,wBAAwB,CAAC,CAqB1D;;;;;;;oBAhCU,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EAC1B,YAAY,EAAE,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACtC,WAAW,EAAE,MAAM,EACnB,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,OAAO,KACpB,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;;yBApBmB,aAAa;8BADvB,aAAa;8BAGxB,aAAa;mCAJA,oBAAoB;0BACtB,aAAa;kCACH,aAAa;6BACnC,gBAAgB;gCADM,aAAa;yBADvB,aAAa"}
|
package/src/utils/zcf-tools.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @import {HostInterface} from '@agoric/async-flow';
|
|
3
|
-
* @import {VowTools} from '@agoric/vow';
|
|
2
|
+
* @import {HostInterface, HostOf} from '@agoric/async-flow';
|
|
3
|
+
* @import {ERef, Vow, VowTools} from '@agoric/vow';
|
|
4
|
+
* @import {Invitation, OfferHandler, ZCF} from '@agoric/zoe';
|
|
5
|
+
* @import {Pattern} from '@endo/patterns';
|
|
4
6
|
* @import {ZcfTools} from '../types.js';
|
|
5
7
|
*/
|
|
6
8
|
|
|
@@ -8,10 +10,24 @@ import { M, mustMatch } from '@endo/patterns';
|
|
|
8
10
|
|
|
9
11
|
const HandlerShape = M.remotable('OfferHandler');
|
|
10
12
|
|
|
13
|
+
/**
|
|
14
|
+
* ZcfTools methods that are generic currently don't survive the HostInterface
|
|
15
|
+
* type below. So, we manually define their Vow transformation here and supply
|
|
16
|
+
* them as the Overrides type parameter.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {object} GenericZcfToolsOverrides
|
|
19
|
+
* @property {<R, A = undefined>(
|
|
20
|
+
* offerHandler: OfferHandler<ERef<R>, A>,
|
|
21
|
+
* description: string,
|
|
22
|
+
* customDetails?: object,
|
|
23
|
+
* proposalShape?: Pattern,
|
|
24
|
+
* ) => Vow<Invitation<R, A>>} makeInvitation
|
|
25
|
+
*/
|
|
26
|
+
|
|
11
27
|
/**
|
|
12
28
|
* @param {ZCF} zcf
|
|
13
29
|
* @param {VowTools} vowTools
|
|
14
|
-
* @returns {HostInterface<ZcfTools>}
|
|
30
|
+
* @returns {HostInterface<ZcfTools, GenericZcfToolsOverrides>}
|
|
15
31
|
*/
|
|
16
32
|
export const makeZcfTools = (zcf, vowTools) =>
|
|
17
33
|
harden({
|