@hyperlane-xyz/sdk 14.1.0 → 14.2.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.
Files changed (75) hide show
  1. package/dist/ccip/consts.d.ts.map +1 -1
  2. package/dist/ccip/consts.js +0 -20
  3. package/dist/ccip/consts.js.map +1 -1
  4. package/dist/consts/multisigIsm.d.ts.map +1 -1
  5. package/dist/consts/multisigIsm.js +27 -22
  6. package/dist/consts/multisigIsm.js.map +1 -1
  7. package/dist/core/CosmosNativeCoreModule.d.ts +5 -5
  8. package/dist/core/CosmosNativeCoreModule.d.ts.map +1 -1
  9. package/dist/core/CosmosNativeCoreModule.js +10 -10
  10. package/dist/core/CosmosNativeCoreModule.js.map +1 -1
  11. package/dist/core/EvmCoreModule.d.ts +3 -1
  12. package/dist/core/EvmCoreModule.d.ts.map +1 -1
  13. package/dist/core/EvmCoreModule.hardhat-test.js +85 -1
  14. package/dist/core/EvmCoreModule.hardhat-test.js.map +1 -1
  15. package/dist/core/EvmCoreModule.js +32 -2
  16. package/dist/core/EvmCoreModule.js.map +1 -1
  17. package/dist/core/HyperlaneRelayer.d.ts +43 -0
  18. package/dist/core/HyperlaneRelayer.d.ts.map +1 -1
  19. package/dist/core/types.d.ts +724 -1
  20. package/dist/core/types.d.ts.map +1 -1
  21. package/dist/core/types.js.map +1 -1
  22. package/dist/deploy/proxy.d.ts +8 -0
  23. package/dist/deploy/proxy.d.ts.map +1 -1
  24. package/dist/deploy/proxy.js +21 -0
  25. package/dist/deploy/proxy.js.map +1 -1
  26. package/dist/hook/CosmosNativeHookModule.d.ts +3 -2
  27. package/dist/hook/CosmosNativeHookModule.d.ts.map +1 -1
  28. package/dist/hook/CosmosNativeHookModule.js +10 -10
  29. package/dist/hook/CosmosNativeHookModule.js.map +1 -1
  30. package/dist/hook/CosmosNativeHookReader.d.ts +2 -2
  31. package/dist/hook/CosmosNativeHookReader.d.ts.map +1 -1
  32. package/dist/hook/EvmHookModule.d.ts +6 -15
  33. package/dist/hook/EvmHookModule.d.ts.map +1 -1
  34. package/dist/hook/EvmHookModule.js +74 -71
  35. package/dist/hook/EvmHookModule.js.map +1 -1
  36. package/dist/hook/types.d.ts +318 -0
  37. package/dist/hook/types.d.ts.map +1 -1
  38. package/dist/hook/types.js +2 -2
  39. package/dist/hook/types.js.map +1 -1
  40. package/dist/hook/updates.d.ts +28 -0
  41. package/dist/hook/updates.d.ts.map +1 -0
  42. package/dist/hook/updates.js +34 -0
  43. package/dist/hook/updates.js.map +1 -0
  44. package/dist/ica/types.d.ts +86 -0
  45. package/dist/ica/types.d.ts.map +1 -1
  46. package/dist/index.d.ts +3 -2
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +3 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/ism/CosmosNativeIsmModule.d.ts +3 -2
  51. package/dist/ism/CosmosNativeIsmModule.d.ts.map +1 -1
  52. package/dist/ism/CosmosNativeIsmModule.js +12 -12
  53. package/dist/ism/CosmosNativeIsmModule.js.map +1 -1
  54. package/dist/router/types.d.ts +129 -0
  55. package/dist/router/types.d.ts.map +1 -1
  56. package/dist/token/CosmosNativeWarpModule.d.ts +95 -0
  57. package/dist/token/CosmosNativeWarpModule.d.ts.map +1 -0
  58. package/dist/token/CosmosNativeWarpModule.js +296 -0
  59. package/dist/token/CosmosNativeWarpModule.js.map +1 -0
  60. package/dist/token/EvmERC20WarpModule.d.ts +0 -17
  61. package/dist/token/EvmERC20WarpModule.d.ts.map +1 -1
  62. package/dist/token/EvmERC20WarpModule.js +19 -71
  63. package/dist/token/EvmERC20WarpModule.js.map +1 -1
  64. package/dist/token/adapters/StarknetTokenAdapter.js +2 -2
  65. package/dist/token/adapters/StarknetTokenAdapter.js.map +1 -1
  66. package/dist/token/cosmosnativeDeploy.d.ts +16 -0
  67. package/dist/token/cosmosnativeDeploy.d.ts.map +1 -0
  68. package/dist/token/cosmosnativeDeploy.js +58 -0
  69. package/dist/token/cosmosnativeDeploy.js.map +1 -0
  70. package/dist/token/deploy.d.ts.map +1 -1
  71. package/dist/token/deploy.js +1 -1
  72. package/dist/token/deploy.js.map +1 -1
  73. package/dist/token/types.d.ts +233 -1
  74. package/dist/token/types.d.ts.map +1 -1
  75. package/package.json +5 -5
