@agoric/orchestration 0.1.1-dev-92f2510.0 → 0.1.1-dev-c1ec381.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/stakeIca.contract.js +1 -1
- package/src/exos/README.md +97 -30
- package/src/exos/cosmos-interchain-service.d.ts +2 -2
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
- package/src/exos/cosmos-interchain-service.js +11 -11
- package/src/exos/{chain-account-kit.d.ts → ica-account-kit.d.ts} +4 -15
- package/src/exos/ica-account-kit.d.ts.map +1 -0
- package/src/exos/{chain-account-kit.js → ica-account-kit.js} +12 -32
- package/src/exos/local-chain-facade.js +1 -1
- package/src/exos/orchestrator.js +1 -1
- package/src/exos/remote-chain-facade.js +1 -1
- package/src/types.d.ts +1 -1
- package/src/types.d.ts.map +1 -1
- package/src/types.ts +1 -1
- package/src/utils/address.d.ts.map +1 -1
- package/src/utils/address.js +2 -1
- package/src/exos/chain-account-kit.d.ts.map +0 -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-c1ec381.0+c1ec381",
|
|
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-c1ec381.0+c1ec381",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-c1ec381.0+c1ec381",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-c1ec381.0+c1ec381",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-c1ec381.0+c1ec381",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-c1ec381.0+c1ec381",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-c1ec381.0+c1ec381",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-c1ec381.0+c1ec381",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-c1ec381.0+c1ec381",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-c1ec381.0+c1ec381",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-c1ec381.0+c1ec381",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-c1ec381.0+c1ec381",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-c1ec381.0+c1ec381",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-c1ec381.0+c1ec381",
|
|
49
49
|
"@endo/base64": "^1.0.5",
|
|
50
50
|
"@endo/errors": "^1.2.2",
|
|
51
51
|
"@endo/far": "^1.1.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "github:paulmillr/noble-hashes#ae060da"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-c1ec381.0+c1ec381",
|
|
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": "c1ec3811353f84bcf8e645887109f634cf1ca8c6"
|
|
98
98
|
}
|
|
@@ -119,7 +119,7 @@ export const start = async (zcf, privateArgs, baggage) => {
|
|
|
119
119
|
const publicFacet = zone.exo(
|
|
120
120
|
'StakeAtom',
|
|
121
121
|
M.interface('StakeAtomI', {
|
|
122
|
-
makeAccount: M.callWhen().returns(M.remotable('
|
|
122
|
+
makeAccount: M.callWhen().returns(M.remotable('OrchestrationAccountKit')),
|
|
123
123
|
makeAccountInvitationMaker: M.callWhen().returns(InvitationShape),
|
|
124
124
|
}),
|
|
125
125
|
{
|
package/src/exos/README.md
CHANGED
|
@@ -1,56 +1,123 @@
|
|
|
1
1
|
# Exo structure
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Last verified 2024-07-31
|
|
4
4
|
|
|
5
5
|
```mermaid
|
|
6
6
|
classDiagram
|
|
7
7
|
|
|
8
8
|
%% Orchestration vat business logic (Zoe)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
ICQConnection --* Port
|
|
10
|
+
ICQConnection --* Connection
|
|
11
|
+
IcaAccount --* Port
|
|
12
|
+
IcaAccount --* Connection
|
|
13
|
+
IcaAccount --* CosmosInterchainService
|
|
14
|
+
ICQConnection --* CosmosInterchainService
|
|
15
|
+
CosmosInterchainService --* PortAllocator
|
|
16
|
+
PortAllocator --* NetworkVat
|
|
17
|
+
LocalChainAccount --* LocalChainVat
|
|
18
|
+
|
|
19
|
+
class IcaAccount {
|
|
17
20
|
port: Port
|
|
18
21
|
connection: Connection
|
|
19
22
|
localAddress: LocalIbcAddress
|
|
20
23
|
requestedRemoteAddress: string
|
|
21
24
|
remoteAddress: RemoteIbcAddress
|
|
22
25
|
chainAddress: ChainAddress
|
|
26
|
+
getAddress()
|
|
27
|
+
getLocalAddress()
|
|
28
|
+
getRemoteAddress()
|
|
29
|
+
getPort()
|
|
30
|
+
executeTx()
|
|
31
|
+
executeEncodedTx()
|
|
32
|
+
close()
|
|
23
33
|
}
|
|
24
|
-
class
|
|
34
|
+
class ICQConnection {
|
|
25
35
|
port: Port
|
|
26
36
|
connection: Connection
|
|
27
37
|
localAddress: LocalIbcAddress
|
|
28
38
|
remoteAddress: RemoteIbcAddress
|
|
39
|
+
getLocalAddress()
|
|
40
|
+
getRemoteAddress()
|
|
41
|
+
query()
|
|
29
42
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
|
|
44
|
+
class CosmosInterchainService {
|
|
45
|
+
portAllocator: PortAllocator
|
|
46
|
+
icqConnections: MapStore<ConnectionVersionKey, ICQConnection>
|
|
47
|
+
sharedICQPort: Port
|
|
48
|
+
makeAccount()
|
|
49
|
+
provideICQConnection()
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
%% In other vats
|
|
40
|
-
class
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
class Port {
|
|
54
|
+
getLocalAddress()
|
|
55
|
+
addListener()
|
|
56
|
+
connect()
|
|
57
|
+
removeListener()
|
|
58
|
+
revoke()
|
|
44
59
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
|
|
61
|
+
class Connection {
|
|
62
|
+
getLocalAddress()
|
|
63
|
+
getRemoteAddress()
|
|
64
|
+
send()
|
|
65
|
+
close()
|
|
49
66
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
|
|
68
|
+
class PortAllocator {
|
|
69
|
+
allocateCustomIBCPort()
|
|
70
|
+
allocateICAControllerPort()
|
|
71
|
+
allocateICQControllerPort()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class LocalChainAccount {
|
|
75
|
+
deposit()
|
|
76
|
+
executeTx()
|
|
77
|
+
getBalance()
|
|
78
|
+
withdraw()
|
|
79
|
+
executeTx()
|
|
80
|
+
monitorTransfers()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
%% In api consumer vats
|
|
84
|
+
|
|
85
|
+
LocalOrchestrationAccount --* LocalChainAccount
|
|
86
|
+
CosmosOrchestrationAccount --* IcaAccount
|
|
87
|
+
|
|
88
|
+
class LocalOrchestrationAccount {
|
|
89
|
+
account: LocalChainAccount
|
|
90
|
+
address: ChainAddress
|
|
91
|
+
topicKit: RecorderKit<OrchestrationAccountNotification>
|
|
92
|
+
asContinuingOffer()
|
|
93
|
+
delegate()
|
|
94
|
+
deposit()
|
|
95
|
+
executeTx()
|
|
96
|
+
getAddress()
|
|
97
|
+
getBalance()
|
|
98
|
+
getPublicTopics()
|
|
99
|
+
monitorTransfers()
|
|
100
|
+
send()
|
|
101
|
+
transfer()
|
|
102
|
+
undelegate()
|
|
103
|
+
withdraw()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
class CosmosOrchestrationAccount {
|
|
107
|
+
account: LocalChainAccount
|
|
108
|
+
bondDenom: string
|
|
109
|
+
chainAddress: ChainAddress
|
|
110
|
+
icqConnection: ICQConnection | undefined
|
|
111
|
+
timer: Timer
|
|
112
|
+
topicKit: RecorderKit<OrchestrationAccountNotification>
|
|
113
|
+
asContinuingOffer()
|
|
114
|
+
delegate()
|
|
115
|
+
executeEncodedTx()
|
|
116
|
+
getAddress()
|
|
117
|
+
getBalance()
|
|
118
|
+
getPublicTopics()
|
|
119
|
+
redelegate()
|
|
120
|
+
undelegate()
|
|
121
|
+
withdrawReward()
|
|
55
122
|
}
|
|
56
123
|
```
|
|
@@ -25,7 +25,7 @@ export type OrchestrationPowers = {
|
|
|
25
25
|
reserved: undefined;
|
|
26
26
|
};
|
|
27
27
|
export type ICQConnectionStore = MapStore<string, ICQConnectionKit>;
|
|
28
|
-
export type ConnectionKit =
|
|
28
|
+
export type ConnectionKit = IcaAccountKit | ICQConnectionKit;
|
|
29
29
|
export type OrchestrationState = {
|
|
30
30
|
icqConnections: ICQConnectionStore;
|
|
31
31
|
sharedICQPort: Remote<Port> | undefined;
|
|
@@ -42,6 +42,6 @@ import type { ICQConnection } from '../types.js';
|
|
|
42
42
|
import type { PortAllocator } from '@agoric/network';
|
|
43
43
|
import type { Remote } from '@agoric/internal';
|
|
44
44
|
import type { ICQConnectionKit } from '../types.js';
|
|
45
|
-
import type {
|
|
45
|
+
import type { IcaAccountKit } from '../types.js';
|
|
46
46
|
import type { Port } from '@agoric/network';
|
|
47
47
|
//# sourceMappingURL=cosmos-interchain-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos-interchain-service.d.ts","sourceRoot":"","sources":["cosmos-interchain-service.js"],"names":[],"mappings":"AA6PO,qDAHI,IAAI,YACJ,QAAQ;IAnEX;;;;;;;;OAQG;yBAPQ,MAAM,oBACN,eAAe,0BAEf,eAAe,6CAGb,IAAI,UAAU,CAAC;IAkB5B;;;;OAIG;iDAHQ,eAAe,iCAEb,IAAI,aAAa,CAAC,GAAG,aAAa;GAwDtD;;mBAjPa,OAAO,aAAa,CAAC;;;;;cACrB,SAAS;;iCAIT,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;4BAElC,
|
|
1
|
+
{"version":3,"file":"cosmos-interchain-service.d.ts","sourceRoot":"","sources":["cosmos-interchain-service.js"],"names":[],"mappings":"AA6PO,qDAHI,IAAI,YACJ,QAAQ;IAnEX;;;;;;;;OAQG;yBAPQ,MAAM,oBACN,eAAe,0BAEf,eAAe,6CAGb,IAAI,UAAU,CAAC;IAkB5B;;;;OAIG;iDAHQ,eAAe,iCAEb,IAAI,aAAa,CAAC,GAAG,aAAa;GAwDtD;;mBAjPa,OAAO,aAAa,CAAC;;;;;cACrB,SAAS;;iCAIT,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;4BAElC,aAAa,GAAG,gBAAgB;iCAGjC;IACZ,cAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAiB,EAAE,OAAO,IAAI,CAAC,GAAG,SAAS,CAAC;CACzC,GAAG,mBAAmB;0CAuOZ,UAAU,CAAC,OAAO,8BAA8B,CAAC;sCACjD,UAAU,CAAC,2BAA2B,CAAC;0BAlQ9B,mBAAmB;8BAKV,aAAa;qCAFX,cAAc;2CAIR,qBAAqB;gCADgB,aAAa;yBAD1D,aAAa;mCACgC,aAAa;mCAJxC,iBAAiB;4BAD1C,kBAAkB;sCAKkC,aAAa;mCAAb,aAAa;0BAJxC,iBAAiB"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { E } from '@endo/far';
|
|
4
4
|
import { M, mustMatch } from '@endo/patterns';
|
|
5
5
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
6
|
-
import {
|
|
6
|
+
import { prepareIcaAccountKit } from './ica-account-kit.js';
|
|
7
7
|
import { prepareICQConnectionKit } from './icq-connection-kit.js';
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_ICQ_VERSION,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
* @import {IBCConnectionID} from '@agoric/vats';
|
|
19
19
|
* @import {RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js';
|
|
20
20
|
* @import {Vow, VowTools} from '@agoric/vow';
|
|
21
|
-
* @import {ICQConnection, IcaAccount, ICQConnectionKit,
|
|
21
|
+
* @import {ICQConnection, IcaAccount, ICQConnectionKit, IcaAccountKit} from '../types.js';
|
|
22
22
|
* @import {ICAChannelAddressOpts} from '../utils/address.js';
|
|
23
23
|
*/
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ const { Vow$ } = NetworkShape; // TODO #9611
|
|
|
32
32
|
|
|
33
33
|
/** @typedef {MapStore<string, ICQConnectionKit>} ICQConnectionStore */
|
|
34
34
|
|
|
35
|
-
/** @typedef {
|
|
35
|
+
/** @typedef {IcaAccountKit | ICQConnectionKit} ConnectionKit */
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @typedef {{
|
|
@@ -56,13 +56,13 @@ const getICQConnectionKey = (controllerConnectionId, version) => {
|
|
|
56
56
|
/**
|
|
57
57
|
* @param {Zone} zone
|
|
58
58
|
* @param {VowTools} vowTools
|
|
59
|
-
* @param {ReturnType<typeof
|
|
59
|
+
* @param {ReturnType<typeof prepareIcaAccountKit>} makeIcaAccountKit
|
|
60
60
|
* @param {ReturnType<typeof prepareICQConnectionKit>} makeICQConnectionKit
|
|
61
61
|
*/
|
|
62
62
|
const prepareCosmosOrchestrationServiceKit = (
|
|
63
63
|
zone,
|
|
64
64
|
{ watch, asVow },
|
|
65
|
-
|
|
65
|
+
makeIcaAccountKit,
|
|
66
66
|
makeICQConnectionKit,
|
|
67
67
|
) =>
|
|
68
68
|
zone.exoClassKit(
|
|
@@ -94,7 +94,7 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
94
94
|
public: M.interface('CosmosInterchainService', {
|
|
95
95
|
makeAccount: M.call(M.string(), M.string(), M.string())
|
|
96
96
|
.optional(M.record())
|
|
97
|
-
.returns(Vow$(M.remotable('
|
|
97
|
+
.returns(Vow$(M.remotable('IcaAccountKit'))),
|
|
98
98
|
provideICQConnection: M.call(M.string())
|
|
99
99
|
.optional(M.string())
|
|
100
100
|
.returns(Vow$(M.remotable('ICQConnection'))),
|
|
@@ -121,15 +121,15 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
121
121
|
* }} watchContext
|
|
122
122
|
*/
|
|
123
123
|
onFulfilled(port, { chainId, remoteConnAddr }) {
|
|
124
|
-
const
|
|
124
|
+
const connectionKit = makeIcaAccountKit(
|
|
125
125
|
chainId,
|
|
126
126
|
port,
|
|
127
127
|
remoteConnAddr,
|
|
128
128
|
);
|
|
129
129
|
return watch(
|
|
130
|
-
E(port).connect(remoteConnAddr,
|
|
130
|
+
E(port).connect(remoteConnAddr, connectionKit.connectionHandler),
|
|
131
131
|
this.facets.channelOpenWatcher,
|
|
132
|
-
{ returnFacet: 'account', connectionKit
|
|
132
|
+
{ returnFacet: 'account', connectionKit },
|
|
133
133
|
);
|
|
134
134
|
},
|
|
135
135
|
},
|
|
@@ -252,13 +252,13 @@ const prepareCosmosOrchestrationServiceKit = (
|
|
|
252
252
|
* @param {VowTools} vowTools
|
|
253
253
|
*/
|
|
254
254
|
export const prepareCosmosInterchainService = (zone, vowTools) => {
|
|
255
|
-
const
|
|
255
|
+
const makeIcaAccountKit = prepareIcaAccountKit(zone, vowTools);
|
|
256
256
|
const makeICQConnectionKit = prepareICQConnectionKit(zone, vowTools);
|
|
257
257
|
const makeCosmosOrchestrationServiceKit =
|
|
258
258
|
prepareCosmosOrchestrationServiceKit(
|
|
259
259
|
zone,
|
|
260
260
|
vowTools,
|
|
261
|
-
|
|
261
|
+
makeIcaAccountKit,
|
|
262
262
|
makeICQConnectionKit,
|
|
263
263
|
);
|
|
264
264
|
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const IcaAccountI: import("@endo/patterns").InterfaceGuard<{
|
|
2
2
|
getAddress: import("@endo/patterns").MethodGuard;
|
|
3
|
-
getBalance: import("@endo/patterns").MethodGuard;
|
|
4
|
-
getBalances: import("@endo/patterns").MethodGuard;
|
|
5
3
|
getLocalAddress: import("@endo/patterns").MethodGuard;
|
|
6
4
|
getRemoteAddress: import("@endo/patterns").MethodGuard;
|
|
7
5
|
getPort: import("@endo/patterns").MethodGuard;
|
|
8
6
|
executeTx: import("@endo/patterns").MethodGuard;
|
|
9
7
|
executeEncodedTx: import("@endo/patterns").MethodGuard;
|
|
10
8
|
close: import("@endo/patterns").MethodGuard;
|
|
11
|
-
getPurse: import("@endo/patterns").MethodGuard;
|
|
12
9
|
}>;
|
|
13
|
-
export function
|
|
10
|
+
export function prepareIcaAccountKit(zone: Zone, { watch, asVow }: VowTools): (chainId: string, port: Port, requestedRemoteAddress: string) => import("@endo/exo").GuardedKit<{
|
|
14
11
|
parseTxPacketWatcher: {
|
|
15
12
|
/** @param {string} ack */
|
|
16
13
|
onFulfilled(ack: string): string;
|
|
@@ -18,8 +15,6 @@ export function prepareChainAccountKit(zone: Zone, { watch, asVow }: VowTools):
|
|
|
18
15
|
account: {
|
|
19
16
|
/** @returns {ChainAddress} */
|
|
20
17
|
getAddress(): ChainAddress;
|
|
21
|
-
getBalance(_denom: any): Vow<never>;
|
|
22
|
-
getBalances(): Vow<never>;
|
|
23
18
|
getLocalAddress(): `/ibc-port/${string}`;
|
|
24
19
|
getRemoteAddress(): `/${string}ibc-port/${string}/ordered/${string}` | `/${string}ibc-port/${string}/unordered/${string}`;
|
|
25
20
|
getPort(): Port;
|
|
@@ -42,12 +37,6 @@ export function prepareChainAccountKit(zone: Zone, { watch, asVow }: VowTools):
|
|
|
42
37
|
* @throws {Error} if connection is not available or already closed
|
|
43
38
|
*/
|
|
44
39
|
close(): Vow<void>;
|
|
45
|
-
/**
|
|
46
|
-
* get Purse for a brand to .withdraw() a Payment from the account
|
|
47
|
-
*
|
|
48
|
-
* @param {Brand} brand
|
|
49
|
-
*/
|
|
50
|
-
getPurse(brand: Brand): Vow<never>;
|
|
51
40
|
};
|
|
52
41
|
connectionHandler: {
|
|
53
42
|
/**
|
|
@@ -73,7 +62,7 @@ export type State = {
|
|
|
73
62
|
remoteAddress: RemoteIbcAddress | undefined;
|
|
74
63
|
chainAddress: ChainAddress | undefined;
|
|
75
64
|
};
|
|
76
|
-
export type
|
|
65
|
+
export type IcaAccountKit = ReturnType<ReturnType<typeof prepareIcaAccountKit>>;
|
|
77
66
|
import type { Zone } from '@agoric/base-zone';
|
|
78
67
|
import type { VowTools } from '@agoric/vow';
|
|
79
68
|
import type { Port } from '@agoric/network';
|
|
@@ -85,4 +74,4 @@ import type { Connection } from '@agoric/network';
|
|
|
85
74
|
import type { Remote } from '@agoric/vow';
|
|
86
75
|
import type { LocalIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
87
76
|
import type { RemoteIbcAddress } from '@agoric/vats/tools/ibc-utils.js';
|
|
88
|
-
//# sourceMappingURL=
|
|
77
|
+
//# sourceMappingURL=ica-account-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ica-account-kit.d.ts","sourceRoot":"","sources":["ica-account-kit.js"],"names":[],"mappings":"AA6BA;;;;;;;;GAUG;AAkBI,2CAHI,IAAI,oBACJ,QAAQ;;QA+BX,0BAA0B;yBAAd,MAAM;;;QAMlB,8BAA8B;sBAAhB,YAAY;;;;;QAyB1B;;;;;;;;;WASG;+BALQ,OAAO,EAAE,gDAEP,IAAI,MAAM,CAAC;QAcxB;;;;;WAKG;iBAFU,IAAI,IAAI,CAAC;;;QAetB;;;;WAIG;2BAHQ,OAAO,UAAU,CAAC,aAClB,eAAe,cACf,gBAAgB;QAiB3B;;;WAGG;6BAFQ,OAAO,UAAU,CAAC,UAClB,OAAO;;GASvB;qCAhKW,0BAA0B;oBAgB3B;IACZ,OAAW,EAAE,MAAM,CAAC;IACpB,IAAQ,EAAE,IAAI,CAAC;IACf,UAAc,EAAE,OAAO,UAAU,CAAC,GAAG,SAAS,CAAC;IAC/C,YAAgB,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,sBAA0B,EAAE,MAAM,CAAC;IACnC,aAAiB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChD,YAAgB,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;4BA0IU,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;0BA7K1C,mBAAmB;8BAEF,aAAa;0BADlB,iBAAiB;kCAKrB,aAAa;yBAJJ,aAAa;6BAC3B,sBAAsB;4BACvB,8CAA8C;gCAHpC,iBAAiB;4BACZ,aAAa;qCAGD,iCAAiC;sCAAjC,iCAAiC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @file
|
|
1
|
+
/** @file IcaAccount exo */
|
|
2
2
|
import { Fail } from '@endo/errors';
|
|
3
3
|
import { E } from '@endo/far';
|
|
4
4
|
import { M } from '@endo/patterns';
|
|
@@ -22,15 +22,13 @@ import { makeTxPacket, parseTxPacket } from '../utils/packet.js';
|
|
|
22
22
|
* @import {ChainAddress} from '../types.js';
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const trace = makeTracer('
|
|
25
|
+
const trace = makeTracer('IcaAccountKit');
|
|
26
26
|
|
|
27
27
|
/** @typedef {'UNPARSABLE_CHAIN_ADDRESS'} UnparsableChainAddress */
|
|
28
28
|
const UNPARSABLE_CHAIN_ADDRESS = 'UNPARSABLE_CHAIN_ADDRESS';
|
|
29
29
|
|
|
30
|
-
export const
|
|
30
|
+
export const IcaAccountI = M.interface('IcaAccount', {
|
|
31
31
|
getAddress: M.call().returns(ChainAddressShape),
|
|
32
|
-
getBalance: M.call(M.string()).returns(VowShape),
|
|
33
|
-
getBalances: M.call().returns(VowShape),
|
|
34
32
|
getLocalAddress: M.call().returns(M.string()),
|
|
35
33
|
getRemoteAddress: M.call().returns(M.string()),
|
|
36
34
|
getPort: M.call().returns(M.remotable('Port')),
|
|
@@ -39,7 +37,6 @@ export const ChainAccountI = M.interface('ChainAccount', {
|
|
|
39
37
|
.optional(M.record())
|
|
40
38
|
.returns(VowShape),
|
|
41
39
|
close: M.call().returns(VowShape),
|
|
42
|
-
getPurse: M.call().returns(VowShape),
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
/**
|
|
@@ -58,11 +55,11 @@ export const ChainAccountI = M.interface('ChainAccount', {
|
|
|
58
55
|
* @param {Zone} zone
|
|
59
56
|
* @param {VowTools} vowTools
|
|
60
57
|
*/
|
|
61
|
-
export const
|
|
58
|
+
export const prepareIcaAccountKit = (zone, { watch, asVow }) =>
|
|
62
59
|
zone.exoClassKit(
|
|
63
|
-
'
|
|
60
|
+
'IcaAccountKit',
|
|
64
61
|
{
|
|
65
|
-
account:
|
|
62
|
+
account: IcaAccountI,
|
|
66
63
|
connectionHandler: OutboundConnectionHandlerI,
|
|
67
64
|
parseTxPacketWatcher: M.interface('ParseTxPacketWatcher', {
|
|
68
65
|
onFulfilled: M.call(M.string())
|
|
@@ -100,16 +97,6 @@ export const prepareChainAccountKit = (zone, { watch, asVow }) =>
|
|
|
100
97
|
'ICA channel creation acknowledgement not yet received.',
|
|
101
98
|
);
|
|
102
99
|
},
|
|
103
|
-
getBalance(_denom) {
|
|
104
|
-
// TODO https://github.com/Agoric/agoric-sdk/issues/9610
|
|
105
|
-
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326
|
|
106
|
-
return asVow(() => Fail`not yet implemented`);
|
|
107
|
-
},
|
|
108
|
-
getBalances() {
|
|
109
|
-
// TODO https://github.com/Agoric/agoric-sdk/issues/9610
|
|
110
|
-
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9326
|
|
111
|
-
return asVow(() => Fail`not yet implemented`);
|
|
112
|
-
},
|
|
113
100
|
getLocalAddress() {
|
|
114
101
|
return NonNullish(
|
|
115
102
|
this.state.localAddress,
|
|
@@ -164,15 +151,6 @@ export const prepareChainAccountKit = (zone, { watch, asVow }) =>
|
|
|
164
151
|
return E(connection).close();
|
|
165
152
|
});
|
|
166
153
|
},
|
|
167
|
-
/**
|
|
168
|
-
* get Purse for a brand to .withdraw() a Payment from the account
|
|
169
|
-
*
|
|
170
|
-
* @param {Brand} brand
|
|
171
|
-
*/
|
|
172
|
-
getPurse(brand) {
|
|
173
|
-
console.log('getPurse got', brand);
|
|
174
|
-
return asVow(() => Fail`not yet implemented`);
|
|
175
|
-
},
|
|
176
154
|
},
|
|
177
155
|
connectionHandler: {
|
|
178
156
|
/**
|
|
@@ -185,10 +163,12 @@ export const prepareChainAccountKit = (zone, { watch, asVow }) =>
|
|
|
185
163
|
this.state.connection = connection;
|
|
186
164
|
this.state.remoteAddress = remoteAddr;
|
|
187
165
|
this.state.localAddress = localAddr;
|
|
166
|
+
const address = findAddressField(remoteAddr);
|
|
167
|
+
if (!address) {
|
|
168
|
+
console.error('⚠️ failed to parse chain address', remoteAddr);
|
|
169
|
+
}
|
|
188
170
|
this.state.chainAddress = harden({
|
|
189
|
-
|
|
190
|
-
// https://github.com/Agoric/agoric-sdk/issues/9066
|
|
191
|
-
value: findAddressField(remoteAddr) || UNPARSABLE_CHAIN_ADDRESS,
|
|
171
|
+
value: address || UNPARSABLE_CHAIN_ADDRESS,
|
|
192
172
|
chainId: this.state.chainId,
|
|
193
173
|
encoding: 'bech32',
|
|
194
174
|
});
|
|
@@ -206,4 +186,4 @@ export const prepareChainAccountKit = (zone, { watch, asVow }) =>
|
|
|
206
186
|
},
|
|
207
187
|
);
|
|
208
188
|
|
|
209
|
-
/** @typedef {ReturnType<ReturnType<typeof
|
|
189
|
+
/** @typedef {ReturnType<ReturnType<typeof prepareIcaAccountKit>>} IcaAccountKit */
|
package/src/exos/orchestrator.js
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export type * from './chain-info.js';
|
|
3
3
|
export type * from './cosmos-api.js';
|
|
4
4
|
export type * from './ethereum-api.js';
|
|
5
|
-
export type * from './exos/
|
|
5
|
+
export type * from './exos/ica-account-kit.js';
|
|
6
6
|
export type * from './exos/icq-connection-kit.js';
|
|
7
7
|
export type * from './orchestration-api.js';
|
|
8
8
|
export type * from './exos/cosmos-interchain-service.js';
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,wBAAwB,CAAC"}
|
package/src/types.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export type * from './chain-info.js';
|
|
4
4
|
export type * from './cosmos-api.js';
|
|
5
5
|
export type * from './ethereum-api.js';
|
|
6
|
-
export type * from './exos/
|
|
6
|
+
export type * from './exos/ica-account-kit.js';
|
|
7
7
|
export type * from './exos/icq-connection-kit.js';
|
|
8
8
|
export type * from './orchestration-api.js';
|
|
9
9
|
export type * from './exos/cosmos-interchain-service.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"AAwBO,wDALI,eAAe,0BACf,eAAe,iFAEb,gBAAgB,CAuB5B;AAGD,0CAA2C;AAOpC,8DAJI,eAAe,YACf,MAAM,GACJ,gBAAgB,CAQ5B;AAaM,sDAJI,gBAAgB,GAEd,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["address.js"],"names":[],"mappings":"AAwBO,wDALI,eAAe,0BACf,eAAe,iFAEb,gBAAgB,CAuB5B;AAGD,0CAA2C;AAOpC,8DAJI,eAAe,YACf,MAAM,GACJ,gBAAgB,CAQ5B;AAaM,sDAJI,gBAAgB,GAEd,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAY7C;;;;;;;;;;;;;;;;;;;;;qCAjFiC,cAAc;sCAEb,iCAAiC;kCADrC,aAAa"}
|
package/src/utils/address.js
CHANGED
|
@@ -77,7 +77,8 @@ export const findAddressField = remoteAddressString => {
|
|
|
77
77
|
// Extract JSON version string assuming it's always surrounded by {}
|
|
78
78
|
const jsonStr = remoteAddressString?.match(/{.*?}/)?.[0];
|
|
79
79
|
const jsonObj = jsonStr ? JSON.parse(jsonStr) : undefined;
|
|
80
|
-
|
|
80
|
+
if (!jsonObj?.address?.length) return undefined;
|
|
81
|
+
return jsonObj.address;
|
|
81
82
|
} catch (error) {
|
|
82
83
|
return undefined;
|
|
83
84
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chain-account-kit.d.ts","sourceRoot":"","sources":["chain-account-kit.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;GAaG;AAkBI,6CAHI,IAAI,oBACJ,QAAQ;;QA+BX,0BAA0B;yBAAd,MAAM;;;QAMlB,8BAA8B;sBAAhB,YAAY;;;;;;;QAmC1B;;;;;;;;;WASG;+BALQ,OAAO,EAAE,gDAEP,IAAI,MAAM,CAAC;QAcxB;;;;;WAKG;iBAFU,IAAI,IAAI,CAAC;QAatB;;;;WAIG;wBADQ,KAAK;;;QAQhB;;;;WAIG;2BAHQ,OAAO,UAAU,CAAC,aAClB,eAAe,cACf,gBAAgB;QAe3B;;;WAGG;6BAFQ,OAAO,UAAU,CAAC,UAClB,OAAO;;GASvB;qCApLW,0BAA0B;oBAmB3B;IACZ,OAAW,EAAE,MAAM,CAAC;IACpB,IAAQ,EAAE,IAAI,CAAC;IACf,UAAc,EAAE,OAAO,UAAU,CAAC,GAAG,SAAS,CAAC;IAC/C,YAAgB,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,sBAA0B,EAAE,MAAM,CAAC;IACnC,aAAiB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChD,YAAgB,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;8BA2JU,UAAU,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;0BAjM5C,mBAAmB;8BAEF,aAAa;0BADlB,iBAAiB;kCAKrB,aAAa;yBAJJ,aAAa;6BAC3B,sBAAsB;4BACvB,8CAA8C;gCAHpC,iBAAiB;4BACZ,aAAa;qCAGD,iCAAiC;sCAAjC,iCAAiC"}
|