@agoric/orchestration 0.1.1-dev-c56c51e.0 → 0.1.1-dev-42d1d4f.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/examples/auto-stake-it.contract.d.ts +1 -1
- package/src/examples/auto-stake-it.flows.d.ts +1 -3
- package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
- package/src/examples/auto-stake-it.flows.js +4 -7
- package/src/examples/sendAnywhere.contract.d.ts +1 -0
- package/src/examples/sendAnywhere.contract.d.ts.map +1 -1
- package/src/examples/stakeBld.contract.d.ts.map +1 -1
- package/src/examples/stakeBld.contract.js +15 -3
- package/src/exos/chain-hub-admin.d.ts +20 -0
- package/src/exos/chain-hub-admin.d.ts.map +1 -1
- package/src/exos/chain-hub-admin.js +18 -3
- package/src/exos/chain-hub.d.ts +10 -2
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +23 -1
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +4 -14
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +19 -26
- package/src/exos/orchestrator.d.ts +5 -9183
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +6 -7
- package/src/orchestration-api.d.ts +13 -12
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.ts +18 -13
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/typeGuards.d.ts +4 -2
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +9 -3
- package/src/utils/amounts.d.ts +10 -0
- package/src/utils/amounts.d.ts.map +1 -0
- package/src/utils/amounts.js +53 -0
- package/src/utils/orchestrationAccount.js +5 -2
- package/src/utils/start-helper.d.ts +2 -1
- package/src/utils/start-helper.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-42d1d4f.0+42d1d4f",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/network": "0.1.1-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
45
|
-
"@agoric/vats": "0.15.2-dev-
|
|
46
|
-
"@agoric/vow": "0.1.1-dev-
|
|
47
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
48
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/async-flow": "0.1.1-dev-42d1d4f.0+42d1d4f",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-42d1d4f.0+42d1d4f",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-42d1d4f.0+42d1d4f",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-42d1d4f.0+42d1d4f",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-42d1d4f.0+42d1d4f",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-42d1d4f.0+42d1d4f",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-42d1d4f.0+42d1d4f",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-42d1d4f.0+42d1d4f",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-42d1d4f.0+42d1d4f",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-42d1d4f.0+42d1d4f",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-42d1d4f.0+42d1d4f",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-42d1d4f.0+42d1d4f",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-42d1d4f.0+42d1d4f",
|
|
49
49
|
"@endo/base64": "^1.0.6",
|
|
50
50
|
"@endo/errors": "^1.2.4",
|
|
51
51
|
"@endo/far": "^1.1.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "github:paulmillr/noble-hashes#ae060daa6252f3ff2aa2f84e887de0aab491281d"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-42d1d4f.0+42d1d4f",
|
|
58
58
|
"@chain-registry/client": "^1.47.4",
|
|
59
59
|
"@cosmjs/amino": "^0.32.3",
|
|
60
60
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typeCoverage": {
|
|
95
95
|
"atLeast": 98.1
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "42d1d4fa872b48c3851a66187cda08671a38c70c"
|
|
98
98
|
}
|
|
@@ -12,7 +12,6 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
12
12
|
}>>, {
|
|
13
13
|
chainName: string;
|
|
14
14
|
validator: import("@agoric/orchestration").CosmosValidatorAddress;
|
|
15
|
-
localDenom: import("@agoric/orchestration").Denom;
|
|
16
15
|
}>>;
|
|
17
16
|
}>;
|
|
18
17
|
creatorFacet: import("@endo/exo").Guarded<{
|
|
@@ -24,6 +23,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
24
23
|
denom: string;
|
|
25
24
|
}>>;
|
|
26
25
|
}>, connectionInfo: import("@agoric/orchestration").IBCConnectionInfo): Promise<void>;
|
|
26
|
+
registerAsset(denom: import("@agoric/orchestration").Denom, detail: import("@agoric/orchestration").DenomDetail): Promise<void>;
|
|
27
27
|
}>;
|
|
28
28
|
}>;
|
|
29
29
|
export type OrchestrationPowers = {
|
|
@@ -2,10 +2,9 @@ export function makeAccounts(orch: Orchestrator, { makeStakingTap, makePortfolio
|
|
|
2
2
|
makeStakingTap: MakeStakingTap;
|
|
3
3
|
makePortfolioHolder: MakePortfolioHolder;
|
|
4
4
|
chainHub: GuestInterface<ChainHub>;
|
|
5
|
-
}, seat: ZCFSeat, { chainName, validator
|
|
5
|
+
}, seat: ZCFSeat, { chainName, validator }: {
|
|
6
6
|
chainName: string;
|
|
7
7
|
validator: CosmosValidatorAddress;
|
|
8
|
-
localDenom: Denom;
|
|
9
8
|
}): Promise<import("@agoric/vow").Vow<{
|
|
10
9
|
publicSubscribers: {
|
|
11
10
|
[k: string]: ResolvedPublicTopic<unknown>;
|
|
@@ -20,6 +19,5 @@ import type { MakePortfolioHolder } from '../exos/portfolio-holder-kit.js';
|
|
|
20
19
|
import type { ChainHub } from '../exos/chain-hub.js';
|
|
21
20
|
import type { GuestInterface } from '@agoric/async-flow';
|
|
22
21
|
import type { CosmosValidatorAddress } from '@agoric/orchestration';
|
|
23
|
-
import type { Denom } from '@agoric/orchestration';
|
|
24
22
|
import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
|
|
25
23
|
//# sourceMappingURL=auto-stake-it.flows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-stake-it.flows.d.ts","sourceRoot":"","sources":["auto-stake-it.flows.js"],"names":[],"mappings":"AA0BO,
|
|
1
|
+
{"version":3,"file":"auto-stake-it.flows.d.ts","sourceRoot":"","sources":["auto-stake-it.flows.js"],"names":[],"mappings":"AA0BO,mCAZI,YAAY,qDACZ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,mBAAuB,EAAE,mBAAmB,CAAC;IAC7C,QAAY,EAAE,eAAe,QAAQ,CAAC,CAAC;CACpC,QACO,OAAO,4BACP;IACV,SAAa,EAAE,MAAM,CAAC;IACtB,SAAa,EAAE,sBAAsB,CAAC;CACnC;;;;;;;IA4EH;kCA9FsJ,uBAAuB;oCAC7I,4BAA4B;yCACvB,iCAAiC;8BAC5C,sBAAsB;oCAJhB,oBAAoB;4CACkG,uBAAuB;yCAFxI,2CAA2C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fail } from '@endo/errors';
|
|
2
|
+
import { denomHash } from '../utils/denomHash.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @import {ResolvedPublicTopic} from '@agoric/zoe/src/contractSupport/topics.js';
|
|
@@ -21,19 +22,13 @@ import { Fail } from '@endo/errors';
|
|
|
21
22
|
* @param {{
|
|
22
23
|
* chainName: string;
|
|
23
24
|
* validator: CosmosValidatorAddress;
|
|
24
|
-
* localDenom: Denom;
|
|
25
25
|
* }} offerArgs
|
|
26
26
|
*/
|
|
27
27
|
export const makeAccounts = async (
|
|
28
28
|
orch,
|
|
29
29
|
{ makeStakingTap, makePortfolioHolder, chainHub },
|
|
30
30
|
seat,
|
|
31
|
-
{
|
|
32
|
-
chainName,
|
|
33
|
-
validator,
|
|
34
|
-
// TODO localDenom is user supplied, until #9211
|
|
35
|
-
localDenom,
|
|
36
|
-
},
|
|
31
|
+
{ chainName, validator },
|
|
37
32
|
) => {
|
|
38
33
|
seat.exit(); // no funds exchanged
|
|
39
34
|
const [agoric, remoteChain] = await Promise.all([
|
|
@@ -65,6 +60,8 @@ export const makeAccounts = async (
|
|
|
65
60
|
);
|
|
66
61
|
assert(transferChannel.counterPartyChannelId, 'unable to find sourceChannel');
|
|
67
62
|
|
|
63
|
+
const localDenom = `ibc/${denomHash({ denom: remoteDenom, channelId: transferChannel.channelId })}`;
|
|
64
|
+
|
|
68
65
|
// Every time the `localAccount` receives `remoteDenom` over IBC, delegate it.
|
|
69
66
|
const tap = makeStakingTap({
|
|
70
67
|
localAccount,
|
|
@@ -36,6 +36,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
36
36
|
denom: string;
|
|
37
37
|
}>>;
|
|
38
38
|
}>, connectionInfo: import("../cosmos-api.js").IBCConnectionInfo): Promise<void>;
|
|
39
|
+
registerAsset(denom: import("../orchestration-api.js").Denom, detail: import("../types.js").DenomDetail): Promise<void>;
|
|
39
40
|
}>;
|
|
40
41
|
}>;
|
|
41
42
|
export type OrchestrationPowers = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AAEH,kEAKE;AAsDF;gBA9CiB,UAAU
|
|
1
|
+
{"version":3,"file":"sendAnywhere.contract.d.ts","sourceRoot":"","sources":["sendAnywhere.contract.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AAEH,kEAKE;AAsDF;gBA9CiB,UAAU;;;;;;;;;;;;;;;;;;;GA8CsB;kCApEpC;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;yBAd0B,aAAa;gCAFd,gCAAgC;4BAE/B,aAAa;6CAGD,sCAAsC;kCANjD,cAAc;6BAEnB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stakeBld.contract.d.ts","sourceRoot":"","sources":["stakeBld.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stakeBld.contract.d.ts","sourceRoot":"","sources":["stakeBld.contract.js"],"names":[],"mappings":"AAmCO,2BAVI,GAAG,eACH;IACV,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;IACjC,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,UAAc,EAAE,UAAU,CAAC;IAC3B,WAAe,EAAE,WAAW,CAAC;IAC7B,YAAgB,EAAE,YAAY,CAAC;CAC5B,WACO,OAAO,kBAAkB,EAAE,OAAO;;QA4DvC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0BH;;WAEG;;;GAaR;6BAxHyB,cAAc;4BACf,kBAAkB;gCAEd,gCAAgC;kCAD9B,cAAc"}
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* @file Stake BLD contract
|
|
3
3
|
*/
|
|
4
4
|
import { makeTracer } from '@agoric/internal';
|
|
5
|
+
import { heapVowE as E, prepareVowTools } from '@agoric/vow/vat.js';
|
|
5
6
|
import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
6
7
|
import { withdrawFromSeat } from '@agoric/zoe/src/contractSupport/zoeHelpers.js';
|
|
7
8
|
import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
|
|
8
9
|
import { makeDurableZone } from '@agoric/zone/durable.js';
|
|
9
|
-
import { prepareVowTools, heapVowE as E } from '@agoric/vow/vat.js';
|
|
10
10
|
import { deeplyFulfilled } from '@endo/marshal';
|
|
11
11
|
import { M } from '@endo/patterns';
|
|
12
|
-
import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
|
|
13
12
|
import { makeChainHub } from '../exos/chain-hub.js';
|
|
13
|
+
import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
|
|
14
|
+
import fetchedChainInfo from '../fetched-chain-info.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @import {NameHub} from '@agoric/vats';
|
|
@@ -41,13 +42,15 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
41
42
|
);
|
|
42
43
|
const vowTools = prepareVowTools(zone.subZone('vows'));
|
|
43
44
|
|
|
45
|
+
const chainHub = makeChainHub(privateArgs.agoricNames, vowTools);
|
|
46
|
+
|
|
44
47
|
const makeLocalOrchestrationAccountKit = prepareLocalOrchestrationAccountKit(
|
|
45
48
|
zone,
|
|
46
49
|
makeRecorderKit,
|
|
47
50
|
zcf,
|
|
48
51
|
privateArgs.timerService,
|
|
49
52
|
vowTools,
|
|
50
|
-
|
|
53
|
+
chainHub,
|
|
51
54
|
);
|
|
52
55
|
|
|
53
56
|
// ----------------
|
|
@@ -56,6 +59,15 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
56
59
|
const BLD = zcf.getTerms().brands.In;
|
|
57
60
|
const bldAmountShape = await E(BLD).getAmountShape();
|
|
58
61
|
|
|
62
|
+
// XXX big dependency (59KB) but in production will probably already be registered in agoricNames
|
|
63
|
+
chainHub.registerChain('agoric', fetchedChainInfo.agoric);
|
|
64
|
+
chainHub.registerAsset('ubld', {
|
|
65
|
+
baseName: 'agoric',
|
|
66
|
+
baseDenom: 'ubld',
|
|
67
|
+
brand: BLD,
|
|
68
|
+
chainName: 'agoric',
|
|
69
|
+
});
|
|
70
|
+
|
|
59
71
|
async function makeLocalAccountKit() {
|
|
60
72
|
const account = await E(privateArgs.localchain).makeAccount();
|
|
61
73
|
const address = await E(account).getAddress();
|
|
@@ -5,6 +5,15 @@ export function prepareChainHubAdmin(zone: Zone, chainHub: ChainHub): import("@e
|
|
|
5
5
|
* @param {IBCConnectionInfo} connectionInfo
|
|
6
6
|
*/
|
|
7
7
|
initChain(chainName: string, chainInfo: CosmosChainInfo, connectionInfo: IBCConnectionInfo): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Register an asset that may be held on a chain other than the issuing
|
|
10
|
+
* chain.
|
|
11
|
+
*
|
|
12
|
+
* @param {Denom} denom - on the holding chain, whose name is given in
|
|
13
|
+
* `detail.chainName`
|
|
14
|
+
* @param {DenomDetail} detail - chainName and baseName must be registered
|
|
15
|
+
*/
|
|
16
|
+
registerAsset(denom: Denom, detail: DenomDetail): Promise<void>;
|
|
8
17
|
}>;
|
|
9
18
|
export type ChainHubAdmin = ReturnType<(zone: Zone, chainHub: ChainHub) => import("@endo/exo").Guarded<{
|
|
10
19
|
/**
|
|
@@ -13,9 +22,20 @@ export type ChainHubAdmin = ReturnType<(zone: Zone, chainHub: ChainHub) => impor
|
|
|
13
22
|
* @param {IBCConnectionInfo} connectionInfo
|
|
14
23
|
*/
|
|
15
24
|
initChain(chainName: string, chainInfo: CosmosChainInfo, connectionInfo: IBCConnectionInfo): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Register an asset that may be held on a chain other than the issuing
|
|
27
|
+
* chain.
|
|
28
|
+
*
|
|
29
|
+
* @param {Denom} denom - on the holding chain, whose name is given in
|
|
30
|
+
* `detail.chainName`
|
|
31
|
+
* @param {DenomDetail} detail - chainName and baseName must be registered
|
|
32
|
+
*/
|
|
33
|
+
registerAsset(denom: Denom, detail: DenomDetail): Promise<void>;
|
|
16
34
|
}>>;
|
|
17
35
|
import type { Zone } from '@agoric/zone';
|
|
18
36
|
import type { ChainHub } from './chain-hub.js';
|
|
19
37
|
import type { CosmosChainInfo } from '@agoric/orchestration';
|
|
20
38
|
import type { IBCConnectionInfo } from '@agoric/orchestration';
|
|
39
|
+
import type { Denom } from '@agoric/orchestration';
|
|
40
|
+
import type { DenomDetail } from './chain-hub.js';
|
|
21
41
|
//# sourceMappingURL=chain-hub-admin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-hub-admin.d.ts","sourceRoot":"","sources":["chain-hub-admin.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chain-hub-admin.d.ts","sourceRoot":"","sources":["chain-hub-admin.js"],"names":[],"mappings":"AAqBO,2CAHI,IAAI,YACJ,QAAQ;IAeb;;;;OAIG;yBAHQ,MAAM,aACN,eAAe,kBACf,iBAAiB;IAe5B;;;;;;;OAOG;yBAHQ,KAAK,UAEL,WAAW;GAU3B;4BAEa,UAAU,QApDb,IAAI,YACJ,QAAQ;IAeb;;;;OAIG;yBAHQ,MAAM,aACN,eAAe,kBACf,iBAAiB;IAe5B;;;;;;;OAOG;yBAHQ,KAAK,UAEL,WAAW;GAYkB;0BA9DvB,cAAc;8BAEG,gBAAgB;qCADI,uBAAuB;uCAAvB,uBAAuB;2BAAvB,uBAAuB;iCAC3C,gBAAgB"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* we expect promises to resolved promptly, */
|
|
2
2
|
/* eslint-disable no-restricted-syntax */
|
|
3
|
-
import { M } from '@endo/patterns';
|
|
4
3
|
import { heapVowE } from '@agoric/vow/vat.js';
|
|
4
|
+
import { M } from '@endo/patterns';
|
|
5
5
|
import { CosmosChainInfoShape } from '../typeGuards.js';
|
|
6
|
+
import { DenomDetailShape } from './chain-hub.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @import {Zone} from '@agoric/zone';
|
|
9
|
-
* @import {CosmosChainInfo, IBCConnectionInfo} from '@agoric/orchestration';
|
|
10
|
-
* @import {ChainHub} from './chain-hub.js';
|
|
10
|
+
* @import {CosmosChainInfo, Denom, IBCConnectionInfo} from '@agoric/orchestration';
|
|
11
|
+
* @import {ChainHub, DenomDetail} from './chain-hub.js';
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -28,6 +29,7 @@ export const prepareChainHubAdmin = (zone, chainHub) => {
|
|
|
28
29
|
CosmosChainInfoShape,
|
|
29
30
|
ConnectionInfoShape,
|
|
30
31
|
).returns(M.undefined()),
|
|
32
|
+
registerAsset: M.call(M.string(), DenomDetailShape).returns(M.promise()),
|
|
31
33
|
}),
|
|
32
34
|
{
|
|
33
35
|
/**
|
|
@@ -48,6 +50,19 @@ export const prepareChainHubAdmin = (zone, chainHub) => {
|
|
|
48
50
|
connectionInfo,
|
|
49
51
|
);
|
|
50
52
|
},
|
|
53
|
+
/**
|
|
54
|
+
* Register an asset that may be held on a chain other than the issuing
|
|
55
|
+
* chain.
|
|
56
|
+
*
|
|
57
|
+
* @param {Denom} denom - on the holding chain, whose name is given in
|
|
58
|
+
* `detail.chainName`
|
|
59
|
+
* @param {DenomDetail} detail - chainName and baseName must be registered
|
|
60
|
+
*/
|
|
61
|
+
async registerAsset(denom, detail) {
|
|
62
|
+
// XXX async work necessary before the synchronous call
|
|
63
|
+
await heapVowE.when(chainHub.getChainInfo('agoric'));
|
|
64
|
+
chainHub.registerAsset(denom, detail);
|
|
65
|
+
},
|
|
51
66
|
},
|
|
52
67
|
);
|
|
53
68
|
return makeCreatorFacet;
|
package/src/exos/chain-hub.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @property {string} baseName - name of issuing chain; e.g. cosmoshub
|
|
21
21
|
* @property {Denom} baseDenom - e.g. uatom
|
|
22
22
|
* @property {string} chainName - name of holding chain; e.g. agoric
|
|
23
|
-
* @property {Brand} [brand] - vbank brand, if registered
|
|
23
|
+
* @property {Brand<'nat'>} [brand] - vbank brand, if registered
|
|
24
24
|
* @see {ChainHub} `registerAsset` method
|
|
25
25
|
*/
|
|
26
26
|
/** @type {TypedPattern<DenomDetail>} */
|
|
@@ -93,8 +93,16 @@ export function makeChainHub(agoricNames: Remote<NameHub>, vowTools: VowTools):
|
|
|
93
93
|
* Retrieve holding, issuing chain names etc. for a denom.
|
|
94
94
|
*
|
|
95
95
|
* @param {Denom} denom
|
|
96
|
+
* @returns {DenomDetail}
|
|
96
97
|
*/
|
|
97
98
|
lookupAsset(denom: Denom): DenomDetail;
|
|
99
|
+
/**
|
|
100
|
+
* Retrieve holding, issuing chain names etc. for a denom.
|
|
101
|
+
*
|
|
102
|
+
* @param {Brand} brand
|
|
103
|
+
* @returns {string | undefined}
|
|
104
|
+
*/
|
|
105
|
+
lookupDenom(brand: Brand): string | undefined;
|
|
98
106
|
}>;
|
|
99
107
|
export function registerAssets(chainHub: ChainHub, name: string, assets: CosmosAssetInfo[]): void;
|
|
100
108
|
/**
|
|
@@ -117,7 +125,7 @@ export type DenomDetail = {
|
|
|
117
125
|
/**
|
|
118
126
|
* - vbank brand, if registered
|
|
119
127
|
*/
|
|
120
|
-
brand?: globalThis.Brand | undefined;
|
|
128
|
+
brand?: globalThis.Brand<"nat"> | undefined;
|
|
121
129
|
};
|
|
122
130
|
export type ChainHub = ReturnType<typeof makeChainHub>;
|
|
123
131
|
import type { TypedPattern } from '@agoric/internal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CAIlC;AAEF,wCAAwC;AACxC,gCAAiC;AACjC,kCAAkC;AAClC,gDAAiD;AACjD,8BAA8B;AAC9B,uCAAwC;AAqBjC,wCAHI,MAAM,YACN,MAAM,UAUhB;AAQM,0CAHI,iBAAiB,GACf,iBAAiB,CAuB7B;AAUM,wDALI,MAAM,kBACN,MAAM,YACN,iBAAiB,GACf,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAavC;
|
|
1
|
+
{"version":3,"file":"chain-hub.d.ts","sourceRoot":"","sources":["chain-hub.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,wCAAwC;AACxC,+BADW,aAAa,WAAW,CAAC,CAIlC;AAEF,wCAAwC;AACxC,gCAAiC;AACjC,kCAAkC;AAClC,gDAAiD;AACjD,8BAA8B;AAC9B,uCAAwC;AAqBjC,wCAHI,MAAM,YACN,MAAM,UAUhB;AAQM,0CAHI,iBAAiB,GACf,iBAAi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AkB;yBADxD,aAAa;2BAGrB,yBAAyB;qCAFqB,kBAAkB;iCAC/C,kBAAkB;+BAAlB,kBAAkB"}
|
package/src/exos/chain-hub.js
CHANGED
|
@@ -31,7 +31,7 @@ import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js';
|
|
|
31
31
|
* @property {string} baseName - name of issuing chain; e.g. cosmoshub
|
|
32
32
|
* @property {Denom} baseDenom - e.g. uatom
|
|
33
33
|
* @property {string} chainName - name of holding chain; e.g. agoric
|
|
34
|
-
* @property {Brand} [brand] - vbank brand, if registered
|
|
34
|
+
* @property {Brand<'nat'>} [brand] - vbank brand, if registered
|
|
35
35
|
* @see {ChainHub} `registerAsset` method
|
|
36
36
|
*/
|
|
37
37
|
/** @type {TypedPattern<DenomDetail>} */
|
|
@@ -168,6 +168,7 @@ const ChainHubI = M.interface('ChainHub', {
|
|
|
168
168
|
getChainsAndConnection: M.call(M.string(), M.string()).returns(VowShape),
|
|
169
169
|
registerAsset: M.call(M.string(), DenomDetailShape).returns(),
|
|
170
170
|
lookupAsset: M.call(M.string()).returns(DenomDetailShape),
|
|
171
|
+
lookupDenom: M.call(BrandShape).returns(M.or(M.string(), M.undefined())),
|
|
171
172
|
});
|
|
172
173
|
|
|
173
174
|
/**
|
|
@@ -199,6 +200,11 @@ export const makeChainHub = (agoricNames, vowTools) => {
|
|
|
199
200
|
keyShape: M.string(),
|
|
200
201
|
valueShape: DenomDetailShape,
|
|
201
202
|
});
|
|
203
|
+
/** @type {MapStore<Brand, string>} */
|
|
204
|
+
const brandDenoms = zone.mapStore('brandDenom', {
|
|
205
|
+
keyShape: BrandShape,
|
|
206
|
+
valueShape: M.string(),
|
|
207
|
+
});
|
|
202
208
|
|
|
203
209
|
const lookupChainInfo = vowTools.retriable(
|
|
204
210
|
zone,
|
|
@@ -380,15 +386,31 @@ export const makeChainHub = (agoricNames, vowTools) => {
|
|
|
380
386
|
chainInfos.has(baseName) ||
|
|
381
387
|
Fail`must register chain ${q(baseName)} first`;
|
|
382
388
|
denomDetails.init(denom, detail);
|
|
389
|
+
if (detail.brand) {
|
|
390
|
+
brandDenoms.init(detail.brand, denom);
|
|
391
|
+
}
|
|
383
392
|
},
|
|
384
393
|
/**
|
|
385
394
|
* Retrieve holding, issuing chain names etc. for a denom.
|
|
386
395
|
*
|
|
387
396
|
* @param {Denom} denom
|
|
397
|
+
* @returns {DenomDetail}
|
|
388
398
|
*/
|
|
389
399
|
lookupAsset(denom) {
|
|
390
400
|
return denomDetails.get(denom);
|
|
391
401
|
},
|
|
402
|
+
/**
|
|
403
|
+
* Retrieve holding, issuing chain names etc. for a denom.
|
|
404
|
+
*
|
|
405
|
+
* @param {Brand} brand
|
|
406
|
+
* @returns {string | undefined}
|
|
407
|
+
*/
|
|
408
|
+
lookupDenom(brand) {
|
|
409
|
+
if (brandDenoms.has(brand)) {
|
|
410
|
+
return brandDenoms.get(brand);
|
|
411
|
+
}
|
|
412
|
+
return undefined;
|
|
413
|
+
},
|
|
392
414
|
});
|
|
393
415
|
|
|
394
416
|
return chainHub;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"AA2DA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,mCAAmC;AACnC;;;;;;;;;;;;;;;;;GAeG;AAmBI,2DARI,IAAI,gGAEZ;IAAyB,QAAQ,EAAzB,QAAQ;IACgB,eAAe,EAAvC,eAAe;IACc,YAAY,EAAzC,OAAO,YAAY,CAAC;IACH,QAAQ,EAAzB,QAAQ;IACI,GAAG,EAAf,GAAG;CACb;kBA0Ec,YAAY;eACZ,MAAM;kBACN,eAAe;mBACf,gBAAgB;;aAEhB,UAAU;iBACV,OAAO,WAAW,CAAC;mBAC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cosmos/bank/v1beta1/tx.js';
|
|
7
8
|
import {
|
|
8
9
|
MsgWithdrawDelegatorReward,
|
|
9
10
|
MsgWithdrawDelegatorRewardResponse,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
MsgUndelegateResponse,
|
|
16
17
|
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
|
|
17
18
|
import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
18
|
-
import { MsgSend } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
|
|
19
19
|
import { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
20
20
|
import { makeTracer } from '@agoric/internal';
|
|
21
21
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
DenomAmountShape,
|
|
32
32
|
IBCTransferOptionsShape,
|
|
33
33
|
} from '../typeGuards.js';
|
|
34
|
+
import { coerceCoin, coerceDenom } from '../utils/amounts.js';
|
|
34
35
|
import { maxClockSkew, tryDecodeResponse } from '../utils/cosmos.js';
|
|
35
36
|
import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
36
37
|
import { makeTimestampHelper } from '../utils/time.js';
|
|
@@ -242,15 +243,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
242
243
|
* @returns {Coin}
|
|
243
244
|
*/
|
|
244
245
|
amountToCoin(amount) {
|
|
245
|
-
|
|
246
|
-
// FIXME(#9211) look up values from brands
|
|
247
|
-
trace('TODO #9211: handle brand', amount);
|
|
248
|
-
throw Fail`Brands not currently supported.`;
|
|
249
|
-
}
|
|
250
|
-
return harden({
|
|
251
|
-
denom: amount.denom,
|
|
252
|
-
amount: String(amount.value),
|
|
253
|
-
});
|
|
246
|
+
return coerceCoin(chainHub, amount);
|
|
254
247
|
},
|
|
255
248
|
},
|
|
256
249
|
balanceQueryWatcher: {
|
|
@@ -574,14 +567,11 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
574
567
|
if (!icqConnection) {
|
|
575
568
|
throw Fail`Queries not available for chain ${chainAddress.chainId}`;
|
|
576
569
|
}
|
|
577
|
-
// TODO #9211 lookup denom from brand
|
|
578
|
-
assert.typeof(denom, 'string');
|
|
579
|
-
|
|
580
570
|
const results = E(icqConnection).query([
|
|
581
571
|
toRequestQueryJson(
|
|
582
572
|
QueryBalanceRequest.toProtoMsg({
|
|
583
573
|
address: chainAddress.value,
|
|
584
|
-
denom,
|
|
574
|
+
denom: coerceDenom(chainHub, denom),
|
|
585
575
|
}),
|
|
586
576
|
),
|
|
587
577
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-orchestration-account.d.ts","sourceRoot":"","sources":["local-orchestration-account.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-orchestration-account.d.ts","sourceRoot":"","sources":["local-orchestration-account.js"],"names":[],"mappings":"AA0FO,0DAPI,IAAI,mBACJ,eAAe,OACf,GAAG,gBACH,OAAO,YAAY,CAAC,YACpB,QAAQ,YACR,QAAQ;aAqEJ,iBAAiB;aACjB,YAAY;iBACZ,OAAO,WAAW,CAAC;;;QAc1B;;;WAGG;6BAFQ,SAAS,GACP,IAAI;;;QAOjB;;;WAGG;mCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;QAYxB;;;WAGG;qCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;uBAmBJ,YAAY;oBAAU,SAAS;;;uBAa/B,YAAY;qBAAW,SAAS,EAAE;;;oBAcrC,SAAS;yBACJ,YAAY;kBACnB,qBAAqB;;;;QAcpC;;;;;;WAMG;8BALQ,CACV,SACA,UAAgB,+CAA+C,CAAC,CAC3D,CACF;;;QAcJ;;;;;;;;;;WAUG;6DATQ,CACV;YAAM,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;SAAE,EAC7D,MAAU,CACP,iCACO;YACV,WAAe,EAAE,YAAY,CAAC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,uBAAuB;+BAQxG,sBAAsB;8BAAtB,sBAAsB;uCAR2D,uBAAuB;iCAAvB,uBAAuB;6BAUvH,gBAAgB;0BAHD,aAAa;iCANhB,6CAA6C;iCAW9D,mBAAmB"}
|
|
@@ -20,6 +20,7 @@ import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
|
20
20
|
import { makeTimestampHelper } from '../utils/time.js';
|
|
21
21
|
import { preparePacketTools } from './packet-tools.js';
|
|
22
22
|
import { prepareIBCTools } from './ibc-packet.js';
|
|
23
|
+
import { coerceCoin, coerceDenomAmount } from '../utils/amounts.js';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* @import {HostOf} from '@agoric/async-flow';
|
|
@@ -175,15 +176,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
175
176
|
* @returns {Coin}
|
|
176
177
|
*/
|
|
177
178
|
amountToCoin(amount) {
|
|
178
|
-
|
|
179
|
-
// FIXME(#9211) look up values from brands
|
|
180
|
-
trace('TODO #9211: handle brand', amount);
|
|
181
|
-
throw Fail`Brands not currently supported.`;
|
|
182
|
-
}
|
|
183
|
-
return harden({
|
|
184
|
-
denom: amount.denom,
|
|
185
|
-
amount: String(amount.value),
|
|
186
|
-
});
|
|
179
|
+
return coerceCoin(chainHub, amount);
|
|
187
180
|
},
|
|
188
181
|
},
|
|
189
182
|
invitationMakers: {
|
|
@@ -392,12 +385,17 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
392
385
|
* @type {HostOf<OrchestrationAccountI['getBalance']>}
|
|
393
386
|
*/
|
|
394
387
|
getBalance(denomArg) {
|
|
395
|
-
// FIXME look up real values
|
|
396
|
-
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9211
|
|
397
388
|
const [brand, denom] =
|
|
398
389
|
typeof denomArg === 'string'
|
|
399
|
-
? [
|
|
400
|
-
: [denomArg,
|
|
390
|
+
? [chainHub.lookupAsset(denomArg).brand, denomArg]
|
|
391
|
+
: [denomArg, chainHub.lookupDenom(denomArg)];
|
|
392
|
+
|
|
393
|
+
if (!brand) {
|
|
394
|
+
throw Fail`No brand for ${denomArg}`;
|
|
395
|
+
}
|
|
396
|
+
if (!denom) {
|
|
397
|
+
throw Fail`No denom for ${denomArg}`;
|
|
398
|
+
}
|
|
401
399
|
|
|
402
400
|
return watch(
|
|
403
401
|
E(this.state.account).getBalance(brand),
|
|
@@ -435,13 +433,10 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
435
433
|
* @param {Amount<'nat'>} ertpAmount
|
|
436
434
|
*/
|
|
437
435
|
delegate(validatorAddress, ertpAmount) {
|
|
438
|
-
// TODO #9211 lookup denom from brand
|
|
439
|
-
const amount = {
|
|
440
|
-
amount: String(ertpAmount.value),
|
|
441
|
-
denom: 'ubld',
|
|
442
|
-
};
|
|
443
436
|
const { account: lca } = this.state;
|
|
444
437
|
|
|
438
|
+
const amount = coerceCoin(chainHub, ertpAmount);
|
|
439
|
+
|
|
445
440
|
return watch(
|
|
446
441
|
E(lca).executeTx([
|
|
447
442
|
typedJson('/cosmos.staking.v1beta1.MsgDelegate', {
|
|
@@ -460,11 +455,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
460
455
|
* @returns {Vow<void | TimestampRecord>}
|
|
461
456
|
*/
|
|
462
457
|
undelegate(validatorAddress, ertpAmount) {
|
|
463
|
-
|
|
464
|
-
const amount = {
|
|
465
|
-
amount: String(ertpAmount.value),
|
|
466
|
-
denom: 'ubld',
|
|
467
|
-
};
|
|
458
|
+
const amount = coerceCoin(chainHub, ertpAmount);
|
|
468
459
|
const { account: lca } = this.state;
|
|
469
460
|
return watch(
|
|
470
461
|
E(lca).executeTx([
|
|
@@ -555,8 +546,6 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
555
546
|
transfer(amount, destination, opts) {
|
|
556
547
|
return asVow(() => {
|
|
557
548
|
trace('Transferring funds from LCA over IBC');
|
|
558
|
-
// TODO #9211 lookup denom from brand
|
|
559
|
-
if ('brand' in amount) throw Fail`ERTP Amounts not yet supported`;
|
|
560
549
|
|
|
561
550
|
const connectionInfoV = watch(
|
|
562
551
|
chainHub.getConnectionInfo(
|
|
@@ -578,7 +567,11 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
578
567
|
const resultV = watch(
|
|
579
568
|
allVows([connectionInfoV, timeoutTimestampVowOrValue]),
|
|
580
569
|
this.facets.transferWatcher,
|
|
581
|
-
{
|
|
570
|
+
{
|
|
571
|
+
opts,
|
|
572
|
+
amount: coerceDenomAmount(chainHub, amount),
|
|
573
|
+
destination,
|
|
574
|
+
},
|
|
582
575
|
);
|
|
583
576
|
return resultV;
|
|
584
577
|
});
|