@@ -137,14 +137,37 @@ export declare const MailboxClientConfigSchema: z.ZodObject<{
137
137
  gasPrice: z.ZodString;
138
138
  tokenExchangeRate: z.ZodString;
139
139
  tokenDecimals: z.ZodOptional<z.ZodNumber>;
140
+ typicalCost: z.ZodOptional<z.ZodObject<{
141
+ handleGasAmount: z.ZodNumber;
142
+ totalGasAmount: z.ZodNumber;
143
+ totalUsdCost: z.ZodNumber;
144
+ }, "strip", z.ZodTypeAny, {
145
+ handleGasAmount: number;
146
+ totalGasAmount: number;
147
+ totalUsdCost: number;
148
+ }, {
149
+ handleGasAmount: number;
150
+ totalGasAmount: number;
151
+ totalUsdCost: number;
152
+ }>>;
140
153
  }, "strip", z.ZodTypeAny, {
141
154
  gasPrice: string;
142
155
  tokenExchangeRate: string;
143
156
  tokenDecimals?: number | undefined;
157
+ typicalCost?: {
158
+ handleGasAmount: number;
159
+ totalGasAmount: number;
160
+ totalUsdCost: number;
161
+ } | undefined;
144
162
  }, {
145
163
  gasPrice: string;
146
164
  tokenExchangeRate: string;
147
165
  tokenDecimals?: number | undefined;
166
+ typicalCost?: {
167
+ handleGasAmount: number;
168
+ totalGasAmount: number;
169
+ totalUsdCost: number;
170
+ } | undefined;
148
171
  }>>;
149
172
  }, "strip", z.ZodTypeAny, {
150
173
  type: import("../hook/types.js").HookType.INTERCHAIN_GAS_PAYMASTER;
@@ -156,6 +179,11 @@ export declare const MailboxClientConfigSchema: z.ZodObject<{
156
179
  gasPrice: string;
157
180
  tokenExchangeRate: string;
158
181
  tokenDecimals?: number | undefined;
182
+ typicalCost?: {
183
+ handleGasAmount: number;
184
+ totalGasAmount: number;
185
+ totalUsdCost: number;
186
+ } | undefined;
159
187
  }>;
160
188
  ownerOverrides?: Record<string, string> | undefined;
161
189
  }, {
@@ -168,6 +196,11 @@ export declare const MailboxClientConfigSchema: z.ZodObject<{
168
196
  gasPrice: string;
169
197
  tokenExchangeRate: string;
170
198
  tokenDecimals?: number | undefined;
199
+ typicalCost?: {
200
+ handleGasAmount: number;
201
+ totalGasAmount: number;
202
+ totalUsdCost: number;
203
+ } | undefined;
171
204
  }>;
172
205
  ownerOverrides?: Record<string, string> | undefined;
173
206
  }>, z.ZodType<import("../hook/types.js").DomainRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").DomainRoutingHookConfig>, z.ZodType<import("../hook/types.js").FallbackRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").FallbackRoutingHookConfig>, z.ZodType<import("../hook/types.js").AmountRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").AmountRoutingHookConfig>, z.ZodType<import("../hook/types.js").AggregationHookConfig, z.ZodTypeDef, import("../hook/types.js").AggregationHookConfig>, z.ZodObject<{
@@ -359,6 +392,11 @@ export declare const MailboxClientConfigSchema: z.ZodObject<{
359
392
  gasPrice: string;
360
393
  tokenExchangeRate: string;
361
394
  tokenDecimals?: number | undefined;
395
+ typicalCost?: {
396
+ handleGasAmount: number;
397
+ totalGasAmount: number;
398
+ totalUsdCost: number;
399
+ } | undefined;
362
400
  }>;
363
401
  ownerOverrides?: Record<string, string> | undefined;
