@agoric/orchestration 0.1.1-dev-ceec1d5.0 → 0.1.1-dev-21a664a.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 +15 -15
- package/src/chain-info.d.ts +83 -38
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +60 -0
- package/src/cosmos-api.d.ts +11 -0
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +17 -0
- package/src/examples/stakeBld.contract.d.ts.map +1 -1
- package/src/examples/swapExample.contract.d.ts +2 -13
- package/src/examples/swapExample.contract.d.ts.map +1 -1
- package/src/examples/unbondExample.contract.d.ts +1 -1
- package/src/examples/unbondExample.contract.d.ts.map +1 -1
- package/src/exos/local-chain-account-kit.d.ts +2 -2
- package/src/exos/local-chain-account-kit.d.ts.map +1 -1
- package/src/facade.d.ts +21 -5
- package/src/facade.d.ts.map +1 -1
- package/src/facade.js +72 -36
- package/src/orchestration-api.d.ts +10 -8
- package/src/orchestration-api.d.ts.map +1 -1
- package/src/orchestration-api.ts +19 -11
- package/src/proposals/start-stakeBld.d.ts +1 -1
- package/src/proposals/start-stakeBld.d.ts.map +1 -1
- package/src/typeGuards.d.ts +6 -1
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +21 -1
- package/src/chain-info.ts +0 -64
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-21a664a.0+21a664a",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@agoric/assert": "0.6.1-dev-
|
|
35
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
36
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
37
|
-
"@agoric/internal": "0.3.3-dev-
|
|
38
|
-
"@agoric/network": "0.1.1-dev-
|
|
39
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
40
|
-
"@agoric/store": "0.9.3-dev-
|
|
41
|
-
"@agoric/time": "0.3.3-dev-
|
|
42
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
43
|
-
"@agoric/vats": "0.15.2-dev-
|
|
44
|
-
"@agoric/vow": "0.1.1-dev-
|
|
45
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
46
|
-
"@agoric/zone": "0.2.3-dev-
|
|
34
|
+
"@agoric/assert": "0.6.1-dev-21a664a.0+21a664a",
|
|
35
|
+
"@agoric/cosmic-proto": "0.4.1-dev-21a664a.0+21a664a",
|
|
36
|
+
"@agoric/ertp": "0.16.3-dev-21a664a.0+21a664a",
|
|
37
|
+
"@agoric/internal": "0.3.3-dev-21a664a.0+21a664a",
|
|
38
|
+
"@agoric/network": "0.1.1-dev-21a664a.0+21a664a",
|
|
39
|
+
"@agoric/notifier": "0.6.3-dev-21a664a.0+21a664a",
|
|
40
|
+
"@agoric/store": "0.9.3-dev-21a664a.0+21a664a",
|
|
41
|
+
"@agoric/time": "0.3.3-dev-21a664a.0+21a664a",
|
|
42
|
+
"@agoric/vat-data": "0.5.3-dev-21a664a.0+21a664a",
|
|
43
|
+
"@agoric/vats": "0.15.2-dev-21a664a.0+21a664a",
|
|
44
|
+
"@agoric/vow": "0.1.1-dev-21a664a.0+21a664a",
|
|
45
|
+
"@agoric/zoe": "0.26.3-dev-21a664a.0+21a664a",
|
|
46
|
+
"@agoric/zone": "0.2.3-dev-21a664a.0+21a664a",
|
|
47
47
|
"@endo/base64": "^1.0.5",
|
|
48
48
|
"@endo/far": "^1.1.2",
|
|
49
49
|
"@endo/marshal": "^1.5.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"typeCoverage": {
|
|
85
85
|
"atLeast": 97.38
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "21a664a978e14c27a2a193c5e103a2f72129e52d"
|
|
88
88
|
}
|
package/src/chain-info.d.ts
CHANGED
|
@@ -1,40 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export namespace wellKnownChainInfo {
|
|
2
|
+
namespace stride {
|
|
3
|
+
let chainId: string;
|
|
4
|
+
let connections: {};
|
|
5
|
+
let icaEnabled: true;
|
|
6
|
+
let icqEnabled: true;
|
|
7
|
+
let pfmEnabled: true;
|
|
8
|
+
let ibcHooksEnabled: true;
|
|
9
|
+
let allowedMessages: never[];
|
|
10
|
+
let allowedQueries: never[];
|
|
11
|
+
let stakingTokens: {
|
|
12
|
+
denom: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
namespace cosmos {
|
|
16
|
+
let chainId_1: string;
|
|
17
|
+
export { chainId_1 as chainId };
|
|
18
|
+
let connections_1: {};
|
|
19
|
+
export { connections_1 as connections };
|
|
20
|
+
let icaEnabled_1: true;
|
|
21
|
+
export { icaEnabled_1 as icaEnabled };
|
|
22
|
+
let icqEnabled_1: true;
|
|
23
|
+
export { icqEnabled_1 as icqEnabled };
|
|
24
|
+
let pfmEnabled_1: true;
|
|
25
|
+
export { pfmEnabled_1 as pfmEnabled };
|
|
26
|
+
let ibcHooksEnabled_1: true;
|
|
27
|
+
export { ibcHooksEnabled_1 as ibcHooksEnabled };
|
|
28
|
+
let allowedMessages_1: never[];
|
|
29
|
+
export { allowedMessages_1 as allowedMessages };
|
|
30
|
+
let allowedQueries_1: never[];
|
|
31
|
+
export { allowedQueries_1 as allowedQueries };
|
|
32
|
+
let stakingTokens_1: {
|
|
33
|
+
denom: string;
|
|
34
|
+
}[];
|
|
35
|
+
export { stakingTokens_1 as stakingTokens };
|
|
36
|
+
}
|
|
37
|
+
namespace celestia {
|
|
38
|
+
let chainId_2: string;
|
|
39
|
+
export { chainId_2 as chainId };
|
|
40
|
+
let connections_2: {};
|
|
41
|
+
export { connections_2 as connections };
|
|
42
|
+
let icaEnabled_2: true;
|
|
43
|
+
export { icaEnabled_2 as icaEnabled };
|
|
44
|
+
let icqEnabled_2: true;
|
|
45
|
+
export { icqEnabled_2 as icqEnabled };
|
|
46
|
+
let pfmEnabled_2: true;
|
|
47
|
+
export { pfmEnabled_2 as pfmEnabled };
|
|
48
|
+
let ibcHooksEnabled_2: true;
|
|
49
|
+
export { ibcHooksEnabled_2 as ibcHooksEnabled };
|
|
50
|
+
let allowedMessages_2: never[];
|
|
51
|
+
export { allowedMessages_2 as allowedMessages };
|
|
52
|
+
let allowedQueries_2: never[];
|
|
53
|
+
export { allowedQueries_2 as allowedQueries };
|
|
54
|
+
let stakingTokens_2: {
|
|
55
|
+
denom: string;
|
|
56
|
+
}[];
|
|
57
|
+
export { stakingTokens_2 as stakingTokens };
|
|
58
|
+
}
|
|
59
|
+
namespace osmosis {
|
|
60
|
+
let chainId_3: string;
|
|
61
|
+
export { chainId_3 as chainId };
|
|
62
|
+
let connections_3: {};
|
|
63
|
+
export { connections_3 as connections };
|
|
64
|
+
let icaEnabled_3: true;
|
|
65
|
+
export { icaEnabled_3 as icaEnabled };
|
|
66
|
+
let icqEnabled_3: true;
|
|
67
|
+
export { icqEnabled_3 as icqEnabled };
|
|
68
|
+
let pfmEnabled_3: true;
|
|
69
|
+
export { pfmEnabled_3 as pfmEnabled };
|
|
70
|
+
let ibcHooksEnabled_3: true;
|
|
71
|
+
export { ibcHooksEnabled_3 as ibcHooksEnabled };
|
|
72
|
+
let allowedMessages_3: never[];
|
|
73
|
+
export { allowedMessages_3 as allowedMessages };
|
|
74
|
+
let allowedQueries_3: never[];
|
|
75
|
+
export { allowedQueries_3 as allowedQueries };
|
|
76
|
+
let stakingTokens_3: {
|
|
77
|
+
denom: string;
|
|
78
|
+
}[];
|
|
79
|
+
export { stakingTokens_3 as stakingTokens };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
6
82
|
export type ChainInfo = CosmosChainInfo | EthChainInfo;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
methods?: {};
|
|
10
|
-
}> & {
|
|
11
|
-
stride: {
|
|
12
|
-
info: CosmosChainInfo;
|
|
13
|
-
methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries & LiquidStakingMethods;
|
|
14
|
-
};
|
|
15
|
-
cosmos: {
|
|
16
|
-
info: CosmosChainInfo;
|
|
17
|
-
methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries;
|
|
18
|
-
};
|
|
19
|
-
agoric: {
|
|
20
|
-
info: CosmosChainInfo;
|
|
21
|
-
methods: {
|
|
22
|
-
/**
|
|
23
|
-
* Register a hook to intercept an incoming IBC Transfer and handle it.
|
|
24
|
-
* Calling without arguments will unregister the hook.
|
|
25
|
-
*/
|
|
26
|
-
interceptTransfer: (tap?: {
|
|
27
|
-
upcall: (args: any) => Promise<any>;
|
|
28
|
-
}) => Promise<void>;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
celestia: {
|
|
32
|
-
info: CosmosChainInfo;
|
|
33
|
-
methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries;
|
|
34
|
-
};
|
|
35
|
-
osmosis: {
|
|
36
|
-
info: CosmosChainInfo;
|
|
37
|
-
methods: IcaAccount & ICQConnection & StakingAccountActions & StakingAccountQueries;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
83
|
+
import type { CosmosChainInfo } from './types.js';
|
|
84
|
+
import type { EthChainInfo } from './types.js';
|
|
40
85
|
//# sourceMappingURL=chain-info.d.ts.map
|
package/src/chain-info.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.
|
|
1
|
+
{"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAIiD,YAAY;kCAAZ,YAAY"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/8879
|
|
2
|
+
|
|
3
|
+
/** @file temporary static lookup of chain info */
|
|
4
|
+
|
|
5
|
+
/** @import {CosmosChainInfo, EthChainInfo} from './types.js'; */
|
|
6
|
+
|
|
7
|
+
/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */
|
|
8
|
+
|
|
9
|
+
// TODO generate this automatically with a build script drawing on data sources such as https://github.com/cosmos/chain-registry
|
|
10
|
+
|
|
11
|
+
export const wellKnownChainInfo =
|
|
12
|
+
/** @satisfies {Record<string, ChainInfo>} */ (
|
|
13
|
+
harden({
|
|
14
|
+
// https://github.com/cosmos/chain-registry/blob/master/stride/chain.json
|
|
15
|
+
stride: {
|
|
16
|
+
chainId: 'stride-1',
|
|
17
|
+
connections: {},
|
|
18
|
+
icaEnabled: true,
|
|
19
|
+
icqEnabled: true,
|
|
20
|
+
pfmEnabled: true,
|
|
21
|
+
ibcHooksEnabled: true,
|
|
22
|
+
allowedMessages: [],
|
|
23
|
+
allowedQueries: [],
|
|
24
|
+
stakingTokens: [{ denom: 'ustride' }],
|
|
25
|
+
},
|
|
26
|
+
cosmos: {
|
|
27
|
+
chainId: 'cosmoshub-4',
|
|
28
|
+
connections: {},
|
|
29
|
+
icaEnabled: true,
|
|
30
|
+
icqEnabled: true,
|
|
31
|
+
pfmEnabled: true,
|
|
32
|
+
ibcHooksEnabled: true,
|
|
33
|
+
allowedMessages: [],
|
|
34
|
+
allowedQueries: [],
|
|
35
|
+
stakingTokens: [{ denom: 'uatom' }],
|
|
36
|
+
},
|
|
37
|
+
celestia: {
|
|
38
|
+
chainId: 'celestia',
|
|
39
|
+
connections: {},
|
|
40
|
+
icaEnabled: true,
|
|
41
|
+
icqEnabled: true,
|
|
42
|
+
pfmEnabled: true,
|
|
43
|
+
ibcHooksEnabled: true,
|
|
44
|
+
allowedMessages: [],
|
|
45
|
+
allowedQueries: [],
|
|
46
|
+
stakingTokens: [{ denom: 'utia' }],
|
|
47
|
+
},
|
|
48
|
+
osmosis: {
|
|
49
|
+
chainId: 'osmosis-1',
|
|
50
|
+
connections: {},
|
|
51
|
+
icaEnabled: true,
|
|
52
|
+
icqEnabled: true,
|
|
53
|
+
pfmEnabled: true,
|
|
54
|
+
ibcHooksEnabled: true,
|
|
55
|
+
allowedMessages: [],
|
|
56
|
+
allowedQueries: [],
|
|
57
|
+
stakingTokens: [{ denom: 'uosmo' }],
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
);
|
package/src/cosmos-api.d.ts
CHANGED
|
@@ -62,6 +62,12 @@ export type CosmosChainInfo = {
|
|
|
62
62
|
*/
|
|
63
63
|
allowedMessages: TypeUrl[];
|
|
64
64
|
allowedQueries: TypeUrl[];
|
|
65
|
+
/**
|
|
66
|
+
* cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
|
|
67
|
+
*/
|
|
68
|
+
stakingTokens?: Array<{
|
|
69
|
+
denom: string;
|
|
70
|
+
}>;
|
|
65
71
|
};
|
|
66
72
|
export interface StakingAccountQueries {
|
|
67
73
|
/**
|
|
@@ -173,4 +179,9 @@ export type IBCMsgTransferOptions = {
|
|
|
173
179
|
timeoutTimestamp?: MsgTransfer['timeoutTimestamp'];
|
|
174
180
|
memo?: string;
|
|
175
181
|
};
|
|
182
|
+
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> = (CCI extends {
|
|
183
|
+
icaEnabled: true;
|
|
184
|
+
} ? IcaAccount : {}) & CCI extends {
|
|
185
|
+
stakingTokens: {};
|
|
186
|
+
} ? StakingAccountActions : {};
|
|
176
187
|
//# sourceMappingURL=cosmos-api.d.ts.map
|
package/src/cosmos-api.d.ts.map
CHANG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AC,MAAM,CAAC,CAAC;IACrB,sEAAsE;IACtE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3C;;OAEG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;IACzC,gDAAgD;IAChD,eAAe,EAAE,MAAM,eAAe,CAAC;IACvC,oDAAoD;IACpD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,GAAG,SAAS,eAAe,IAC/D,CAAC,GAAG,SAAS;IACX,UAAU,EAAE,IAAI,CAAC;CAClB,GACG,UAAU,GACV,EAAE,CAAC,GACL,GAAG,SAAS;IACZ,aAAa,EAAE,EAAE,CAAC;CACnB,GACG,qBAAqB,GACrB,EAAE,CAAC"}
|
package/src/cosmos-api.ts
CHANGED
|
@@ -77,6 +77,11 @@ export type CosmosChainInfo = {
|
|
|
77
77
|
*/
|
|
78
78
|
allowedMessages: TypeUrl[];
|
|
79
79
|
allowedQueries: TypeUrl[];
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
|
|
83
|
+
*/
|
|
84
|
+
stakingTokens?: Array<{ denom: string }>;
|
|
80
85
|
};
|
|
81
86
|
|
|
82
87
|
export interface StakingAccountQueries {
|
|
@@ -219,3 +224,15 @@ export type IBCMsgTransferOptions = {
|
|
|
219
224
|
timeoutTimestamp?: MsgTransfer['timeoutTimestamp'];
|
|
220
225
|
memo?: string;
|
|
221
226
|
};
|
|
227
|
+
|
|
228
|
+
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> =
|
|
229
|
+
(CCI extends {
|
|
230
|
+
icaEnabled: true;
|
|
231
|
+
}
|
|
232
|
+
? IcaAccount
|
|
233
|
+
: {}) &
|
|
234
|
+
CCI extends {
|
|
235
|
+
stakingTokens: {};
|
|
236
|
+
}
|
|
237
|
+
? StakingAccountActions
|
|
238
|
+
: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stakeBld.contract.d.ts","sourceRoot":"","sources":["stakeBld.contract.js"],"names":[],"mappings":"AA+BO,2BAVI,GAAG;gBAEG,OAAO,gCAAgC,EAAE,UAAU;gBACnD,UAAU;iBACT,WAAW;;;YAIlB,OAAO,kBAAkB,EAAE,OAAO;;QA+CvC;;WAEG;;;;;;;;;;+DAuCoC,OAAO,KACpD,CAAC;;;iEAUgT,OAAO,KAAK,CAAC;;;;;;;;;;;+DAAs4B,OAAO,KAAK,CAAC;;;iEAA+yB,OAAO,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"stakeBld.contract.d.ts","sourceRoot":"","sources":["stakeBld.contract.js"],"names":[],"mappings":"AA+BO,2BAVI,GAAG;gBAEG,OAAO,gCAAgC,EAAE,UAAU;gBACnD,UAAU;iBACT,WAAW;;;YAIlB,OAAO,kBAAkB,EAAE,OAAO;;QA+CvC;;WAEG;;;;;;;;;;+DAuCoC,OAAO,KACpD,CAAC;;;iEAUgT,OAAO,KAAK,CAAC;;;;;;;;;;;+DAAs4B,OAAO,KAAK,CAAC;;;iEAA+yB,OAAO,KAAK,CAAC;iCArE1+D,QAAQ,KAAK,CAAC,mBACxB,OAAO;iCAiBN,OAAO,KAAK,CAAC;;;+BAclB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;QAiBjB;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBR;kCAhH0C,cAAc;gCAAd,cAAc"}
|
|
@@ -16,19 +16,8 @@ export function makeNatAmountShape(brand: Brand, min?: bigint | undefined): {
|
|
|
16
16
|
export function start(zcf: ZCF, privateArgs: {
|
|
17
17
|
localchain: Remote<import("@endo/exo").Guarded<{
|
|
18
18
|
makeAccount(): Promise<import("@endo/exo").Guarded<{
|
|
19
|
-
getAddress():
|
|
20
|
-
getBalance(brand: Brand<"nat"
|
|
21
|
-
/**
|
|
22
|
-
* @param {ZCF} zcf
|
|
23
|
-
* @param {{
|
|
24
|
-
* localchain: Remote<LocalChain>;
|
|
25
|
-
* orchestrationService: Remote<OrchestrationService>;
|
|
26
|
-
* storageNode: Remote<StorageNode>;
|
|
27
|
-
* timerService: Remote<TimerService>;
|
|
28
|
-
* }} privateArgs
|
|
29
|
-
* @param {Baggage} baggage
|
|
30
|
-
*/
|
|
31
|
-
>): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
19
|
+
getAddress(): string;
|
|
20
|
+
getBalance(brand: Brand<"nat">): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
32
21
|
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): Promise<globalThis.Amount>;
|
|
33
22
|
withdraw(amount: Amount<"nat">): Promise<globalThis.Payment<"nat">>;
|
|
34
23
|
executeTx<MT extends {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swapExample.contract.d.ts","sourceRoot":"","sources":["swapExample.contract.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AAEH,2BAA2B;AAC3B,mBADW,YAAY,CASrB;AASK,0CAHI,KAAK;;;EAIsC;AAY/C,2BATI,GAAG;;;;
|
|
1
|
+
{"version":3,"file":"swapExample.contract.d.ts","sourceRoot":"","sources":["swapExample.contract.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AAEH,2BAA2B;AAC3B,mBADW,YAAY,CASrB;AASK,0CAHI,KAAK;;;EAIsC;AAY/C,2BATI,GAAG;;;;8BAHwB,MAAM,KAAK,CAAC;6BAiBZ,QAAQ,KAAK,CAAC,mBAC/C,OAAO;6BAsB0C,OAAO,KAAK,CAAC;;;2BAeH,EAAE;;uBA0C0hC,OAAO,sBAAsB,EAAE,SAAS;;;4BAAyqB,OAAO,sBAAsB,EAAE,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;oBAhEt0D,MAAM,CAAC,KAAK,CAAC;;;;;oBAAb,MAAM,CAAC,KAAK,CAAC;;;;GA+D7B;4BAzHwB,kBAAkB;gCAHwB,aAAa;kCACjD,cAAc;6BAInB,kBAAkB;4CALuB,aAAa"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function start(zcf: ZCF, privateArgs: {
|
|
2
2
|
localchain: Remote<import("@endo/exo").Guarded<{
|
|
3
3
|
makeAccount(): Promise<import("@endo/exo").Guarded<{
|
|
4
|
-
getAddress():
|
|
4
|
+
getAddress(): string;
|
|
5
5
|
getBalance(brand: Brand<"nat">): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
6
6
|
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): Promise<globalThis.Amount>;
|
|
7
7
|
withdraw(amount: Amount<"nat">): Promise<globalThis.Payment<"nat">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unbondExample.contract.d.ts","sourceRoot":"","sources":["unbondExample.contract.js"],"names":[],"mappings":"AAwBO,2BATI,GAAG;;;;
|
|
1
|
+
{"version":3,"file":"unbondExample.contract.d.ts","sourceRoot":"","sources":["unbondExample.contract.js"],"names":[],"mappings":"AAwBO,2BATI,GAAG;;;;8BA8BP,MAAM,KAAK,CAAC;6BAQkB,QAAQ,KAAK,CAAC,mBAC5C,OAAO;6BAWsB,OAAO,KAAK,CAAC;;;2BAuBI,EAAE;;uBAAupE,OAAO,sBAAsB,EAAE,SAAS;;;4BAAyqB,OAAO,sBAAsB,EAAE,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;GADx8F;4BA7EwB,kBAAkB;gCAJwB,aAAa;kCACjD,cAAc;6BACnB,kBAAkB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function prepareLocalChainAccountKit(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: TimerService, timerBrand: TimerBrand, agoricChainInfo: AgoricChainInfo): (args_0: {
|
|
2
2
|
account: import("@endo/exo").Guarded<{
|
|
3
|
-
getAddress():
|
|
3
|
+
getAddress(): string;
|
|
4
4
|
getBalance(brand: Brand<"nat">): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
5
5
|
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): Promise<globalThis.Amount>;
|
|
6
6
|
withdraw(amount: Amount<"nat">): Promise<globalThis.Payment<"nat">>;
|
|
@@ -85,7 +85,7 @@ export type LocalChainAccountNotification = {
|
|
|
85
85
|
export type State = {
|
|
86
86
|
topicKit: RecorderKit<LocalChainAccountNotification>;
|
|
87
87
|
account: import("@endo/exo").Guarded<{
|
|
88
|
-
getAddress():
|
|
88
|
+
getAddress(): string;
|
|
89
89
|
getBalance(brand: Brand<"nat">): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
90
90
|
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): Promise<globalThis.Amount>;
|
|
91
91
|
withdraw(amount: Amount<"nat">): Promise<globalThis.Payment<"nat">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-chain-account-kit.d.ts","sourceRoot":"","sources":["local-chain-account-kit.js"],"names":[],"mappings":"AAsEO,0FAuED,WACD,GAAE,QACC,OAAA,WAAU,EAAE,MAAM,CAChB,WAAA,CAAC,CAAC,0HA/ED,GAAG,uEAGH,eAAe;;;
|
|
1
|
+
{"version":3,"file":"local-chain-account-kit.d.ts","sourceRoot":"","sources":["local-chain-account-kit.js"],"names":[],"mappings":"AAsEO,0FAuED,WACD,GAAE,QACC,OAAA,WAAU,EAAE,MAAM,CAChB,WAAA,CAAC,CAAC,0HA/ED,GAAG,uEAGH,eAAe;;;0BA5BpB,MAAM,KAAK,CAAC;yBAWX,QAAQ,KAAK,CAAC,mBACZ,OAAO;yBAkBkB,OAAO,KACxC,CAAC;;;uBAkBY,EAAE;;;iBASD,WAAW;;;QAalB;;;WAGG;mCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;QAYxB;;;WAGG;qCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;QA0BxB;;;WAGG;mCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;QAsBxB;;;;WAIG;qCAHQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC,GACX,OAAO,CAAC,IAAI,CAAC;QA2B1B;;;;WAIG;QACH,2CAA2C;yBAjK5C,QAAQ,KAAK,CAAC,mBACZ,OAAO;QAoKR,4CAA4C;yBAlJlB,OAAO,KACxC,CAAC;QAqJM,6CAA6C;;;uBAnIvC,EAAE;QAwIR;;WAEG;;QAIH;;;;;;;;WAQG;0GADU,OAAO,CAAC,IAAI,CAAC;;GA+CjC;;;;;aA5Pa,MAAM;;;;;;0BAOd,MAAM,KAAK,CAAC;yBAWX,QAAQ,KAAK,CAAC,mBACZ,OAAO;yBAkBkB,OAAO,KACxC,CAAC;;;uBAkBY,EAAE;;;;mCAqMF,UAAU,CAAC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;0BAzQjD,cAAc;iCADU,6CAA6C;kCAEjD,cAAc;gCAAd,cAAc;+BAHsC,uBAAuB;kCAAvB,uBAAuB;2CAAvB,uBAAuB"}
|
package/src/facade.d.ts
CHANGED
|
@@ -6,17 +6,18 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
|
|
|
6
6
|
orchestrationService: Remote<import("@endo/exo").Guarded<{
|
|
7
7
|
makeAccount(hostConnectionId: `connection-${number}`, controllerConnectionId: `connection-${number}`): Promise<import("./cosmos-api.js").IcaAccount>;
|
|
8
8
|
provideICQConnection(controllerConnectionId: `connection-${number}`): Promise<import("@endo/exo").Guarded<{
|
|
9
|
-
getLocalAddress(): `/ibc-port/${string}`;
|
|
9
|
+
getLocalAddress(): `/ibc-port/${string}`;
|
|
10
10
|
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
11
11
|
query(msgs: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").RequestQuery>[]): Promise<import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto/tendermint/abci/types.js").ResponseQuery>[]>;
|
|
12
12
|
}>>;
|
|
13
13
|
}>>;
|
|
14
14
|
localchain: Remote<import("@endo/exo").Guarded<{
|
|
15
15
|
makeAccount(): Promise<import("@endo/exo").Guarded<{
|
|
16
|
-
getAddress():
|
|
16
|
+
getAddress(): string;
|
|
17
17
|
getBalance(brand: Brand<"nat">): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
18
18
|
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): Promise<globalThis.Amount>;
|
|
19
|
-
withdraw(amount: Amount
|
|
19
|
+
withdraw(amount: Amount<// FIXME implement
|
|
20
|
+
"nat">): Promise<globalThis.Payment<"nat">>;
|
|
20
21
|
executeTx<MT extends {
|
|
21
22
|
'@type': string;
|
|
22
23
|
}[]>(messages: MT): Promise<{ [K in keyof MT]: import("@agoric/cosmic-proto").JsonSafe<import("@agoric/cosmic-proto").ResponseTo<MT[K]>>; }>;
|
|
@@ -32,11 +33,25 @@ export function makeOrchestrationFacade({ zone, timerService, zcf, storageNode,
|
|
|
32
33
|
}[]>;
|
|
33
34
|
}>>;
|
|
34
35
|
}): {
|
|
36
|
+
/**
|
|
37
|
+
* Register a new chain in a heap store. The name will override a name in
|
|
38
|
+
* well known chain names.
|
|
39
|
+
*
|
|
40
|
+
* This registration will not surve a reincarnation of the vat so if the
|
|
41
|
+
* chain is not yet in the well known names at that point, it will have to
|
|
42
|
+
* be registered again. In an unchanged contract `start` the call will
|
|
43
|
+
* happen again naturally.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} name
|
|
46
|
+
* @param {ChainInfo} chainInfo
|
|
47
|
+
*/
|
|
48
|
+
registerChain(name: string, chainInfo: ChainInfo): void;
|
|
35
49
|
/**
|
|
36
50
|
* @template Context
|
|
37
51
|
* @template {any[]} Args
|
|
38
|
-
* @param {string} durableName
|
|
39
|
-
*
|
|
52
|
+
* @param {string} durableName - the orchestration flow identity in the zone
|
|
53
|
+
* (to resume across upgrades)
|
|
54
|
+
* @param {Context} ctx - values to pass through the async flow membrane
|
|
40
55
|
* @param {(orc: Orchestrator, ctx2: Context, ...args: Args) => object} fn
|
|
41
56
|
* @returns {(...args: Args) => Promise<unknown>}
|
|
42
57
|
*/
|
|
@@ -46,5 +61,6 @@ export type OrchestrationFacade = ReturnType<typeof makeOrchestrationFacade>;
|
|
|
46
61
|
import type { Zone } from '@agoric/zone';
|
|
47
62
|
import type { TimerService } from '@agoric/time';
|
|
48
63
|
import type { Remote } from '@agoric/internal';
|
|
64
|
+
import type { ChainInfo } from './types.js';
|
|
49
65
|
import type { Orchestrator } from './types.js';
|
|
50
66
|
//# sourceMappingURL=facade.d.ts.map
|
package/src/facade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["facade.js"],"names":[],"mappings":"AA+JO;;;SANG,GAAG;;;;;;;;;;;;;8BAtGH,MAAE,KAAK,CAAC;6BAa6B,QAAQ,KAAK,CAAC,mBACzC,OAAO;6BAemB,OACpC,kBAAkB;YAClB,KADJ,CAAC;;;2BAsBQ,EAAE;;uBAoFuB,OAAO,sBAAsB,EAAE,SAClE;;;4BAoBG,OAAA,sBAAoB,EAClB,SAAF,EAAE;;;;;;;;IA5BN;;;;;;;;;;;OAWG;wBAFQ,MAAM;IAMjB;;;;;;;;OAQG;gBAFkC,OAAO,EACrB,IAAI,6BAJhB,MAAM,OAGoB,OAAO,AAD1B,gCACmB,OAAO,WACrB,IAAI,AADgC,KAAK,MAAM,GACzD,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC;EAiCnD;kCAEa,UAAU,CAAC,OAAO,uBAAuB,CAAC;0BApOjC,cAAc;kCACN,cAAc;4BAEpB,kBAAkB;+BAE6C,YAAY;kCAAZ,YAAY"}
|
package/src/facade.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/** @file Orchestration service */
|
|
2
2
|
|
|
3
|
+
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
3
4
|
import { E } from '@endo/far';
|
|
5
|
+
import { M } from '@endo/patterns';
|
|
6
|
+
import { wellKnownChainInfo } from './chain-info.js';
|
|
4
7
|
import { prepareCosmosOrchestrationAccount } from './exos/cosmosOrchestrationAccount.js';
|
|
8
|
+
import { CosmosChainInfoShape } from './typeGuards.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* @import {Zone} from '@agoric/zone';
|
|
@@ -9,13 +13,14 @@ import { prepareCosmosOrchestrationAccount } from './exos/cosmosOrchestrationAcc
|
|
|
9
13
|
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
|
|
10
14
|
* @import {Remote} from '@agoric/internal';
|
|
11
15
|
* @import {OrchestrationService} from './service.js';
|
|
12
|
-
* @import {Chain, ChainInfo, CosmosChainInfo,
|
|
16
|
+
* @import {Chain, ChainInfo, CosmosChainInfo, OrchestrationAccount, Orchestrator} from './types.js';
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
/** @type {any} */
|
|
16
20
|
const anyVal = null;
|
|
17
21
|
|
|
18
|
-
// FIXME
|
|
22
|
+
// FIXME look up real values
|
|
23
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9063
|
|
19
24
|
const mockLocalChainInfo = {
|
|
20
25
|
allegedName: 'agoric',
|
|
21
26
|
allowedMessages: [],
|
|
@@ -39,36 +44,41 @@ const makeLocalChainFacade = localchain => {
|
|
|
39
44
|
return mockLocalChainInfo;
|
|
40
45
|
},
|
|
41
46
|
|
|
42
|
-
// @ts-expect-error FIXME promise resolution through membrane
|
|
43
47
|
async makeAccount() {
|
|
44
48
|
const account = await E(localchain).makeAccount();
|
|
45
49
|
|
|
46
50
|
return {
|
|
47
|
-
deposit(payment) {
|
|
51
|
+
async deposit(payment) {
|
|
48
52
|
console.log('deposit got', payment);
|
|
49
|
-
|
|
53
|
+
await E(account).deposit(payment);
|
|
50
54
|
},
|
|
51
|
-
|
|
52
|
-
const addressStr =
|
|
55
|
+
getAddress() {
|
|
56
|
+
const addressStr = account.getAddress();
|
|
53
57
|
return {
|
|
54
58
|
address: addressStr,
|
|
55
59
|
chainId: mockLocalChainInfo.chainId,
|
|
56
60
|
addressEncoding: 'bech32',
|
|
57
61
|
};
|
|
58
62
|
},
|
|
59
|
-
getBalance(
|
|
60
|
-
// FIXME
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
async getBalance(denomArg) {
|
|
64
|
+
// FIXME look up real values
|
|
65
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9211
|
|
66
|
+
const [brand, denom] =
|
|
67
|
+
typeof denomArg === 'string'
|
|
68
|
+
? [/** @type {any} */ (null), denomArg]
|
|
69
|
+
: [denomArg, 'FIXME'];
|
|
70
|
+
|
|
71
|
+
const natAmount = await account.getBalance(brand);
|
|
72
|
+
return harden({ denom, value: natAmount.value });
|
|
63
73
|
},
|
|
64
74
|
getBalances() {
|
|
65
75
|
throw new Error('not yet implemented');
|
|
66
76
|
},
|
|
67
|
-
send(toAccount, amount) {
|
|
77
|
+
async send(toAccount, amount) {
|
|
68
78
|
// FIXME implement
|
|
69
79
|
console.log('send got', toAccount, amount);
|
|
70
80
|
},
|
|
71
|
-
transfer(amount, destination, opts) {
|
|
81
|
+
async transfer(amount, destination, opts) {
|
|
72
82
|
// FIXME implement
|
|
73
83
|
console.log('transfer got', amount, destination, opts);
|
|
74
84
|
},
|
|
@@ -82,27 +92,21 @@ const makeLocalChainFacade = localchain => {
|
|
|
82
92
|
};
|
|
83
93
|
|
|
84
94
|
/**
|
|
85
|
-
* @template {
|
|
86
|
-
* @param {
|
|
95
|
+
* @template {CosmosChainInfo} CCI
|
|
96
|
+
* @param {CCI} chainInfo
|
|
87
97
|
* @param {object} io
|
|
88
98
|
* @param {Remote<OrchestrationService>} io.orchestration
|
|
89
99
|
* @param {Remote<TimerService>} io.timer
|
|
90
100
|
* @param {ZCF} io.zcf
|
|
91
101
|
* @param {Zone} io.zone
|
|
92
|
-
* @returns {Chain<
|
|
102
|
+
* @returns {Chain<CCI>}
|
|
93
103
|
*/
|
|
94
|
-
const makeRemoteChainFacade = (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
icqEnabled: true,
|
|
101
|
-
pfmEnabled: true,
|
|
102
|
-
ibcHooksEnabled: true,
|
|
103
|
-
allowedMessages: [],
|
|
104
|
-
allowedQueries: [],
|
|
105
|
-
});
|
|
104
|
+
const makeRemoteChainFacade = (
|
|
105
|
+
chainInfo,
|
|
106
|
+
{ orchestration, timer, zcf, zone },
|
|
107
|
+
) => {
|
|
108
|
+
const name = chainInfo.chainId;
|
|
109
|
+
|
|
106
110
|
const makeRecorderKit = () => anyVal;
|
|
107
111
|
const makeCosmosOrchestrationAccount = prepareCosmosOrchestrationAccount(
|
|
108
112
|
zone.subZone(name),
|
|
@@ -112,11 +116,10 @@ const makeRemoteChainFacade = (name, { orchestration, timer, zcf, zone }) => {
|
|
|
112
116
|
|
|
113
117
|
return {
|
|
114
118
|
getChainInfo: async () => chainInfo,
|
|
115
|
-
/** @returns {Promise<OrchestrationAccount<
|
|
119
|
+
/** @returns {Promise<OrchestrationAccount<CCI>>} */
|
|
116
120
|
makeAccount: async () => {
|
|
117
|
-
console.log('makeAccount for', name);
|
|
118
|
-
|
|
119
121
|
// FIXME look up real values
|
|
122
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9063
|
|
120
123
|
const hostConnectionId = 'connection-1';
|
|
121
124
|
const controllerConnectionId = 'connection-2';
|
|
122
125
|
|
|
@@ -127,8 +130,13 @@ const makeRemoteChainFacade = (name, { orchestration, timer, zcf, zone }) => {
|
|
|
127
130
|
|
|
128
131
|
const address = await E(icaAccount).getAddress();
|
|
129
132
|
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
const [{ denom: bondDenom }] = chainInfo.stakingTokens || [
|
|
134
|
+
{
|
|
135
|
+
denom: null,
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
assert(bondDenom, 'missing bondDenom');
|
|
139
|
+
// @ts-expect-error XXX dynamic method availability
|
|
132
140
|
return makeCosmosOrchestrationAccount(address, bondDenom, {
|
|
133
141
|
account: icaAccount,
|
|
134
142
|
storageNode: anyVal,
|
|
@@ -165,12 +173,33 @@ export const makeOrchestrationFacade = ({
|
|
|
165
173
|
orchestrationService,
|
|
166
174
|
});
|
|
167
175
|
|
|
176
|
+
const chainInfos = makeScalarBigMapStore('chainInfos', {
|
|
177
|
+
keyShape: M.string(),
|
|
178
|
+
valueShape: CosmosChainInfoShape,
|
|
179
|
+
});
|
|
180
|
+
|
|
168
181
|
return {
|
|
182
|
+
/**
|
|
183
|
+
* Register a new chain in a heap store. The name will override a name in
|
|
184
|
+
* well known chain names.
|
|
185
|
+
*
|
|
186
|
+
* This registration will not surve a reincarnation of the vat so if the
|
|
187
|
+
* chain is not yet in the well known names at that point, it will have to
|
|
188
|
+
* be registered again. In an unchanged contract `start` the call will
|
|
189
|
+
* happen again naturally.
|
|
190
|
+
*
|
|
191
|
+
* @param {string} name
|
|
192
|
+
* @param {ChainInfo} chainInfo
|
|
193
|
+
*/
|
|
194
|
+
registerChain(name, chainInfo) {
|
|
195
|
+
chainInfos.init(name, chainInfo);
|
|
196
|
+
},
|
|
169
197
|
/**
|
|
170
198
|
* @template Context
|
|
171
199
|
* @template {any[]} Args
|
|
172
|
-
* @param {string} durableName
|
|
173
|
-
*
|
|
200
|
+
* @param {string} durableName - the orchestration flow identity in the zone
|
|
201
|
+
* (to resume across upgrades)
|
|
202
|
+
* @param {Context} ctx - values to pass through the async flow membrane
|
|
174
203
|
* @param {(orc: Orchestrator, ctx2: Context, ...args: Args) => object} fn
|
|
175
204
|
* @returns {(...args: Args) => Promise<unknown>}
|
|
176
205
|
*/
|
|
@@ -182,7 +211,14 @@ export const makeOrchestrationFacade = ({
|
|
|
182
211
|
return makeLocalChainFacade(localchain);
|
|
183
212
|
}
|
|
184
213
|
|
|
185
|
-
|
|
214
|
+
// TODO look up well known realistically https://github.com/Agoric/agoric-sdk/issues/9063
|
|
215
|
+
const chainInfo = chainInfos.has(name)
|
|
216
|
+
? chainInfos.get(name)
|
|
217
|
+
: // @ts-expect-error may be undefined
|
|
218
|
+
wellKnownChainInfo[name];
|
|
219
|
+
assert(chainInfo, `unknown chain ${name}`);
|
|
220
|
+
|
|
221
|
+
return makeRemoteChainFacade(chainInfo, {
|
|
186
222
|
orchestration: orchestrationService,
|
|
187
223
|
timer: timerService,
|
|
188
224
|
zcf,
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import type { Amount, Brand, NatAmount, Payment } from '@agoric/ertp/src/types.js';
|
|
7
7
|
import type { LocalChainAccount } from '@agoric/vats/src/localchain.js';
|
|
8
8
|
import type { Timestamp } from '@agoric/time';
|
|
9
|
-
import type { IBCMsgTransferOptions,
|
|
9
|
+
import type { ChainInfo, CosmosChainAccountMethods, CosmosChainInfo, IBCMsgTransferOptions, wellKnownChainInfo } from './types.js';
|
|
10
|
+
type KnownChains = typeof wellKnownChainInfo;
|
|
10
11
|
/**
|
|
11
12
|
* A denom that designates a path to a token type on some blockchain.
|
|
12
13
|
*
|
|
@@ -42,26 +43,26 @@ export type ChainAddress = {
|
|
|
42
43
|
address: string;
|
|
43
44
|
addressEncoding: 'bech32' | 'ethereum';
|
|
44
45
|
};
|
|
45
|
-
export type OrchestrationAccount<
|
|
46
|
+
export type OrchestrationAccount<CI extends ChainInfo> = OrchestrationAccountI & (CI extends CosmosChainInfo ? CosmosChainAccountMethods<CI> : never);
|
|
46
47
|
/**
|
|
47
48
|
* An object for access the core functions of a remote chain.
|
|
48
49
|
*
|
|
49
50
|
* Note that "remote" can mean the local chain; it's just that
|
|
50
51
|
* accounts are treated as remote/arms length for consistency.
|
|
51
52
|
*/
|
|
52
|
-
export interface Chain<
|
|
53
|
-
getChainInfo: () => Promise<
|
|
53
|
+
export interface Chain<CI extends ChainInfo> {
|
|
54
|
+
getChainInfo: () => Promise<CI>;
|
|
54
55
|
/**
|
|
55
56
|
* Creates a new account on the remote chain.
|
|
56
57
|
* @returns an object that controls a new remote account on Chain
|
|
57
58
|
*/
|
|
58
|
-
makeAccount: () => Promise<OrchestrationAccount<
|
|
59
|
+
makeAccount: () => Promise<OrchestrationAccount<CI>>;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* Provided in the callback to `orchestrate()`.
|
|
62
63
|
*/
|
|
63
64
|
export interface Orchestrator {
|
|
64
|
-
getChain: <C extends
|
|
65
|
+
getChain: <C extends string>(chainName: C) => Promise<Chain<C extends keyof KnownChains ? KnownChains[C] : any>>;
|
|
65
66
|
makeLocalAccount: () => Promise<LocalChainAccount>;
|
|
66
67
|
/**
|
|
67
68
|
* For a denom, return information about a denom including the equivalent
|
|
@@ -73,9 +74,9 @@ export interface Orchestrator {
|
|
|
73
74
|
/** The well-known Brand on Agoric for the direct asset */
|
|
74
75
|
brand?: Brand;
|
|
75
76
|
/** The Chain at which the argument `denom` exists (where the asset is currently held) */
|
|
76
|
-
chain: Chain<HoldingChain>;
|
|
77
|
+
chain: Chain<KnownChains[HoldingChain]>;
|
|
77
78
|
/** The Chain that is the issuer of the underlying asset */
|
|
78
|
-
base: Chain<IssuingChain>;
|
|
79
|
+
base: Chain<KnownChains[IssuingChain]>;
|
|
79
80
|
/** the Denom for the underlying asset on its issuer chain */
|
|
80
81
|
baseDenom: Denom;
|
|
81
82
|
};
|
|
@@ -155,4 +156,5 @@ export type SwapMaxSlippage = {
|
|
|
155
156
|
brandOut: Brand;
|
|
156
157
|
slippage: number;
|
|
157
158
|
};
|
|
159
|
+
export {};
|
|
158
160
|
//# sourceMappingURL=orchestration-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-api.d.ts","sourceRoot":"","sources":["orchestration-api.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,SAAS,EACT,OAAO,EACR,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"orchestration-api.d.ts","sourceRoot":"","sources":["orchestration-api.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,SAAS,EACT,OAAO,EACR,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,SAAS,EACT,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,KAAK,WAAW,GAAG,OAAO,kBAAkB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,KAAK,GA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AE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,YAAY,CAAA;CAAE,CAAC;AAC3E,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
package/src/orchestration-api.ts
CHANGED
|
@@ -12,7 +12,15 @@ import type {
|
|
|
12
12
|
} from '@agoric/ertp/src/types.js';
|
|
13
13
|
import type { LocalChainAccount } from '@agoric/vats/src/localchain.js';
|
|
14
14
|
import type { Timestamp } from '@agoric/time';
|
|
15
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
ChainInfo,
|
|
17
|
+
CosmosChainAccountMethods,
|
|
18
|
+
CosmosChainInfo,
|
|
19
|
+
IBCMsgTransferOptions,
|
|
20
|
+
wellKnownChainInfo,
|
|
21
|
+
} from './types.js';
|
|
22
|
+
|
|
23
|
+
type KnownChains = typeof wellKnownChainInfo;
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
26
|
* A denom that designates a path to a token type on some blockchain.
|
|
@@ -57,8 +65,8 @@ export type ChainAddress = {
|
|
|
57
65
|
addressEncoding: 'bech32' | 'ethereum';
|
|
58
66
|
};
|
|
59
67
|
|
|
60
|
-
export type OrchestrationAccount<
|
|
61
|
-
|
|
68
|
+
export type OrchestrationAccount<CI extends ChainInfo> = OrchestrationAccountI &
|
|
69
|
+
(CI extends CosmosChainInfo ? CosmosChainAccountMethods<CI> : never);
|
|
62
70
|
|
|
63
71
|
/**
|
|
64
72
|
* An object for access the core functions of a remote chain.
|
|
@@ -66,15 +74,15 @@ export type OrchestrationAccount<C extends keyof KnownChains> =
|
|
|
66
74
|
* Note that "remote" can mean the local chain; it's just that
|
|
67
75
|
* accounts are treated as remote/arms length for consistency.
|
|
68
76
|
*/
|
|
69
|
-
export interface Chain<
|
|
70
|
-
getChainInfo: () => Promise<
|
|
77
|
+
export interface Chain<CI extends ChainInfo> {
|
|
78
|
+
getChainInfo: () => Promise<CI>;
|
|
71
79
|
|
|
72
80
|
// "makeAccount" suggests an operation within a vat
|
|
73
81
|
/**
|
|
74
82
|
* Creates a new account on the remote chain.
|
|
75
83
|
* @returns an object that controls a new remote account on Chain
|
|
76
84
|
*/
|
|
77
|
-
makeAccount: () => Promise<OrchestrationAccount<
|
|
85
|
+
makeAccount: () => Promise<OrchestrationAccount<CI>>;
|
|
78
86
|
// FUTURE supply optional port object; also fetch port object
|
|
79
87
|
|
|
80
88
|
// TODO provide a way to get the local denom/brand/whatever for this chain
|
|
@@ -84,9 +92,9 @@ export interface Chain<C extends keyof KnownChains> {
|
|
|
84
92
|
* Provided in the callback to `orchestrate()`.
|
|
85
93
|
*/
|
|
86
94
|
export interface Orchestrator {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
getChain: <C extends string>(
|
|
96
|
+
chainName: C,
|
|
97
|
+
) => Promise<Chain<C extends keyof KnownChains ? KnownChains[C] : any>>;
|
|
90
98
|
|
|
91
99
|
makeLocalAccount: () => Promise<LocalChainAccount>;
|
|
92
100
|
/**
|
|
@@ -104,9 +112,9 @@ export interface Orchestrator {
|
|
|
104
112
|
/** The well-known Brand on Agoric for the direct asset */
|
|
105
113
|
brand?: Brand;
|
|
106
114
|
/** The Chain at which the argument `denom` exists (where the asset is currently held) */
|
|
107
|
-
chain: Chain<HoldingChain>;
|
|
115
|
+
chain: Chain<KnownChains[HoldingChain]>;
|
|
108
116
|
/** The Chain that is the issuer of the underlying asset */
|
|
109
|
-
base: Chain<IssuingChain>;
|
|
117
|
+
base: Chain<KnownChains[IssuingChain]>;
|
|
110
118
|
/** the Denom for the underlying asset on its issuer chain */
|
|
111
119
|
baseDenom: Denom;
|
|
112
120
|
};
|
|
@@ -4,7 +4,7 @@ export function startStakeBld({ consume: { board, chainStorage, chainTimerServic
|
|
|
4
4
|
stakeBld: Installation<(zcf: ZCF, privateArgs: {
|
|
5
5
|
localchain: import("@endo/exo").Guarded<{
|
|
6
6
|
makeAccount(): Promise<import("@endo/exo").Guarded<{
|
|
7
|
-
getAddress():
|
|
7
|
+
getAddress(): string;
|
|
8
8
|
getBalance(brand: Brand<"nat">): Promise<import("@agoric/ertp/src/types.js").NatAmount>;
|
|
9
9
|
deposit(payment: Payment<"nat">, optAmountShape?: Pattern): Promise<globalThis.Amount>;
|
|
10
10
|
withdraw(amount: Amount<"nat">): Promise<globalThis.Payment<"nat">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-stakeBld.d.ts","sourceRoot":"","sources":["start-stakeBld.js"],"names":[],"mappings":"AAkBO,kSAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,OAqB7B,GAAA;;;;
|
|
1
|
+
{"version":3,"file":"start-stakeBld.d.ts","sourceRoot":"","sources":["start-stakeBld.js"],"names":[],"mappings":"AAkBO,kSAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,OAqB7B,GAAA;;;;0CAyBa,MAAM,KAAK,CAAC;yCAmBC,QACpB,KAAE,CAAC,mBACQ,OAChB;yCAqB+E,OAAO,KAAK,CAAC;;;uCAAgiB,EAAE;;mCAAupE,OAAO,sBAAsB,EAAE,SAAS;;;wCAAyqB,OAAO,sBAAsB,EAAE,SAAS,EAAE;;;;;;;;;;;;;;;;wBA3Dt/G,OAAM,kBAAkB,EAAE,OAAO;;;;;;;;;;;2EA2Do2C,OAAO,KAAK,CAAC;;;6EAAid,OAAO,KAAK,CAAC;;;;;;;;;;;2EAAs4B,OAAO,KAAK,CAAC;;;6EAA+yB,OAAO,KAAK,CAAC;6CAxBhkH,QACpB,KAAE,CAAC,mBACQ,OAChB;6CAqB+E,OAAO,KAAK,CAAC;;;2CAAgiB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAvFvnB,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAsDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BN;sBAjGqB,gCAAgC"}
|
package/src/typeGuards.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export namespace ChainAmountShape {
|
|
|
24
24
|
export { value_2 as value };
|
|
25
25
|
}
|
|
26
26
|
export const AmountArgShape: import("@endo/patterns").Matcher;
|
|
27
|
-
export
|
|
27
|
+
export namespace DelegationShape {
|
|
28
|
+
let delegatorAddress: import("@endo/patterns").Matcher;
|
|
29
|
+
let validatorAddress: import("@endo/patterns").Matcher;
|
|
30
|
+
let shares: import("@endo/patterns").Matcher;
|
|
31
|
+
}
|
|
28
32
|
export const IBCTransferOptionsShape: import("@endo/patterns").Matcher;
|
|
33
|
+
export const CosmosChainInfoShape: import("@endo/patterns").Matcher;
|
|
29
34
|
//# sourceMappingURL=typeGuards.d.ts.map
|
package/src/typeGuards.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAGA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;AAiBH,8DAAkE;
|
|
1
|
+
{"version":3,"file":"typeGuards.d.ts","sourceRoot":"","sources":["typeGuards.js"],"names":[],"mappings":"AAGA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;AAiBH,8DAAkE;;;;;;AAQlE,uEAUE;AAEF,oEAcE"}
|
package/src/typeGuards.js
CHANGED
|
@@ -24,7 +24,11 @@ export const ChainAmountShape = harden({ denom: M.string(), value: M.nat() });
|
|
|
24
24
|
|
|
25
25
|
export const AmountArgShape = M.or(AmountShape, ChainAmountShape);
|
|
26
26
|
|
|
27
|
-
export const DelegationShape =
|
|
27
|
+
export const DelegationShape = harden({
|
|
28
|
+
delegatorAddress: M.string(),
|
|
29
|
+
validatorAddress: M.string(),
|
|
30
|
+
shares: M.string(), // TODO: bigint?
|
|
31
|
+
});
|
|
28
32
|
|
|
29
33
|
export const IBCTransferOptionsShape = M.splitRecord(
|
|
30
34
|
{},
|
|
@@ -37,3 +41,19 @@ export const IBCTransferOptionsShape = M.splitRecord(
|
|
|
37
41
|
memo: M.string(),
|
|
38
42
|
},
|
|
39
43
|
);
|
|
44
|
+
|
|
45
|
+
export const CosmosChainInfoShape = M.splitRecord(
|
|
46
|
+
{
|
|
47
|
+
chainId: M.string(),
|
|
48
|
+
connections: M.record(),
|
|
49
|
+
stakingTokens: M.arrayOf({ denom: M.string() }),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
icaEnabled: M.boolean(),
|
|
53
|
+
icqEnabled: M.boolean(),
|
|
54
|
+
pfmEnabled: M.boolean(),
|
|
55
|
+
ibcHooksEnabled: M.boolean(),
|
|
56
|
+
allowedMessages: M.arrayOf(M.string()),
|
|
57
|
+
allowedQueries: M.arrayOf(M.string()),
|
|
58
|
+
},
|
|
59
|
+
);
|
package/src/chain-info.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file static declaration of known chain types will allow type support for
|
|
3
|
-
* additional chain-specific operations like `liquidStake`
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
CosmosChainInfo,
|
|
8
|
-
EthChainInfo,
|
|
9
|
-
IcaAccount,
|
|
10
|
-
ICQConnection,
|
|
11
|
-
LiquidStakingMethods,
|
|
12
|
-
StakingAccountActions,
|
|
13
|
-
StakingAccountQueries,
|
|
14
|
-
} from './types.js';
|
|
15
|
-
|
|
16
|
-
export type ChainInfo = CosmosChainInfo | EthChainInfo;
|
|
17
|
-
|
|
18
|
-
// TODO generate this automatically with a build script drawing on data sources such as https://github.com/cosmos/chain-registry
|
|
19
|
-
|
|
20
|
-
// XXX methods ad-hoc and not fully accurate
|
|
21
|
-
export type KnownChains = Record<string, { info: ChainInfo; methods?: {} }> & {
|
|
22
|
-
stride: {
|
|
23
|
-
info: CosmosChainInfo;
|
|
24
|
-
methods: IcaAccount &
|
|
25
|
-
ICQConnection &
|
|
26
|
-
StakingAccountActions &
|
|
27
|
-
StakingAccountQueries &
|
|
28
|
-
LiquidStakingMethods;
|
|
29
|
-
};
|
|
30
|
-
cosmos: {
|
|
31
|
-
info: CosmosChainInfo;
|
|
32
|
-
methods: IcaAccount &
|
|
33
|
-
ICQConnection &
|
|
34
|
-
StakingAccountActions &
|
|
35
|
-
StakingAccountQueries;
|
|
36
|
-
};
|
|
37
|
-
agoric: {
|
|
38
|
-
info: CosmosChainInfo;
|
|
39
|
-
methods: {
|
|
40
|
-
// TODO reference type from #8624 `packages/vats/src/localchain.js`
|
|
41
|
-
/**
|
|
42
|
-
* Register a hook to intercept an incoming IBC Transfer and handle it.
|
|
43
|
-
* Calling without arguments will unregister the hook.
|
|
44
|
-
*/
|
|
45
|
-
interceptTransfer: (tap?: {
|
|
46
|
-
upcall: (args: any) => Promise<any>;
|
|
47
|
-
}) => Promise<void>;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
celestia: {
|
|
51
|
-
info: CosmosChainInfo;
|
|
52
|
-
methods: IcaAccount &
|
|
53
|
-
ICQConnection &
|
|
54
|
-
StakingAccountActions &
|
|
55
|
-
StakingAccountQueries;
|
|
56
|
-
};
|
|
57
|
-
osmosis: {
|
|
58
|
-
info: CosmosChainInfo;
|
|
59
|
-
methods: IcaAccount &
|
|
60
|
-
ICQConnection &
|
|
61
|
-
StakingAccountActions &
|
|
62
|
-
StakingAccountQueries;
|
|
63
|
-
};
|
|
64
|
-
};
|