@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
package/src/utils/gmp.d.ts
CHANGED
|
@@ -17,39 +17,8 @@ export const gmpAddresses: {
|
|
|
17
17
|
};
|
|
18
18
|
export function constructContractCall({ target, functionSignature, args }: ContractCall): AbiEncodedContractCall;
|
|
19
19
|
export function buildGMPPayload(contractCalls: ContractCall[]): number[];
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
let label: string;
|
|
23
|
-
let url: string;
|
|
24
|
-
let rpc: string;
|
|
25
|
-
let api: string;
|
|
26
|
-
let chainId: string;
|
|
27
|
-
}
|
|
28
|
-
namespace emerynet {
|
|
29
|
-
let label_1: string;
|
|
30
|
-
export { label_1 as label };
|
|
31
|
-
let url_1: string;
|
|
32
|
-
export { url_1 as url };
|
|
33
|
-
let rpc_1: string;
|
|
34
|
-
export { rpc_1 as rpc };
|
|
35
|
-
let api_1: string;
|
|
36
|
-
export { api_1 as api };
|
|
37
|
-
let chainId_1: string;
|
|
38
|
-
export { chainId_1 as chainId };
|
|
39
|
-
}
|
|
40
|
-
namespace localhost {
|
|
41
|
-
let label_2: string;
|
|
42
|
-
export { label_2 as label };
|
|
43
|
-
let url_2: string;
|
|
44
|
-
export { url_2 as url };
|
|
45
|
-
let rpc_2: string;
|
|
46
|
-
export { rpc_2 as rpc };
|
|
47
|
-
let api_2: string;
|
|
48
|
-
export { api_2 as api };
|
|
49
|
-
let chainId_2: string;
|
|
50
|
-
export { chainId_2 as chainId };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
20
|
+
export function buildNoncePayload(nonce: bigint): number[];
|
|
21
|
+
export function buildGasPayload(gasAmount: bigint): number[];
|
|
53
22
|
export namespace EVM_CHAINS {
|
|
54
23
|
let Avalanche: string;
|
|
55
24
|
let Base: string;
|
package/src/utils/gmp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmp.d.ts","sourceRoot":"","sources":["gmp.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gmp.d.ts","sourceRoot":"","sources":["gmp.js"],"names":[],"mappings":";;;;;AAoBA;;;;;;GAMG;AACH,2BANU;IACL,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,aAAa,CAAC;IAC1B,gBAAgB,EAAE,aAAa,CAAC;CACjC,CAOF;AAQK,2EAHI,YAAY,GACV,sBAAsB,CAoBlC;AAQM,+CAHI,YAAY,EAAE,GACZ,MAAM,EAAE,CAyBpB;AAMM,yCAHI,MAAM,GACJ,MAAM,EAAE,CAMpB;AAMM,2CAHI,MAAM,GACJ,MAAM,EAAE,CASpB;;;;;;mCArG+B,uBAAuB;kCADA,oBAAoB;4CAApB,oBAAoB"}
|
package/src/utils/gmp.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fromHex } from '@cosmjs/encoding';
|
|
2
|
+
import {
|
|
3
|
+
encodeAbiParameters,
|
|
4
|
+
encodeFunctionData,
|
|
5
|
+
} from '../vendor/viem/viem-abi.js';
|
|
6
|
+
|
|
7
|
+
/** @param {string} hex */
|
|
8
|
+
const hexToBytes = hex => fromHex(hex.slice(2));
|
|
2
9
|
|
|
3
10
|
/**
|
|
4
11
|
* @import {ContractCall, AbiEncodedContractCall} from '../axelar-types.js';
|
|
@@ -55,7 +62,7 @@ export const constructContractCall = ({ target, functionSignature, args }) => {
|
|
|
55
62
|
* Builds a GMP payload from an array of contract calls.
|
|
56
63
|
*
|
|
57
64
|
* @param {ContractCall[]} contractCalls - Array of contract call objects.
|
|
58
|
-
* @returns {number[]} The GMP payload
|
|
65
|
+
* @returns {number[]} The GMP payload array.
|
|
59
66
|
*/
|
|
60
67
|
export const buildGMPPayload = contractCalls => {
|
|
61
68
|
const abiEncodedContractCalls = [];
|
|
@@ -82,28 +89,27 @@ export const buildGMPPayload = contractCalls => {
|
|
|
82
89
|
return Array.from(hexToBytes(abiEncodedData));
|
|
83
90
|
};
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
92
|
+
/**
|
|
93
|
+
* @param {bigint} nonce - gas amount for the EVM to Agoric message
|
|
94
|
+
* @returns {number[]} The payload array.
|
|
95
|
+
*/
|
|
96
|
+
export const buildNoncePayload = nonce => {
|
|
97
|
+
const abiEncodedData = encodeAbiParameters([{ type: 'uint256' }], [nonce]);
|
|
98
|
+
|
|
99
|
+
return Array.from(hexToBytes(abiEncodedData));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {bigint} gasAmount - gas amount for the EVM to Agoric message
|
|
104
|
+
* @returns {number[]} The payload array.
|
|
105
|
+
*/
|
|
106
|
+
export const buildGasPayload = gasAmount => {
|
|
107
|
+
const abiEncodedData = encodeAbiParameters(
|
|
108
|
+
[{ type: 'uint256' }],
|
|
109
|
+
[gasAmount],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
return Array.from(hexToBytes(abiEncodedData));
|
|
107
113
|
};
|
|
108
114
|
|
|
109
115
|
export const EVM_CHAINS = {
|
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
|
*/
|
|
@@ -28,6 +28,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
28
28
|
resolveAccountId(partialId: import("../orchestration-api.js").AccountId | import("../cosmos-api.js").Bech32Address): import("../orchestration-api.js").AccountId;
|
|
29
29
|
coerceCosmosAddress(partialId: import("../orchestration-api.js").AccountIdArg | import("../cosmos-api.js").Bech32Address): import("../orchestration-api.js").CosmosChainAddress;
|
|
30
30
|
makeTransferRoute(destination: import("../orchestration-api.js").AccountIdArg | import("../cosmos-api.js").Bech32Address, denomAmount: import("../orchestration-api.js").DenomAmount, srcChainName: string, forwardOpts?: import("../cosmos-api.js").IBCMsgTransferOptions["forwardOpts"]): import("../cosmos-api.js").TransferRoute;
|
|
31
|
+
isEmpty(): boolean;
|
|
31
32
|
}>;
|
|
32
33
|
vowTools: import("@agoric/vow").VowTools;
|
|
33
34
|
asyncFlowTools: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA2DO,0CARI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU,SAElB;IAA4D,mBAAmB,GAAvE,qBAAqB,CAAC,qBAAqB,CAAC;CACpD;+BAmGU,IAAI
|
|
1
|
+
{"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA2DO,0CARI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU,SAElB;IAA4D,mBAAmB,GAAvE,qBAAqB,CAAC,qBAAqB,CAAC;CACpD;+BAmGU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA5DX,CAAC;;;;;;;;;;;;;;;;;;;;;sBA2IqlX,CAAC;;;;;;;;;;;;;;;;;;;;EA9C5lX;AA+BM,kCAfgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IAC/B,UAAU,EAAE,UAAU,CAAC;CACvB,EACQ,CAAC,cACH,CACN,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EACZ,WAAW,EAAE,EAAE,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,SACP,qBAAqB,GACnB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAgBzE;kCA/MU;IACR,UAAU,EAAE,OAAO,UAAU,CAAC,CAAC;IAC/B,oBAAoB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,OAAO,WAAW,CAAC,CAAC;IAClC,YAAY,EAAE,OAAO,YAAY,CAAC,CAAC;IACnC,WAAW,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;;;;;;;;;;;;;0BAQU,OAAO;;iCAwJP,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;6BA/KzC,kBAAkB;0BAGrB,cAAc;gCALR,gCAAgC;4BAIpC,aAAa;6CAGI,2BAA2B;kCANtC,cAAc;6BAEnB,cAAc;6BAGd,gBAAgB"}
|