@agoric/orchestration 0.1.1-dev-3c4ffbe.0.3c4ffbe → 0.1.1-dev-47014db.0.47014db
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-47014db.0.47014db",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
39
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
40
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
41
|
-
"@agoric/internal": "0.3.3-dev-
|
|
42
|
-
"@agoric/network": "0.1.1-dev-
|
|
43
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
44
|
-
"@agoric/store": "0.9.3-dev-
|
|
45
|
-
"@agoric/time": "0.3.3-dev-
|
|
46
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
47
|
-
"@agoric/vats": "0.15.2-dev-
|
|
48
|
-
"@agoric/vow": "0.1.1-dev-
|
|
49
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
50
|
-
"@agoric/zone": "0.2.3-dev-
|
|
38
|
+
"@agoric/async-flow": "0.1.1-dev-47014db.0.47014db",
|
|
39
|
+
"@agoric/cosmic-proto": "0.4.1-dev-47014db.0.47014db",
|
|
40
|
+
"@agoric/ertp": "0.16.3-dev-47014db.0.47014db",
|
|
41
|
+
"@agoric/internal": "0.3.3-dev-47014db.0.47014db",
|
|
42
|
+
"@agoric/network": "0.1.1-dev-47014db.0.47014db",
|
|
43
|
+
"@agoric/notifier": "0.6.3-dev-47014db.0.47014db",
|
|
44
|
+
"@agoric/store": "0.9.3-dev-47014db.0.47014db",
|
|
45
|
+
"@agoric/time": "0.3.3-dev-47014db.0.47014db",
|
|
46
|
+
"@agoric/vat-data": "0.5.3-dev-47014db.0.47014db",
|
|
47
|
+
"@agoric/vats": "0.15.2-dev-47014db.0.47014db",
|
|
48
|
+
"@agoric/vow": "0.1.1-dev-47014db.0.47014db",
|
|
49
|
+
"@agoric/zoe": "0.26.3-dev-47014db.0.47014db",
|
|
50
|
+
"@agoric/zone": "0.2.3-dev-47014db.0.47014db",
|
|
51
51
|
"@cosmjs/encoding": "^0.36.0",
|
|
52
52
|
"@endo/base64": "^1.0.12",
|
|
53
53
|
"@endo/errors": "^1.2.13",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"bs58": "^6.0.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
62
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-47014db.0.47014db",
|
|
63
63
|
"@chain-registry/client": "^1.53.194",
|
|
64
64
|
"@cosmjs/amino": "^0.36.0",
|
|
65
65
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"typeCoverage": {
|
|
106
106
|
"atLeast": 97.49
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "47014db07286cf552da73810603af34ef3e7b064"
|
|
109
109
|
}
|
|
@@ -135,16 +135,17 @@ export function prepareLocalOrchestrationAccountKit(zone: Zone, { makeRecorderKi
|
|
|
135
135
|
};
|
|
136
136
|
parseInboundTransferWatcher: {
|
|
137
137
|
/**
|
|
138
|
-
* @param {
|
|
138
|
+
* @param {{ error?: string; reply: TypedJson<string> }[]
|
|
139
|
+
* | TypedJson<string>} result
|
|
139
140
|
* @param {Awaited<
|
|
140
141
|
* ReturnType<LocalAccountMethods['parseInboundTransfer']>
|
|
141
142
|
* >} naiveResult
|
|
142
143
|
*/
|
|
143
|
-
onFulfilled(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
onFulfilled(result: {
|
|
145
|
+
error?: string;
|
|
146
|
+
reply: TypedJson<string>;
|
|
147
|
+
}[] | TypedJson<string>, naiveResult: Awaited<ReturnType<LocalAccountMethods["parseInboundTransfer"]>>): {
|
|
148
|
+
amount: DenomAmount;
|
|
148
149
|
fromAccount: string;
|
|
149
150
|
toAccount: string;
|
|
150
151
|
extra: Record<string, any>;
|
|
@@ -253,7 +254,6 @@ import type { TransferRoute } from '@agoric/orchestration';
|
|
|
253
254
|
import type { DenomAmount } from '@agoric/orchestration';
|
|
254
255
|
import type { ZCFSeat } from '@agoric/zoe';
|
|
255
256
|
import type { ResponseTo } from '@agoric/cosmic-proto';
|
|
256
|
-
import type { QueryDenomHashResponse } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/query.js';
|
|
257
257
|
import type { LocalAccountMethods } from '@agoric/orchestration';
|
|
258
258
|
import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
259
259
|
import type { PacketTools } from './packet-tools.js';
|
|
@@ -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":"AA4JO,0DAVI,IAAI,qFAEZ;IAAgC,eAAe,EAAvC,eAAe;IACH,GAAG,EAAf,GAAG;IAC0B,YAAY,EAAzC,OAAO,YAAY,CAAC;IACH,QAAQ,EAAzB,QAAQ;IACS,QAAQ,EAAzB,QAAQ;IACmB,UAAU,EAArC,OAAO,UAAU,CAAC;IACD,QAAQ,EAAzB,QAAQ;CAClB;aAyFc,iBAAiB;aACjB,kBAAkB;;;;QAoBzB;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,CACb,UAAU,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,CACxD;;;;;;;;;;;;QAkGJ;;;WAGG;mCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;QAmBxB;;;;WAIG;qCAHQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC,GACX,IAAI,IAAI,GAAG,eAAe,CAAC;;;;;;;;;;;QAqFxC;;;;;;;;;;;WAWG;8BAVQ,YAAY,UACZ,SAAS,SAET,qBAAqB,GAGnB,IAAI,GAAG,CAAC;;;;;;;;;;;;;;;GA2H5B;;aA9yBa,MAAM;;;;;oBAKP;IACR,QAAQ,EAAE,YAAY,6BAA6B,CAAC,GAAG,SAAS,CAAC;IACjE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,kBAAkB,CAAC;CAC7B;+CAsyBU,UAAU,CAAC,OAAO,mCAAmC,CAAC;2CACtD,UAAU,CAAC,gCAAgC,CAAC;0BAt1BnC,cAAc;qCADU,6CAA6C;yBAJ/C,aAAa;kCAQV,cAAc;4BAFrC,kBAAkB;8BAGX,aAAa;8BAIlB,gBAAgB;gCAfK,gCAAgC;8BAiBrD,uBAAuB;uCAjBF,gCAAgC;wCACwG,uBAAuB;+BAAvB,uBAAuB;0BAYxL,kDAAkD;yBAFzC,aAAa;qCADG,cAAc;kCAT0H,uBAAuB;2CAAvB,uBAAuB;+BAW7J,sBAAsB;8BAAtB,sBAAsB;mCAXgH,uBAAuB;iCAAvB,uBAAuB;6BAClK,aAAa;gCAUR,sBAAsB;yCAXgH,uBAAuB;iCAKhK,6CAA6C;iCAU9D,mBAAmB"}
|
|
@@ -9,7 +9,10 @@ import { E } from '@endo/far';
|
|
|
9
9
|
import { Fail, q } from '@endo/errors';
|
|
10
10
|
|
|
11
11
|
import { MsgTransfer as MsgTransferType } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
QueryDenomHashRequest as QueryDenomHashRequestType,
|
|
14
|
+
QueryDenomHashResponse as QueryDenomHashResponseType,
|
|
15
|
+
} from '@agoric/cosmic-proto/ibc/applications/transfer/v1/query.js';
|
|
13
16
|
import {
|
|
14
17
|
QueryAllBalancesRequest as QueryAllBalancesRequestType,
|
|
15
18
|
QueryBalanceRequest as QueryBalanceRequestType,
|
|
@@ -36,8 +39,11 @@ import { prepareIBCTools } from './ibc-packet.js';
|
|
|
36
39
|
import { coerceCoin, coerceDenomAmount } from '../utils/amounts.js';
|
|
37
40
|
import { TransferRouteShape } from './chain-hub.js';
|
|
38
41
|
|
|
42
|
+
const { details: X } = assert;
|
|
43
|
+
|
|
39
44
|
const MsgTransfer = CodecHelper(MsgTransferType);
|
|
40
45
|
const QueryDenomHashRequest = CodecHelper(QueryDenomHashRequestType);
|
|
46
|
+
const QueryDenomHashResponse = CodecHelper(QueryDenomHashResponseType);
|
|
41
47
|
const QueryAllBalancesRequest = CodecHelper(QueryAllBalancesRequestType);
|
|
42
48
|
const QueryBalanceRequest = CodecHelper(QueryBalanceRequestType);
|
|
43
49
|
const MsgDelegate = CodecHelper(MsgDelegateType);
|
|
@@ -72,6 +78,22 @@ const { Vow$ } = NetworkShape; // TODO #9611
|
|
|
72
78
|
|
|
73
79
|
const EVow$ = shape => M.or(Vow$(shape), M.promise(/* shape */));
|
|
74
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @template {string} TU
|
|
83
|
+
* @param {{ error?: string; reply: TypedJson<TU> }[] | TypedJson<TU>} result
|
|
84
|
+
* @returns {{ error?: string; reply: TypedJson<TU> }}
|
|
85
|
+
*/
|
|
86
|
+
const extractFirstQueryResult = result => {
|
|
87
|
+
if (Array.isArray(result)) {
|
|
88
|
+
assert(
|
|
89
|
+
result.length > 0,
|
|
90
|
+
X`Expected result to be a nonempty array, got ${result}`,
|
|
91
|
+
);
|
|
92
|
+
return result[0];
|
|
93
|
+
}
|
|
94
|
+
return { reply: result };
|
|
95
|
+
};
|
|
96
|
+
|
|
75
97
|
/**
|
|
76
98
|
* @typedef {object} LocalChainAccountNotification
|
|
77
99
|
* @property {string} address
|
|
@@ -115,6 +137,12 @@ const PUBLIC_TOPICS = {
|
|
|
115
137
|
account: ['Account holder status', M.any()],
|
|
116
138
|
};
|
|
117
139
|
|
|
140
|
+
/**
|
|
141
|
+
* @see {@link https://github.com/cosmos/ibc-go/blob/a24a6c6/modules/apps/transfer/types/errors.go#L13}
|
|
142
|
+
* a24a6c6 Feb 27, 2023
|
|
143
|
+
*/
|
|
144
|
+
const ErrTraceNotFound = 'denomination trace not found';
|
|
145
|
+
|
|
118
146
|
/**
|
|
119
147
|
* @param {Zone} zone
|
|
120
148
|
* @param {object} powers
|
|
@@ -198,7 +226,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
198
226
|
),
|
|
199
227
|
}),
|
|
200
228
|
parseInboundTransferWatcher: M.interface('parseInboundTransferWatcher', {
|
|
201
|
-
onFulfilled: M.call(M.
|
|
229
|
+
onFulfilled: M.call(M.any(), M.record()).returns(M.record()),
|
|
202
230
|
onRejected: M.call(M.any(), M.record()).returns(M.record()),
|
|
203
231
|
}),
|
|
204
232
|
invitationMakers: M.interface('invitationMakers', {
|
|
@@ -516,12 +544,23 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
516
544
|
},
|
|
517
545
|
parseInboundTransferWatcher: {
|
|
518
546
|
/**
|
|
519
|
-
* @param {
|
|
547
|
+
* @param {{ error?: string; reply: TypedJson<string> }[]
|
|
548
|
+
* | TypedJson<string>} result
|
|
520
549
|
* @param {Awaited<
|
|
521
550
|
* ReturnType<LocalAccountMethods['parseInboundTransfer']>
|
|
522
551
|
* >} naiveResult
|
|
523
552
|
*/
|
|
524
|
-
onFulfilled(
|
|
553
|
+
onFulfilled(result, naiveResult) {
|
|
554
|
+
const { error, reply } = extractFirstQueryResult(result);
|
|
555
|
+
if (typeof error === 'string') {
|
|
556
|
+
if (error.includes(ErrTraceNotFound)) {
|
|
557
|
+
// Looks like the trace was not found; The naive result is good enough.
|
|
558
|
+
return naiveResult;
|
|
559
|
+
}
|
|
560
|
+
throw Error(`IBC denom trace query failed: ${error}`);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const localDenomHash = QueryDenomHashResponse.fromTyped(reply);
|
|
525
564
|
const localDenom = `ibc/${localDenomHash.hash}`;
|
|
526
565
|
const { amount, ...rest } = naiveResult;
|
|
527
566
|
const { denom: _, ...amountRest } = amount;
|
|
@@ -539,7 +578,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
539
578
|
onRejected(reason, naiveResult) {
|
|
540
579
|
if (
|
|
541
580
|
reason instanceof Error &&
|
|
542
|
-
String(reason.message).includes(
|
|
581
|
+
String(reason.message).includes(ErrTraceNotFound)
|
|
543
582
|
) {
|
|
544
583
|
// Looks like the trace was not found; The naive result is good enough.
|
|
545
584
|
return naiveResult;
|
|
@@ -836,11 +875,11 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
836
875
|
|
|
837
876
|
// Find the local denom hash for the transferDenom, if there is one.
|
|
838
877
|
return watch(
|
|
839
|
-
E(localchain).
|
|
878
|
+
E(localchain).queryMany([
|
|
840
879
|
QueryDenomHashRequest.typedJson({
|
|
841
880
|
trace: denomOrTrace,
|
|
842
881
|
}),
|
|
843
|
-
),
|
|
882
|
+
]),
|
|
844
883
|
this.facets.parseInboundTransferWatcher,
|
|
845
884
|
buildReturnValue(denomOrTrace),
|
|
846
885
|
);
|