@agoric/orchestration 0.1.1-dev-a035bbe.0 → 0.1.1-dev-c244e96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -16
- package/src/chain-info.js +1 -1
- package/src/examples/sendAnywhere.contract.d.ts.map +1 -1
- package/src/examples/sendAnywhere.contract.js +3 -2
- package/src/examples/stakeBld.contract.d.ts +23 -11
- package/src/examples/stakeBld.contract.d.ts.map +1 -1
- package/src/examples/stakeBld.contract.js +9 -5
- package/src/examples/stakeIca.contract.d.ts +3 -3
- package/src/examples/stakeIca.contract.js +1 -1
- package/src/examples/swapExample.contract.d.ts.map +1 -1
- package/src/examples/swapExample.contract.js +6 -1
- package/src/exos/{chainAccountKit.d.ts → chain-account-kit.d.ts} +1 -1
- package/src/exos/chain-account-kit.d.ts.map +1 -0
- package/src/exos/{chainAccountKit.js → chain-account-kit.js} +2 -2
- package/src/exos/{cosmosOrchestrationAccount.d.ts → cosmos-orchestration-account.d.ts} +1 -1
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -0
- package/src/exos/{icqConnectionKit.d.ts → icq-connection-kit.d.ts} +1 -1
- package/src/exos/icq-connection-kit.d.ts.map +1 -0
- package/src/exos/local-chain-facade.d.ts +105 -0
- package/src/exos/local-chain-facade.d.ts.map +1 -0
- package/src/exos/local-chain-facade.js +67 -0
- package/src/exos/{local-chain-account-kit.d.ts → local-orchestration-account.d.ts} +33 -63
- package/src/exos/{local-chain-account-kit.d.ts.map → local-orchestration-account.d.ts.map} +1 -1
- package/src/exos/{local-chain-account-kit.js → local-orchestration-account.js} +48 -30
- package/src/exos/orchestrator.d.ts +4763 -0
- package/src/exos/orchestrator.d.ts.map +1 -0
- package/src/exos/orchestrator.js +93 -0
- package/src/exos/remote-chain-facade.d.ts +84 -0
- package/src/exos/remote-chain-facade.d.ts.map +1 -0
- package/src/exos/remote-chain-facade.js +81 -0
- package/src/facade.d.ts +88 -4
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +30 -169
- package/src/proposals/start-stakeAtom.d.ts +3 -3
- package/src/proposals/start-stakeAtom.d.ts.map +1 -1
- package/src/proposals/start-stakeBld.d.ts +23 -11
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/proposals/start-stakeOsmo.d.ts +3 -3
- package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
- package/src/service.js +3 -3
- package/src/typeGuards.d.ts +14 -0
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +15 -0
- package/src/types.d.ts +2 -2
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +2 -2
- package/src/utils/chainHub.d.ts +15 -3
- package/src/utils/chainHub.d.ts.map +1 -1
- package/src/utils/chainHub.js +1 -1
- package/src/utils/orc.js +2 -2
- package/src/utils/orchestrationAccount.js +3 -4
- package/src/utils/start-helper.d.ts +9 -0
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/utils/start-helper.js +32 -3
- package/src/exos/chainAccountKit.d.ts.map +0 -1
- package/src/exos/cosmosOrchestrationAccount.d.ts.map +0 -1
- package/src/exos/icqConnectionKit.d.ts.map +0 -1
- /package/src/exos/{cosmosOrchestrationAccount.js → cosmos-orchestration-account.js} +0 -0
- /package/src/exos/{icqConnectionKit.js → icq-connection-kit.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function prepareLocalOrchestrationAccountKit(zone: Zone, makeRecorderKit: <T>(storageNode: StorageNode | Awaited<import("@endo/far").FarRef<StorageNode>>, valueShape?: import("@agoric/zoe/src/contractSupport/recorder.js").TypedMatcher<T> | undefined) => RecorderKit<T>, zcf: ZCF, timerService: Remote<TimerService>, chainHub: {
|
|
2
2
|
registerChain(name: string, chainInfo: Readonly<{
|
|
3
3
|
chainId: string;
|
|
4
4
|
connections?: Record<string, import("@agoric/orchestration").IBCConnectionInfo> | undefined;
|
|
@@ -100,17 +100,6 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
100
100
|
readonly counterPartyChannelId: "channel-62";
|
|
101
101
|
readonly counterPartyPortId: "transfer";
|
|
102
102
|
readonly ordering: 0;
|
|
103
|
-
/**
|
|
104
|
-
* @typedef {object} LocalChainAccountNotification
|
|
105
|
-
* @property {string} address
|
|
106
|
-
*/
|
|
107
|
-
/**
|
|
108
|
-
* @typedef {{
|
|
109
|
-
* topicKit: RecorderKit<LocalChainAccountNotification>;
|
|
110
|
-
* account: LocalChainAccount;
|
|
111
|
-
* address: ChainAddress['address'];
|
|
112
|
-
* }} State
|
|
113
|
-
*/
|
|
114
103
|
readonly state: 3;
|
|
115
104
|
readonly version: "ics20-1";
|
|
116
105
|
};
|
|
@@ -227,17 +216,14 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
227
216
|
readonly stakingTokens: readonly [{
|
|
228
217
|
readonly denom: "utia";
|
|
229
218
|
}];
|
|
230
|
-
readonly icqEnabled: false;
|
|
231
|
-
* @param {string} validatorAddress
|
|
232
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
233
|
-
*/
|
|
219
|
+
readonly icqEnabled: false;
|
|
234
220
|
readonly connections: {
|
|
235
221
|
readonly 'neutron-1': {
|
|
236
222
|
readonly id: "connection-7";
|
|
237
223
|
readonly client_id: "07-tendermint-29";
|
|
238
224
|
readonly counterparty: {
|
|
239
225
|
readonly client_id: "07-tendermint-48";
|
|
240
|
-
readonly connection_id: "connection-36";
|
|
226
|
+
readonly connection_id: "connection-36"; /** @type {OrchestrationAccount<any>['getBalance']} */
|
|
241
227
|
readonly prefix: {
|
|
242
228
|
readonly key_prefix: "FIXME";
|
|
243
229
|
};
|
|
@@ -296,11 +282,6 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
296
282
|
};
|
|
297
283
|
};
|
|
298
284
|
readonly 'stargaze-1': {
|
|
299
|
-
/**
|
|
300
|
-
* @param {string} validatorAddress
|
|
301
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
302
|
-
* @returns {Promise<void>}
|
|
303
|
-
*/
|
|
304
285
|
readonly id: "connection-56";
|
|
305
286
|
readonly client_id: "07-tendermint-86";
|
|
306
287
|
readonly counterparty: {
|
|
@@ -370,22 +351,13 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
370
351
|
readonly ordering: 0;
|
|
371
352
|
readonly state: 3;
|
|
372
353
|
readonly version: "ics20-1";
|
|
373
|
-
};
|
|
354
|
+
};
|
|
374
355
|
};
|
|
375
356
|
readonly 'juno-1': {
|
|
376
357
|
readonly id: "connection-372";
|
|
377
358
|
readonly client_id: "07-tendermint-439";
|
|
378
359
|
readonly counterparty: {
|
|
379
360
|
readonly client_id: "07-tendermint-3";
|
|
380
|
-
/**
|
|
381
|
-
* @param {AmountArg} amount an ERTP {@link Amount} or a
|
|
382
|
-
* {@link DenomAmount}
|
|
383
|
-
* @param {ChainAddress} destination
|
|
384
|
-
* @param {IBCMsgTransferOptions} [opts] if either timeoutHeight or
|
|
385
|
-
* timeoutTimestamp are not supplied, a default timeoutTimestamp will
|
|
386
|
-
* be set for 5 minutes in the future
|
|
387
|
-
* @returns {Promise<void>}
|
|
388
|
-
*/
|
|
389
361
|
readonly connection_id: "connection-2";
|
|
390
362
|
readonly prefix: {
|
|
391
363
|
readonly key_prefix: "FIXME";
|
|
@@ -396,7 +368,15 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
396
368
|
readonly channelId: "channel-1";
|
|
397
369
|
readonly portId: "transfer";
|
|
398
370
|
readonly counterPartyChannelId: "channel-207";
|
|
399
|
-
readonly counterPartyPortId: "transfer";
|
|
371
|
+
readonly counterPartyPortId: "transfer"; /**
|
|
372
|
+
* @param {AmountArg} amount an ERTP {@link Amount} or a
|
|
373
|
+
* {@link DenomAmount}
|
|
374
|
+
* @param {ChainAddress} destination
|
|
375
|
+
* @param {IBCMsgTransferOptions} [opts] if either timeoutHeight or
|
|
376
|
+
* timeoutTimestamp are not supplied, a default timeoutTimestamp will
|
|
377
|
+
* be set for 5 minutes in the future
|
|
378
|
+
* @returns {Promise<void>}
|
|
379
|
+
*/
|
|
400
380
|
readonly ordering: 0;
|
|
401
381
|
readonly state: 3;
|
|
402
382
|
readonly version: "ics20-1";
|
|
@@ -2349,21 +2329,15 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
2349
2329
|
account: import("@endo/exo").Guarded<{
|
|
2350
2330
|
getAddress(): string;
|
|
2351
2331
|
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2352
|
-
deposit(payment: Payment<"nat"
|
|
2353
|
-
* @param {string} validatorAddress
|
|
2354
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
2355
|
-
*/> /**
|
|
2356
|
-
* @param {string} validatorAddress
|
|
2357
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
2358
|
-
*/, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2332
|
+
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2359
2333
|
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<globalThis.Payment<"nat">>;
|
|
2360
2334
|
executeTx<MT extends {
|
|
2361
2335
|
'@type': string;
|
|
2362
2336
|
}[]>(messages: MT): import("@agoric/vats/src/localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K_1 in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/vatsafe").ResponseTo<MT[K_1]>>; }>;
|
|
2363
2337
|
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
2364
2338
|
}>;
|
|
2365
|
-
address:
|
|
2366
|
-
storageNode: StorageNode
|
|
2339
|
+
address: ChainAddress;
|
|
2340
|
+
storageNode: Remote<globalThis.StorageNode>;
|
|
2367
2341
|
}) => import("@endo/exo").GuardedKit<{
|
|
2368
2342
|
invitationMakers: {
|
|
2369
2343
|
/**
|
|
@@ -2381,6 +2355,9 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
2381
2355
|
CloseAccount(): never;
|
|
2382
2356
|
};
|
|
2383
2357
|
holder: {
|
|
2358
|
+
/** @type {OrchestrationAccount<any>['getBalance']} */
|
|
2359
|
+
getBalance(denom: DenomArg): Promise<DenomAmount>;
|
|
2360
|
+
getBalances(): never;
|
|
2384
2361
|
getPublicTopics(): {
|
|
2385
2362
|
account: {
|
|
2386
2363
|
description: string;
|
|
@@ -2406,22 +2383,17 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
2406
2383
|
* updater will get a special notification that the account is being
|
|
2407
2384
|
* transferred.
|
|
2408
2385
|
*/
|
|
2409
|
-
/** @type {
|
|
2410
|
-
deposit(payment: Payment<"nat"
|
|
2411
|
-
* @param {string} validatorAddress
|
|
2412
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
2413
|
-
*/> /**
|
|
2414
|
-
* @param {string} validatorAddress
|
|
2415
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
2416
|
-
*/, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2386
|
+
/** @type {OrchestrationAccount<any>['deposit']} */
|
|
2387
|
+
deposit(payment: globalThis.Payment<"nat">): Promise<void>;
|
|
2417
2388
|
/** @type {LocalChainAccount['withdraw']} */
|
|
2418
2389
|
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<globalThis.Payment<"nat">>;
|
|
2419
2390
|
/** @type {LocalChainAccount['executeTx']} */
|
|
2420
2391
|
executeTx<MT extends {
|
|
2421
2392
|
'@type': string;
|
|
2422
2393
|
}[]>(messages: MT): import("@agoric/vats/src/localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K_1 in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/vatsafe").ResponseTo<MT[K_1]>>; }>;
|
|
2423
|
-
/** @returns {ChainAddress
|
|
2424
|
-
getAddress():
|
|
2394
|
+
/** @returns {ChainAddress} */
|
|
2395
|
+
getAddress(): ChainAddress;
|
|
2396
|
+
send(toAccount: any, amount: any): Promise<void>;
|
|
2425
2397
|
/**
|
|
2426
2398
|
* @param {AmountArg} amount an ERTP {@link Amount} or a
|
|
2427
2399
|
* {@link DenomAmount}
|
|
@@ -2432,6 +2404,8 @@ export function prepareLocalChainAccountKit(zone: Zone, makeRecorderKit: <T>(sto
|
|
|
2432
2404
|
* @returns {Promise<void>}
|
|
2433
2405
|
*/
|
|
2434
2406
|
transfer(amount: AmountArg, destination: ChainAddress, opts?: IBCMsgTransferOptions | undefined): Promise<void>;
|
|
2407
|
+
/** @type {OrchestrationAccount<any>['transferSteps']} */
|
|
2408
|
+
transferSteps(amount: AmountArg, msg: TransferMsg): Promise<void>;
|
|
2435
2409
|
};
|
|
2436
2410
|
}>;
|
|
2437
2411
|
export type LocalChainAccountNotification = {
|
|
@@ -2442,27 +2416,23 @@ export type State = {
|
|
|
2442
2416
|
account: import("@endo/exo").Guarded<{
|
|
2443
2417
|
getAddress(): string;
|
|
2444
2418
|
getBalance(brand: Brand<"nat">): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2445
|
-
deposit(payment: Payment<"nat"
|
|
2446
|
-
* @param {string} validatorAddress
|
|
2447
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
2448
|
-
*/> /**
|
|
2449
|
-
* @param {string} validatorAddress
|
|
2450
|
-
* @param {Amount<'nat'>} ertpAmount
|
|
2451
|
-
*/, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2419
|
+
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): import("@agoric/vow").PromiseVow<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
2452
2420
|
withdraw(amount: Amount<"nat">): import("@agoric/vow").PromiseVow<globalThis.Payment<"nat">>;
|
|
2453
2421
|
executeTx<MT extends {
|
|
2454
2422
|
'@type': string;
|
|
2455
2423
|
}[]>(messages: MT): import("@agoric/vats/src/localchain.js").PromiseVowOfTupleMappedToGenerics<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/vatsafe").ResponseTo<MT[K]>>; }>;
|
|
2456
2424
|
monitorTransfers(tap: import("@agoric/vats/src/bridge-target.js").TargetApp): import("@agoric/vow").PromiseVow<import("@agoric/vats/src/bridge-target.js").TargetRegistration>;
|
|
2457
2425
|
}>;
|
|
2458
|
-
address:
|
|
2426
|
+
address: ChainAddress;
|
|
2459
2427
|
};
|
|
2460
|
-
export type
|
|
2428
|
+
export type MakeLocalOrchestrationAccountKit = ReturnType<typeof prepareLocalOrchestrationAccountKit>;
|
|
2429
|
+
export type LocalOrchestrationAccountKit = ReturnType<MakeLocalOrchestrationAccountKit>;
|
|
2461
2430
|
import type { Zone } from '@agoric/zone';
|
|
2462
2431
|
import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
2463
2432
|
import type { TimerService } from '@agoric/time';
|
|
2464
2433
|
import type { Remote } from '@agoric/internal';
|
|
2465
|
-
import type { AmountArg } from '@agoric/orchestration';
|
|
2466
2434
|
import type { ChainAddress } from '@agoric/orchestration';
|
|
2435
|
+
import type { DenomAmount } from '@agoric/orchestration';
|
|
2436
|
+
import type { AmountArg } from '@agoric/orchestration';
|
|
2467
2437
|
import type { IBCMsgTransferOptions } from '@agoric/orchestration';
|
|
2468
|
-
//# sourceMappingURL=local-
|
|
2438
|
+
//# sourceMappingURL=local-orchestration-account.d.ts.map
|
|
@@ -1 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8BAlH/B,SAAU,OAAM,WAAY;;GA2H7D;;aA5Qa,MAAM;;;;;;0BA+DW,MAAM,KAClC,CAAC;yBAgBQ,QAAA,KAAI,CAAC,mBAA6B,OAAO;yBAiBjC,OACV,KAAH,CAAC;;;uBAoBA,EAAL;;;;;+CAuJW,UAAU,CAAC,OAAO,mCAAmC,CAAC;2CACtD,UAAU,CAAC,gCAAgC,CAAC;0BAzRnC,cAAc;iCADU,6CAA6C;kCAGjD,cAAc;4BADhC,kBAAkB;kCAHgF,uBAAuB;iCAAvB,uBAAuB;+BAAvB,uBAAuB;2CAAvB,uBAAuB"}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/** @file Use-object for the owner of a localchain account */
|
|
2
|
-
import { NonNullish } from '@agoric/assert';
|
|
3
2
|
import { typedJson } from '@agoric/cosmic-proto/vatsafe';
|
|
4
3
|
import { AmountShape, PaymentShape } from '@agoric/ertp';
|
|
5
4
|
import { makeTracer } from '@agoric/internal';
|
|
6
5
|
import { M } from '@agoric/vat-data';
|
|
6
|
+
import { V } from '@agoric/vow/vat.js';
|
|
7
7
|
import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js';
|
|
8
8
|
import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
|
|
9
|
-
import { V } from '@agoric/vow/vat.js';
|
|
10
9
|
import { E } from '@endo/far';
|
|
11
|
-
import {
|
|
12
|
-
AmountArgShape,
|
|
13
|
-
ChainAddressShape,
|
|
14
|
-
IBCTransferOptionsShape,
|
|
15
|
-
} from '../typeGuards.js';
|
|
16
10
|
import { maxClockSkew } from '../utils/cosmos.js';
|
|
11
|
+
import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
17
12
|
import { dateInSeconds, makeTimestampHelper } from '../utils/time.js';
|
|
18
13
|
|
|
19
14
|
/**
|
|
20
15
|
* @import {LocalChainAccount} from '@agoric/vats/src/localchain.js';
|
|
21
|
-
* @import {AmountArg, ChainAddress, DenomAmount, IBCMsgTransferOptions,
|
|
16
|
+
* @import {AmountArg, ChainAddress, DenomAmount, IBCMsgTransferOptions, OrchestrationAccount, OrchestrationAccountI} from '@agoric/orchestration';
|
|
22
17
|
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'.
|
|
23
18
|
* @import {Zone} from '@agoric/zone';
|
|
24
19
|
* @import {Remote} from '@agoric/internal';
|
|
@@ -26,7 +21,7 @@ import { dateInSeconds, makeTimestampHelper } from '../utils/time.js';
|
|
|
26
21
|
* @import {ChainHub} from '../utils/chainHub.js';
|
|
27
22
|
*/
|
|
28
23
|
|
|
29
|
-
const trace = makeTracer('
|
|
24
|
+
const trace = makeTracer('LOA');
|
|
30
25
|
|
|
31
26
|
const { Fail } = assert;
|
|
32
27
|
/**
|
|
@@ -38,20 +33,16 @@ const { Fail } = assert;
|
|
|
38
33
|
* @typedef {{
|
|
39
34
|
* topicKit: RecorderKit<LocalChainAccountNotification>;
|
|
40
35
|
* account: LocalChainAccount;
|
|
41
|
-
* address: ChainAddress
|
|
36
|
+
* address: ChainAddress;
|
|
42
37
|
* }} State
|
|
43
38
|
*/
|
|
44
39
|
|
|
45
40
|
const HolderI = M.interface('holder', {
|
|
41
|
+
...orchestrationAccountMethods,
|
|
46
42
|
getPublicTopics: M.call().returns(TopicsRecordShape),
|
|
47
43
|
delegate: M.call(M.string(), AmountShape).returns(M.promise()),
|
|
48
44
|
undelegate: M.call(M.string(), AmountShape).returns(M.promise()),
|
|
49
|
-
deposit: M.callWhen(PaymentShape).optional(AmountShape).returns(AmountShape),
|
|
50
45
|
withdraw: M.callWhen(AmountShape).returns(PaymentShape),
|
|
51
|
-
transfer: M.call(AmountArgShape, ChainAddressShape)
|
|
52
|
-
.optional(IBCTransferOptionsShape)
|
|
53
|
-
.returns(M.promise()),
|
|
54
|
-
getAddress: M.call().returns(M.string()),
|
|
55
46
|
executeTx: M.callWhen(M.arrayOf(M.record())).returns(M.arrayOf(M.record())),
|
|
56
47
|
});
|
|
57
48
|
|
|
@@ -67,7 +58,7 @@ const PUBLIC_TOPICS = {
|
|
|
67
58
|
* @param {Remote<TimerService>} timerService
|
|
68
59
|
* @param {ChainHub} chainHub
|
|
69
60
|
*/
|
|
70
|
-
export const
|
|
61
|
+
export const prepareLocalOrchestrationAccountKit = (
|
|
71
62
|
zone,
|
|
72
63
|
makeRecorderKit,
|
|
73
64
|
zcf,
|
|
@@ -75,10 +66,10 @@ export const prepareLocalChainAccountKit = (
|
|
|
75
66
|
chainHub,
|
|
76
67
|
) => {
|
|
77
68
|
const timestampHelper = makeTimestampHelper(timerService);
|
|
78
|
-
|
|
69
|
+
|
|
79
70
|
/** Make an object wrapping an LCA with Zoe interfaces. */
|
|
80
|
-
const
|
|
81
|
-
'
|
|
71
|
+
const makeLocalOrchestrationAccountKit = zone.exoClassKit(
|
|
72
|
+
'Local Orchestration Account Kit',
|
|
82
73
|
{
|
|
83
74
|
holder: HolderI,
|
|
84
75
|
invitationMakers: M.interface('invitationMakers', {
|
|
@@ -92,8 +83,8 @@ export const prepareLocalChainAccountKit = (
|
|
|
92
83
|
/**
|
|
93
84
|
* @param {object} initState
|
|
94
85
|
* @param {LocalChainAccount} initState.account
|
|
95
|
-
* @param {ChainAddress
|
|
96
|
-
* @param {StorageNode} initState.storageNode
|
|
86
|
+
* @param {ChainAddress} initState.address
|
|
87
|
+
* @param {Remote<StorageNode>} initState.storageNode
|
|
97
88
|
* @returns {State}
|
|
98
89
|
*/
|
|
99
90
|
({ account, address, storageNode }) => {
|
|
@@ -101,7 +92,6 @@ export const prepareLocalChainAccountKit = (
|
|
|
101
92
|
// @ts-expect-error XXX Patterns
|
|
102
93
|
const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.account[1]);
|
|
103
94
|
|
|
104
|
-
// #9162 use ChainAddress object instead of `address` string
|
|
105
95
|
return { account, address, topicKit };
|
|
106
96
|
},
|
|
107
97
|
{
|
|
@@ -138,6 +128,24 @@ export const prepareLocalChainAccountKit = (
|
|
|
138
128
|
},
|
|
139
129
|
},
|
|
140
130
|
holder: {
|
|
131
|
+
/** @type {OrchestrationAccount<any>['getBalance']} */
|
|
132
|
+
async getBalance(denomArg) {
|
|
133
|
+
// FIXME look up real values
|
|
134
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9211
|
|
135
|
+
const [brand, denom] =
|
|
136
|
+
typeof denomArg === 'string'
|
|
137
|
+
? [/** @type {any} */ (null), denomArg]
|
|
138
|
+
: [denomArg, 'FIXME'];
|
|
139
|
+
|
|
140
|
+
const natAmount = await V.when(
|
|
141
|
+
E(this.state.account).getBalance(brand),
|
|
142
|
+
);
|
|
143
|
+
return harden({ denom, value: natAmount.value });
|
|
144
|
+
},
|
|
145
|
+
getBalances() {
|
|
146
|
+
throw new Error('not yet implemented');
|
|
147
|
+
},
|
|
148
|
+
|
|
141
149
|
getPublicTopics() {
|
|
142
150
|
const { topicKit } = this.state;
|
|
143
151
|
return harden({
|
|
@@ -207,9 +215,9 @@ export const prepareLocalChainAccountKit = (
|
|
|
207
215
|
* updater will get a special notification that the account is being
|
|
208
216
|
* transferred.
|
|
209
217
|
*/
|
|
210
|
-
/** @type {
|
|
211
|
-
async deposit(payment
|
|
212
|
-
|
|
218
|
+
/** @type {OrchestrationAccount<any>['deposit']} */
|
|
219
|
+
async deposit(payment) {
|
|
220
|
+
await V(this.state.account).deposit(payment);
|
|
213
221
|
},
|
|
214
222
|
/** @type {LocalChainAccount['withdraw']} */
|
|
215
223
|
async withdraw(amount) {
|
|
@@ -220,9 +228,13 @@ export const prepareLocalChainAccountKit = (
|
|
|
220
228
|
// @ts-expect-error subtype
|
|
221
229
|
return V(this.state.account).executeTx(messages);
|
|
222
230
|
},
|
|
223
|
-
/** @returns {ChainAddress
|
|
231
|
+
/** @returns {ChainAddress} */
|
|
224
232
|
getAddress() {
|
|
225
|
-
return
|
|
233
|
+
return this.state.address;
|
|
234
|
+
},
|
|
235
|
+
async send(toAccount, amount) {
|
|
236
|
+
// FIXME implement
|
|
237
|
+
console.log('send got', toAccount, amount);
|
|
226
238
|
},
|
|
227
239
|
/**
|
|
228
240
|
* @param {AmountArg} amount an ERTP {@link Amount} or a
|
|
@@ -261,7 +273,7 @@ export const prepareLocalChainAccountKit = (
|
|
|
261
273
|
amount: String(amount.value),
|
|
262
274
|
denom: amount.denom,
|
|
263
275
|
},
|
|
264
|
-
sender: this.state.address,
|
|
276
|
+
sender: this.state.address.address,
|
|
265
277
|
receiver: destination.address,
|
|
266
278
|
timeoutHeight: opts?.timeoutHeight ?? {
|
|
267
279
|
revisionHeight: 0n,
|
|
@@ -273,9 +285,15 @@ export const prepareLocalChainAccountKit = (
|
|
|
273
285
|
]);
|
|
274
286
|
trace('MsgTransfer result', result);
|
|
275
287
|
},
|
|
288
|
+
/** @type {OrchestrationAccount<any>['transferSteps']} */
|
|
289
|
+
transferSteps(amount, msg) {
|
|
290
|
+
console.log('transferSteps got', amount, msg);
|
|
291
|
+
return Promise.resolve();
|
|
292
|
+
},
|
|
276
293
|
},
|
|
277
294
|
},
|
|
278
295
|
);
|
|
279
|
-
return
|
|
296
|
+
return makeLocalOrchestrationAccountKit;
|
|
280
297
|
};
|
|
281
|
-
/** @typedef {ReturnType<
|
|
298
|
+
/** @typedef {ReturnType<typeof prepareLocalOrchestrationAccountKit>} MakeLocalOrchestrationAccountKit */
|
|
299
|
+
/** @typedef {ReturnType<MakeLocalOrchestrationAccountKit>} LocalOrchestrationAccountKit */
|