@hyperlane-xyz/sdk 1.1.3 → 1.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 (170) hide show
  1. package/README.md +2 -2
  2. package/dist/HyperlaneApp.d.ts +7 -8
  3. package/dist/HyperlaneApp.d.ts.map +1 -1
  4. package/dist/HyperlaneApp.js +1 -4
  5. package/dist/HyperlaneApp.js.map +1 -1
  6. package/dist/consts/chainMetadata.d.ts +54 -25
  7. package/dist/consts/chainMetadata.d.ts.map +1 -1
  8. package/dist/consts/chainMetadata.js +65 -81
  9. package/dist/consts/chainMetadata.js.map +1 -1
  10. package/dist/consts/chains.d.ts +5 -5
  11. package/dist/consts/chains.d.ts.map +1 -1
  12. package/dist/consts/chains.js +5 -1
  13. package/dist/consts/chains.js.map +1 -1
  14. package/dist/consts/environments/index.d.ts +4 -2
  15. package/dist/consts/environments/index.d.ts.map +1 -1
  16. package/dist/consts/environments/mainnet.json +3 -1
  17. package/dist/core/HyperlaneCore.d.ts +10 -385
  18. package/dist/core/HyperlaneCore.d.ts.map +1 -1
  19. package/dist/core/HyperlaneCore.js +6 -11
  20. package/dist/core/HyperlaneCore.js.map +1 -1
  21. package/dist/core/HyperlaneCore.test.js +2 -3
  22. package/dist/core/HyperlaneCore.test.js.map +1 -1
  23. package/dist/core/TestCoreApp.d.ts +5 -5
  24. package/dist/core/TestCoreApp.d.ts.map +1 -1
  25. package/dist/core/TestCoreApp.js +2 -4
  26. package/dist/core/TestCoreApp.js.map +1 -1
  27. package/dist/core/TestCoreDeployer.d.ts +6 -6
  28. package/dist/core/TestCoreDeployer.d.ts.map +1 -1
  29. package/dist/core/TestCoreDeployer.js +1 -1
  30. package/dist/core/TestCoreDeployer.js.map +1 -1
  31. package/dist/core/testHyperlaneDeploy.hardhat-test.js +8 -12
  32. package/dist/core/testHyperlaneDeploy.hardhat-test.js.map +1 -1
  33. package/dist/deploy/HyperlaneAppChecker.d.ts +9 -7
  34. package/dist/deploy/HyperlaneAppChecker.d.ts.map +1 -1
  35. package/dist/deploy/HyperlaneAppChecker.js +32 -9
  36. package/dist/deploy/HyperlaneAppChecker.js.map +1 -1
  37. package/dist/deploy/HyperlaneDeployer.d.ts +15 -15
  38. package/dist/deploy/HyperlaneDeployer.d.ts.map +1 -1
  39. package/dist/deploy/HyperlaneDeployer.js +28 -35
  40. package/dist/deploy/HyperlaneDeployer.js.map +1 -1
  41. package/dist/deploy/core/HyperlaneCoreChecker.d.ts +9 -7
  42. package/dist/deploy/core/HyperlaneCoreChecker.d.ts.map +1 -1
  43. package/dist/deploy/core/HyperlaneCoreChecker.js +57 -3
  44. package/dist/deploy/core/HyperlaneCoreChecker.js.map +1 -1
  45. package/dist/deploy/core/HyperlaneCoreDeployer.d.ts +11 -11
  46. package/dist/deploy/core/HyperlaneCoreDeployer.d.ts.map +1 -1
  47. package/dist/deploy/core/HyperlaneCoreDeployer.js +12 -20
  48. package/dist/deploy/core/HyperlaneCoreDeployer.js.map +1 -1
  49. package/dist/deploy/core/types.d.ts +9 -1
  50. package/dist/deploy/core/types.d.ts.map +1 -1
  51. package/dist/deploy/core/types.js +1 -0
  52. package/dist/deploy/core/types.js.map +1 -1
  53. package/dist/deploy/middleware/LiquidityLayerApp.d.ts +17 -17
  54. package/dist/deploy/middleware/LiquidityLayerApp.d.ts.map +1 -1
  55. package/dist/deploy/middleware/LiquidityLayerApp.js +18 -23
  56. package/dist/deploy/middleware/LiquidityLayerApp.js.map +1 -1
  57. package/dist/deploy/middleware/LiquidityLayerRouterDeployer.d.ts +7 -7
  58. package/dist/deploy/middleware/LiquidityLayerRouterDeployer.d.ts.map +1 -1
  59. package/dist/deploy/middleware/LiquidityLayerRouterDeployer.js +6 -9
  60. package/dist/deploy/middleware/LiquidityLayerRouterDeployer.js.map +1 -1
  61. package/dist/deploy/middleware/deploy.d.ts +9 -9
  62. package/dist/deploy/middleware/deploy.d.ts.map +1 -1
  63. package/dist/deploy/middleware/deploy.js.map +1 -1
  64. package/dist/deploy/router/GasRouterDeployer.d.ts +12 -0
  65. package/dist/deploy/router/GasRouterDeployer.d.ts.map +1 -0
  66. package/dist/deploy/router/GasRouterDeployer.js +46 -0
  67. package/dist/deploy/router/GasRouterDeployer.js.map +1 -0
  68. package/dist/deploy/router/HyperlaneRouterChecker.d.ts +6 -6
  69. package/dist/deploy/router/HyperlaneRouterChecker.d.ts.map +1 -1
  70. package/dist/deploy/router/HyperlaneRouterChecker.js +2 -2
  71. package/dist/deploy/router/HyperlaneRouterChecker.js.map +1 -1
  72. package/dist/deploy/router/HyperlaneRouterDeployer.d.ts +7 -7
  73. package/dist/deploy/router/HyperlaneRouterDeployer.d.ts.map +1 -1
  74. package/dist/deploy/router/HyperlaneRouterDeployer.js +19 -22
  75. package/dist/deploy/router/HyperlaneRouterDeployer.js.map +1 -1
  76. package/dist/deploy/router/types.d.ts +5 -0
  77. package/dist/deploy/router/types.d.ts.map +1 -1
  78. package/dist/deploy/types.d.ts +9 -5
  79. package/dist/deploy/types.d.ts.map +1 -1
  80. package/dist/deploy/types.js +1 -0
  81. package/dist/deploy/types.js.map +1 -1
  82. package/dist/deploy/utils.d.ts +2 -6
  83. package/dist/deploy/utils.d.ts.map +1 -1
  84. package/dist/deploy/utils.js +1 -27
  85. package/dist/deploy/utils.js.map +1 -1
  86. package/dist/deploy/verify/ContractVerifier.d.ts +7 -7
  87. package/dist/deploy/verify/ContractVerifier.d.ts.map +1 -1
  88. package/dist/deploy/verify/ContractVerifier.js +2 -5
  89. package/dist/deploy/verify/ContractVerifier.js.map +1 -1
  90. package/dist/events.d.ts +4 -4
  91. package/dist/events.d.ts.map +1 -1
  92. package/dist/events.js +12 -9
  93. package/dist/events.js.map +1 -1
  94. package/dist/gas/calculator.d.ts +20 -20
  95. package/dist/gas/calculator.d.ts.map +1 -1
  96. package/dist/gas/calculator.hardhat-test.js +5 -4
  97. package/dist/gas/calculator.hardhat-test.js.map +1 -1
  98. package/dist/gas/calculator.js +9 -11
  99. package/dist/gas/calculator.js.map +1 -1
  100. package/dist/gas/calculator.test.js +2 -14
  101. package/dist/gas/calculator.test.js.map +1 -1
  102. package/dist/gas/token-prices.d.ts +4 -2
  103. package/dist/gas/token-prices.d.ts.map +1 -1
  104. package/dist/gas/token-prices.js +4 -2
  105. package/dist/gas/token-prices.js.map +1 -1
  106. package/dist/index.d.ts +30 -31
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +59 -66
  109. package/dist/index.js.map +1 -1
  110. package/dist/middleware/accounts.hardhat-test.js +23 -13
  111. package/dist/middleware/accounts.hardhat-test.js.map +1 -1
  112. package/dist/middleware/liquidity-layer.hardhat-test.js +10 -9
  113. package/dist/middleware/liquidity-layer.hardhat-test.js.map +1 -1
  114. package/dist/middleware/queries.hardhat-test.js +17 -13
  115. package/dist/middleware/queries.hardhat-test.js.map +1 -1
  116. package/dist/providers/MultiProvider.d.ts +186 -37
  117. package/dist/providers/MultiProvider.d.ts.map +1 -1
  118. package/dist/providers/MultiProvider.js +408 -63
  119. package/dist/providers/MultiProvider.js.map +1 -1
  120. package/dist/router.d.ts +11 -2
  121. package/dist/router.d.ts.map +1 -1
  122. package/dist/router.js +28 -0
  123. package/dist/router.js.map +1 -1
  124. package/dist/test/envSubsetDeployer/app.d.ts +12 -21
  125. package/dist/test/envSubsetDeployer/app.d.ts.map +1 -1
  126. package/dist/test/envSubsetDeployer/app.js +13 -18
  127. package/dist/test/envSubsetDeployer/app.js.map +1 -1
  128. package/dist/test/envSubsetDeployer/check-single-chain.js +1 -11
  129. package/dist/test/envSubsetDeployer/check-single-chain.js.map +1 -1
  130. package/dist/test/envSubsetDeployer/deploy-single-chain.js +3 -9
  131. package/dist/test/envSubsetDeployer/deploy-single-chain.js.map +1 -1
  132. package/dist/test/envSubsetDeployer/deploy.hardhat-test.js +4 -3
  133. package/dist/test/envSubsetDeployer/deploy.hardhat-test.js.map +1 -1
  134. package/dist/test/envSubsetDeployer/utils.d.ts +0 -3
  135. package/dist/test/envSubsetDeployer/utils.d.ts.map +1 -1
  136. package/dist/test/envSubsetDeployer/utils.js +2 -10
  137. package/dist/test/envSubsetDeployer/utils.js.map +1 -1
  138. package/dist/test/testUtils.d.ts +5 -1
  139. package/dist/test/testUtils.d.ts.map +1 -1
  140. package/dist/test/testUtils.js +8 -1
  141. package/dist/test/testUtils.js.map +1 -1
  142. package/dist/types.d.ts +2 -17
  143. package/dist/types.d.ts.map +1 -1
  144. package/dist/utils/MultiGeneric.d.ts +11 -12
  145. package/dist/utils/MultiGeneric.d.ts.map +1 -1
  146. package/dist/utils/MultiGeneric.js +3 -6
  147. package/dist/utils/MultiGeneric.js.map +1 -1
  148. package/dist/utils/wagmi.d.ts +4 -0
  149. package/dist/utils/wagmi.d.ts.map +1 -0
  150. package/dist/utils/wagmi.js +28 -0
  151. package/dist/utils/wagmi.js.map +1 -0
  152. package/logos/black/gnosis.svg +1 -0
  153. package/logos/color/gnosis.svg +1 -0
  154. package/package.json +5 -6
  155. package/dist/consts/chainConnectionConfigs.d.ts +0 -21
  156. package/dist/consts/chainConnectionConfigs.d.ts.map +0 -1
  157. package/dist/consts/chainConnectionConfigs.js +0 -35
  158. package/dist/consts/chainConnectionConfigs.js.map +0 -1
  159. package/dist/core/message.d.ts +0 -146
  160. package/dist/core/message.d.ts.map +0 -1
  161. package/dist/core/message.js +0 -285
  162. package/dist/core/message.js.map +0 -1
  163. package/dist/domains.d.ts +0 -4
  164. package/dist/domains.d.ts.map +0 -1
  165. package/dist/domains.js +0 -12
  166. package/dist/domains.js.map +0 -1
  167. package/dist/providers/ChainConnection.d.ts +0 -23
  168. package/dist/providers/ChainConnection.d.ts.map +0 -1
  169. package/dist/providers/ChainConnection.js +0 -67
  170. package/dist/providers/ChainConnection.js.map +0 -1
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.testChainConnectionConfigs = exports.chainConnectionConfigs = void 0;
4
- const ethers_1 = require("ethers");
5
- const celo_ethers_provider_1 = require("@hyperlane-xyz/celo-ethers-provider");
6
- const objects_1 = require("../utils/objects");
7
- const chainMetadata_1 = require("./chainMetadata");
8
- const chains_1 = require("./chains");
9
- function testChainConnection(id) {
10
- return {
11
- id,
12
- provider: new ethers_1.ethers.providers.JsonRpcProvider('http://localhost:8545', 31337),
13
- confirmations: 1,
14
- };
15
- }
16
- exports.chainConnectionConfigs = (0, objects_1.objMap)(chainMetadata_1.chainMetadata, (chainName, metadata) => {
17
- if (chains_1.TestChains.includes(chainName))
18
- return testChainConnection(metadata.id);
19
- const providerClass = chainName === chains_1.Chains.alfajores || chainName === chains_1.Chains.celo
20
- ? celo_ethers_provider_1.StaticCeloJsonRpcProvider
21
- : ethers_1.ethers.providers.JsonRpcProvider;
22
- return {
23
- id: metadata.id,
24
- provider: new providerClass(metadata.publicRpcUrls[0].http, metadata.id),
25
- confirmations: metadata.blocks.confirmations,
26
- blockExplorerUrl: metadata.blockExplorers[0].url,
27
- blockExplorerApiUrl: metadata.blockExplorers[0].apiUrl,
28
- };
29
- });
30
- exports.testChainConnectionConfigs = {
31
- test1: testChainConnection(chainMetadata_1.test1.id),
32
- test2: testChainConnection(chainMetadata_1.test2.id),
33
- test3: testChainConnection(chainMetadata_1.test3.id),
34
- };
35
- //# sourceMappingURL=chainConnectionConfigs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chainConnectionConfigs.js","sourceRoot":"","sources":["../../src/consts/chainConnectionConfigs.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,8EAAgF;AAGhF,8CAA0C;AAE1C,mDAAqE;AACrE,qCAA8C;AAE9C,SAAS,mBAAmB,CAAC,EAAU;IACrC,OAAO;QACL,EAAE;QACF,QAAQ,EAAE,IAAI,eAAM,CAAC,SAAS,CAAC,eAAe,CAC5C,uBAAuB,EACvB,KAAK,CACN;QACD,aAAa,EAAE,CAAC;KACjB,CAAC;AACJ,CAAC;AAEY,QAAA,sBAAsB,GACjC,IAAA,gBAAM,EAAC,6BAAa,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE;IAC5C,IAAI,mBAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE5E,MAAM,aAAa,GACjB,SAAS,KAAK,eAAM,CAAC,SAAS,IAAI,SAAS,KAAK,eAAM,CAAC,IAAI;QACzD,CAAC,CAAC,gDAAyB;QAC3B,CAAC,CAAC,eAAM,CAAC,SAAS,CAAC,eAAe,CAAC;IAEvC,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,QAAQ,EAAE,IAAI,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QACxE,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa;QAC5C,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG;QAChD,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM;KACvD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEQ,QAAA,0BAA0B,GAAG;IACxC,KAAK,EAAE,mBAAmB,CAAC,qBAAK,CAAC,EAAE,CAAC;IACpC,KAAK,EAAE,mBAAmB,CAAC,qBAAK,CAAC,EAAE,CAAC;IACpC,KAAK,EAAE,mBAAmB,CAAC,qBAAK,CAAC,EAAE,CAAC;CACrC,CAAC"}
@@ -1,146 +0,0 @@
1
- import { providers } from 'ethers';
2
- import { Mailbox } from '@hyperlane-xyz/core';
3
- import { types } from '@hyperlane-xyz/utils';
4
- import { MultiProvider } from '../providers/MultiProvider';
5
- import { ChainName, NameOrDomain } from '../types';
6
- import { HyperlaneCore } from './HyperlaneCore';
7
- import { AnnotatedDispatch, AnnotatedLifecycleEvent, AnnotatedProcess } from './events';
8
- export declare const resolveDomain: (nameOrDomain: NameOrDomain) => ChainName;
9
- export declare const resolveId: (nameOrDomain: NameOrDomain) => number;
10
- export declare const resolveChains: (message: types.ParsedMessage) => {
11
- origin: ChainName;
12
- destination: ChainName;
13
- };
14
- export declare type HyperlaneStatus = {
15
- status: MessageStatus;
16
- events: AnnotatedLifecycleEvent[];
17
- };
18
- export declare enum MessageStatus {
19
- Dispatched = 0,
20
- Included = 1,
21
- Relayed = 2,
22
- Processed = 3
23
- }
24
- export declare type EventCache = {
25
- process?: AnnotatedProcess;
26
- };
27
- /**
28
- * A deserialized Hyperlane message.
29
- */
30
- export declare class HyperlaneMessage {
31
- readonly dispatch: AnnotatedDispatch;
32
- readonly message: types.ParsedMessage;
33
- readonly outbox: Mailbox;
34
- readonly inbox: Mailbox;
35
- readonly multiProvider: MultiProvider;
36
- readonly core: HyperlaneCore;
37
- protected cache: EventCache;
38
- constructor(multiProvider: MultiProvider, core: HyperlaneCore, dispatch: AnnotatedDispatch);
39
- /**
40
- * The receipt of the TX that dispatched this message
41
- */
42
- get receipt(): providers.TransactionReceipt;
43
- /**
44
- * Instantiate one or more messages from a receipt.
45
- *
46
- * @param core the {@link HyperlaneCore} object to use
47
- * @param nameOrDomain the domain on which the receipt was logged
48
- * @param receipt the receipt
49
- * @returns an array of {@link HyperlaneMessage} objects
50
- */
51
- static fromReceipt(multiProvider: MultiProvider, core: HyperlaneCore, nameOrDomain: NameOrDomain, receipt: providers.TransactionReceipt): HyperlaneMessage[];
52
- /**
53
- * Instantiate EXACTLY one message from a receipt.
54
- *
55
- * @param core the {@link HyperlaneCore} object to use
56
- * @param nameOrDomain the domain on which the receipt was logged
57
- * @param receipt the receipt
58
- * @returns an array of {@link HyperlaneMessage} objects
59
- * @throws if there is not EXACTLY 1 dispatch in the receipt
60
- */
61
- static singleFromReceipt(multiProvider: MultiProvider, core: HyperlaneCore, nameOrDomain: NameOrDomain, receipt: providers.TransactionReceipt): HyperlaneMessage;
62
- /**
63
- * Instantiate one or more messages from a tx hash.
64
- *
65
- * @param core the {@link HyperlaneCore} object to use
66
- * @param nameOrDomain the domain on which the receipt was logged
67
- * @param receipt the receipt
68
- * @returns an array of {@link HyperlaneMessage} objects
69
- * @throws if there is no receipt for the TX
70
- */
71
- static fromTransactionHash(multiProvider: MultiProvider, core: HyperlaneCore, nameOrDomain: NameOrDomain, transactionHash: string): Promise<HyperlaneMessage[]>;
72
- /**
73
- * Instantiate EXACTLY one message from a transaction has.
74
- *
75
- * @param core the {@link HyperlaneCore} object to use
76
- * @param nameOrDomain the domain on which the receipt was logged
77
- * @param receipt the receipt
78
- * @returns an array of {@link HyperlaneMessage} objects
79
- * @throws if there is no receipt for the TX, or if not EXACTLY 1 dispatch in
80
- * the receipt
81
- */
82
- static singleFromTransactionHash(multiProvider: MultiProvider, core: HyperlaneCore, nameOrDomain: NameOrDomain, transactionHash: string): Promise<HyperlaneMessage>;
83
- /**
84
- * Get the Inbox `Process` event associated with this message (if any)
85
- *
86
- * @returns An {@link AnnotatedProcess} (if any)
87
- */
88
- getProcess(): Promise<AnnotatedProcess | undefined>;
89
- /**
90
- * Get all lifecycle events associated with this message
91
- *
92
- * @returns An array of {@link AnnotatedLifecycleEvent} objects
93
- */
94
- events(): Promise<HyperlaneStatus>;
95
- /**
96
- * Checks whether the message has been delivered.
97
- *
98
- * @returns true if processed, else false.
99
- */
100
- delivered(): Promise<boolean>;
101
- /**
102
- * Returns a promise that resolves when the message has been delivered.
103
- *
104
- * WARNING: May never resolve. Oftern takes hours to resolve.
105
- *
106
- * @param opts Polling options.
107
- */
108
- wait(opts?: {
109
- pollTime?: number;
110
- }): Promise<void>;
111
- /**
112
- * The domain from which the message was sent.
113
- */
114
- get origin(): number;
115
- get originName(): ChainName;
116
- /**
117
- * The identifier for the sender of this message
118
- */
119
- get sender(): string;
120
- /**
121
- * The destination domain for this message
122
- */
123
- get destination(): number;
124
- get destinationName(): ChainName;
125
- /**
126
- * The identifer for the recipient for this message
127
- */
128
- get recipient(): string;
129
- /**
130
- * The message body
131
- */
132
- get body(): string;
133
- /**
134
- * The keccak256 hash of the message body
135
- */
136
- get bodyHash(): string;
137
- /**
138
- * The hash of the transaction that dispatched this message
139
- */
140
- get transactionHash(): string;
141
- /**
142
- * The messageId committed to the tree in the Mailbox contract.
143
- */
144
- get id(): string;
145
- }
146
- //# sourceMappingURL=message.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/core/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAoB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAS,MAAM,sBAAsB,CAAC;AAIpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAGjB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,aAAa,iBAAkB,YAAY,KAAG,SAGzC,CAAC;AAEnB,eAAO,MAAM,SAAS,iBAAkB,YAAY,KAAG,MAGrC,CAAC;AAEnB,eAAO,MAAM,aAAa,YACf,MAAM,aAAa,KAC3B;IAAE,QAAQ,SAAS,CAAC;IAAC,WAAW,EAAE,SAAS,CAAA;CAK7C,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,uBAAuB,EAAE,CAAC;CACnC,CAAC;AAEF,oBAAY,aAAa;IACvB,UAAU,IAAI;IACd,QAAQ,IAAI;IACZ,OAAO,IAAI;IACX,SAAS,IAAI;CACd;AAED,oBAAY,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAIF;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,QAAQ,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ACG,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC;IAoBxC;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;;;;;OAMG;IACG,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvD;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,UAAU,IAAI,SAAS,CAE1B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,eAAe,IAAI,SAAS,CAE/B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAI,EAAE,IAAI,MAAM,CAEf;CACF"}
@@ -1,285 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HyperlaneMessage = exports.MessageStatus = exports.resolveChains = exports.resolveId = exports.resolveDomain = void 0;
13
- const ethers_1 = require("ethers");
14
- const core_1 = require("@hyperlane-xyz/core");
15
- const utils_1 = require("@hyperlane-xyz/utils");
16
- const domains_1 = require("../domains");
17
- const events_1 = require("../events");
18
- const time_1 = require("../utils/time");
19
- const resolveDomain = (nameOrDomain) => typeof nameOrDomain === 'number'
20
- ? domains_1.DomainIdToChainName[nameOrDomain]
21
- : nameOrDomain;
22
- exports.resolveDomain = resolveDomain;
23
- const resolveId = (nameOrDomain) => typeof nameOrDomain === 'string'
24
- ? domains_1.ChainNameToDomainId[nameOrDomain]
25
- : nameOrDomain;
26
- exports.resolveId = resolveId;
27
- const resolveChains = (message) => {
28
- return {
29
- origin: (0, exports.resolveDomain)(message.origin),
30
- destination: (0, exports.resolveDomain)(message.destination),
31
- };
32
- };
33
- exports.resolveChains = resolveChains;
34
- var MessageStatus;
35
- (function (MessageStatus) {
36
- MessageStatus[MessageStatus["Dispatched"] = 0] = "Dispatched";
37
- MessageStatus[MessageStatus["Included"] = 1] = "Included";
38
- MessageStatus[MessageStatus["Relayed"] = 2] = "Relayed";
39
- MessageStatus[MessageStatus["Processed"] = 3] = "Processed";
40
- })(MessageStatus = exports.MessageStatus || (exports.MessageStatus = {}));
41
- // TODO: move HyperlaneMessage into HyperlaneCore app
42
- /**
43
- * A deserialized Hyperlane message.
44
- */
45
- class HyperlaneMessage {
46
- constructor(multiProvider, core, dispatch) {
47
- this.multiProvider = multiProvider;
48
- this.core = core;
49
- this.message = utils_1.utils.parseMessage(dispatch.event.args.message);
50
- this.dispatch = dispatch;
51
- const messageChains = (0, exports.resolveChains)(this.message);
52
- this.outbox = core.getContracts(messageChains.origin).mailbox.contract;
53
- this.inbox = core.getContracts(messageChains.destination).mailbox.contract;
54
- this.cache = {};
55
- }
56
- /**
57
- * The receipt of the TX that dispatched this message
58
- */
59
- get receipt() {
60
- return this.dispatch.receipt;
61
- }
62
- /**
63
- * Instantiate one or more messages from a receipt.
64
- *
65
- * @param core the {@link HyperlaneCore} object to use
66
- * @param nameOrDomain the domain on which the receipt was logged
67
- * @param receipt the receipt
68
- * @returns an array of {@link HyperlaneMessage} objects
69
- */
70
- static fromReceipt(multiProvider, core, nameOrDomain, receipt) {
71
- const messages = [];
72
- const outbox = new core_1.Mailbox__factory().interface;
73
- const chain = (0, exports.resolveDomain)(nameOrDomain);
74
- const provider = multiProvider.getChainConnection(chain).provider;
75
- for (const log of receipt.logs) {
76
- try {
77
- const parsed = outbox.parseLog(log);
78
- if (parsed.name === 'Dispatch') {
79
- const dispatch = Object.assign(Object.assign({}, parsed), { getBlock: () => provider.getBlock(log.blockHash), getTransaction: () => provider.getTransaction(log.transactionHash), getTransactionReceipt: () => provider.getTransactionReceipt(log.transactionHash) });
80
- const annotated = new events_1.Annotated((0, exports.resolveId)(nameOrDomain), receipt, dispatch, true);
81
- annotated.event.blockNumber = annotated.receipt.blockNumber;
82
- const message = new HyperlaneMessage(multiProvider, core, annotated);
83
- messages.push(message);
84
- }
85
- }
86
- catch (e) {
87
- continue;
88
- }
89
- }
90
- return messages;
91
- }
92
- /**
93
- * Instantiate EXACTLY one message from a receipt.
94
- *
95
- * @param core the {@link HyperlaneCore} object to use
96
- * @param nameOrDomain the domain on which the receipt was logged
97
- * @param receipt the receipt
98
- * @returns an array of {@link HyperlaneMessage} objects
99
- * @throws if there is not EXACTLY 1 dispatch in the receipt
100
- */
101
- static singleFromReceipt(multiProvider, core, nameOrDomain, receipt) {
102
- const messages = HyperlaneMessage.fromReceipt(multiProvider, core, nameOrDomain, receipt);
103
- if (messages.length !== 1) {
104
- throw new Error('Expected single Dispatch in transaction');
105
- }
106
- return messages[0];
107
- }
108
- /**
109
- * Instantiate one or more messages from a tx hash.
110
- *
111
- * @param core the {@link HyperlaneCore} object to use
112
- * @param nameOrDomain the domain on which the receipt was logged
113
- * @param receipt the receipt
114
- * @returns an array of {@link HyperlaneMessage} objects
115
- * @throws if there is no receipt for the TX
116
- */
117
- static fromTransactionHash(multiProvider, core, nameOrDomain, transactionHash) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- const provider = multiProvider.getChainConnection((0, exports.resolveDomain)(nameOrDomain)).provider;
120
- const receipt = yield provider.getTransactionReceipt(transactionHash);
121
- if (!receipt) {
122
- throw new Error(`No receipt for ${transactionHash} on ${nameOrDomain}`);
123
- }
124
- return HyperlaneMessage.fromReceipt(multiProvider, core, nameOrDomain, receipt);
125
- });
126
- }
127
- /**
128
- * Instantiate EXACTLY one message from a transaction has.
129
- *
130
- * @param core the {@link HyperlaneCore} object to use
131
- * @param nameOrDomain the domain on which the receipt was logged
132
- * @param receipt the receipt
133
- * @returns an array of {@link HyperlaneMessage} objects
134
- * @throws if there is no receipt for the TX, or if not EXACTLY 1 dispatch in
135
- * the receipt
136
- */
137
- static singleFromTransactionHash(multiProvider, core, nameOrDomain, transactionHash) {
138
- return __awaiter(this, void 0, void 0, function* () {
139
- const provider = multiProvider.getChainConnection((0, exports.resolveDomain)(nameOrDomain)).provider;
140
- const receipt = yield provider.getTransactionReceipt(transactionHash);
141
- if (!receipt) {
142
- throw new Error(`No receipt for ${transactionHash} on ${nameOrDomain}`);
143
- }
144
- return HyperlaneMessage.singleFromReceipt(multiProvider, core, nameOrDomain, receipt);
145
- });
146
- }
147
- /**
148
- * Get the Inbox `Process` event associated with this message (if any)
149
- *
150
- * @returns An {@link AnnotatedProcess} (if any)
151
- */
152
- getProcess() {
153
- return __awaiter(this, void 0, void 0, function* () {
154
- // if we have already gotten the event,
155
- // return it without re-querying
156
- if (this.cache.process) {
157
- return this.cache.process;
158
- }
159
- // if not, attempt to query the event
160
- const processFilter = this.inbox.filters.Process(this.id);
161
- const processLogs = yield (0, events_1.findAnnotatedSingleEvent)(this.multiProvider, this.destinationName, this.inbox, processFilter);
162
- if (processLogs.length === 1) {
163
- // if event is returned, store it to the object
164
- this.cache.process = processLogs[0];
165
- }
166
- else if (processLogs.length > 1) {
167
- throw new Error('multiple inbox process for same message');
168
- }
169
- // return the process or undefined if it doesn't exist
170
- return this.cache.process;
171
- });
172
- }
173
- /**
174
- * Get all lifecycle events associated with this message
175
- *
176
- * @returns An array of {@link AnnotatedLifecycleEvent} objects
177
- */
178
- events() {
179
- return __awaiter(this, void 0, void 0, function* () {
180
- const events = [this.dispatch];
181
- // attempt to get Inbox process
182
- const process = yield this.getProcess();
183
- if (!process) {
184
- // NOTE: when this is the status, you may way to
185
- // query confirmAt() to check if challenge period
186
- // on the Inbox has elapsed or not
187
- return {
188
- status: MessageStatus.Relayed,
189
- events,
190
- };
191
- }
192
- events.push(process);
193
- return {
194
- status: MessageStatus.Processed,
195
- events,
196
- };
197
- });
198
- }
199
- /**
200
- * Checks whether the message has been delivered.
201
- *
202
- * @returns true if processed, else false.
203
- */
204
- delivered() {
205
- return __awaiter(this, void 0, void 0, function* () {
206
- return this.inbox.delivered(this.id);
207
- });
208
- }
209
- /**
210
- * Returns a promise that resolves when the message has been delivered.
211
- *
212
- * WARNING: May never resolve. Oftern takes hours to resolve.
213
- *
214
- * @param opts Polling options.
215
- */
216
- wait(opts) {
217
- var _a;
218
- return __awaiter(this, void 0, void 0, function* () {
219
- const interval = (_a = opts === null || opts === void 0 ? void 0 : opts.pollTime) !== null && _a !== void 0 ? _a : 5000;
220
- // sad spider face
221
- for (;;) {
222
- if (yield this.delivered()) {
223
- return;
224
- }
225
- yield (0, time_1.delay)(interval);
226
- }
227
- });
228
- }
229
- /**
230
- * The domain from which the message was sent.
231
- */
232
- get origin() {
233
- return this.message.origin;
234
- }
235
- get originName() {
236
- return (0, exports.resolveDomain)(this.origin);
237
- }
238
- /**
239
- * The identifier for the sender of this message
240
- */
241
- get sender() {
242
- return this.message.sender;
243
- }
244
- /**
245
- * The destination domain for this message
246
- */
247
- get destination() {
248
- return this.message.destination;
249
- }
250
- get destinationName() {
251
- return (0, exports.resolveDomain)(this.destination);
252
- }
253
- /**
254
- * The identifer for the recipient for this message
255
- */
256
- get recipient() {
257
- return this.message.recipient;
258
- }
259
- /**
260
- * The message body
261
- */
262
- get body() {
263
- return this.message.body;
264
- }
265
- /**
266
- * The keccak256 hash of the message body
267
- */
268
- get bodyHash() {
269
- return ethers_1.utils.keccak256(this.body);
270
- }
271
- /**
272
- * The hash of the transaction that dispatched this message
273
- */
274
- get transactionHash() {
275
- return this.dispatch.event.transactionHash;
276
- }
277
- /**
278
- * The messageId committed to the tree in the Mailbox contract.
279
- */
280
- get id() {
281
- return utils_1.utils.messageId(this.dispatch.event.args.message);
282
- }
283
- }
284
- exports.HyperlaneMessage = HyperlaneMessage;
285
- //# sourceMappingURL=message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/core/message.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAyD;AAEzD,8CAAgE;AAChE,gDAAoD;AAEpD,wCAAsE;AACtE,sCAAgE;AAGhE,wCAAsC;AAW/B,MAAM,aAAa,GAAG,CAAC,YAA0B,EAAa,EAAE,CACrE,OAAO,YAAY,KAAK,QAAQ;IAC9B,CAAC,CAAC,6BAAmB,CAAC,YAAY,CAAC;IACnC,CAAC,CAAC,YAAY,CAAC;AAHN,QAAA,aAAa,iBAGP;AAEZ,MAAM,SAAS,GAAG,CAAC,YAA0B,EAAU,EAAE,CAC9D,OAAO,YAAY,KAAK,QAAQ;IAC9B,CAAC,CAAC,6BAAmB,CAAC,YAAY,CAAC;IACnC,CAAC,CAAC,YAAY,CAAC;AAHN,QAAA,SAAS,aAGH;AAEZ,MAAM,aAAa,GAAG,CAC3B,OAA4B,EACmB,EAAE;IACjD,OAAO;QACL,MAAM,EAAE,IAAA,qBAAa,EAAC,OAAO,CAAC,MAAM,CAAC;QACrC,WAAW,EAAE,IAAA,qBAAa,EAAC,OAAO,CAAC,WAAW,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB;AAOF,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,6DAAc,CAAA;IACd,yDAAY,CAAA;IACZ,uDAAW,CAAA;IACX,2DAAa,CAAA;AACf,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB;AAMD,qDAAqD;AAErD;;GAE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AI,CAAC,SAAS,EAAE,EAAE;oBAC1B,OAAO;iBACR;gBACD,MAAM,IAAA,YAAK,EAAC,QAAQ,CAAC,CAAC;aACvB;;KACF;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAA,qBAAa,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IAClC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAA,qBAAa,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,cAAW,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAI,EAAE;QACJ,OAAO,aAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AA3TD,4CA2TC"}
package/dist/domains.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { LooseChainMap } from './types';
2
- export declare const DomainIdToChainName: Record<number, "polygon" | "alfajores" | "arbitrum" | "arbitrumgoerli" | "avalanche" | "bsc" | "bsctestnet" | "celo" | "ethereum" | "fuji" | "goerli" | "moonbasealpha" | "moonbeam" | "mumbai" | "optimism" | "optimismgoerli" | "gnosis" | "test1" | "test2" | "test3">;
3
- export declare const ChainNameToDomainId: LooseChainMap<number>;
4
- //# sourceMappingURL=domains.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,mBAAmB,2QAMF,CAAC;AAE/B,eAAO,MAAM,mBAAmB,uBAEN,CAAC"}
package/dist/domains.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChainNameToDomainId = exports.DomainIdToChainName = void 0;
4
- const chainMetadata_1 = require("./consts/chainMetadata");
5
- const chains_1 = require("./consts/chains");
6
- exports.DomainIdToChainName = Object.fromEntries(chains_1.AllChains.map((chain) => {
7
- if (!chainMetadata_1.chainMetadata[chain])
8
- throw new Error(`Chain metadata for ${chain} could not be found`);
9
- return [chainMetadata_1.chainMetadata[chain].id, chain];
10
- }));
11
- exports.ChainNameToDomainId = Object.fromEntries(chains_1.AllChains.map((chain) => [chain, chainMetadata_1.chainMetadata[chain].id]));
12
- //# sourceMappingURL=domains.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.js","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AACvD,4CAA4C;AAG/B,QAAA,mBAAmB,GAAG,MAAM,CAAC,WAAW,CACnD,kBAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;IACtB,IAAI,CAAC,6BAAa,CAAC,KAAK,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,qBAAqB,CAAC,CAAC;IACpE,OAAO,CAAC,6BAAa,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC,CAAC,CAC0B,CAAC;AAElB,QAAA,mBAAmB,GAAG,MAAM,CAAC,WAAW,CACnD,kBAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,6BAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAClC,CAAC"}
@@ -1,23 +0,0 @@
1
- import { Debugger } from 'debug';
2
- import { ethers } from 'ethers';
3
- import { IChainConnection } from '../types';
4
- export declare class ChainConnection {
5
- id: number;
6
- provider: ethers.providers.Provider;
7
- signer?: ethers.Signer;
8
- overrides: ethers.Overrides;
9
- confirmations: number;
10
- blockExplorerUrl: string;
11
- blockExplorerApiUrl: string;
12
- logger: Debugger;
13
- constructor(dc: IChainConnection);
14
- getConnection: () => ethers.providers.Provider | ethers.Signer;
15
- getAddress: () => Promise<string> | undefined;
16
- getTxUrl(response: ethers.providers.TransactionResponse): string;
17
- getAddressUrl(address?: string): Promise<string>;
18
- getApiUrl(): string;
19
- handleTx(tx: ethers.ContractTransaction | Promise<ethers.ContractTransaction>): Promise<ethers.ContractReceipt>;
20
- estimateGas(tx: ethers.PopulatedTransaction, from?: string): Promise<ethers.BigNumber>;
21
- sendTransaction(tx: ethers.PopulatedTransaction): Promise<ethers.ContractReceipt>;
22
- }
23
- //# sourceMappingURL=ChainConnection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChainConnection.d.ts","sourceRoot":"","sources":["../../src/providers/ChainConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAS,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,qBAAa,eAAe;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,QAAQ,CAAC;gBAEL,EAAE,EAAE,gBAAgB;IAWhC,aAAa,QAAO,OAAO,SAAS,CAAC,QAAQ,GAAG,OAAO,MAAM,CAC9B;IAE/B,UAAU,QAAO,QAAQ,MAAM,CAAC,GAAG,SAAS,CAA8B;IAE1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,mBAAmB,GAAG,MAAM;IAI1D,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMtD,SAAS,IAAI,MAAM;IAIb,QAAQ,CACZ,EAAE,EAAE,MAAM,CAAC,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,GACnE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC;IAU5B,WAAW,CACf,EAAE,EAAE,MAAM,CAAC,oBAAoB,EAC/B,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;IAYtB,eAAe,CACnB,EAAE,EAAE,MAAM,CAAC,oBAAoB,GAC9B,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC;CAWnC"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ChainConnection = void 0;
13
- const debug_1 = require("debug");
14
- class ChainConnection {
15
- constructor(dc) {
16
- var _a, _b, _c, _d;
17
- this.getConnection = () => { var _a; return (_a = this.signer) !== null && _a !== void 0 ? _a : this.provider; };
18
- this.getAddress = () => { var _a; return (_a = this.signer) === null || _a === void 0 ? void 0 : _a.getAddress(); };
19
- this.id = dc.id;
20
- this.provider = dc.provider;
21
- this.signer = dc.signer;
22
- this.overrides = (_a = dc.overrides) !== null && _a !== void 0 ? _a : {};
23
- this.confirmations = (_b = dc.confirmations) !== null && _b !== void 0 ? _b : 0;
24
- this.blockExplorerUrl = (_c = dc.blockExplorerUrl) !== null && _c !== void 0 ? _c : 'UNKNOWN_EXPLORER';
25
- this.blockExplorerApiUrl = (_d = dc.blockExplorerApiUrl) !== null && _d !== void 0 ? _d : this.blockExplorerUrl;
26
- this.logger = (0, debug_1.debug)('hyperlane:ChainConnection');
27
- }
28
- getTxUrl(response) {
29
- return `${this.blockExplorerUrl}/tx/${response.hash}`;
30
- }
31
- getAddressUrl(address) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- return `${this.blockExplorerUrl}/address/${address !== null && address !== void 0 ? address : (yield this.signer.getAddress())}`;
34
- });
35
- }
36
- getApiUrl() {
37
- return this.blockExplorerApiUrl + '/api';
38
- }
39
- handleTx(tx) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const response = yield tx;
42
- this.logger(`Pending ${this.getTxUrl(response)} (waiting ${this.confirmations} blocks for confirmation)`);
43
- return response.wait(this.confirmations);
44
- });
45
- }
46
- estimateGas(tx, from) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- let txFrom = from;
49
- if (!txFrom) {
50
- txFrom = yield this.getAddress();
51
- }
52
- return this.provider.estimateGas(Object.assign(Object.assign(Object.assign({}, tx), { from: txFrom }), this.overrides));
53
- });
54
- }
55
- sendTransaction(tx) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- if (!this.signer)
58
- throw new Error('no signer found');
59
- const from = yield this.signer.getAddress();
60
- const response = yield this.signer.sendTransaction(Object.assign(Object.assign(Object.assign({}, tx), { from }), this.overrides));
61
- this.logger(`sent tx ${response.hash}`);
62
- return this.handleTx(response);
63
- });
64
- }
65
- }
66
- exports.ChainConnection = ChainConnection;
67
- //# sourceMappingURL=ChainConnection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChainConnection.js","sourceRoot":"","sources":["../../src/providers/ChainConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAwC;AAKxC,MAAa,eAAe;IAU1B,YAAY,EAAoB;;QAWhC,kBAAa,GAAG,GAA8C,EAAE,WAC9D,OAAA,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,CAAC,QAAQ,CAAA,EAAA,CAAC;QAE/B,eAAU,GAAG,GAAgC,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,UAAU,EAAE,CAAA,EAAA,CAAC;QAbxE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,MAAA,EAAE,CAAC,SAAS,mCAAI,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,MAAA,EAAE,CAAC,aAAa,mCAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,MAAA,EAAE,CAAC,gBAAgB,mCAAI,kBAAkB,CAAC;QAClE,IAAI,CAAC,mBAAmB,GAAG,MAAA,EAAE,CAAC,mBAAmB,mCAAI,IAAI,CAAC,gBAAgB,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,IAAA,aAAK,EAAC,2BAA2B,CAAC,CAAC;I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