364
402
  } | {
@@ -447,6 +485,11 @@ export declare const MailboxClientConfigSchema: z.ZodObject<{
447
485
  gasPrice: string;
448
486
  tokenExchangeRate: string;
449
487
  tokenDecimals?: number | undefined;
488
+ typicalCost?: {
489
+ handleGasAmount: number;
490
+ totalGasAmount: number;
491
+ totalUsdCost: number;
492
+ } | undefined;
450
493
  }>;
451
494
  ownerOverrides?: Record<string, string> | undefined;
452
495
  } | {
@@ -624,14 +667,37 @@ export declare const RouterConfigSchema: z.ZodObject<{
624
667
  gasPrice: z.ZodString;
625
668
  tokenExchangeRate: z.ZodString;
626
669
  tokenDecimals: z.ZodOptional<z.ZodNumber>;
670
+ typicalCost: z.ZodOptional<z.ZodObject<{
671
+ handleGasAmount: z.ZodNumber;
672
+ totalGasAmount: z.ZodNumber;
673
+ totalUsdCost: z.ZodNumber;
674
+ }, "strip", z.ZodTypeAny, {
675
+ handleGasAmount: number;
676
+ totalGasAmount: number;
677
+ totalUsdCost: number;
678
+ }, {
679
+ handleGasAmount: number;
680
+ totalGasAmount: number;
681
+ totalUsdCost: number;
682
+ }>>;
627
683
  }, "strip", z.ZodTypeAny, {
628
684
  gasPrice: string;
629
685
  tokenExchangeRate: string;
630
686
  tokenDecimals?: number | undefined;
687
+ typicalCost?: {
688
+ handleGasAmount: number;
689
+ totalGasAmount: number;
690
+ totalUsdCost: number;
691
+ } | undefined;
631
692
  }, {
632
693
  gasPrice: string;
633
694
  tokenExchangeRate: string;
634
695
  tokenDecimals?: number | undefined;
696
+ typicalCost?: {
697
+ handleGasAmount: number;
698
+ totalGasAmount: number;
699
+ totalUsdCost: number;
700
+ } | undefined;
635
701
  }>>;
636
702
  }, "strip", z.ZodTypeAny, {
637
703
  type: import("../hook/types.js").HookType.INTERCHAIN_GAS_PAYMASTER;
@@ -643,6 +709,11 @@ export declare const RouterConfigSchema: z.ZodObject<{
643
709
  gasPrice: string;
644
710
  tokenExchangeRate: string;
645
711
  tokenDecimals?: number | undefined;
712
+ typicalCost?: {
713
+ handleGasAmount: number;
714
+ totalGasAmount: number;
715
+ totalUsdCost: number;
716
+ } | undefined;
646
717
  }>;
647
718
  ownerOverrides?: Record<string, string> | undefined;
648
719
  }, {
@@ -655,6 +726,11 @@ export declare const RouterConfigSchema: z.ZodObject<{
655
726
  gasPrice: string;
656
727
  tokenExchangeRate: string;
657
728
  tokenDecimals?: number | undefined;
729
+ typicalCost?: {
730
+ handleGasAmount: number;
731
+ totalGasAmount: number;
732
+ totalUsdCost: number;
733
+ } | undefined;
658
734
  }>;
659
735
  ownerOverrides?: Record<string, string> | undefined;
660
736
  }>, z.ZodType<import("../hook/types.js").DomainRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").DomainRoutingHookConfig>, z.ZodType<import("../hook/types.js").FallbackRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").FallbackRoutingHookConfig>, z.ZodType<import("../hook/types.js").AmountRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").AmountRoutingHookConfig>, z.ZodType<import("../hook/types.js").AggregationHookConfig, z.ZodTypeDef, import("../hook/types.js").AggregationHookConfig>, z.ZodObject<{
@@ -867,6 +943,11 @@ export declare const RouterConfigSchema: z.ZodObject<{
867
943
  gasPrice: string;
868
944
  tokenExchangeRate: string;
869
945
  tokenDecimals?: number | undefined;
946
+ typicalCost?: {
947
+ handleGasAmount: number;
948
+ totalGasAmount: number;
949
+ totalUsdCost: number;
950
+ } | undefined;
870
951
  }>;
871
952
  ownerOverrides?: Record<string, string> | undefined;
