@agoric/orchestration 0.1.1-dev-660fc46.0 → 0.1.1-dev-c8948c5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/orchestration",
3
- "version": "0.1.1-dev-660fc46.0+660fc46",
3
+ "version": "0.1.1-dev-c8948c5.0+c8948c5",
4
4
  "description": "Chain abstraction for Agoric's orchestration clients",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -105,5 +105,5 @@
105
105
  "typeCoverage": {
106
106
  "atLeast": 97.46
107
107
  },
108
- "gitHead": "660fc463854c0928366a79da4efb842e422f7a1f"
108
+ "gitHead": "c8948c5d1a88100f755b3e0c97131a1105f684ea"
109
109
  }
@@ -11,7 +11,9 @@ export function contract(zcf: ZCF, privateArgs: OrchestrationPowers & {
11
11
  invitationMakers: import("@endo/exo").Guarded<{
12
12
  makeEVMTransactionInvitation(method: any, args: any): Promise<globalThis.Invitation<string | void, undefined>>;
13
13
  }>;
14
- }>, undefined>>;
14
+ }>, {
15
+ gasAmount: bigint;
16
+ }>>;
15
17
  }>;
16
18
  creatorFacet: import("@endo/exo").Guarded<{
17
19
  registerChain(chainName: string, chainInfo: import("@agoric/orchestration").ChainInfo, ibcConnectionInfo?: import("@agoric/orchestration").IBCConnectionInfo): Promise<void>;
@@ -31,7 +33,9 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
31
33
  invitationMakers: import("@endo/exo").Guarded<{
32
34
  makeEVMTransactionInvitation(method: any, args: any): Promise<globalThis.Invitation<string | void, undefined>>;
33
35
  }>;
34
- }>, undefined>>;
36
+ }>, {
37
+ gasAmount: bigint;
38
+ }>>;
35
39
  }>;
36
40
  creatorFacet: import("@endo/exo").Guarded<{
37
41
  registerChain(chainName: string, chainInfo: import("@agoric/orchestration").ChainInfo, ibcConnectionInfo?: import("@agoric/orchestration").IBCConnectionInfo): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"axelar-gmp.contract.d.ts","sourceRoot":"","sources":["axelar-gmp.contract.js"],"names":[],"mappings":"AAiCO,8BAVI,GAAG,eACH,mBAAmB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC3D,WAAW,EAAE,OAAO,WAAW,CAAC,CAAC;CAClC,QACO,IAAI,oDACJ,kBAAkB;;;;;;;;;;;;GAyD5B;AAGD;gBAlEiB,UAAU;gBACV,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;gBAC/B,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE;iBAC7C,OAAO,WAAW,CAAC;;;;;;;;;;;;;GA+DY;yBA5E3B,aAAa;yCAHuB,0BAA0B;gCAE1C,0CAA0C;qCAD9B,uBAAuB;2BAAvB,uBAAuB;iCAAvB,uBAAuB;iCACnC,0CAA0C;4BAJtD,aAAa;0BACpB,cAAc;wCACqB,0BAA0B;yBAFtD,aAAa"}
1
+ {"version":3,"file":"axelar-gmp.contract.d.ts","sourceRoot":"","sources":["axelar-gmp.contract.js"],"names":[],"mappings":"AAiCO,8BAVI,GAAG,eACH,mBAAmB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC3D,WAAW,EAAE,OAAO,WAAW,CAAC,CAAC;CAClC,QACO,IAAI,oDACJ,kBAAkB;;;;;;;uBAkDK,MAAM;;;;;;;GAcvC;AAGD;gBAzEiB,UAAU;gBACV,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;gBAC/B,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE;iBAC7C,OAAO,WAAW,CAAC;;;;;;;;uBAqDH,MAAM;;;;;;;GAiBS;yBAnF3B,aAAa;yCAHuB,0BAA0B;gCAE1C,0CAA0C;qCAD9B,uBAAuB;2BAAvB,uBAAuB;iCAAvB,uBAAuB;iCACnC,0CAA0C;4BAJtD,aAAa;0BACpB,cAAc;wCACqB,0BAA0B;yBAFtD,aAAa"}
@@ -1,11 +1,11 @@
1
- import { M } from '@endo/patterns';
2
- import { E } from '@endo/far';
3
1
  import { makeTracer } from '@agoric/internal';
