@agoric/orchestration 0.1.1-dev-b2cdd8c.0.b2cdd8c → 0.1.1-dev-8dbcc20.0.8dbcc20
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/exos/cosmos-orchestration-account.d.ts.map +1 -1
- package/src/exos/cosmos-orchestration-account.js +87 -36
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +37 -25
- package/src/fixtures/query-flows.contract.d.ts +1 -1
- package/src/fixtures/query-flows.contract.d.ts.map +1 -1
- package/src/fixtures/query-flows.contract.js +1 -2
- package/src/utils/packet.d.ts +9 -9
- package/src/utils/packet.d.ts.map +1 -1
- package/src/utils/packet.js +21 -15
- package/tools/ibc-mocks.d.ts +9 -15
- package/tools/ibc-mocks.d.ts.map +1 -1
- package/tools/ibc-mocks.ts +37 -39
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-8dbcc20.0.8dbcc20",
|
|
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-8dbcc20.0.8dbcc20",
|
|
39
|
+
"@agoric/cosmic-proto": "0.4.1-dev-8dbcc20.0.8dbcc20",
|
|
40
|
+
"@agoric/ertp": "0.16.3-dev-8dbcc20.0.8dbcc20",
|
|
41
|
+
"@agoric/internal": "0.3.3-dev-8dbcc20.0.8dbcc20",
|
|
42
|
+
"@agoric/network": "0.1.1-dev-8dbcc20.0.8dbcc20",
|
|
43
|
+
"@agoric/notifier": "0.6.3-dev-8dbcc20.0.8dbcc20",
|
|
44
|
+
"@agoric/store": "0.9.3-dev-8dbcc20.0.8dbcc20",
|
|
45
|
+
"@agoric/time": "0.3.3-dev-8dbcc20.0.8dbcc20",
|
|
46
|
+
"@agoric/vat-data": "0.5.3-dev-8dbcc20.0.8dbcc20",
|
|
47
|
+
"@agoric/vats": "0.15.2-dev-8dbcc20.0.8dbcc20",
|
|
48
|
+
"@agoric/vow": "0.1.1-dev-8dbcc20.0.8dbcc20",
|
|
49
|
+
"@agoric/zoe": "0.26.3-dev-8dbcc20.0.8dbcc20",
|
|
50
|
+
"@agoric/zone": "0.2.3-dev-8dbcc20.0.8dbcc20",
|
|
51
51
|
"@cosmjs/encoding": "^0.36.0",
|
|
52
52
|
"@endo/base64": "^1.0.12",
|
|
53
53
|
"@endo/errors": "^1.2.13",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"esbuild": "^0.25.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
63
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-8dbcc20.0.8dbcc20",
|
|
64
64
|
"@chain-registry/client": "^1.53.194",
|
|
65
65
|
"@cosmjs/amino": "^0.36.0",
|
|
66
66
|
"@cosmjs/proto-signing": "^0.36.0",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"typeCoverage": {
|
|
106
106
|
"atLeast": 97.49
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "8dbcc20242baf7121f3db466cdf6f5a923faec5e"
|
|
109
109
|
}
|
|
@@ -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":"AAwOA,wCAAwC;AACxC;;;;;;;;;;;;;;;;;;;;;;;;;;GAUG;AAOH;;;;;;;;;;;GAoBE;AAYK,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;kBAsGc,kBAAkB;kBAClB,eAAe;mBACf,gBAAgB;;aAEhB,UAAU;;;;;;;WAGV,OAAO,YAAY,CAAC;;;QAuC3B,wDAAwD;;;QAYxD;;;WAGG;6BAFQ,SAAS,GACP,IAAI;;;QASjB;;WAEG;8BADQ,SAAS,aAAa,CAAC,EAAE;;;QASpC;;;WAGG;8BAFQ,SAAS,aAAa,CAAC,EAAE,GACvB,wBAAwB;;;QAgBrC;;;WAGG;8BAFQ,SAAS,aAAa,CAAC,EAAE,GACvB,wBAAwB,EAAE;;;QAkBvC;;WAEG;8BADQ,SAAS,aAAa,CAAC,EAAE;;;QAYpC;;WAEG;8BADQ,SAAS,aAAa,CAAC,EAAE;;;QAapC;;WAEG;8BADQ,SAAS,aAAa,CAAC,EAAE;;;QAapC;;WAEG;8BADQ,SAAS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zC,OAAO,YAAY,CAAC;IACH,QAAQ,EAAzB,QAAQ;IACI,GAAG,EAAf,GAAG;CACX,GAAU,CACZ,GAAO,IAAI,EAAE,UAAU,CACjB,UAAU,CAAC,OAAO,oCAAoC,CAAC,CACxD,KACE,6BAA6B,CAAC,QAAQ,CAAC,CAc9C;;kBAznCa,kBAAkB;;;;;oBA8BnB;IACR,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,EAAE,kBAAkB,CAAC;IACjC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACzC,YAAY,EAAE,eAAe,CAAC;IAC9B,aAAa,EAAE,gBAAgB,CAAC;IAChC,KAAK,EAAE,OAAO,YAAY,CAAC,CAAC;IAC5B,QAAQ,EAAE,YAAY,sCAAsC,CAAC,GAAG,SAAS,CAAC;CAC3E;qDAKS;IACR,YAAY,EAAE,eAAe,CAAC;IAC9B,aAAa,EAAE,gBAAgB,CAAC;CACjC;4CA4iCS,UAAU,CAClB,UAAU,CAAC,OAAO,oCAAoC,CAAC,CACxD;yCA8BU,6BAA6B,CAAC,QAAQ,CAAC;0BAvoC9B,cAAc;8BATsR,aAAa;qCAEzR,6CAA6C;kCAK7D,cAAc;4BAHpB,kBAAkB;8BAIX,aAAa;yBAP0B,aAAa;wCADuO,aAAa;qCAapR,iCAAiC;sCAAjC,iCAAiC;gCAbsO,aAAa;8BAW7S,sBAAsB;mCADjB,+CAA+C;yBAF/C,aAAa;+BAR8Q,aAAa;0BAGjT,kDAAkD;8CAHkP,aAAa;2CAAb,aAAa;uCAAb,aAAa;2CAAb,aAAa;4CAAb,aAAa;gCACjQ,aAAa;kCADuO,aAAa;mCAAb,aAAa;iCAEzR,6CAA6C"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
/** @file Use-object for the owner of a staking account */
|
|
2
|
-
import { toRequestQueryJson } from '@agoric/cosmic-proto';
|
|
2
|
+
import { toRequestQueryJson, CodecHelper } from '@agoric/cosmic-proto';
|
|
3
3
|
import {
|
|
4
|
-
MsgDepositForBurn,
|
|
5
|
-
MsgDepositForBurnWithCaller,
|
|
4
|
+
MsgDepositForBurn as MsgDepositForBurnType,
|
|
5
|
+
MsgDepositForBurnWithCaller as MsgDepositForBurnWithCallerType,
|
|
6
6
|
} from '@agoric/cosmic-proto/circle/cctp/v1/tx.js';
|
|
7
7
|
import {
|
|
8
|
-
QueryAllBalancesRequest,
|
|
9
|
-
QueryAllBalancesResponse,
|
|
10
|
-
QueryBalanceRequest,
|
|
11
|
-
QueryBalanceResponse,
|
|
8
|
+
QueryAllBalancesRequest as QueryAllBalancesRequestType,
|
|
9
|
+
QueryAllBalancesResponse as QueryAllBalancesResponseType,
|
|
10
|
+
QueryBalanceRequest as QueryBalanceRequestType,
|
|
11
|
+
QueryBalanceResponse as QueryBalanceResponseType,
|
|
12
12
|
} from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js';
|
|
13
|
-
import { MsgSend } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
|
|
13
|
+
import { MsgSend as MsgSendType } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
|
|
14
14
|
import {
|
|
15
|
-
QueryDelegationRewardsRequest,
|
|
16
|
-
QueryDelegationRewardsResponse,
|
|
17
|
-
QueryDelegationTotalRewardsRequest,
|
|
18
|
-
QueryDelegationTotalRewardsResponse,
|
|
15
|
+
QueryDelegationRewardsRequest as QueryDelegationRewardsRequestType,
|
|
16
|
+
QueryDelegationRewardsResponse as QueryDelegationRewardsResponseType,
|
|
17
|
+
QueryDelegationTotalRewardsRequest as QueryDelegationTotalRewardsRequestType,
|
|
18
|
+
QueryDelegationTotalRewardsResponse as QueryDelegationTotalRewardsResponseType,
|
|
19
19
|
} from '@agoric/cosmic-proto/cosmos/distribution/v1beta1/query.js';
|
|
20
20
|
import {
|
|
21
|
-
MsgWithdrawDelegatorReward,
|
|
22
|
-
MsgWithdrawDelegatorRewardResponse,
|
|
21
|
+
MsgWithdrawDelegatorReward as MsgWithdrawDelegatorRewardType,
|
|
22
|
+
MsgWithdrawDelegatorRewardResponse as MsgWithdrawDelegatorRewardResponseType,
|
|
23
23
|
} from '@agoric/cosmic-proto/cosmos/distribution/v1beta1/tx.js';
|
|
24
24
|
import {
|
|
25
|
-
QueryDelegationRequest,
|
|
26
|
-
QueryDelegationResponse,
|
|
27
|
-
QueryDelegatorDelegationsRequest,
|
|
28
|
-
QueryDelegatorDelegationsResponse,
|
|
29
|
-
QueryDelegatorUnbondingDelegationsRequest,
|
|
30
|
-
QueryDelegatorUnbondingDelegationsResponse,
|
|
31
|
-
QueryRedelegationsRequest,
|
|
32
|
-
QueryRedelegationsResponse,
|
|
33
|
-
QueryUnbondingDelegationRequest,
|
|
34
|
-
QueryUnbondingDelegationResponse,
|
|
25
|
+
QueryDelegationRequest as QueryDelegationRequestType,
|
|
26
|
+
QueryDelegationResponse as QueryDelegationResponseType,
|
|
27
|
+
QueryDelegatorDelegationsRequest as QueryDelegatorDelegationsRequestType,
|
|
28
|
+
QueryDelegatorDelegationsResponse as QueryDelegatorDelegationsResponseType,
|
|
29
|
+
QueryDelegatorUnbondingDelegationsRequest as QueryDelegatorUnbondingDelegationsRequestType,
|
|
30
|
+
QueryDelegatorUnbondingDelegationsResponse as QueryDelegatorUnbondingDelegationsResponseType,
|
|
31
|
+
QueryRedelegationsRequest as QueryRedelegationsRequestType,
|
|
32
|
+
QueryRedelegationsResponse as QueryRedelegationsResponseType,
|
|
33
|
+
QueryUnbondingDelegationRequest as QueryUnbondingDelegationRequestType,
|
|
34
|
+
QueryUnbondingDelegationResponse as QueryUnbondingDelegationResponseType,
|
|
35
35
|
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/query.js';
|
|
36
36
|
import {
|
|
37
|
-
MsgBeginRedelegate,
|
|
38
|
-
MsgDelegate,
|
|
39
|
-
MsgUndelegate,
|
|
40
|
-
MsgUndelegateResponse,
|
|
37
|
+
MsgBeginRedelegate as MsgBeginRedelegateType,
|
|
38
|
+
MsgDelegate as MsgDelegateType,
|
|
39
|
+
MsgUndelegate as MsgUndelegateType,
|
|
40
|
+
MsgUndelegateResponse as MsgUndelegateResponseType,
|
|
41
41
|
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
|
|
42
|
-
import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
43
|
-
import { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
42
|
+
import { Any as AnyType } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
43
|
+
import { MsgTransfer as MsgTransferType } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
44
44
|
import { makeTracer } from '@agoric/internal';
|
|
45
45
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
46
46
|
import { M } from '@agoric/vat-data';
|
|
@@ -70,6 +70,60 @@ import { orchestrationAccountMethods } from '../utils/orchestrationAccount.js';
|
|
|
70
70
|
import { makeTimestampHelper } from '../utils/time.js';
|
|
71
71
|
import { accountIdTo32Bytes, parseAccountId } from '../utils/address.js';
|
|
72
72
|
|
|
73
|
+
const MsgDepositForBurn = CodecHelper(MsgDepositForBurnType);
|
|
74
|
+
const MsgDepositForBurnWithCaller = CodecHelper(
|
|
75
|
+
MsgDepositForBurnWithCallerType,
|
|
76
|
+
);
|
|
77
|
+
const QueryAllBalancesRequest = CodecHelper(QueryAllBalancesRequestType);
|
|
78
|
+
const QueryAllBalancesResponse = CodecHelper(QueryAllBalancesResponseType);
|
|
79
|
+
const QueryBalanceRequest = CodecHelper(QueryBalanceRequestType);
|
|
80
|
+
const QueryBalanceResponse = CodecHelper(QueryBalanceResponseType);
|
|
81
|
+
const MsgSend = CodecHelper(MsgSendType);
|
|
82
|
+
const QueryDelegationRewardsRequest = CodecHelper(
|
|
83
|
+
QueryDelegationRewardsRequestType,
|
|
84
|
+
);
|
|
85
|
+
const QueryDelegationRewardsResponse = CodecHelper(
|
|
86
|
+
QueryDelegationRewardsResponseType,
|
|
87
|
+
);
|
|
88
|
+
const QueryDelegationTotalRewardsRequest = CodecHelper(
|
|
89
|
+
QueryDelegationTotalRewardsRequestType,
|
|
90
|
+
);
|
|
91
|
+
const QueryDelegationTotalRewardsResponse = CodecHelper(
|
|
92
|
+
QueryDelegationTotalRewardsResponseType,
|
|
93
|
+
);
|
|
94
|
+
const MsgWithdrawDelegatorReward = CodecHelper(MsgWithdrawDelegatorRewardType);
|
|
95
|
+
const MsgWithdrawDelegatorRewardResponse = CodecHelper(
|
|
96
|
+
MsgWithdrawDelegatorRewardResponseType,
|
|
97
|
+
);
|
|
98
|
+
const QueryDelegationRequest = CodecHelper(QueryDelegationRequestType);
|
|
99
|
+
const QueryDelegationResponse = CodecHelper(QueryDelegationResponseType);
|
|
100
|
+
const QueryDelegatorDelegationsRequest = CodecHelper(
|
|
101
|
+
QueryDelegatorDelegationsRequestType,
|
|
102
|
+
);
|
|
103
|
+
const QueryDelegatorDelegationsResponse = CodecHelper(
|
|
104
|
+
QueryDelegatorDelegationsResponseType,
|
|
105
|
+
);
|
|
106
|
+
const QueryDelegatorUnbondingDelegationsRequest = CodecHelper(
|
|
107
|
+
QueryDelegatorUnbondingDelegationsRequestType,
|
|
108
|
+
);
|
|
109
|
+
const QueryDelegatorUnbondingDelegationsResponse = CodecHelper(
|
|
110
|
+
QueryDelegatorUnbondingDelegationsResponseType,
|
|
111
|
+
);
|
|
112
|
+
const QueryRedelegationsRequest = CodecHelper(QueryRedelegationsRequestType);
|
|
113
|
+
const QueryRedelegationsResponse = CodecHelper(QueryRedelegationsResponseType);
|
|
114
|
+
const QueryUnbondingDelegationRequest = CodecHelper(
|
|
115
|
+
QueryUnbondingDelegationRequestType,
|
|
116
|
+
);
|
|
117
|
+
const QueryUnbondingDelegationResponse = CodecHelper(
|
|
118
|
+
QueryUnbondingDelegationResponseType,
|
|
119
|
+
);
|
|
120
|
+
const MsgBeginRedelegate = CodecHelper(MsgBeginRedelegateType);
|
|
121
|
+
const MsgDelegate = CodecHelper(MsgDelegateType);
|
|
122
|
+
const MsgUndelegate = CodecHelper(MsgUndelegateType);
|
|
123
|
+
const MsgUndelegateResponse = CodecHelper(MsgUndelegateResponseType);
|
|
124
|
+
const Any = CodecHelper(AnyType);
|
|
125
|
+
const MsgTransfer = CodecHelper(MsgTransferType);
|
|
126
|
+
|
|
73
127
|
/**
|
|
74
128
|
* @import {HostOf} from '@agoric/async-flow';
|
|
75
129
|
* @import {AmountArg, IcaAccount, CosmosChainAddress, CosmosValidatorAddress, ICQConnection, StakingAccountActions, StakingAccountQueries, NobleMethods, OrchestrationAccountCommon, CosmosRewardsResponse, IBCConnectionInfo, IBCMsgTransferOptions, ChainHub, CosmosDelegationResponse, CaipChainId, AccountIdArg} from '../types.js';
|
|
@@ -611,12 +665,9 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
611
665
|
token,
|
|
612
666
|
sender: this.state.chainAddress.value,
|
|
613
667
|
receiver: destination.value,
|
|
614
|
-
timeoutHeight: opts?.timeoutHeight
|
|
615
|
-
revisionHeight: 0n,
|
|
616
|
-
revisionNumber: 0n,
|
|
617
|
-
},
|
|
668
|
+
timeoutHeight: opts?.timeoutHeight,
|
|
618
669
|
timeoutTimestamp,
|
|
619
|
-
memo: opts?.memo
|
|
670
|
+
memo: opts?.memo,
|
|
620
671
|
}),
|
|
621
672
|
),
|
|
622
673
|
]);
|
|
@@ -1170,7 +1221,7 @@ export const prepareCosmosOrchestrationAccountKit = (
|
|
|
1170
1221
|
throw Fail`${q(chainId)} does not have "cctpDestinationDomain" set in ChainInfo`;
|
|
1171
1222
|
}
|
|
1172
1223
|
|
|
1173
|
-
/** @satisfies {
|
|
1224
|
+
/** @satisfies {MsgDepositForBurnType} */
|
|
1174
1225
|
const depositForBurn = {
|
|
1175
1226
|
amount: helper.amountToCoin(amount)?.amount,
|
|
1176
1227
|
from: chainAddress.value,
|
|
@@ -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":"AAgIO,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;;;WAGG;6BAFQ,SAAS,GACP,IAAI;;;QAOjB;;;WAGG;mCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;QAiCxB;;;WAGG;qCAFQ,MAAM,cACN,MAAM,CAAC,KAAK,CAAC;;;uBAmBJ,YAAY;oBAAU,SAAS;;;uBAa/B,kBAAkB;qBAAW,SAAS,EAAE;;;oBAc3C,SAAS;yBACJ,YAAY;mBAClB,qBAAqB;;;;;QAmCrC;;;;;;WAMG;8BALQ,CACV,SACA,UAAgB,+CAA+C,CAAC,CAC3D,CACF;;;QAcJ;;;;;;WAMG;sCALQ,MAAM,mBACN;YACN,IAAI,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC;YAClD,KAAK,EAAE,aAAa,CAAC;SACtB;;IAqCN;;;OAGG;;QAED,kDAAkD;6BAAtC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;;;;;IAYxC;;;OAGG;;QAED;;;;WAIG;+BAHQ,MAAM,CAAC,KAAK,CAAC,SACb,WAAW,CAAC,OAAO,CAAC,GAClB,WAAW;;IAM1B,kDAAkD;;QAEhD;;;WAGG;uBAFQ,SAAS,QACT,OAAO;QAKlB;;;WAGG;2BAFQ,KAAK,QACL,OAAO;;IAOpB;;;OAGG;;QAED;;;;;WAKG;4BAJQ,WACV,UAAc,0CA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vB,uBAAuB;6BAClK,aAAa;gCAUR,sBAAsB;4CAR/B,4DAA4D;yCAHmF,uBAAuB;iCAKhK,6CAA6C;iCAU9D,mBAAmB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @file Use-object for the owner of a localchain account */
|
|
2
|
-
import {
|
|
2
|
+
import { CodecHelper } from '@agoric/cosmic-proto';
|
|
3
3
|
import { AmountShape, PaymentShape } from '@agoric/ertp';
|
|
4
4
|
import { makeTracer } from '@agoric/internal';
|
|
5
5
|
import { Shape as NetworkShape } from '@agoric/network';
|
|
@@ -8,6 +8,17 @@ import { VowShape } from '@agoric/vow';
|
|
|
8
8
|
import { E } from '@endo/far';
|
|
9
9
|
import { Fail, q } from '@endo/errors';
|
|
10
10
|
|
|
11
|
+
import { MsgTransfer as MsgTransferType } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
12
|
+
import { QueryDenomHashRequest as QueryDenomHashRequestType } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/query.js';
|
|
13
|
+
import {
|
|
14
|
+
QueryAllBalancesRequest as QueryAllBalancesRequestType,
|
|
15
|
+
QueryBalanceRequest as QueryBalanceRequestType,
|
|
16
|
+
} from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js';
|
|
17
|
+
import {
|
|
18
|
+
MsgDelegate as MsgDelegateType,
|
|
19
|
+
MsgUndelegate as MsgUndelegateType,
|
|
20
|
+
} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
|
|
21
|
+
import { MsgSend as MsgSendType } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
|
|
11
22
|
import {
|
|
12
23
|
AmountArgShape,
|
|
13
24
|
AnyNatAmountsRecord,
|
|
@@ -25,6 +36,14 @@ import { prepareIBCTools } from './ibc-packet.js';
|
|
|
25
36
|
import { coerceCoin, coerceDenomAmount } from '../utils/amounts.js';
|
|
26
37
|
import { TransferRouteShape } from './chain-hub.js';
|
|
27
38
|
|
|
39
|
+
const MsgTransfer = CodecHelper(MsgTransferType);
|
|
40
|
+
const QueryDenomHashRequest = CodecHelper(QueryDenomHashRequestType);
|
|
41
|
+
const QueryAllBalancesRequest = CodecHelper(QueryAllBalancesRequestType);
|
|
42
|
+
const QueryBalanceRequest = CodecHelper(QueryBalanceRequestType);
|
|
43
|
+
const MsgDelegate = CodecHelper(MsgDelegateType);
|
|
44
|
+
const MsgUndelegate = CodecHelper(MsgUndelegateType);
|
|
45
|
+
const MsgSend = CodecHelper(MsgSendType);
|
|
46
|
+
|
|
28
47
|
/**
|
|
29
48
|
* @import {HostOf} from '@agoric/async-flow';
|
|
30
49
|
* @import {LocalChain, LocalChainAccount} from '@agoric/vats/src/localchain.js';
|
|
@@ -33,7 +52,7 @@ import { TransferRouteShape } from './chain-hub.js';
|
|
|
33
52
|
* @import {IBCEvent} from '@agoric/vats';
|
|
34
53
|
* @import {QueryDenomHashResponse} from '@agoric/cosmic-proto/ibc/applications/transfer/v1/query.js';
|
|
35
54
|
* @import {FungibleTokenPacketData} from '@agoric/cosmic-proto/ibc/applications/transfer/v2/packet.js';
|
|
36
|
-
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js'
|
|
55
|
+
* @import {RecorderKit, MakeRecorderKit} from '@agoric/zoe/src/contractSupport/recorder.js';
|
|
37
56
|
* @import {Zone} from '@agoric/zone';
|
|
38
57
|
* @import {Remote} from '@agoric/internal';
|
|
39
58
|
* @import {InvitationMakers} from '@agoric/smart-wallet/src/types.js';
|
|
@@ -387,19 +406,13 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
387
406
|
},
|
|
388
407
|
});
|
|
389
408
|
}
|
|
390
|
-
const transferMsg = typedJson(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
revisionNumber: 0n,
|
|
398
|
-
},
|
|
399
|
-
timeoutTimestamp,
|
|
400
|
-
memo: memo ?? '',
|
|
401
|
-
},
|
|
402
|
-
);
|
|
409
|
+
const transferMsg = MsgTransfer.typedJson({
|
|
410
|
+
...transferDetails,
|
|
411
|
+
sender: this.state.address.value,
|
|
412
|
+
timeoutHeight: opts?.timeoutHeight,
|
|
413
|
+
timeoutTimestamp,
|
|
414
|
+
memo,
|
|
415
|
+
});
|
|
403
416
|
|
|
404
417
|
const { holder } = this.facets;
|
|
405
418
|
const sender = makeIBCTransferSender(
|
|
@@ -580,7 +593,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
580
593
|
|
|
581
594
|
return watch(
|
|
582
595
|
E(localchain).query(
|
|
583
|
-
typedJson(
|
|
596
|
+
QueryBalanceRequest.typedJson({
|
|
584
597
|
address: this.state.address.value,
|
|
585
598
|
denom,
|
|
586
599
|
}),
|
|
@@ -593,7 +606,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
593
606
|
getBalances() {
|
|
594
607
|
return watch(
|
|
595
608
|
E(localchain).query(
|
|
596
|
-
typedJson(
|
|
609
|
+
QueryAllBalancesRequest.typedJson({
|
|
597
610
|
address: this.state.address.value,
|
|
598
611
|
}),
|
|
599
612
|
),
|
|
@@ -630,7 +643,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
630
643
|
|
|
631
644
|
return watch(
|
|
632
645
|
E(lca).executeTx([
|
|
633
|
-
typedJson(
|
|
646
|
+
MsgDelegate.typedJson({
|
|
634
647
|
amount,
|
|
635
648
|
validatorAddress,
|
|
636
649
|
delegatorAddress: this.state.address.value,
|
|
@@ -650,7 +663,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
650
663
|
const { account: lca } = this.state;
|
|
651
664
|
return watch(
|
|
652
665
|
E(lca).executeTx([
|
|
653
|
-
typedJson(
|
|
666
|
+
MsgUndelegate.typedJson({
|
|
654
667
|
amount,
|
|
655
668
|
validatorAddress,
|
|
656
669
|
delegatorAddress: this.state.address.value,
|
|
@@ -697,7 +710,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
697
710
|
const { helper } = this.facets;
|
|
698
711
|
return watch(
|
|
699
712
|
E(this.state.account).executeTx([
|
|
700
|
-
typedJson(
|
|
713
|
+
MsgSend.typedJson({
|
|
701
714
|
amount: [helper.amountToCoin(amount)],
|
|
702
715
|
toAddress: cosmosDest.value,
|
|
703
716
|
fromAddress: this.state.address.value,
|
|
@@ -718,7 +731,7 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
718
731
|
const { helper } = this.facets;
|
|
719
732
|
return watch(
|
|
720
733
|
E(this.state.account).executeTx([
|
|
721
|
-
typedJson(
|
|
734
|
+
MsgSend.typedJson({
|
|
722
735
|
amount: amounts.map(a => helper.amountToCoin(a)),
|
|
723
736
|
toAddress: toAccount.value,
|
|
724
737
|
fromAddress: this.state.address.value,
|
|
@@ -824,10 +837,9 @@ export const prepareLocalOrchestrationAccountKit = (
|
|
|
824
837
|
// Find the local denom hash for the transferDenom, if there is one.
|
|
825
838
|
return watch(
|
|
826
839
|
E(localchain).query(
|
|
827
|
-
typedJson(
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
),
|
|
840
|
+
QueryDenomHashRequest.typedJson({
|
|
841
|
+
trace: denomOrTrace,
|
|
842
|
+
}),
|
|
831
843
|
),
|
|
832
844
|
this.facets.parseInboundTransferWatcher,
|
|
833
845
|
buildReturnValue(denomOrTrace),
|
|
@@ -24,7 +24,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
24
24
|
}>;
|
|
25
25
|
export type QueryFlowsSF = typeof start;
|
|
26
26
|
import type { ZCF } from '@agoric/zoe';
|
|
27
|
-
import type { OrchestrationPowers } from '
|
|
27
|
+
import type { OrchestrationPowers } from '../utils/start-helper.js';
|
|
28
28
|
import type { CosmosChainInfo } from '@agoric/orchestration';
|
|
29
29
|
import type { Denom } from '@agoric/orchestration';
|
|
30
30
|
import type { DenomDetail } from '@agoric/orchestration';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-flows.contract.d.ts","sourceRoot":"","sources":["query-flows.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-flows.contract.d.ts","sourceRoot":"","sources":["query-flows.contract.js"],"names":[],"mappings":"AAkFA;gBA/DiB,UAAU;gBACV,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;gBAC/B,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE;;;;;;;;;;;;;;;;;;GA6DgB;2BAGjE,OAAO,KAAK;yBA3EJ,aAAa;yCAGuB,0BAA0B;qCAD9B,uBAAuB;2BAAvB,uBAAuB;iCAAvB,uBAAuB"}
|
|
@@ -11,8 +11,7 @@ import * as flows from './query-flows.flows.js';
|
|
|
11
11
|
* @import {ZCF} from '@agoric/zoe';
|
|
12
12
|
* @import {Zone} from '@agoric/zone';
|
|
13
13
|
* @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
|
|
14
|
-
* @import {OrchestrationPowers} from '
|
|
15
|
-
* @import {OrchestrationTools} from '../utils/start-helper.js';
|
|
14
|
+
* @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js';
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
/**
|
package/src/utils/packet.d.ts
CHANGED
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
* malformed messages in favor of interface guards.
|
|
10
10
|
*
|
|
11
11
|
* @param {AnyJson[]} msgs
|
|
12
|
-
* @param {Partial<Omit<
|
|
12
|
+
* @param {Partial<Omit<TxBodyType, 'messages'>>} [opts]
|
|
13
13
|
* @returns {string} stringified InterchainAccountPacketData
|
|
14
14
|
* @throws {Error} if malformed messages are provided
|
|
15
15
|
*/
|
|
16
|
-
export function makeTxPacket(msgs: AnyJson[], opts?: Partial<Omit<
|
|
16
|
+
export function makeTxPacket(msgs: AnyJson[], opts?: Partial<Omit<TxBodyType, "messages">>): string;
|
|
17
17
|
/**
|
|
18
18
|
* Makes an IBC query packet from an array of query messages. Expects the `data`
|
|
19
19
|
* of each message to be base64 encoded bytes. Skips checks for malformed
|
|
20
20
|
* messages in favor of interface guards.
|
|
21
21
|
*
|
|
22
|
-
* @param {JsonSafe<
|
|
22
|
+
* @param {JsonSafe<RequestQueryType>[]} msgs
|
|
23
23
|
* @returns {string} stringified InterchainQueryPacketData
|
|
24
24
|
* @throws {Error} if malformed messages are provided
|
|
25
25
|
*/
|
|
26
|
-
export function makeQueryPacket(msgs: JsonSafe<
|
|
26
|
+
export function makeQueryPacket(msgs: JsonSafe<RequestQueryType>[]): string;
|
|
27
27
|
/**
|
|
28
28
|
* Looks for a result or error key in the response string, and returns a
|
|
29
29
|
* Base64Bytes string. This string can be decoded using the corresponding
|
|
@@ -44,14 +44,14 @@ export function parseTxPacket(response: string): string;
|
|
|
44
44
|
* seem to be plain text and do not need decoding.
|
|
45
45
|
*
|
|
46
46
|
* @param {string} response
|
|
47
|
-
* @returns {JsonSafe<
|
|
47
|
+
* @returns {JsonSafe<ResponseQueryType>[]}
|
|
48
48
|
* @throws {Error} if error key is detected in response string, or result key is
|
|
49
49
|
* not found
|
|
50
50
|
*/
|
|
51
|
-
export function parseQueryPacket(response: string): JsonSafe<
|
|
51
|
+
export function parseQueryPacket(response: string): JsonSafe<ResponseQueryType>[];
|
|
52
52
|
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
53
|
-
import { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
54
|
-
import { RequestQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
53
|
+
import { TxBody as TxBodyType } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
54
|
+
import { RequestQuery as RequestQueryType } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
55
55
|
import type { JsonSafe } from '@agoric/cosmic-proto';
|
|
56
|
-
import { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
56
|
+
import { ResponseQuery as ResponseQueryType } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
57
57
|
//# sourceMappingURL=packet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packet.d.ts","sourceRoot":"","sources":["packet.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packet.d.ts","sourceRoot":"","sources":["packet.js"],"names":[],"mappings":"AAsBA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,mCALW,OAAO,EAAE,SACT,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,GACnC,MAAM,CAiBlB;AAGD;;;;;;;;GAQG;AACH,sCAJW,SAAS,gBAAgB,CAAC,EAAE,GAC1B,MAAM,CAgBlB;AAGD;;;;;;;;;;GAUG;AACH,wCALW,MAAM,GACJ,MAAM,CASlB;AAGD;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,GACJ,SAAS,iBAAiB,CAAC,EAAE,CASzC;6BA7FmC,sBAAsB;qCAtBrB,8CAA8C;iDAK5E,+CAA+C;8BAiBlB,sBAAsB;mDAjBnD,+CAA+C"}
|
package/src/utils/packet.js
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { Fail } from '@endo/errors';
|
|
2
|
-
import { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
3
|
-
import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
2
|
+
import { TxBody as TxBodyType } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
3
|
+
import { Any as AnyType } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
4
4
|
import {
|
|
5
|
-
RequestQuery,
|
|
6
|
-
ResponseQuery,
|
|
5
|
+
RequestQuery as RequestQueryType,
|
|
6
|
+
ResponseQuery as ResponseQueryType,
|
|
7
7
|
} from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
8
8
|
import { atob, decodeBase64, encodeBase64 } from '@endo/base64';
|
|
9
9
|
import {
|
|
10
|
-
CosmosQuery,
|
|
11
|
-
CosmosResponse,
|
|
10
|
+
CosmosQuery as CosmosQueryType,
|
|
11
|
+
CosmosResponse as CosmosResponseType,
|
|
12
12
|
} from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
13
|
+
import { CodecHelper } from '@agoric/cosmic-proto';
|
|
13
14
|
import { Type as PacketType } from '@agoric/cosmic-proto/ibc/applications/interchain_accounts/v1/packet.js';
|
|
14
15
|
|
|
16
|
+
const TxBody = CodecHelper(TxBodyType);
|
|
17
|
+
const Any = CodecHelper(AnyType);
|
|
18
|
+
const RequestQuery = CodecHelper(RequestQueryType);
|
|
19
|
+
const ResponseQuery = CodecHelper(ResponseQueryType);
|
|
20
|
+
const CosmosQuery = CodecHelper(CosmosQueryType);
|
|
21
|
+
const CosmosResponse = CodecHelper(CosmosResponseType);
|
|
22
|
+
|
|
15
23
|
/**
|
|
16
24
|
* @import {AnyJson, JsonSafe} from '@agoric/cosmic-proto';
|
|
17
25
|
* @import {InterchainAccountPacketData} from '@agoric/cosmic-proto/ibc/applications/interchain_accounts/v1/packet.js';
|
|
@@ -24,18 +32,16 @@ import { Type as PacketType } from '@agoric/cosmic-proto/ibc/applications/interc
|
|
|
24
32
|
* malformed messages in favor of interface guards.
|
|
25
33
|
*
|
|
26
34
|
* @param {AnyJson[]} msgs
|
|
27
|
-
* @param {Partial<Omit<
|
|
35
|
+
* @param {Partial<Omit<TxBodyType, 'messages'>>} [opts]
|
|
28
36
|
* @returns {string} stringified InterchainAccountPacketData
|
|
29
37
|
* @throws {Error} if malformed messages are provided
|
|
30
38
|
*/
|
|
31
39
|
export function makeTxPacket(msgs, opts) {
|
|
32
40
|
const messages = msgs.map(Any.fromJSON);
|
|
33
|
-
const bytes = TxBody.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}),
|
|
38
|
-
).finish();
|
|
41
|
+
const bytes = TxBody.toProto({
|
|
42
|
+
messages,
|
|
43
|
+
...opts,
|
|
44
|
+
});
|
|
39
45
|
|
|
40
46
|
return JSON.stringify(
|
|
41
47
|
/** @type {JsonSafe<InterchainAccountPacketData>} */ ({
|
|
@@ -52,7 +58,7 @@ harden(makeTxPacket);
|
|
|
52
58
|
* of each message to be base64 encoded bytes. Skips checks for malformed
|
|
53
59
|
* messages in favor of interface guards.
|
|
54
60
|
*
|
|
55
|
-
* @param {JsonSafe<
|
|
61
|
+
* @param {JsonSafe<RequestQueryType>[]} msgs
|
|
56
62
|
* @returns {string} stringified InterchainQueryPacketData
|
|
57
63
|
* @throws {Error} if malformed messages are provided
|
|
58
64
|
*/
|
|
@@ -99,7 +105,7 @@ harden(parseTxPacket);
|
|
|
99
105
|
* seem to be plain text and do not need decoding.
|
|
100
106
|
*
|
|
101
107
|
* @param {string} response
|
|
102
|
-
* @returns {JsonSafe<
|
|
108
|
+
* @returns {JsonSafe<ResponseQueryType>[]}
|
|
103
109
|
* @throws {Error} if error key is detected in response string, or result key is
|
|
104
110
|
* not found
|
|
105
111
|
*/
|
package/tools/ibc-mocks.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
/** @file Tools to support making IBC mocks */
|
|
2
|
-
import { type JsonSafe } from '@agoric/cosmic-proto';
|
|
3
|
-
import { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
4
|
-
import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
2
|
+
import { type JsonSafe, type Proto3Codec } from '@agoric/cosmic-proto';
|
|
3
|
+
import { TxBody as TxBodyType } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
4
|
+
import { Any as AnyType } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
5
5
|
import type { PacketSDKType } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
|
|
6
|
-
import { RequestQuery, ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
6
|
+
import { type RequestQuery as RequestQueryType, ResponseQuery as ResponseQueryType } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
7
7
|
import type { IBCChannelID, IBCEvent, VTransferIBCEvent } from '@agoric/vats';
|
|
8
8
|
import type { CosmosChainAddress, Denom } from '../src/orchestration-api.js';
|
|
9
|
-
|
|
10
|
-
encode: (message: T) => {
|
|
11
|
-
finish: () => Uint8Array;
|
|
12
|
-
};
|
|
13
|
-
fromPartial: (partial: Partial<T>) => T;
|
|
14
|
-
typeUrl: string;
|
|
15
|
-
}
|
|
9
|
+
type EncoderCommon<T> = Proto3Codec<string, T>;
|
|
16
10
|
/**
|
|
17
11
|
* Build a response "packet bytes string" we'd expect to see from a
|
|
18
12
|
* Response to a Tx carrying a single Msg.
|
|
@@ -45,7 +39,7 @@ export declare function buildMsgErrorString(msg?: string): string;
|
|
|
45
39
|
* @param query
|
|
46
40
|
* @param opts
|
|
47
41
|
*/
|
|
48
|
-
export declare function buildQueryResponseString<T>(encoder: EncoderCommon<T>, query: Partial<T>, opts?: Partial<Omit<
|
|
42
|
+
export declare function buildQueryResponseString<T>(encoder: EncoderCommon<T>, query: Partial<T>, opts?: Partial<Omit<ResponseQueryType, 'key'>>): string;
|
|
49
43
|
/**
|
|
50
44
|
* Build a response "packet bytes string" we'd expect to see from
|
|
51
45
|
* the Responses corresponding to multiple Queries.
|
|
@@ -55,7 +49,7 @@ export declare function buildQueryResponseString<T>(encoder: EncoderCommon<T>, q
|
|
|
55
49
|
export declare function buildQueriesResponseString<T extends {
|
|
56
50
|
encoder: EncoderCommon<any>;
|
|
57
51
|
query: Partial<any>;
|
|
58
|
-
opts?: Partial<Omit<
|
|
52
|
+
opts?: Partial<Omit<ResponseQueryType, 'key'>>;
|
|
59
53
|
}[]>(queries: T): string;
|
|
60
54
|
/**
|
|
61
55
|
* Build a tx packet string for the mocked dibc bridge handler
|
|
@@ -72,14 +66,14 @@ export declare function buildTxPacketString(msgs: {
|
|
|
72
66
|
*
|
|
73
67
|
* @param b64 base64 encoded string
|
|
74
68
|
*/
|
|
75
|
-
export declare const parseOutgoingTxPacket: (b64: string) =>
|
|
69
|
+
export declare const parseOutgoingTxPacket: (b64: string) => TxBodyType;
|
|
76
70
|
/**
|
|
77
71
|
* Build a query packet string for the mocked dibc bridge handler
|
|
78
72
|
* @param msgs
|
|
79
73
|
* @param opts
|
|
80
74
|
* @returns {string}
|
|
81
75
|
*/
|
|
82
|
-
export declare function buildQueryPacketString(msgs:
|
|
76
|
+
export declare function buildQueryPacketString(msgs: AnyType[], opts?: Partial<Omit<RequestQueryType, 'path' | 'data'>>): string;
|
|
83
77
|
/**
|
|
84
78
|
* Fields that are common to every vtransfer IBC event.
|
|
85
79
|
*/
|
package/tools/ibc-mocks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ibc-mocks.d.ts","sourceRoot":"","sources":["ibc-mocks.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"ibc-mocks.d.ts","sourceRoot":"","sources":["ibc-mocks.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAEpF,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,6CAA6C,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AAEzF,OAAO,EACL,KAAK,YAAY,IAAI,gBAAgB,EACrC,aAAa,IAAI,iBAAiB,EACnC,MAAM,+CAA+C,CAAC;AAKvD,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EAER,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAU7E,KAAK,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EF,KAAK,eAAe,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAEnE,sDAAsD;AACtD,KAAK,YAAY,CAAC,CAAC,IAEjB,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAEzB,EAAE,SAAS,SAAS,GAClB,uBAAuB,GACvB,EAAE,GAEJ,uBAAuB,CAAC;AAE9B,KAAK,yBAAyB,CAAC,CAAC,SAAS,eAAe,IAAI,gBAAgB,CAC1E,YAAY,CAAC,CAAC,CAAC,CAChB,CAAC;AAEF,KAAK,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,CAAC,OAAO,CAAC,IAAI,OAAO,CACnE,iBAAiB,EACjB;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,eAAe,EAC3D,MAAM,EAAE,CAAC,GACR,yBAAyB,CAAC,CAAC,CAAC,CA4D9B;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,MAOtD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,GAAI,yBAG3C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAM,KAAG,OAAO,CACxD,QAAQ,CAAC,qBAAqB,CAAC,CAQ/B,CAAC"}
|
package/tools/ibc-mocks.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
/** @file Tools to support making IBC mocks */
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import {
|
|
3
|
+
type JsonSafe,
|
|
4
|
+
type Proto3Codec,
|
|
5
|
+
toRequestQueryJson,
|
|
6
|
+
CodecHelper,
|
|
7
|
+
} from '@agoric/cosmic-proto';
|
|
8
|
+
import { TxBody as TxBodyType } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
9
|
+
import { TxMsgData as TxMsgDataType } from '@agoric/cosmic-proto/cosmos/base/abci/v1beta1/abci.js';
|
|
10
|
+
import { Any as AnyType } from '@agoric/cosmic-proto/google/protobuf/any.js';
|
|
11
|
+
import { FungibleTokenPacketData as FungibleTokenPacketDataType } from '@agoric/cosmic-proto/ibc/applications/transfer/v2/packet.js';
|
|
7
12
|
import type { PacketSDKType } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
|
|
8
|
-
import { CosmosResponse } from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
13
|
+
import { CosmosResponse as CosmosResponseType } from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
9
14
|
import {
|
|
10
|
-
RequestQuery,
|
|
11
|
-
ResponseQuery,
|
|
15
|
+
type RequestQuery as RequestQueryType,
|
|
16
|
+
ResponseQuery as ResponseQueryType,
|
|
12
17
|
} from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
13
18
|
import {
|
|
14
19
|
IBC_EVENT,
|
|
@@ -25,13 +30,14 @@ import { atob, btoa, decodeBase64, encodeBase64 } from '@endo/base64';
|
|
|
25
30
|
import type { CosmosChainAddress, Denom } from '../src/orchestration-api.js';
|
|
26
31
|
import { makeQueryPacket, makeTxPacket } from '../src/utils/packet.js';
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const TxBody = CodecHelper(TxBodyType);
|
|
34
|
+
const TxMsgData = CodecHelper(TxMsgDataType);
|
|
35
|
+
const Any = CodecHelper(AnyType);
|
|
36
|
+
const FungibleTokenPacketData = CodecHelper(FungibleTokenPacketDataType);
|
|
37
|
+
const CosmosResponse = CodecHelper(CosmosResponseType);
|
|
38
|
+
const ResponseQuery = CodecHelper(ResponseQueryType);
|
|
39
|
+
|
|
40
|
+
type EncoderCommon<T> = Proto3Codec<string, T>;
|
|
35
41
|
|
|
36
42
|
const toPacket = (obj: Record<string, any>): string =>
|
|
37
43
|
btoa(JSON.stringify(obj));
|
|
@@ -63,18 +69,12 @@ export function buildTxResponseString<T extends EncoderMessage<any>[]>(
|
|
|
63
69
|
messages: T,
|
|
64
70
|
): string {
|
|
65
71
|
const msgResponses = messages.map(({ encoder, message }) => {
|
|
66
|
-
|
|
67
|
-
return Any.fromPartial({
|
|
68
|
-
typeUrl: encoder.typeUrl,
|
|
69
|
-
value: encodedMsg,
|
|
70
|
-
});
|
|
72
|
+
return Any.fromPartial(CodecHelper(encoder).toProtoMsg(message));
|
|
71
73
|
});
|
|
72
74
|
|
|
73
|
-
const txMsgData = TxMsgData.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
).finish();
|
|
75
|
+
const txMsgData = TxMsgData.toProto({
|
|
76
|
+
msgResponses,
|
|
77
|
+
});
|
|
78
78
|
|
|
79
79
|
return toPacket({
|
|
80
80
|
result: encodeBase64(txMsgData),
|
|
@@ -106,7 +106,7 @@ export function buildMsgErrorString(
|
|
|
106
106
|
export function buildQueryResponseString<T>(
|
|
107
107
|
encoder: EncoderCommon<T>,
|
|
108
108
|
query: Partial<T>,
|
|
109
|
-
opts?: Partial<Omit<
|
|
109
|
+
opts?: Partial<Omit<ResponseQueryType, 'key'>>,
|
|
110
110
|
): string {
|
|
111
111
|
return buildQueriesResponseString([{ encoder, query, opts }] as const);
|
|
112
112
|
}
|
|
@@ -121,18 +121,16 @@ export function buildQueriesResponseString<
|
|
|
121
121
|
T extends {
|
|
122
122
|
encoder: EncoderCommon<any>;
|
|
123
123
|
query: Partial<any>;
|
|
124
|
-
opts?: Partial<Omit<
|
|
124
|
+
opts?: Partial<Omit<ResponseQueryType, 'key'>>;
|
|
125
125
|
}[],
|
|
126
126
|
>(queries: T): string {
|
|
127
|
-
const encodedResp = CosmosResponse.encode(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return response;
|
|
133
|
-
}),
|
|
127
|
+
const encodedResp = CosmosResponse.encode({
|
|
128
|
+
responses: queries.map(({ encoder, query, opts }) => {
|
|
129
|
+
const key = CodecHelper(encoder).toProto(query);
|
|
130
|
+
const response = ResponseQuery.fromPartial({ ...opts, key });
|
|
131
|
+
return response;
|
|
134
132
|
}),
|
|
135
|
-
).finish();
|
|
133
|
+
}).finish();
|
|
136
134
|
|
|
137
135
|
return toPacket({
|
|
138
136
|
result: toPacket({ data: encodeBase64(encodedResp) }),
|
|
@@ -147,7 +145,7 @@ export function buildQueriesResponseString<
|
|
|
147
145
|
export function buildTxPacketString(
|
|
148
146
|
msgs: { value: Uint8Array; typeUrl: string }[],
|
|
149
147
|
): string {
|
|
150
|
-
return btoa(makeTxPacket(msgs.map(Any.toJSON)));
|
|
148
|
+
return btoa(makeTxPacket(msgs.map(m => Any.toJSON(m))));
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
/**
|
|
@@ -167,8 +165,8 @@ export const parseOutgoingTxPacket = (b64: string) => {
|
|
|
167
165
|
* @returns {string}
|
|
168
166
|
*/
|
|
169
167
|
export function buildQueryPacketString(
|
|
170
|
-
msgs:
|
|
171
|
-
opts: Partial<Omit<
|
|
168
|
+
msgs: AnyType[],
|
|
169
|
+
opts: Partial<Omit<RequestQueryType, 'path' | 'data'>> = {},
|
|
172
170
|
): string {
|
|
173
171
|
return btoa(makeQueryPacket(msgs.map(msg => toRequestQueryJson(msg, opts))));
|
|
174
172
|
}
|
|
@@ -295,7 +293,7 @@ export function buildVTransferEvent<P extends VTransferParams>(
|
|
|
295
293
|
packet: {
|
|
296
294
|
data: btoa(
|
|
297
295
|
JSON.stringify(
|
|
298
|
-
FungibleTokenPacketData.
|
|
296
|
+
FungibleTokenPacketData.toJSON({
|
|
299
297
|
amount: String(amount),
|
|
300
298
|
denom,
|
|
301
299
|
sender,
|