872
953
  } | {
@@ -964,6 +1045,11 @@ export declare const RouterConfigSchema: z.ZodObject<{
964
1045
  gasPrice: string;
965
1046
  tokenExchangeRate: string;
966
1047
  tokenDecimals?: number | undefined;
1048
+ typicalCost?: {
1049
+ handleGasAmount: number;
1050
+ totalGasAmount: number;
1051
+ totalUsdCost: number;
1052
+ } | undefined;
967
1053
  }>;
968
1054
  ownerOverrides?: Record<string, string> | undefined;
969
1055
  } | {
@@ -1140,14 +1226,37 @@ export declare const GasRouterConfigSchema: z.ZodObject<{
1140
1226
  gasPrice: z.ZodString;
1141
1227
  tokenExchangeRate: z.ZodString;
1142
1228
  tokenDecimals: z.ZodOptional<z.ZodNumber>;
1229
+ typicalCost: z.ZodOptional<z.ZodObject<{
1230
+ handleGasAmount: z.ZodNumber;
1231
+ totalGasAmount: z.ZodNumber;
1232
+ totalUsdCost: z.ZodNumber;
1233
+ }, "strip", z.ZodTypeAny, {
1234
+ handleGasAmount: number;
1235
+ totalGasAmount: number;
1236
+ totalUsdCost: number;
1237
+ }, {
1238
+ handleGasAmount: number;
1239
+ totalGasAmount: number;
1240
+ totalUsdCost: number;
1241
+ }>>;
1143
1242
  }, "strip", z.ZodTypeAny, {
1144
1243
  gasPrice: string;
1145
1244
  tokenExchangeRate: string;
1146
1245
  tokenDecimals?: number | undefined;
1246
+ typicalCost?: {
1247
+ handleGasAmount: number;
1248
+ totalGasAmount: number;
1249
+ totalUsdCost: number;
1250
+ } | undefined;
1147
1251
  }, {
1148
1252
  gasPrice: string;
1149
1253
  tokenExchangeRate: string;
1150
1254
  tokenDecimals?: number | undefined;
1255
+ typicalCost?: {
1256
+ handleGasAmount: number;
1257
+ totalGasAmount: number;
1258
+ totalUsdCost: number;
1259
+ } | undefined;
1151
1260
  }>>;
1152
1261
  }, "strip", z.ZodTypeAny, {
1153
1262
  type: import("../hook/types.js").HookType.INTERCHAIN_GAS_PAYMASTER;
@@ -1159,6 +1268,11 @@ export declare const GasRouterConfigSchema: z.ZodObject<{
1159
1268
  gasPrice: string;
1160
1269
  tokenExchangeRate: string;
1161
1270
  tokenDecimals?: number | undefined;
1271
+ typicalCost?: {
1272
+ handleGasAmount: number;
1273
+ totalGasAmount: number;
1274
+ totalUsdCost: number;
1275
+ } | undefined;
1162
1276
  }>;
1163
1277
  ownerOverrides?: Record<string, string> | undefined;
1164
1278
  }, {
@@ -1171,6 +1285,11 @@ export declare const GasRouterConfigSchema: z.ZodObject<{
1171
1285
  gasPrice: string;
1172
1286
  tokenExchangeRate: string;
1173
1287
  tokenDecimals?: number | undefined;
1288
+ typicalCost?: {
1289
+ handleGasAmount: number;
1290
+ totalGasAmount: number;
1291
+ totalUsdCost: number;
1292
+ } | undefined;
1174
1293
  }>;
1175
1294
  ownerOverrides?: Record<string, string> | undefined;
1176
1295
  }>, z.ZodType<import("../hook/types.js").DomainRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").DomainRoutingHookConfig>, z.ZodType<import("../hook/types.js").FallbackRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").FallbackRoutingHookConfig>, z.ZodType<import("../hook/types.js").AmountRoutingHookConfig, z.ZodTypeDef, import("../hook/types.js").AmountRoutingHookConfig>, z.ZodType<import("../hook/types.js").AggregationHookConfig, z.ZodTypeDef, import("../hook/types.js").AggregationHookConfig>, z.ZodObject<{
@@ -1377,6 +1496,11 @@ export declare const GasRouterConfigSchema: z.ZodObject<{
1377
1496
  gasPrice: string;
1378
1497
  tokenExchangeRate: string;
1379
1498
  tokenDecimals?: number | undefined;
1499
+ typicalCost?: {
1500
+ handleGasAmount: number;
1501
+ totalGasAmount: number;
1502
+ totalUsdCost: number;
1503
+ } | undefined;
1380
1504
  }>;
1381
1505
  ownerOverrides?: Record<string, string> | undefined;
1382
1506
  } | {
@@ -1476,6 +1600,11 @@ export declare const GasRouterConfigSchema: z.ZodObject<{
1476
1600
  gasPrice: string;
1477
1601
  tokenExchangeRate: string;
1478
1602
  tokenDecimals?: number | undefined;
1603
+ typicalCost?: {
1604
+ handleGasAmount: number;
1605
+ totalGasAmount: number;
1606
+ totalUsdCost: number;
1607
+ } | undefined;
1479
1608
  }>;
1480
1609
  ownerOverrides?: Record<string, string> | undefined;
1481
1610
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/router/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,MAAM,EACN,2BAA2B,EAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAa,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,a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;;;;EAO9B,CAAC;AAGF,eAAO,MAAM,oBAAoB,kEAGhC,CAAC;AACF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { SigningHyperlaneModuleClient } from '@hyperlane-xyz/cosmos-sdk';
2
+ import { Address, Domain, ProtocolType } from '@hyperlane-xyz/utils';
3
+ import { HyperlaneModule, HyperlaneModuleParams } from '../core/AbstractHyperlaneModule.js';
4
+ import { ChainMetadataManager } from '../metadata/ChainMetadataManager.js';
5
+ import { MultiProvider } from '../providers/MultiProvider.js';
6
+ import { AnnotatedCosmJsNativeTransaction } from '../providers/ProviderType.js';
7
+ import { ChainName, ChainNameOrId } from '../types.js';
8
+ import { CosmosNativeWarpRouteReader } from './CosmosNativeWarpRouteReader.js';
9
+ import { DerivedTokenRouterConfig, HypTokenRouterConfig } from './types.js';
10
+ type WarpRouteAddresses = {
11
+ deployedTokenRoute: Address;
12
+ };
13
+ export declare class CosmosNativeWarpModule extends HyperlaneModule<ProtocolType.CosmosNative, HypTokenRouterConfig, WarpRouteAddresses> {
14
+ protected readonly metadataManager: ChainMetadataManager;
15
+ protected readonly signer: SigningHyperlaneModuleClient;
16
+ protected logger: import("pino").default.Logger<never>;
17
+ reader: CosmosNativeWarpRouteReader;
18
+ readonly chainName: ChainName;
19
+ readonly chainId: string;
20
+ readonly domainId: Domain;
21
+ constructor(metadataManager: ChainMetadataManager, args: HyperlaneModuleParams<HypTokenRouterConfig, WarpRouteAddresses>, signer: SigningHyperlaneModuleClient);
22
+ /**
23
+ * Retrieves the token router configuration for the specified address.
24
+ *
25
+ * @param address - The address to derive the token router configuration from.
26
+ * @returns A promise that resolves to the token router configuration.
27
+ */
28
+ read(): Promise<DerivedTokenRouterConfig>;
29
+ /**
30
+ * Updates the Warp Route contract with the provided configuration.
31
+ *
32
+ * @param expectedConfig - The configuration for the token router to be updated.
33
+ * @returns An array of Cosmos transactions that were executed to update the contract, or an error if the update failed.
34
+ */
35
+ update(expectedConfig: HypTokenRouterConfig): Promise<AnnotatedCosmJsNativeTransaction[]>;
36
+ /**
37
+ * Create a transaction to update the remote routers for the Warp Route contract.
38
+ *
39
+ * @param actualConfig - The on-chain router configuration, including the remoteRouters array.
40
+ * @param expectedConfig - The expected token router configuration.
41
+ * @returns An array with Cosmos Native transactions that need to be executed to enroll the routers
42
+ */
43
+ createEnrollRemoteRoutersUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedCosmJsNativeTransaction[];
44
+ createUnenrollRemoteRoutersUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedCosmJsNativeTransaction[];
45
+ /**
46
+ * Create a transaction to update the remote routers for the Warp Route contract.
47
+ *
48
+ * @param actualConfig - The on-chain router configuration, including the remoteRouters array.
49
+ * @param expectedConfig - The expected token router configuration.
50
+ * @returns A array with Cosmos transactions that need to be executed to update the destination gas
51
+ */
52
+ createSetDestinationGasUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedCosmJsNativeTransaction[]>;
53
+ /**
54
+ * Create transactions to update an existing ISM config, or deploy a new ISM and return a tx to setInterchainSecurityModule
55
+ *
56
+ * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
57
+ * @param expectedConfig - The expected token router configuration, including the ISM configuration.
58
+ * @returns Cosmos transaction that need to be executed to update the ISM configuration.
59
+ */
60
+ createIsmUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedCosmJsNativeTransaction[]>;
61
+ /**
62
+ * Transfer ownership of an existing Warp route with a given config.
63
+ *
64
+ * @param actualConfig - The on-chain router configuration.
65
+ * @param expectedConfig - The expected token router configuration.
66
+ * @returns Cosmos transaction that need to be executed to update the owner.
67
+ */
68
+ createOwnershipUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedCosmJsNativeTransaction[];
69
+ /**
70
+ * Updates or deploys the ISM using the provided configuration.
71
+ *
72
+ * @returns Object with deployedIsm address, and update Transactions
73
+ */
74
+ deployOrUpdateIsm(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<{
75
+ deployedIsm: Address;
76
+ updateTransactions: AnnotatedCosmJsNativeTransaction[];
77
+ }>;
78
+ /**
79
+ * Deploys the Warp Route.
80
+ *
81
+ * @param chain - The chain to deploy the module on.
82
+ * @param config - The configuration for the token router.
83
+ * @param multiProvider - The multi-provider instance to use.
84
+ * @param signer - The Cosmos signing client
85
+ * @returns A new instance of the CosmosNativeWarpModule.
86
+ */
87
+ static create(params: {
88
+ chain: ChainNameOrId;
89
+ config: HypTokenRouterConfig;
90
+ multiProvider: MultiProvider;
91
+ signer: SigningHyperlaneModuleClient;
92
+ }): Promise<CosmosNativeWarpModule>;
93
+ }
94
+ export {};
95
+ //# sourceMappingURL=CosmosNativeWarpModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CosmosNativeWarpModule.d.ts","sourceRoot":"","sources":["../../src/token/CosmosNativeWarpModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,4BAA4B,EAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,OAAO,EACP,MAAM,EACN,YAAY,EAQb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,EACf,qBAAqB,EACtB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAEpB,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,eAAe,CACzD,YAAY,CAAC,YAAY,EACzB,oBAAoB,EACpB,kBAAkB,CACnB;IAUG,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,oBAAoB;IAExD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,4BAA4B;IAXzD,SAAS,CAAC,MAAM,uCAEb;IACH,MAAM,EAAE,2BAA2B,CAAC;IACpC,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAGZ,eAAe,EAAE,oBAAoB,EACxD,IAAI,EAAE,qBAAqB,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,EAClD,MAAM,EAAE,4BA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dk';
3
+ import { addressToBytes32, assert, deepEquals, difference, eqAddress, objMap, rootLogger, } from '@hyperlane-xyz/utils';
4
+ import { HyperlaneModule, } from '../core/AbstractHyperlaneModule.js';
5
+ import { CosmosNativeIsmModule } from '../ism/CosmosNativeIsmModule.js';
6
+ import { CosmosNativeWarpRouteReader } from './CosmosNativeWarpRouteReader.js';
7
+ import { CosmosNativeDeployer } from './cosmosnativeDeploy.js';
8
+ import { HypTokenRouterConfigSchema, } from './types.js';
9
+ export class CosmosNativeWarpModule extends HyperlaneModule {
10
+ metadataManager;
11
+ signer;
12
+ logger = rootLogger.child({
13
+ module: 'CosmosNativeWarpModule',
14
+ });
15
+ reader;
16
+ chainName;
17
+ chainId;
18
+ domainId;
19
+ constructor(metadataManager, args, signer) {
20
+ super(args);
21
+ this.metadataManager = metadataManager;
22
+ this.signer = signer;
23
+ this.reader = new CosmosNativeWarpRouteReader(metadataManager, args.chain, signer);
24
+ this.chainName = this.metadataManager.getChainName(args.chain);
25
+ this.chainId = metadataManager.getChainId(args.chain).toString();
26
+ this.domainId = metadataManager.getDomainId(args.chain);
27
+ }
28
+ /**
29
+ * Retrieves the token router configuration for the specified address.
30
+ *
31
+ * @param address - The address to derive the token router configuration from.
32
+ * @returns A promise that resolves to the token router configuration.
33
+ */
34
+ async read() {
35
+ return this.reader.deriveWarpRouteConfig(this.args.addresses.deployedTokenRoute);
36
+ }
37
+ /**
38
+ * Updates the Warp Route contract with the provided configuration.
39
+ *
40
+ * @param expectedConfig - The configuration for the token router to be updated.
41
+ * @returns An array of Cosmos transactions that were executed to update the contract, or an error if the update failed.
42
+ */
43
+ async update(expectedConfig) {
44
+ HypTokenRouterConfigSchema.parse(expectedConfig);
45
+ const actualConfig = await this.read();
46
+ const transactions = [];
47
+ /**
48
+ * @remark
49
+ * The order of operations matter
50
+ * 1. createOwnershipUpdateTxs() must always be LAST because no updates possible after ownership transferred
51
+ * 2. createRemoteRoutersUpdateTxs() must always be BEFORE createSetDestinationGasUpdateTxs() because gas enumeration depends on domains
52
+ */
53
+ transactions.push(...(await this.createIsmUpdateTxs(actualConfig, expectedConfig)), ...this.createEnrollRemoteRoutersUpdateTxs(actualConfig, expectedConfig), ...this.createUnenrollRemoteRoutersUpdateTxs(actualConfig, expectedConfig), ...(await this.createSetDestinationGasUpdateTxs(actualConfig, expectedConfig)), ...this.createOwnershipUpdateTxs(actualConfig, expectedConfig));
54
+ return transactions;
55
+ }
56
+ /**
57
+ * Create a transaction to update the remote routers for the Warp Route contract.
58
+ *
59
+ * @param actualConfig - The on-chain router configuration, including the remoteRouters array.
60
+ * @param expectedConfig - The expected token router configuration.
61
+ * @returns An array with Cosmos Native transactions that need to be executed to enroll the routers
62
+ */
63
+ createEnrollRemoteRoutersUpdateTxs(actualConfig, expectedConfig) {
64
+ const updateTransactions = [];
65
+ if (!expectedConfig.remoteRouters) {
66
+ return [];
67
+ }
68
+ assert(actualConfig.remoteRouters, 'actualRemoteRouters is undefined');
69
+ assert(expectedConfig.remoteRouters, 'expectedRemoteRouters is undefined');
70
+ const { remoteRouters: actualRemoteRouters } = actualConfig;
71
+ const { remoteRouters: expectedRemoteRouters } = expectedConfig;
72
+ const routesToEnroll = Object.entries(expectedRemoteRouters)
73
+ .filter(([domain, expectedRouter]) => {
74
+ const actualRouter = actualRemoteRouters[domain];
75
+ // Enroll if router doesn't exist for domain or has different address
76
+ return (!actualRouter ||
77
+ !eqAddress(actualRouter.address, expectedRouter.address));
78
+ })
79
+ .map(([domain]) => domain);
80
+ if (routesToEnroll.length === 0) {
81
+ return updateTransactions;
82
+ }
83
+ // in cosmos the gas is attached to the remote router. we set
84
+ // it to zero for now and set the real value later during the
85
+ // createSetDestinationGasUpdateTxs step
86
+ routesToEnroll.forEach((domainId) => {
87
+ updateTransactions.push({
88
+ annotation: `Enrolling Router ${this.args.addresses.deployedTokenRoute} on ${this.args.chain}`,
89
+ typeUrl: R.MsgEnrollRemoteRouter.proto.type,
90
+ value: R.MsgEnrollRemoteRouter.proto.converter.create({
91
+ owner: actualConfig.owner,
92
+ token_id: this.args.addresses.deployedTokenRoute,
93
+ remote_router: {
94
+ receiver_domain: parseInt(domainId),
95
+ receiver_contract: addressToBytes32(expectedRemoteRouters[domainId].address),
96
+ gas: '0',
97
+ },
98
+ }),
99
+ });
100
+ });
101
+ return updateTransactions;
102
+ }
103
+ createUnenrollRemoteRoutersUpdateTxs(actualConfig, expectedConfig) {
104
+ const updateTransactions = [];
105
+ if (!expectedConfig.remoteRouters) {
106
+ return [];
107
+ }
108
+ assert(actualConfig.remoteRouters, 'actualRemoteRouters is undefined');
109
+ assert(expectedConfig.remoteRouters, 'expectedRemoteRouters is undefined');
110
+ const { remoteRouters: actualRemoteRouters } = actualConfig;
111
+ const { remoteRouters: expectedRemoteRouters } = expectedConfig;
112
+ const routesToUnenroll = Array.from(difference(new Set(Object.keys(actualRemoteRouters)), new Set(Object.keys(expectedRemoteRouters))));
113
+ if (routesToUnenroll.length === 0) {
114
+ return updateTransactions;
115
+ }
116
+ routesToUnenroll.forEach((domainId) => {
117
+ updateTransactions.push({
118
+ annotation: `Unenrolling Router ${this.args.addresses.deployedTokenRoute} on ${this.args.chain}`,
119
+ typeUrl: R.MsgUnrollRemoteRouter.proto.type,
120
+ value: R.MsgUnrollRemoteRouter.proto.converter.create({
121
+ owner: actualConfig.owner,
122
+ token_id: this.args.addresses.deployedTokenRoute,
123
+ receiver_domain: parseInt(domainId),
124
+ }),
125
+ });
126
+ });
127
+ return updateTransactions;
128
+ }
129
+ /**
130
+ * Create a transaction to update the remote routers for the Warp Route contract.
131
+ *
132
+ * @param actualConfig - The on-chain router configuration, including the remoteRouters array.
133
+ * @param expectedConfig - The expected token router configuration.
134
+ * @returns A array with Cosmos transactions that need to be executed to update the destination gas
135
+ */
136
+ async createSetDestinationGasUpdateTxs(actualConfig, expectedConfig) {
137
+ const updateTransactions = [];
138
+ if (!expectedConfig.destinationGas) {
139
+ return [];
140
+ }
141
+ assert(actualConfig.destinationGas, 'actualDestinationGas is undefined');
142
+ assert(expectedConfig.destinationGas, 'expectedDestinationGas is undefined');
143
+ assert(expectedConfig.remoteRouters, 'expectedRemoteRouters is undefined');
144
+ const { destinationGas: actualDestinationGas } = actualConfig;
145
+ const { destinationGas: expectedDestinationGas } = expectedConfig;
146
+ const { remoteRouters: expectedRemoteRouters } = expectedConfig;
147
+ // refetch after routes have been previously enrolled without the "actualConfig"
148
+ // updating
149
+ const { remote_routers: actualRemoteRouters } = await this.signer.query.warp.RemoteRouters({
150
+ id: this.args.addresses.deployedTokenRoute,
151
+ });
152
+ const alreadyEnrolledDomains = actualRemoteRouters.map((router) => router.receiver_domain);
153
+ if (!deepEquals(actualDestinationGas, expectedDestinationGas)) {
154
+ // Convert { 1: 2, 2: 3, ... } to [{ 1: 2 }, { 2: 3 }]
155
+ const gasRouterConfigs = [];
156
+ objMap(expectedDestinationGas, (domain, gas) => {
157
+ gasRouterConfigs.push({
158
+ domain,
159
+ gas,
160
+ });
161
+ });
162
+ // in cosmos updating the gas config is done by unenrolling the router and then
163
+ // enrolling it with the updating value again
164
+ gasRouterConfigs.forEach(({ domain, gas }) => {
165
+ if (alreadyEnrolledDomains.includes(parseInt(domain))) {
166
+ updateTransactions.push({
167
+ annotation: `Unenrolling ${this.args.addresses.deployedTokenRoute} on ${this.args.chain}`,
168
+ typeUrl: R.MsgUnrollRemoteRouter.proto.type,
169
+ value: R.MsgUnrollRemoteRouter.proto.converter.create({
170
+ owner: actualConfig.owner,
171
+ token_id: this.args.addresses.deployedTokenRoute,
172
+ receiver_domain: parseInt(domain),
173
+ }),
174
+ });
175
+ }
176
+ updateTransactions.push({
177
+ annotation: `Setting destination gas for ${this.args.addresses.deployedTokenRoute} on ${this.args.chain}`,
178
+ typeUrl: R.MsgEnrollRemoteRouter.proto.type,
179
+ value: R.MsgEnrollRemoteRouter.proto.converter.create({
180
+ owner: actualConfig.owner,
181
+ token_id: this.args.addresses.deployedTokenRoute,
182
+ remote_router: {
183
+ receiver_domain: parseInt(domain),
184
+ receiver_contract: addressToBytes32(expectedRemoteRouters[domain].address),
185
+ gas,
186
+ },
187
+ }),
188
+ });
189
+ });
190
+ }
191
+ return updateTransactions;
192
+ }
193
+ /**
194
+ * Create transactions to update an existing ISM config, or deploy a new ISM and return a tx to setInterchainSecurityModule
195
+ *
196
+ * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address.
197
+ * @param expectedConfig - The expected token router configuration, including the ISM configuration.
198
+ * @returns Cosmos transaction that need to be executed to update the ISM configuration.
199
+ */
200
+ async createIsmUpdateTxs(actualConfig, expectedConfig) {
201
+ const updateTransactions = [];
202
+ if (!expectedConfig.interchainSecurityModule ||
203
+ expectedConfig.interchainSecurityModule === zeroAddress) {
204
+ return [];
205
+ }
206
+ const actualDeployedIsm = actualConfig.interchainSecurityModule.address;
207
+ // Try to update (may also deploy) Ism with the expected config
208
+ const { deployedIsm: expectedDeployedIsm, updateTransactions: ismUpdateTransactions, } = await this.deployOrUpdateIsm(actualConfig, expectedConfig);
209
+ // If an ISM is updated in-place, push the update txs
210
+ updateTransactions.push(...ismUpdateTransactions);
211
+ // If a new ISM is deployed, push the setInterchainSecurityModule tx
212
+ if (actualDeployedIsm !== expectedDeployedIsm) {
213
+ updateTransactions.push({
214
+ annotation: `Setting ISM for Warp Route to ${expectedDeployedIsm}`,
215
+ typeUrl: R.MsgSetToken.proto.type,
216
+ value: R.MsgSetToken.proto.converter.create({
217
+ owner: actualConfig.owner,
218
+ token_id: this.args.addresses.deployedTokenRoute,
219
+ ism_id: expectedDeployedIsm,
220
+ }),
221
+ });
222
+ }
223
+ return updateTransactions;
224
+ }
225
+ /**
226
+ * Transfer ownership of an existing Warp route with a given config.
227
+ *
228
+ * @param actualConfig - The on-chain router configuration.
229
+ * @param expectedConfig - The expected token router configuration.
230
+ * @returns Cosmos transaction that need to be executed to update the owner.
231
+ */
232
+ createOwnershipUpdateTxs(actualConfig, expectedConfig) {
233
+ if (eqAddress(actualConfig.owner, expectedConfig.owner)) {
234
+ return [];
235
+ }
236
+ return [
237
+ {
238
+ annotation: `Transferring ownership of ${this.args.addresses.deployedTokenRoute} from ${actualConfig.owner} to ${expectedConfig.owner}`,
239
+ typeUrl: R.MsgSetToken.proto.type,
240
+ value: R.MsgSetToken.proto.converter.create({
241
+ owner: actualConfig.owner,
242
+ token_id: this.args.addresses.deployedTokenRoute,
243
+ new_owner: expectedConfig.owner,
244
+ }),
245
+ },
246
+ ];
247
+ }
248
+ /**
249
+ * Updates or deploys the ISM using the provided configuration.
250
+ *
251
+ * @returns Object with deployedIsm address, and update Transactions
252
+ */
253
+ async deployOrUpdateIsm(actualConfig, expectedConfig) {
254
+ assert(expectedConfig.interchainSecurityModule, 'Ism derived incorrectly');
255
+ const ismModule = new CosmosNativeIsmModule(this.metadataManager, {
256
+ chain: this.args.chain,
257
+ config: expectedConfig.interchainSecurityModule,
258
+ addresses: {
259
+ ...this.args.addresses,
260
+ mailbox: expectedConfig.mailbox,
261
+ deployedIsm: actualConfig.interchainSecurityModule.address,
262
+ },
263
+ }, this.signer);
264
+ this.logger.info(`Comparing target ISM config with ${this.args.chain} chain`);
265
+ const updateTransactions = await ismModule.update(expectedConfig.interchainSecurityModule);
266
+ const { deployedIsm } = ismModule.serialize();
267
+ return { deployedIsm, updateTransactions };
268
+ }
269
+ /**
270
+ * Deploys the Warp Route.
271
+ *
272
+ * @param chain - The chain to deploy the module on.
273
+ * @param config - The configuration for the token router.
274
+ * @param multiProvider - The multi-provider instance to use.
275
+ * @param signer - The Cosmos signing client
276
+ * @returns A new instance of the CosmosNativeWarpModule.
277
+ */
278
+ static async create(params) {
279
+ const { chain, config, multiProvider, signer } = params;
280
+ const deployer = new CosmosNativeDeployer(multiProvider, {
281
+ [chain]: signer,
282
+ });
283
+ const { [chain]: deployedTokenRoute } = await deployer.deploy({
284
+ [chain]: config,
285
+ });
286
+ const warpModule = new CosmosNativeWarpModule(multiProvider, {
287
+ addresses: {
288
+ deployedTokenRoute,
289
+ },
290
+ chain,
291
+ config,
292
+ }, signer);
293
+ return warpModule;
294
+ }
295
+ }
296
+ //# sourceMappingURL=CosmosNativeWarpModule.js.map