2
+ import { E } from '@endo/far';
3
+ import { M, mustMatch } from '@endo/patterns';
4
4
  import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
5
- import { withOrchestration } from '../utils/start-helper.js';
6
5
  import { registerChainsAndAssets } from '../utils/chain-hub-helper.js';
7
- import * as evmFlows from './axelar-gmp.flows.js';
6
+ import { withOrchestration } from '../utils/start-helper.js';
8
7
  import { prepareEvmAccountKit } from './axelar-gmp-account-kit.js';
8
+ import * as evmFlows from './axelar-gmp.flows.js';
9
9
 
10
10
  /**
11
11
  * @import {Remote, Vow} from '@agoric/vow';
@@ -77,7 +77,14 @@ export const contract = async (
77
77
  {
78
78
  createAndMonitorLCA() {
79
79
  return zcf.makeInvitation(
80
- createAndMonitorLCA,
80
+ /**
81
+ * @param {ZCFSeat} seat
82
+ * @param {{ gasAmount: bigint }} offerArgs
83
+ */
84
+ (seat, offerArgs) => {
85
+ mustMatch(offerArgs, M.splitRecord({ gasAmount: M.bigint() }));
86
+ return createAndMonitorLCA(seat, offerArgs);
87
+ },
81
88
  'makeAccount',
82
89
  undefined,
83
90
  );
