@agoric/orchestration 0.2.0-u21.0.1 → 0.2.0-u22.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 +39 -37
- package/src/axelar-types.d.ts +4 -3
- package/src/axelar-types.d.ts.map +1 -1
- package/src/axelar-types.js +4 -2
- package/src/chain-info.d.ts +1 -1
- package/src/chain-info.d.ts.map +1 -1
- package/src/chain-info.js +9 -4
- package/src/cosmos-api.d.ts +2 -2
- package/src/cosmos-api.d.ts.map +1 -1
- package/src/cosmos-api.ts +2 -2
- package/src/examples/axelar-gmp-account-kit.d.ts +11 -0
- package/src/examples/axelar-gmp-account-kit.d.ts.map +1 -1
- package/src/examples/axelar-gmp-account-kit.js +23 -4
- package/src/examples/axelar-gmp.contract.d.ts.map +1 -1
- package/src/examples/axelar-gmp.contract.js +10 -5
- package/src/examples/axelar-gmp.flows.d.ts.map +1 -1
- package/src/examples/axelar-gmp.flows.js +10 -5
- package/src/examples/stake-bld.contract.d.ts +2 -2
- package/src/exos/chain-hub.d.ts +8 -0
- package/src/exos/chain-hub.d.ts.map +1 -1
- package/src/exos/chain-hub.js +16 -0
- package/src/exos/cosmos-interchain-service.d.ts +1 -0
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
- package/src/exos/cosmos-interchain-service.js +1 -0
- 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 +6 -6
- package/src/exos/local-orchestration-account.d.ts.map +1 -1
- package/src/exos/local-orchestration-account.js +39 -35
- package/src/exos/orchestrator.d.ts +2 -2
- package/src/exos/orchestrator.d.ts.map +1 -1
- package/src/exos/orchestrator.js +1 -6
- package/src/exos/packet-tools.d.ts +1 -1
- 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/stubs/viem-abi.d.ts +12 -0
- package/src/stubs/viem-abi.d.ts.map +1 -0
- package/src/stubs/viem-abi.ts +11 -0
- package/src/utils/agd-lib.d.ts +0 -1
- package/src/utils/agd-lib.d.ts.map +1 -1
- package/src/utils/agd-lib.js +9 -18
- package/src/utils/gmp.d.ts +2 -33
- package/src/utils/gmp.d.ts.map +1 -1
- package/src/utils/gmp.js +30 -24
- 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/src/utils/start-helper.d.ts +1 -0
- package/src/utils/start-helper.d.ts.map +1 -1
- package/src/vendor/viem/_esm-YOAV66U4.js +5814 -0
- package/src/vendor/viem/ccip-AAQDZF3N.js +14 -0
- package/src/vendor/viem/chunk-4EF4K2MH.js +4082 -0
- package/src/vendor/viem/chunk-4VNS5WPM.js +42 -0
- package/src/vendor/viem/chunk-XN4LUOIH.js +253 -0
- package/src/vendor/viem/secp256k1-WHBDSQB2.js +1914 -0
- package/src/vendor/viem/viem-abi.d.ts +1 -0
- package/src/vendor/viem/viem-abi.js +12 -0
- package/tools/contract-tests.d.ts +31 -5
- package/tools/contract-tests.d.ts.map +1 -1
- package/tools/contract-tests.ts +39 -10
- package/tools/ibc-mocks.d.ts +35 -23
- package/tools/ibc-mocks.d.ts.map +1 -1
- package/tools/ibc-mocks.ts +78 -59
- package/tsup.config.ts +26 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { decodeAbiParameters, encodeAbiParameters, encodeFunctionData } from 'viem/utils';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decodeAbiParameters,
|
|
3
|
+
encodeAbiParameters,
|
|
4
|
+
encodeFunctionData
|
|
5
|
+
} from "./chunk-4EF4K2MH.js";
|
|
6
|
+
import "./chunk-XN4LUOIH.js";
|
|
7
|
+
import "./chunk-4VNS5WPM.js";
|
|
8
|
+
export {
|
|
9
|
+
decodeAbiParameters,
|
|
10
|
+
encodeAbiParameters,
|
|
11
|
+
encodeFunctionData
|
|
12
|
+
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
|
|
2
2
|
import { type VTransferIBCEvent } from '@agoric/vats';
|
|
3
3
|
import type { ExecutionContext } from 'ava';
|
|
4
|
+
import { type ChainInfo } from '../index.js';
|
|
4
5
|
export declare const ROOT_STORAGE_PATH = "orchtest";
|
|
6
|
+
export interface BridgeObject {
|
|
7
|
+
type: string;
|
|
8
|
+
messages: any[];
|
|
9
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* Common setup for contract tests, without any specific asset configuration.
|
|
7
12
|
*/
|
|
8
|
-
export declare const setupOrchestrationTest: ({ log, }: {
|
|
13
|
+
export declare const setupOrchestrationTest: ({ log, chains, }: {
|
|
9
14
|
log: ExecutionContext<any>["log"];
|
|
15
|
+
chains?: Record<string, ChainInfo>;
|
|
10
16
|
}) => Promise<{
|
|
11
17
|
bootstrap: {
|
|
12
18
|
agoricNames: import("@agoric/vats").NameHub<any>;
|
|
@@ -20,6 +26,25 @@ export declare const setupOrchestrationTest: ({ log, }: {
|
|
|
20
26
|
}): Promise<void>;
|
|
21
27
|
getBankForAddress(address: string): Promise<Bank>;
|
|
22
28
|
}>;
|
|
29
|
+
board: import("@endo/exo").Guarded<{
|
|
30
|
+
getId(value: RemotableObject): string;
|
|
31
|
+
getValue(id: BoardId): RemotableObject;
|
|
32
|
+
lookup(...path: string[]): Promise<any>;
|
|
33
|
+
has(val: RemotableObject): boolean;
|
|
34
|
+
ids(): string[];
|
|
35
|
+
getPublishingMarshaller(): import("@endo/exo").Guarded<{
|
|
36
|
+
toCapData(val: any): import("@endo/marshal").CapData<string>;
|
|
37
|
+
fromCapData(data: any): any;
|
|
38
|
+
serialize(data: any): import("@endo/marshal").CapData<string>;
|
|
39
|
+
unserialize(data: any): any;
|
|
40
|
+
}>;
|
|
41
|
+
getReadonlyMarshaller(): import("@endo/exo").Guarded<{
|
|
42
|
+
toCapData(val: any): import("@endo/marshal").CapData<string | null>;
|
|
43
|
+
fromCapData(data: any): any;
|
|
44
|
+
serialize(data: any): import("@endo/marshal").CapData<string | null>;
|
|
45
|
+
unserialize(data: any): any;
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
23
48
|
timer: import("@agoric/zoe/tools/manualTimer.js").ZoeManualTimer;
|
|
24
49
|
localchain: import("@endo/exo").Guarded<{
|
|
25
50
|
makeAccount(): import("@agoric/vow").PromiseVow<LocalChainAccount>;
|
|
@@ -1726,10 +1751,10 @@ export declare const setupOrchestrationTest: ({ log, }: {
|
|
|
1726
1751
|
agoricNames: import("@agoric/vats").NameHub<any>;
|
|
1727
1752
|
/** A chainHub for Exo tests, distinct from the one a contract makes within `withOrchestration` */
|
|
1728
1753
|
chainHub: import("@endo/exo").Guarded<{
|
|
1729
|
-
registerChain(name: string, chainInfo:
|
|
1730
|
-
updateChain(chainName: string, chainInfo:
|
|
1754
|
+
registerChain(name: string, chainInfo: ChainInfo): void;
|
|
1755
|
+
updateChain(chainName: string, chainInfo: ChainInfo): void;
|
|
1731
1756
|
getChainInfo<K extends string>(chainName: K): import("@agoric/vow").Vow<ActualChainInfo<K>>;
|
|
1732
|
-
getChainInfoByChainId(chainId: import("../index.js").CaipChainId):
|
|
1757
|
+
getChainInfoByChainId(chainId: import("../index.js").CaipChainId): ChainInfo;
|
|
1733
1758
|
registerConnection(primaryChainId: string, counterpartyChainId: string, connectionInfo: import("../index.js").IBCConnectionInfo): void;
|
|
1734
1759
|
updateConnection(primaryChainId: string, counterpartyChainId: string, connectionInfo: import("../index.js").IBCConnectionInfo): void;
|
|
1735
1760
|
getConnectionInfo(primary: string | {
|
|
@@ -1745,6 +1770,7 @@ export declare const setupOrchestrationTest: ({ log, }: {
|
|
|
1745
1770
|
resolveAccountId(partialId: import("../index.js").AccountId | import("../index.js").Bech32Address): import("../index.js").AccountId;
|
|
1746
1771
|
coerceCosmosAddress(partialId: import("../index.js").AccountIdArg | import("../index.js").Bech32Address): import("../index.js").CosmosChainAddress;
|
|
1747
1772
|
makeTransferRoute(destination: import("../index.js").AccountIdArg | import("../index.js").Bech32Address, denomAmount: import("../index.js").DenomAmount, srcChainName: string, forwardOpts?: import("../index.js").IBCMsgTransferOptions["forwardOpts"]): import("../index.js").TransferRoute;
|
|
1773
|
+
isEmpty(): boolean;
|
|
1748
1774
|
}>;
|
|
1749
1775
|
localchain: import("@endo/exo").Guarded<{
|
|
1750
1776
|
makeAccount(): import("@agoric/vow").PromiseVow<LocalChainAccount>;
|
|
@@ -1769,7 +1795,7 @@ export declare const setupOrchestrationTest: ({ log, }: {
|
|
|
1769
1795
|
utils: {
|
|
1770
1796
|
contractZone: import("@agoric/base-zone").Zone;
|
|
1771
1797
|
pourPayment: (amount: Amount<"nat">) => Promise<Payment<"nat">>;
|
|
1772
|
-
inspectLocalBridge: () =>
|
|
1798
|
+
inspectLocalBridge: () => BridgeObject[];
|
|
1773
1799
|
inspectDibcBridge: () => Promise<{
|
|
1774
1800
|
bridgeEvents: (import("@agoric/vats").IBCEvent<"channelOpenAck"> | import("@agoric/vats").IBCEvent<"acknowledgementPacket"> | import("@agoric/vats").IBCEvent<"channelCloseConfirm"> | import("@agoric/vats").IBCEvent<"sendPacket">)[];
|
|
1775
1801
|
bridgeDowncalls: (import("@agoric/vats").IBCMethod<"startChannelOpenInit"> | import("@agoric/vats").IBCMethod<"sendPacket"> | import("@agoric/vats").IBCMethod<"startChannelCloseInit"> | import("@agoric/vats").IBCMethod<"bindPort">)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-tests.d.ts","sourceRoot":"","sources":["contract-tests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAS3F,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"contract-tests.d.ts","sourceRoot":"","sources":["contract-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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwIZ,kGAAkG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA/InE,MAAM;qBAT9B,WAAW;sBACV,MAAM;;;wCA2DT,iBAAiB,CAAC,OAAO,CAAC,SAC1B,MAAM,GAAG;YAAE,OAAO,EAAE,WAAW,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,yBACnC,MAAM;;;EA4GhC,CAAC"}
|
package/tools/contract-tests.ts
CHANGED
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
} from '@agoric/vats';
|
|
15
15
|
import { prepareBridgeTargetModule } from '@agoric/vats/src/bridge-target.js';
|
|
16
16
|
import { makeWellKnownSpaces } from '@agoric/vats/src/core/utils.js';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
prepareLocalChainTools,
|
|
19
|
+
type AdditionalTransferPowers,
|
|
20
|
+
} from '@agoric/vats/src/localchain.js';
|
|
18
21
|
import { prepareTransferTools } from '@agoric/vats/src/transfer.js';
|
|
19
22
|
import { makeFakeBankManagerKit } from '@agoric/vats/tools/bank-utils.js';
|
|
20
23
|
import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';
|
|
@@ -28,7 +31,7 @@ import { makeHeapZone } from '@agoric/zone';
|
|
|
28
31
|
import { E } from '@endo/far';
|
|
29
32
|
import { objectMap } from '@endo/patterns';
|
|
30
33
|
import type { ExecutionContext } from 'ava';
|
|
31
|
-
import { withChainCapabilities } from '../index.js';
|
|
34
|
+
import { withChainCapabilities, type ChainInfo } from '../index.js';
|
|
32
35
|
import cctpChainInfo from '../src/cctp-chain-info.js';
|
|
33
36
|
import { registerKnownChains } from '../src/chain-info.js';
|
|
34
37
|
import { makeChainHub } from '../src/exos/chain-hub.js';
|
|
@@ -38,13 +41,20 @@ import { makeTestAddress } from './make-test-address.js';
|
|
|
38
41
|
|
|
39
42
|
export const ROOT_STORAGE_PATH = 'orchtest'; // Orchetration Contract Test
|
|
40
43
|
|
|
44
|
+
export interface BridgeObject {
|
|
45
|
+
type: string;
|
|
46
|
+
messages: any[];
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
/**
|
|
42
50
|
* Common setup for contract tests, without any specific asset configuration.
|
|
43
51
|
*/
|
|
44
52
|
export const setupOrchestrationTest = async ({
|
|
45
53
|
log,
|
|
54
|
+
chains,
|
|
46
55
|
}: {
|
|
47
56
|
log: ExecutionContext<any>['log'];
|
|
57
|
+
chains?: Record<string, ChainInfo>;
|
|
48
58
|
}) => {
|
|
49
59
|
// The common setup cannot support a durable zone because many of the fakes are not durable.
|
|
50
60
|
// They were made before we had durable kinds (and thus don't take a zone or baggage).
|
|
@@ -61,7 +71,11 @@ export const setupOrchestrationTest = async ({
|
|
|
61
71
|
});
|
|
62
72
|
// XXX real bankManager does this. fake should too?
|
|
63
73
|
// TODO https://github.com/Agoric/agoric-sdk/issues/9966
|
|
64
|
-
await makeWellKnownSpaces(agoricNamesAdmin, log, [
|
|
74
|
+
await makeWellKnownSpaces(agoricNamesAdmin, log, [
|
|
75
|
+
'installation',
|
|
76
|
+
'instance',
|
|
77
|
+
'vbankAsset',
|
|
78
|
+
]);
|
|
65
79
|
|
|
66
80
|
const vowTools = prepareSwingsetVowTools(rootZone.subZone('vows'));
|
|
67
81
|
|
|
@@ -84,26 +98,39 @@ export const setupOrchestrationTest = async ({
|
|
|
84
98
|
finisher.useRegistry(bridgeTargetKit.targetRegistry);
|
|
85
99
|
await E(transferBridge).initHandler(bridgeTargetKit.bridgeHandler);
|
|
86
100
|
|
|
87
|
-
const localBridgeLog: { obj:
|
|
101
|
+
const localBridgeLog: { obj: BridgeObject; result: any }[] = [];
|
|
88
102
|
const localchainBridge = makeFakeLocalchainBridge(
|
|
89
103
|
rootZone,
|
|
90
|
-
(obj, result) => localBridgeLog.push({ obj, result }),
|
|
104
|
+
(obj: BridgeObject, result) => localBridgeLog.push({ obj, result }),
|
|
91
105
|
makeTestAddress,
|
|
92
106
|
);
|
|
93
107
|
/** @returns {ReadonlyArray<any>} the input messages sent to the localchain bridge */
|
|
94
108
|
const inspectLocalBridge = () =>
|
|
95
109
|
harden(localBridgeLog.map(entry => entry.obj));
|
|
96
110
|
|
|
97
|
-
const
|
|
111
|
+
const powersForTransfer = rootZone.weakMapStore(
|
|
112
|
+
'powersForTransfer',
|
|
113
|
+
) as AdditionalTransferPowers;
|
|
114
|
+
const makeLocalChain = prepareLocalChainTools(
|
|
98
115
|
rootZone.subZone('localchain'),
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
{
|
|
117
|
+
...vowTools,
|
|
118
|
+
powersForTransfer,
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
const localchain = makeLocalChain({
|
|
101
122
|
bankManager,
|
|
102
123
|
system: localchainBridge,
|
|
103
124
|
transfer: transferMiddleware,
|
|
104
125
|
});
|
|
126
|
+
powersForTransfer.init(
|
|
127
|
+
transferMiddleware,
|
|
128
|
+
harden({ transferBridgeManager: transferBridge }),
|
|
129
|
+
);
|
|
130
|
+
|
|
105
131
|
const timer = buildZoeManualTimer(log);
|
|
106
|
-
const
|
|
132
|
+
const board = makeFakeBoard();
|
|
133
|
+
const marshaller = board.getPublishingMarshaller();
|
|
107
134
|
const storage = makeFakeStorageKit(ROOT_STORAGE_PATH);
|
|
108
135
|
|
|
109
136
|
const { portAllocator, setupIBCProtocol, ibcBridge } = setupFakeNetwork(
|
|
@@ -120,7 +147,8 @@ export const setupOrchestrationTest = async ({
|
|
|
120
147
|
portAllocator,
|
|
121
148
|
});
|
|
122
149
|
|
|
123
|
-
|
|
150
|
+
const chainsToRegister = chains || undefined;
|
|
151
|
+
await registerKnownChains(agoricNamesAdmin, () => {}, chainsToRegister);
|
|
124
152
|
|
|
125
153
|
type TransferMessageInfo = {
|
|
126
154
|
message: MsgTransfer;
|
|
@@ -245,6 +273,7 @@ export const setupOrchestrationTest = async ({
|
|
|
245
273
|
agoricNames,
|
|
246
274
|
agoricNamesAdmin,
|
|
247
275
|
bankManager,
|
|
276
|
+
board,
|
|
248
277
|
timer,
|
|
249
278
|
localchain,
|
|
250
279
|
cosmosInterchainService,
|
package/tools/ibc-mocks.d.ts
CHANGED
|
@@ -1,44 +1,56 @@
|
|
|
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
|
-
* Build a response "packet bytes string" we'd expect to see from a
|
|
18
|
-
* Response
|
|
19
|
-
*
|
|
20
|
-
* XXX support multiple responses in a single message
|
|
11
|
+
* Build a response "packet bytes string" we'd expect to see from a
|
|
12
|
+
* Response to a Tx carrying a single Msg.
|
|
21
13
|
*
|
|
22
|
-
* @
|
|
14
|
+
* @deprecated Use `buildTxResponseString([{ encoder, message }])` instead.
|
|
15
|
+
* @param encoder
|
|
23
16
|
* @param message
|
|
24
17
|
*/
|
|
25
|
-
export declare function buildMsgResponseString<T>(
|
|
18
|
+
export declare function buildMsgResponseString<T>(encoder: EncoderCommon<T>, message: Partial<T>): string;
|
|
19
|
+
type EncoderMessage<T> = {
|
|
20
|
+
encoder: EncoderCommon<T>;
|
|
21
|
+
message: Partial<T>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @param messages
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTxResponseString<T extends EncoderMessage<any>[]>(messages: T): string;
|
|
26
27
|
/**
|
|
27
28
|
* Build an example error packet for a failed Tx Msg
|
|
28
29
|
* @param msg
|
|
29
30
|
*/
|
|
30
31
|
export declare function buildMsgErrorString(msg?: string): string;
|
|
31
32
|
/**
|
|
32
|
-
* Build a response "packet bytes string" we'd expect to see from a Query
|
|
33
|
+
* Build a response "packet bytes string" we'd expect to see from a single Query
|
|
33
34
|
* request
|
|
34
35
|
*
|
|
35
|
-
*
|
|
36
|
+
* @deprecated Use `buildQueriesResponseString([{ encoder, query, opts }])` instead.
|
|
36
37
|
*
|
|
37
|
-
* @param
|
|
38
|
+
* @param encoder
|
|
38
39
|
* @param query
|
|
39
40
|
* @param opts
|
|
40
41
|
*/
|
|
41
|
-
export declare function buildQueryResponseString<T>(
|
|
42
|
+
export declare function buildQueryResponseString<T>(encoder: EncoderCommon<T>, query: Partial<T>, opts?: Partial<Omit<ResponseQueryType, 'key'>>): string;
|
|
43
|
+
/**
|
|
44
|
+
* Build a response "packet bytes string" we'd expect to see from
|
|
45
|
+
* the Responses corresponding to multiple Queries.
|
|
46
|
+
* @param queries
|
|
47
|
+
* @returns {string} base64 encoded string of the response packet
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildQueriesResponseString<T extends {
|
|
50
|
+
encoder: EncoderCommon<any>;
|
|
51
|
+
query: Partial<any>;
|
|
52
|
+
opts?: Partial<Omit<ResponseQueryType, 'key'>>;
|
|
53
|
+
}[]>(queries: T): string;
|
|
42
54
|
/**
|
|
43
55
|
* Build a tx packet string for the mocked dibc bridge handler
|
|
44
56
|
* @param msgs
|
|
@@ -54,14 +66,14 @@ export declare function buildTxPacketString(msgs: {
|
|
|
54
66
|
*
|
|
55
67
|
* @param b64 base64 encoded string
|
|
56
68
|
*/
|
|
57
|
-
export declare const parseOutgoingTxPacket: (b64: string) =>
|
|
69
|
+
export declare const parseOutgoingTxPacket: (b64: string) => TxBodyType;
|
|
58
70
|
/**
|
|
59
71
|
* Build a query packet string for the mocked dibc bridge handler
|
|
60
72
|
* @param msgs
|
|
61
73
|
* @param opts
|
|
62
74
|
* @returns {string}
|
|
63
75
|
*/
|
|
64
|
-
export declare function buildQueryPacketString(msgs:
|
|
76
|
+
export declare function buildQueryPacketString(msgs: AnyType[], opts?: Partial<Omit<RequestQueryType, 'path' | 'data'>>): string;
|
|
65
77
|
/**
|
|
66
78
|
* Fields that are common to every vtransfer IBC event.
|
|
67
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;A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E,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,13 +1,19 @@
|
|
|
1
1
|
/** @file Tools to support making IBC mocks */
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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';
|
|
6
12
|
import type { PacketSDKType } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
|
|
7
|
-
import { CosmosResponse } from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
13
|
+
import { CosmosResponse as CosmosResponseType } from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
8
14
|
import {
|
|
9
|
-
RequestQuery,
|
|
10
|
-
ResponseQuery,
|
|
15
|
+
type RequestQuery as RequestQueryType,
|
|
16
|
+
ResponseQuery as ResponseQueryType,
|
|
11
17
|
} from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
12
18
|
import {
|
|
13
19
|
IBC_EVENT,
|
|
@@ -24,46 +30,54 @@ import { atob, btoa, decodeBase64, encodeBase64 } from '@endo/base64';
|
|
|
24
30
|
import type { CosmosChainAddress, Denom } from '../src/orchestration-api.js';
|
|
25
31
|
import { makeQueryPacket, makeTxPacket } from '../src/utils/packet.js';
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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>;
|
|
34
41
|
|
|
35
42
|
const toPacket = (obj: Record<string, any>): string =>
|
|
36
43
|
btoa(JSON.stringify(obj));
|
|
37
44
|
|
|
38
45
|
/**
|
|
39
|
-
* Build a response "packet bytes string" we'd expect to see from a
|
|
40
|
-
* Response
|
|
41
|
-
*
|
|
42
|
-
* XXX support multiple responses in a single message
|
|
46
|
+
* Build a response "packet bytes string" we'd expect to see from a
|
|
47
|
+
* Response to a Tx carrying a single Msg.
|
|
43
48
|
*
|
|
44
|
-
* @
|
|
49
|
+
* @deprecated Use `buildTxResponseString([{ encoder, message }])` instead.
|
|
50
|
+
* @param encoder
|
|
45
51
|
* @param message
|
|
46
52
|
*/
|
|
47
53
|
export function buildMsgResponseString<T>(
|
|
48
|
-
|
|
54
|
+
encoder: EncoderCommon<T>,
|
|
49
55
|
message: Partial<T>,
|
|
50
56
|
): string {
|
|
51
|
-
|
|
57
|
+
return buildTxResponseString([{ encoder, message }] as const);
|
|
58
|
+
}
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
type EncoderMessage<T> = {
|
|
61
|
+
encoder: EncoderCommon<T>;
|
|
62
|
+
message: Partial<T>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param messages
|
|
67
|
+
*/
|
|
68
|
+
export function buildTxResponseString<T extends EncoderMessage<any>[]>(
|
|
69
|
+
messages: T,
|
|
70
|
+
): string {
|
|
71
|
+
const msgResponses = messages.map(({ encoder, message }) => {
|
|
72
|
+
return Any.fromPartial(CodecHelper(encoder).toProtoMsg(message));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const txMsgData = TxMsgData.toProto({
|
|
76
|
+
msgResponses,
|
|
77
|
+
});
|
|
64
78
|
|
|
65
79
|
return toPacket({
|
|
66
|
-
result: encodeBase64(
|
|
80
|
+
result: encodeBase64(txMsgData),
|
|
67
81
|
});
|
|
68
82
|
}
|
|
69
83
|
|
|
@@ -80,38 +94,43 @@ export function buildMsgErrorString(
|
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
/**
|
|
83
|
-
* Build a response "packet bytes string" we'd expect to see from a Query
|
|
97
|
+
* Build a response "packet bytes string" we'd expect to see from a single Query
|
|
84
98
|
* request
|
|
85
99
|
*
|
|
86
|
-
*
|
|
100
|
+
* @deprecated Use `buildQueriesResponseString([{ encoder, query, opts }])` instead.
|
|
87
101
|
*
|
|
88
|
-
* @param
|
|
102
|
+
* @param encoder
|
|
89
103
|
* @param query
|
|
90
104
|
* @param opts
|
|
91
105
|
*/
|
|
92
106
|
export function buildQueryResponseString<T>(
|
|
93
|
-
|
|
107
|
+
encoder: EncoderCommon<T>,
|
|
94
108
|
query: Partial<T>,
|
|
95
|
-
opts
|
|
96
|
-
value: new Uint8Array(),
|
|
97
|
-
height: 0n,
|
|
98
|
-
index: 0n,
|
|
99
|
-
code: 0,
|
|
100
|
-
log: '',
|
|
101
|
-
info: '',
|
|
102
|
-
codespace: '',
|
|
103
|
-
},
|
|
109
|
+
opts?: Partial<Omit<ResponseQueryType, 'key'>>,
|
|
104
110
|
): string {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
return buildQueriesResponseString([{ encoder, query, opts }] as const);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Build a response "packet bytes string" we'd expect to see from
|
|
116
|
+
* the Responses corresponding to multiple Queries.
|
|
117
|
+
* @param queries
|
|
118
|
+
* @returns {string} base64 encoded string of the response packet
|
|
119
|
+
*/
|
|
120
|
+
export function buildQueriesResponseString<
|
|
121
|
+
T extends {
|
|
122
|
+
encoder: EncoderCommon<any>;
|
|
123
|
+
query: Partial<any>;
|
|
124
|
+
opts?: Partial<Omit<ResponseQueryType, 'key'>>;
|
|
125
|
+
}[],
|
|
126
|
+
>(queries: T): string {
|
|
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;
|
|
113
132
|
}),
|
|
114
|
-
).finish();
|
|
133
|
+
}).finish();
|
|
115
134
|
|
|
116
135
|
return toPacket({
|
|
117
136
|
result: toPacket({ data: encodeBase64(encodedResp) }),
|
|
@@ -126,7 +145,7 @@ export function buildQueryResponseString<T>(
|
|
|
126
145
|
export function buildTxPacketString(
|
|
127
146
|
msgs: { value: Uint8Array; typeUrl: string }[],
|
|
128
147
|
): string {
|
|
129
|
-
return btoa(makeTxPacket(msgs.map(Any.toJSON)));
|
|
148
|
+
return btoa(makeTxPacket(msgs.map(m => Any.toJSON(m))));
|
|
130
149
|
}
|
|
131
150
|
|
|
132
151
|
/**
|
|
@@ -146,8 +165,8 @@ export const parseOutgoingTxPacket = (b64: string) => {
|
|
|
146
165
|
* @returns {string}
|
|
147
166
|
*/
|
|
148
167
|
export function buildQueryPacketString(
|
|
149
|
-
msgs:
|
|
150
|
-
opts: Partial<Omit<
|
|
168
|
+
msgs: AnyType[],
|
|
169
|
+
opts: Partial<Omit<RequestQueryType, 'path' | 'data'>> = {},
|
|
151
170
|
): string {
|
|
152
171
|
return btoa(makeQueryPacket(msgs.map(msg => toRequestQueryJson(msg, opts))));
|
|
153
172
|
}
|
|
@@ -274,7 +293,7 @@ export function buildVTransferEvent<P extends VTransferParams>(
|
|
|
274
293
|
packet: {
|
|
275
294
|
data: btoa(
|
|
276
295
|
JSON.stringify(
|
|
277
|
-
FungibleTokenPacketData.
|
|
296
|
+
FungibleTokenPacketData.toJSON({
|
|
278
297
|
amount: String(amount),
|
|
279
298
|
denom,
|
|
280
299
|
sender,
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @see {@link src/stubs/viem-abi.ts}
|
|
4
|
+
*/
|
|
5
|
+
import { defineConfig } from 'tsup';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
entry: ['src/stubs/viem-abi.ts'],
|
|
9
|
+
format: ['esm'],
|
|
10
|
+
outDir: 'src/vendor/viem',
|
|
11
|
+
target: 'es2020',
|
|
12
|
+
clean: true,
|
|
13
|
+
dts: true,
|
|
14
|
+
bundle: true,
|
|
15
|
+
platform: 'neutral',
|
|
16
|
+
external: [
|
|
17
|
+
'stream',
|
|
18
|
+
'crypto',
|
|
19
|
+
'http',
|
|
20
|
+
'https',
|
|
21
|
+
'zlib',
|
|
22
|
+
'net',
|
|
23
|
+
'tls',
|
|
24
|
+
'url',
|
|
25
|
+
],
|
|
26
|
+
});
|