@@ -4,7 +4,9 @@ export function createAndMonitorLCA(orch: Orchestrator, { makeEvmAccountKit, cha
4
4
  log: GuestOf<(msg: string) => Vow<void>>;
5
5
  localTransfer: GuestOf<(srcSeat: ZCFSeat, localAccount: LocalAccountMethods, amounts: AmountKeywordRecord) => Vow<void>>;
6
6
  withdrawToSeat: GuestOf<(localAccount: LocalAccountMethods, destSeat: ZCFSeat, amounts: AmountKeywordRecord) => Vow<void>>;
7
- }, seat: ZCFSeat): Promise<{
7
+ }, seat: ZCFSeat, offerArgs: {
8
+ gasAmount: bigint;
9
+ }): Promise<{
8
10
  invitationMakers: import("@endo/exo").Guarded<{
9
11
  makeEVMTransactionInvitation(method: any, args: any): Promise<globalThis.Invitation<string | void, undefined>>;
10
12
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"axelar-gmp.flows.d.ts","sourceRoot":"","sources":["axelar-gmp.flows.js"],"names":[],"mappings":"AAsDO,0CAtBI,YAAY,uEACZ;IACN,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,QAAQ,EAAE,eAAe,QAAQ,CAAC,CAAC;IACnC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;IACzC,aAAa,EAAE,QACnB,CACQ,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,mBAAmB,EACjC,OAAO,EAAE,mBAAmB,KACzB,IAAI,IAAI,CAAC,CACf,CAAC;IACF,cAAc,EAAE,QACpB,CACQ,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,mBAAmB,KACzB,IAAI,IAAI,CAAC,CACf,CAAC;CACH,QACO,OAAO;;;;GAsGjB;kCAvIiD,uBAAuB;uCACrC,6BAA6B;8BACtC,6CAA6C;oCAH9B,oBAAoB;yBAIxC,aAAa;6BAJO,oBAAoB;6BAKf,aAAa;yCACtB,uBAAuB;yCADd,aAAa"}
1
+ {"version":3,"file":"axelar-gmp.flows.d.ts","sourceRoot":"","sources":["axelar-gmp.flows.js"],"names":[],"mappings":"AAyDO,0CAzBI,YAAY,uEACZ;IACN,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,QAAQ,EAAE,eAAe,QAAQ,CAAC,CAAC;IACnC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;IACzC,aAAa,EAAE,QACnB,CACQ,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,mBAAmB,EACjC,OAAO,EAAE,mBAAmB,KACzB,IAAI,IAAI,CAAC,CACf,CAAC;IACF,cAAc,EAAE,QACpB,CACQ,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,mBAAmB,KACzB,IAAI,IAAI,CAAC,CACf,CAAC;CACH,QACO,OAAO,aACP;IACN,SAAS,EAAE,MAAM,CAAC;CACnB;;;;GAuGH;kCA3IiD,uBAAuB;uCACrC,6BAA6B;8BACtC,6CAA6C;oCAH9B,oBAAoB;yBAIxC,aAAa;6BAJO,oBAAoB;6BAKf,aAAa;yCACtB,uBAAuB;yCADd,aAAa"}
@@ -9,11 +9,11 @@
9
9
  * orchestration package.
10
10
  */
11
11
 
12
- import { Fail, makeError, q } from '@endo/errors';
13
12
  import { makeTracer, NonNullish } from '@agoric/internal';
14
- import { denomHash } from '../utils/denomHash.js';
15
- import { gmpAddresses } from '../utils/gmp.js';
13
+ import { Fail, makeError, q } from '@endo/errors';
16
14
  import { AxelarGMPMessageType } from '../axelar-types.js';
15
+ import { denomHash } from '../utils/denomHash.js';
16
+ import { buildGasPayload, gmpAddresses } from '../utils/gmp.js';
17
17
 
18
18
  /**
19
19
  * @import {GuestInterface, GuestOf} from '@agoric/async-flow';
@@ -51,11 +51,15 @@ const trace = makeTracer('EvmFlow');
51
51
  * >;
52
52
  * }} ctx
53
53
  * @param {ZCFSeat} seat
54
+ * @param {{
55
+ * gasAmount: bigint;
56
+ * }} offerArgs
54
57
  */
55
58
  export const createAndMonitorLCA = async (
56
59
  orch,
57
60
  { makeEvmAccountKit, chainHub, log, localTransfer, withdrawToSeat },
58
61
  seat,
62
+ offerArgs,
59
63
  ) => {
60
64
  void log('Inside createAndMonitorLCA');
61
65
  const [agoric, remoteChain] = await Promise.all([
@@ -117,7 +121,7 @@ export const createAndMonitorLCA = async (
117
121
  const memo = {
118
122
  destination_chain: 'Ethereum',
119
123
  destination_address: factoryContractAddress,
120
- payload: [],
124
+ payload: buildGasPayload(offerArgs.gasAmount),
121
125
  type: AxelarGMPMessageType.ContractCall,
122
126
  fee: {
123
127
  amount: '1', // TODO: Get fee amount from api
@@ -17,6 +17,7 @@ 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 function buildGasPayload(gasAmount: bigint): number[];
20
21
  export namespace networkConfigs {
21
22
  namespace devnet {
22
23
  let label: string;
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA9E+B,uBAAuB;kCADA,oBAAoB;4CAApB,oBAAoB"}
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,2CAHI,MAAM,GACJ,MAAM,EAAE,CASpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA3F+B,uBAAuB;kCADA,oBAAoB;4CAApB,oBAAoB"}
package/src/utils/gmp.js CHANGED
@@ -62,7 +62,7 @@ export const constructContractCall = ({ target, functionSignature, args }) => {
62
62
  * Builds a GMP payload from an array of contract calls.
63
63
  *
64
64
  * @param {ContractCall[]} contractCalls - Array of contract call objects.
65
- * @returns {number[]} The GMP payload object.
65
+ * @returns {number[]} The GMP payload array.
66
66
  */
67
67
  export const buildGMPPayload = contractCalls => {
68
68
  const abiEncodedContractCalls = [];
@@ -89,6 +89,19 @@ export const buildGMPPayload = contractCalls => {
89
89
  return Array.from(hexToBytes(abiEncodedData));
90
90
  };
91
91
 
92
+ /**
93
+ * @param {bigint} gasAmount - gas amount for the EVM to Agoric message
94
+ * @returns {number[]} The payload array.
95
+ */
96
+ export const buildGasPayload = gasAmount => {
97
+ const abiEncodedData = encodeAbiParameters(
98
+ [{ type: 'uint256' }],
99
+ [gasAmount],
100
+ );
101
+
102
+ return Array.from(hexToBytes(abiEncodedData));
103
+ };
104
+
92
105
  export const networkConfigs = {
93
106
  devnet: {
94
107
  label: 'Agoric Devnet',