@railgun-community/shared-models 3.8.0 → 3.9.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/dist/index.d.ts CHANGED
@@ -1,16 +1,2 @@
1
- export * from './models/artifact';
2
- export * from './models/blocked-address';
3
- export * from './models/fallback-provider';
4
- export * from './models/fee-token';
5
- export * from './models/function-types';
6
- export * from './models/merkletree-scan';
7
- export * from './models/network-config';
8
- export * from './models/proof';
9
- export * from './models/relayer';
10
- export * from './models/response-types';
11
- export * from './models/transaction';
12
- export * from './models/wallet';
13
- export * from './utils/compare';
14
- export * from './utils/error';
15
- export * from './utils/gas';
16
- export * from './utils/serializer';
1
+ export * from './models';
2
+ export * from './utils';
package/dist/index.js CHANGED
@@ -14,20 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  exports.__esModule = true;
17
- __exportStar(require("./models/artifact"), exports);
18
- __exportStar(require("./models/blocked-address"), exports);
19
- __exportStar(require("./models/fallback-provider"), exports);
20
- __exportStar(require("./models/fee-token"), exports);
21
- __exportStar(require("./models/function-types"), exports);
22
- __exportStar(require("./models/merkletree-scan"), exports);
23
- __exportStar(require("./models/network-config"), exports);
24
- __exportStar(require("./models/proof"), exports);
25
- __exportStar(require("./models/relayer"), exports);
26
- __exportStar(require("./models/response-types"), exports);
27
- __exportStar(require("./models/transaction"), exports);
28
- __exportStar(require("./models/wallet"), exports);
29
- __exportStar(require("./utils/compare"), exports);
30
- __exportStar(require("./utils/error"), exports);
31
- __exportStar(require("./utils/gas"), exports);
32
- __exportStar(require("./utils/serializer"), exports);
17
+ __exportStar(require("./models"), exports);
18
+ __exportStar(require("./utils"), exports);
33
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,6DAA2C;AAC3C,qDAAmC;AACnC,0DAAwC;AACxC,2DAAyC;AACzC,0DAAwC;AACxC,iDAA+B;AAC/B,mDAAiC;AACjC,0DAAwC;AACxC,uDAAqC;AACrC,kDAAgC;AAEhC,kDAAgC;AAChC,gDAA8B;AAC9B,8CAA4B;AAC5B,qDAAmC","sourcesContent":["export * from './models/artifact';\nexport * from './models/blocked-address';\nexport * from './models/fallback-provider';\nexport * from './models/fee-token';\nexport * from './models/function-types';\nexport * from './models/merkletree-scan';\nexport * from './models/network-config';\nexport * from './models/proof';\nexport * from './models/relayer';\nexport * from './models/response-types';\nexport * from './models/transaction';\nexport * from './models/wallet';\n\nexport * from './utils/compare';\nexport * from './utils/error';\nexport * from './utils/gas';\nexport * from './utils/serializer';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB","sourcesContent":["export * from './models';\nexport * from './utils';\n"]}
@@ -0,0 +1,12 @@
1
+ export * from './artifact';
2
+ export * from './blocked-address';
3
+ export * from './fallback-provider';
4
+ export * from './fee-token';
5
+ export * from './function-types';
6
+ export * from './merkletree-scan';
7
+ export * from './network-config';
8
+ export * from './proof';
9
+ export * from './relayer';
10
+ export * from './response-types';
11
+ export * from './transaction';
12
+ export * from './wallet';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ exports.__esModule = true;
17
+ __exportStar(require("./artifact"), exports);
18
+ __exportStar(require("./blocked-address"), exports);
19
+ __exportStar(require("./fallback-provider"), exports);
20
+ __exportStar(require("./fee-token"), exports);
21
+ __exportStar(require("./function-types"), exports);
22
+ __exportStar(require("./merkletree-scan"), exports);
23
+ __exportStar(require("./network-config"), exports);
24
+ __exportStar(require("./proof"), exports);
25
+ __exportStar(require("./relayer"), exports);
26
+ __exportStar(require("./response-types"), exports);
27
+ __exportStar(require("./transaction"), exports);
28
+ __exportStar(require("./wallet"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,oDAAkC;AAClC,sDAAoC;AACpC,8CAA4B;AAC5B,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,0CAAwB;AACxB,4CAA0B;AAC1B,mDAAiC;AACjC,gDAA8B;AAC9B,2CAAyB","sourcesContent":["export * from './artifact';\nexport * from './blocked-address';\nexport * from './fallback-provider';\nexport * from './fee-token';\nexport * from './function-types';\nexport * from './merkletree-scan';\nexport * from './network-config';\nexport * from './proof';\nexport * from './relayer';\nexport * from './response-types';\nexport * from './transaction';\nexport * from './wallet';\n"]}
@@ -1,13 +1,9 @@
1
- import { Chain } from './response-types';
2
- /**
3
- * DO NOT CHANGE THESE ENUM STRINGS.
4
- */
1
+ import { Chain, EVMGasType } from './response-types';
5
2
  export declare enum NetworkName {
6
3
  Railgun = "Railgun",
7
4
  Ethereum = "Ethereum",
8
5
  BNBChain = "BNB_Chain",
9
6
  Polygon = "Polygon",
10
- Arbitrum = "Arbitrum",
11
7
  EthereumRopsten_DEPRECATED = "Ethereum_Ropsten",
12
8
  EthereumGoerli = "Ethereum_Goerli",
13
9
  PolygonMumbai = "Polygon_Mumbai",
@@ -45,7 +41,6 @@ export declare enum RailgunProxyContract {
45
41
  Ethereum = "0xfa7093cdd9ee6932b4eb2c9e1cde7ce00b1fa4b9",
46
42
  BNBChain = "0x590162bf4b50f6576a459b75309ee21d92178a10",
47
43
  PolygonPOS = "0x19b620929f97b7b990801496c3b361ca5def8c71",
48
- Arbitrum = "",
49
44
  EthereumRopsten = "",
50
45
  EthereumGoerli = "0xe8bEa99BB438C2f3D533604D33258d74d5eE4824",
51
46
  PolygonMumbai = "0x3ee8306321d992483BDC9c69B8F622Ba3FFF05B6",
@@ -56,7 +51,6 @@ export declare enum RelayAdaptContract {
56
51
  Ethereum = "0x4025ee6512DBbda97049Bcf5AA5D38C54aF6bE8a",
57
52
  BNBChain = "0x741936fb83DDf324636D3048b3E6bC800B8D9e12",
58
53
  PolygonPOS = "0xc7FfA542736321A3dd69246d73987566a5486968",
59
- Arbitrum = "",
60
54
  EthereumRopsten = "",
61
55
  EthereumGoerli = "0x14a57CA7C5c1AD54fB6c642f428d973fcD696ED4",
62
56
  PolygonMumbai = "0x17D36875D723Cf0dA250d404Ef4cA0aABE105837",
@@ -67,7 +61,6 @@ export declare enum RailgunProxyDeploymentBlock {
67
61
  Ethereum = 14737691,
68
62
  BNBChain = 17633701,
69
63
  PolygonPOS = 28083766,
70
- Arbitrum = 0,
71
64
  EthereumRopsten = 12226000,
72
65
  EthereumGoerli = 7795991,
73
66
  PolygonMumbai = 28697343,
@@ -78,24 +71,13 @@ export declare enum BaseTokenWrappedAddress {
78
71
  EthereumWETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
79
72
  BinanceWBNB = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
80
73
  PolygonWMATIC = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
81
- ArbitrumWETH = "",
82
74
  EthereumRopstenWETH = "0xc778417e063141139fce010982780140aa0cd5ab",
83
75
  EthereumGoerliWETH = "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6",
84
76
  PolygonMumbaiWMATIC = "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889",
85
77
  ArbitrumGoerliWETH = "0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3",
86
78
  HardhatWETH = "0x09635F643e140090A9A8Dcd712eD6285858ceBef"
87
79
  }
88
- /**
89
- * Type0 / Type1 = non-EIP-1559 (gasPrice).
90
- * Type2 = EIP-1559 (maxFeePerGas and maxPriorityFeePerGas).
91
- */
92
- export declare enum EVMGasType {
93
- Type0 = 0,
94
- Type1 = 1,
95
- Type2 = 2
96
- }
97
80
  export declare const NETWORK_CONFIG: {
98
81
  [name in NetworkName]: Network;
99
82
  };
100
- export declare const networkForChain: (chain: Chain) => Optional<Network>;
101
83
  export {};
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  exports.__esModule = true;
4
- exports.networkForChain = exports.NETWORK_CONFIG = exports.EVMGasType = exports.BaseTokenWrappedAddress = exports.RailgunProxyDeploymentBlock = exports.RelayAdaptContract = exports.RailgunProxyContract = exports.NetworkName = void 0;
4
+ exports.NETWORK_CONFIG = exports.BaseTokenWrappedAddress = exports.RailgunProxyDeploymentBlock = exports.RelayAdaptContract = exports.RailgunProxyContract = exports.NetworkName = void 0;
5
5
  var response_types_1 = require("./response-types");
6
- /**
7
- * DO NOT CHANGE THESE ENUM STRINGS.
8
- */
9
6
  var NetworkName;
10
7
  (function (NetworkName) {
11
8
  // Mainnets
@@ -13,7 +10,7 @@ var NetworkName;
13
10
  NetworkName["Ethereum"] = "Ethereum";
14
11
  NetworkName["BNBChain"] = "BNB_Chain";
15
12
  NetworkName["Polygon"] = "Polygon";
16
- NetworkName["Arbitrum"] = "Arbitrum";
13
+ // Arbitrum = 'Arbitrum',
17
14
  // Testnets
18
15
  NetworkName["EthereumRopsten_DEPRECATED"] = "Ethereum_Ropsten";
19
16
  NetworkName["EthereumGoerli"] = "Ethereum_Goerli";
@@ -27,7 +24,6 @@ var RailgunProxyContract;
27
24
  RailgunProxyContract["Ethereum"] = "0xfa7093cdd9ee6932b4eb2c9e1cde7ce00b1fa4b9";
28
25
  RailgunProxyContract["BNBChain"] = "0x590162bf4b50f6576a459b75309ee21d92178a10";
29
26
  RailgunProxyContract["PolygonPOS"] = "0x19b620929f97b7b990801496c3b361ca5def8c71";
30
- RailgunProxyContract["Arbitrum"] = "";
31
27
  // Test nets
32
28
  RailgunProxyContract["EthereumRopsten"] = "";
33
29
  RailgunProxyContract["EthereumGoerli"] = "0xe8bEa99BB438C2f3D533604D33258d74d5eE4824";
@@ -40,7 +36,6 @@ var RelayAdaptContract;
40
36
  RelayAdaptContract["Ethereum"] = "0x4025ee6512DBbda97049Bcf5AA5D38C54aF6bE8a";
41
37
  RelayAdaptContract["BNBChain"] = "0x741936fb83DDf324636D3048b3E6bC800B8D9e12";
42
38
  RelayAdaptContract["PolygonPOS"] = "0xc7FfA542736321A3dd69246d73987566a5486968";
43
- RelayAdaptContract["Arbitrum"] = "";
44
39
  // Test nets
45
40
  RelayAdaptContract["EthereumRopsten"] = "";
46
41
  RelayAdaptContract["EthereumGoerli"] = "0x14a57CA7C5c1AD54fB6c642f428d973fcD696ED4";
@@ -53,7 +48,6 @@ var RailgunProxyDeploymentBlock;
53
48
  RailgunProxyDeploymentBlock[RailgunProxyDeploymentBlock["Ethereum"] = 14737691] = "Ethereum";
54
49
  RailgunProxyDeploymentBlock[RailgunProxyDeploymentBlock["BNBChain"] = 17633701] = "BNBChain";
55
50
  RailgunProxyDeploymentBlock[RailgunProxyDeploymentBlock["PolygonPOS"] = 28083766] = "PolygonPOS";
56
- RailgunProxyDeploymentBlock[RailgunProxyDeploymentBlock["Arbitrum"] = 0] = "Arbitrum";
57
51
  // Test nets
58
52
  RailgunProxyDeploymentBlock[RailgunProxyDeploymentBlock["EthereumRopsten"] = 12226000] = "EthereumRopsten";
59
53
  RailgunProxyDeploymentBlock[RailgunProxyDeploymentBlock["EthereumGoerli"] = 7795991] = "EthereumGoerli";
@@ -66,7 +60,6 @@ var BaseTokenWrappedAddress;
66
60
  BaseTokenWrappedAddress["EthereumWETH"] = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
67
61
  BaseTokenWrappedAddress["BinanceWBNB"] = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c";
68
62
  BaseTokenWrappedAddress["PolygonWMATIC"] = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270";
69
- BaseTokenWrappedAddress["ArbitrumWETH"] = "";
70
63
  // Test nets
71
64
  BaseTokenWrappedAddress["EthereumRopstenWETH"] = "0xc778417e063141139fce010982780140aa0cd5ab";
72
65
  BaseTokenWrappedAddress["EthereumGoerliWETH"] = "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6";
@@ -74,16 +67,6 @@ var BaseTokenWrappedAddress;
74
67
  BaseTokenWrappedAddress["ArbitrumGoerliWETH"] = "0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3";
75
68
  BaseTokenWrappedAddress["HardhatWETH"] = "0x09635F643e140090A9A8Dcd712eD6285858ceBef";
76
69
  })(BaseTokenWrappedAddress = exports.BaseTokenWrappedAddress || (exports.BaseTokenWrappedAddress = {}));
77
- /**
78
- * Type0 / Type1 = non-EIP-1559 (gasPrice).
79
- * Type2 = EIP-1559 (maxFeePerGas and maxPriorityFeePerGas).
80
- */
81
- var EVMGasType;
82
- (function (EVMGasType) {
83
- EVMGasType[EVMGasType["Type0"] = 0] = "Type0";
84
- EVMGasType[EVMGasType["Type1"] = 1] = "Type1";
85
- EVMGasType[EVMGasType["Type2"] = 2] = "Type2";
86
- })(EVMGasType = exports.EVMGasType || (exports.EVMGasType = {}));
87
70
  exports.NETWORK_CONFIG = (_a = {},
88
71
  _a[NetworkName.Railgun] = {
89
72
  chain: {
@@ -98,7 +81,7 @@ exports.NETWORK_CONFIG = (_a = {},
98
81
  proxyContract: RailgunProxyContract.Ethereum,
99
82
  relayAdaptContract: RelayAdaptContract.Ethereum,
100
83
  deploymentBlock: RailgunProxyDeploymentBlock.Ethereum,
101
- defaultEVMGasType: EVMGasType.Type2,
84
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
102
85
  shouldQuickSync: false
103
86
  },
104
87
  _a[NetworkName.Ethereum] = {
@@ -119,7 +102,7 @@ exports.NETWORK_CONFIG = (_a = {},
119
102
  proxyContract: RailgunProxyContract.Ethereum,
120
103
  relayAdaptContract: RelayAdaptContract.Ethereum,
121
104
  deploymentBlock: RailgunProxyDeploymentBlock.Ethereum,
122
- defaultEVMGasType: EVMGasType.Type2,
105
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
123
106
  shouldQuickSync: true
124
107
  },
125
108
  _a[NetworkName.BNBChain] = {
@@ -140,7 +123,7 @@ exports.NETWORK_CONFIG = (_a = {},
140
123
  proxyContract: RailgunProxyContract.BNBChain,
141
124
  relayAdaptContract: RelayAdaptContract.BNBChain,
142
125
  deploymentBlock: RailgunProxyDeploymentBlock.BNBChain,
143
- defaultEVMGasType: EVMGasType.Type0,
126
+ defaultEVMGasType: response_types_1.EVMGasType.Type0,
144
127
  shouldQuickSync: true
145
128
  },
146
129
  _a[NetworkName.Polygon] = {
@@ -149,7 +132,7 @@ exports.NETWORK_CONFIG = (_a = {},
149
132
  id: 137
150
133
  },
151
134
  name: NetworkName.Polygon,
152
- publicName: 'Polygon',
135
+ publicName: 'Polygon PoS',
153
136
  shortPublicName: 'Polygon',
154
137
  coingeckoId: 'polygon-pos',
155
138
  baseToken: {
@@ -161,28 +144,7 @@ exports.NETWORK_CONFIG = (_a = {},
161
144
  proxyContract: RailgunProxyContract.PolygonPOS,
162
145
  relayAdaptContract: RelayAdaptContract.PolygonPOS,
163
146
  deploymentBlock: RailgunProxyDeploymentBlock.PolygonPOS,
164
- defaultEVMGasType: EVMGasType.Type2,
165
- shouldQuickSync: true
166
- },
167
- _a[NetworkName.Arbitrum] = {
168
- chain: {
169
- type: response_types_1.ChainType.EVM,
170
- id: 42161
171
- },
172
- name: NetworkName.Arbitrum,
173
- publicName: 'Arbitrum',
174
- shortPublicName: 'Arbitrum',
175
- coingeckoId: 'arbitrum-one',
176
- baseToken: {
177
- symbol: 'ETH',
178
- wrappedSymbol: 'WETH',
179
- wrappedAddress: BaseTokenWrappedAddress.ArbitrumWETH,
180
- decimals: 18
181
- },
182
- proxyContract: RailgunProxyContract.Arbitrum,
183
- relayAdaptContract: RelayAdaptContract.Arbitrum,
184
- deploymentBlock: RailgunProxyDeploymentBlock.Arbitrum,
185
- defaultEVMGasType: EVMGasType.Type2,
147
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
186
148
  shouldQuickSync: true
187
149
  },
188
150
  // TEST NETS
@@ -207,7 +169,7 @@ exports.NETWORK_CONFIG = (_a = {},
207
169
  deploymentBlock: RailgunProxyDeploymentBlock.EthereumRopsten,
208
170
  isDevOnlyNetwork: true,
209
171
  isTestnet: true,
210
- defaultEVMGasType: EVMGasType.Type2,
172
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
211
173
  shouldQuickSync: false
212
174
  },
213
175
  _a[NetworkName.EthereumGoerli] = {
@@ -230,7 +192,7 @@ exports.NETWORK_CONFIG = (_a = {},
230
192
  deploymentBlock: RailgunProxyDeploymentBlock.EthereumGoerli,
231
193
  isDevOnlyNetwork: true,
232
194
  isTestnet: true,
233
- defaultEVMGasType: EVMGasType.Type2,
195
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
234
196
  shouldQuickSync: true
235
197
  },
236
198
  _a[NetworkName.PolygonMumbai] = {
@@ -253,7 +215,7 @@ exports.NETWORK_CONFIG = (_a = {},
253
215
  deploymentBlock: RailgunProxyDeploymentBlock.PolygonMumbai,
254
216
  isDevOnlyNetwork: true,
255
217
  isTestnet: true,
256
- defaultEVMGasType: EVMGasType.Type2,
218
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
257
219
  shouldQuickSync: true
258
220
  },
259
221
  _a[NetworkName.ArbitrumGoerli] = {
@@ -276,7 +238,7 @@ exports.NETWORK_CONFIG = (_a = {},
276
238
  deploymentBlock: RailgunProxyDeploymentBlock.ArbitrumGoerli,
277
239
  isDevOnlyNetwork: true,
278
240
  isTestnet: true,
279
- defaultEVMGasType: EVMGasType.Type2,
241
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
280
242
  shouldQuickSync: true
281
243
  },
282
244
  _a[NetworkName.Hardhat] = {
@@ -299,14 +261,8 @@ exports.NETWORK_CONFIG = (_a = {},
299
261
  deploymentBlock: RailgunProxyDeploymentBlock.Hardhat,
300
262
  isDevOnlyNetwork: true,
301
263
  isTestnet: true,
302
- defaultEVMGasType: EVMGasType.Type2,
264
+ defaultEVMGasType: response_types_1.EVMGasType.Type2,
303
265
  shouldQuickSync: false
304
266
  },
305
267
  _a);
306
- var networkForChain = function (chain) {
307
- return Object.values(exports.NETWORK_CONFIG).find(function (network) {
308
- return network.chain.type === chain.type && network.chain.id === chain.id;
309
- });
310
- };
311
- exports.networkForChain = networkForChain;
312
268
  //# sourceMappingURL=network-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"network-config.js","sourceRoot":"","sources":["../../src/models/network-config.ts"],"names":[],"mappings":";;;;AAAA,mDAAoD;AAEpD;;GAEG;AACH,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACrB,WAAW;IACX,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,qCAAsB,CAAA;IACtB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IAErB,WAAW;IACX,8DAA+C,CAAA;IAC/C,iDAAkC,CAAA;IAClC,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAElC,WAAW;IACX,kCAAmB,CAAA;AACrB,CAAC,EAhBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAgBtB;AAgCD,IAAY,oBAYX;AAZD,WAAY,oBAAoB;IAC9B,+EAAuD,CAAA;IAC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E THESE ENUM STRINGS.\n */\nexport enum NetworkName {\n // Mainnets\n Railgun = 'Railgun',\n Ethereum = 'Ethereum',\n BNBChain = 'BNB_Chain',\n Polygon = 'Polygon',\n Arbitrum = 'Arbitrum',\n\n // Testnets\n EthereumRopsten_DEPRECATED = 'Ethereum_Ropsten',\n EthereumGoerli = 'Ethereum_Goerli',\n PolygonMumbai = 'Polygon_Mumbai',\n ArbitrumGoerli = 'Arbitrum_Goerli',\n\n // Dev only\n Hardhat = 'Hardhat',\n}\n\nexport type FeesSerialized = {\n shield: string;\n unshield: string;\n nft: string;\n};\n\ntype BaseToken = {\n symbol: string;\n wrappedSymbol: string;\n wrappedAddress: BaseTokenWrappedAddress;\n decimals: number;\n};\n\nexport type Network = {\n chain: Chain;\n name: NetworkName;\n publicName: string;\n shortPublicName: string;\n coingeckoId: string;\n baseToken: BaseToken;\n proxyContract: RailgunProxyContract;\n relayAdaptContract: RelayAdaptContract;\n deploymentBlock: RailgunProxyDeploymentBlock;\n isDevOnlyNetwork?: boolean;\n isTestnet?: boolean;\n defaultEVMGasType: EVMGasType;\n shouldQuickSync: boolean;\n deprecated?: boolean;\n};\n\nexport enum RailgunProxyContract {\n Ethereum = '0xfa7093cdd9ee6932b4eb2c9e1cde7ce00b1fa4b9',\n BNBChain = '0x590162bf4b50f6576a459b75309ee21d92178a10',\n PolygonPOS = '0x19b620929f97b7b990801496c3b361ca5def8c71',\n Arbitrum = '',\n\n // Test nets\n EthereumRopsten = '',\n EthereumGoerli = '0xe8bEa99BB438C2f3D533604D33258d74d5eE4824',\n PolygonMumbai = '0x3ee8306321d992483BDC9c69B8F622Ba3FFF05B6',\n ArbitrumGoerli = '0xA0603e598F9Ac2fc7475a3fA08D0794066615D9a',\n Hardhat = '',\n}\n\nexport enum RelayAdaptContract {\n Ethereum = '0x4025ee6512DBbda97049Bcf5AA5D38C54aF6bE8a',\n BNBChain = '0x741936fb83DDf324636D3048b3E6bC800B8D9e12',\n PolygonPOS = '0xc7FfA542736321A3dd69246d73987566a5486968',\n Arbitrum = '',\n\n // Test nets\n EthereumRopsten = '',\n EthereumGoerli = '0x14a57CA7C5c1AD54fB6c642f428d973fcD696ED4',\n PolygonMumbai = '0x17D36875D723Cf0dA250d404Ef4cA0aABE105837',\n ArbitrumGoerli = '0x3eAf99B5EDc79D833AA8B6d18F0a8dd041e13eF6',\n Hardhat = '',\n}\n\nexport enum RailgunProxyDeploymentBlock {\n Ethereum = 14737691,\n BNBChain = 17633701,\n PolygonPOS = 28083766,\n Arbitrum = 0,\n\n // Test nets\n EthereumRopsten = 12226000,\n EthereumGoerli = 7795991,\n PolygonMumbai = 28697343,\n ArbitrumGoerli = 2611949,\n Hardhat = 0,\n}\n\nexport enum BaseTokenWrappedAddress {\n EthereumWETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH\n BinanceWBNB = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', // WBNB\n PolygonWMATIC = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // WMATIC\n ArbitrumWETH = '', // (Arbitrum) WETH\n\n // Test nets\n EthereumRopstenWETH = '0xc778417e063141139fce010982780140aa0cd5ab', // (Ropsten) WETH\n EthereumGoerliWETH = '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6', // (Goerli) WETH\n PolygonMumbaiWMATIC = '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', // (Mumbai) WMATIC\n ArbitrumGoerliWETH = '0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3', // (Arbitrum Goerli) WETH\n HardhatWETH = '0x09635F643e140090A9A8Dcd712eD6285858ceBef', // (Hardhat) WETH\n}\n\n/**\n * Type0 / Type1 = non-EIP-1559 (gasPrice).\n * Type2 = EIP-1559 (maxFeePerGas and maxPriorityFeePerGas).\n */\nexport enum EVMGasType {\n Type0 = 0,\n Type1 = 1,\n Type2 = 2,\n}\n\nexport const NETWORK_CONFIG: { [name in NetworkName]: Network } = {\n [NetworkName.Railgun]: {\n chain: {\n type: -1,\n id: -1,\n },\n name: NetworkName.Railgun,\n publicName: 'RAILGUN',\n shortPublicName: '',\n coingeckoId: '',\n baseToken: {} as BaseToken,\n proxyContract: RailgunProxyContract.Ethereum,\n relayAdaptContract: RelayAdaptContract.Ethereum,\n deploymentBlock: RailgunProxyDeploymentBlock.Ethereum,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: false,\n },\n [NetworkName.Ethereum]: {\n chain: {\n type: ChainType.EVM,\n id: 1,\n },\n name: NetworkName.Ethereum,\n publicName: 'Ethereum',\n shortPublicName: 'Ethereum',\n coingeckoId: 'ethereum',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.EthereumWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.Ethereum,\n relayAdaptContract: RelayAdaptContract.Ethereum,\n deploymentBlock: RailgunProxyDeploymentBlock.Ethereum,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.BNBChain]: {\n chain: {\n type: ChainType.EVM,\n id: 56,\n },\n name: NetworkName.BNBChain,\n publicName: 'BNB Smart Chain',\n shortPublicName: 'BSC',\n coingeckoId: 'binance-smart-chain',\n baseToken: {\n symbol: 'BNB',\n wrappedSymbol: 'WBNB',\n wrappedAddress: BaseTokenWrappedAddress.BinanceWBNB,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.BNBChain,\n relayAdaptContract: RelayAdaptContract.BNBChain,\n deploymentBlock: RailgunProxyDeploymentBlock.BNBChain,\n defaultEVMGasType: EVMGasType.Type0,\n shouldQuickSync: true,\n },\n [NetworkName.Polygon]: {\n chain: {\n type: ChainType.EVM,\n id: 137,\n },\n name: NetworkName.Polygon,\n publicName: 'Polygon',\n shortPublicName: 'Polygon',\n coingeckoId: 'polygon-pos',\n baseToken: {\n symbol: 'MATIC',\n wrappedSymbol: 'WMATIC',\n wrappedAddress: BaseTokenWrappedAddress.PolygonWMATIC,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.PolygonPOS,\n relayAdaptContract: RelayAdaptContract.PolygonPOS,\n deploymentBlock: RailgunProxyDeploymentBlock.PolygonPOS,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.Arbitrum]: {\n chain: {\n type: ChainType.EVM,\n id: 42161,\n },\n name: NetworkName.Arbitrum,\n publicName: 'Arbitrum',\n shortPublicName: 'Arbitrum',\n coingeckoId: 'arbitrum-one',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.ArbitrumWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.Arbitrum,\n relayAdaptContract: RelayAdaptContract.Arbitrum,\n deploymentBlock: RailgunProxyDeploymentBlock.Arbitrum,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n\n // TEST NETS\n [NetworkName.EthereumRopsten_DEPRECATED]: {\n deprecated: true,\n chain: {\n type: ChainType.EVM,\n id: 3,\n },\n name: NetworkName.EthereumRopsten_DEPRECATED,\n publicName: 'Ropsten Testnet',\n shortPublicName: 'Ropsten',\n coingeckoId: 'ethereum',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.EthereumRopstenWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.EthereumRopsten,\n relayAdaptContract: RelayAdaptContract.EthereumRopsten,\n deploymentBlock: RailgunProxyDeploymentBlock.EthereumRopsten,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: false,\n },\n [NetworkName.EthereumGoerli]: {\n chain: {\n type: ChainType.EVM,\n id: 5,\n },\n name: NetworkName.EthereumGoerli,\n publicName: 'Görli Testnet',\n shortPublicName: 'Görli',\n coingeckoId: 'ethereum',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.EthereumGoerliWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.EthereumGoerli,\n relayAdaptContract: RelayAdaptContract.EthereumGoerli,\n deploymentBlock: RailgunProxyDeploymentBlock.EthereumGoerli,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.PolygonMumbai]: {\n chain: {\n type: ChainType.EVM,\n id: 80001,\n },\n name: NetworkName.PolygonMumbai,\n publicName: 'Mumbai Testnet',\n shortPublicName: 'Mumbai',\n coingeckoId: 'polygon-pos',\n baseToken: {\n symbol: 'MATIC',\n wrappedSymbol: 'WMATIC',\n wrappedAddress: BaseTokenWrappedAddress.PolygonMumbaiWMATIC,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.PolygonMumbai,\n relayAdaptContract: RelayAdaptContract.PolygonMumbai,\n deploymentBlock: RailgunProxyDeploymentBlock.PolygonMumbai,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.ArbitrumGoerli]: {\n chain: {\n type: ChainType.EVM,\n id: 421613,\n },\n name: NetworkName.ArbitrumGoerli,\n publicName: 'Arbitrum Görli Testnet',\n shortPublicName: 'Arbitrum Görli',\n coingeckoId: 'arbitrum-one',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.ArbitrumGoerliWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.ArbitrumGoerli,\n relayAdaptContract: RelayAdaptContract.ArbitrumGoerli,\n deploymentBlock: RailgunProxyDeploymentBlock.ArbitrumGoerli,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.Hardhat]: {\n chain: {\n type: ChainType.EVM,\n id: 31337,\n },\n name: NetworkName.Hardhat,\n publicName: 'Hardhat Testnet',\n shortPublicName: 'Hardhat',\n coingeckoId: '',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.HardhatWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.Hardhat,\n relayAdaptContract: RelayAdaptContract.Hardhat,\n deploymentBlock: RailgunProxyDeploymentBlock.Hardhat,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: false,\n },\n};\n\nexport const networkForChain = (chain: Chain): Optional<Network> => {\n return Object.values(NETWORK_CONFIG).find(\n network =>\n network.chain.type === chain.type && network.chain.id === chain.id,\n );\n};\n"]}
1
+ {"version":3,"file":"network-config.js","sourceRoot":"","sources":["../../src/models/network-config.ts"],"names":[],"mappings":";;;;AAAA,mDAAgE;AAEhE,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACrB,WAAW;IACX,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,qCAAsB,CAAA;IACtB,kCAAmB,CAAA;IACnB,yBAAyB;IAEzB,WAAW;IACX,8DAA+C,CAAA;IAC/C,iDAAkC,CAAA;IAClC,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAElC,WAAW;IACX,kCAAmB,CAAA;AACrB,CAAC,EAhBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAgBtB;AAgCD,IAAY,oBAWX;AAXD,WAAY,oBAAoB;IAC9B,+EAAuD,CAAA;IACvD,+EAAuD,CAAA;IACvD,iFAAyD,CAAA;IAEzD,YAAY;IACZ,4CAAoB,CAAA;IACpB,qFAA6D,CAAA;IAC7D,oFAA4D,CAAA;IAC5D,qFAA6D,CAAA;IAC7D,oCAAY,CAAA;AACd,CAAC,EAXW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAW/B;AAED,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,6EAAuD,CAAA;IACvD,6EAAuD,CAAA;IACv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EAAE,gBAAgB;QACjC,WAAW,EAAE,cAAc;QAC3B,SAAS,EAAE;YACT,MAAM,EAAE,KAAK;YACb,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,uBAAuB,CAAC,kBAAkB;YAC1D,QAAQ,EAAE,EAAE;SACb;QACD,aAAa,EAAE,oBAAoB,CAAC,cAAc;QAClD,kBAAkB,EAAE,kBAAkB,CAAC,cAAc;QACrD,eAAe,EAAE,2BAA2B,CAAC,cAAc;QAC3D,gBAAgB,EAAE,IAAI;QACtB,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,2BAAU,CAAC,KAAK;QACnC,eAAe,EAAE,IAAI;KACtB;IACD,GAAC,WAAW,CAAC,OAAO,IAAG;QACrB,KAAK,EAAE;YACL,IAAI,EAAE,0BAAS,CAAC,GAAG;YACnB,EAAE,EAAE,KAAK;SACV;QACD,IAAI,EAAE,WAAW,CAAC,OAAO;QACzB,UAAU,EAAE,iBAAiB;QAC7B,eAAe,EAAE,SAAS;QAC1B,WAAW,EAAE,EAAE;QACf,SAAS,EAAE;YACT,MAAM,EAAE,KAAK;YACb,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,uBAAuB,CAAC,WAAW;YACnD,QAAQ,EAAE,EAAE;SACb;QACD,aAAa,EAAE,oBAAoB,CAAC,OAAO;QAC3C,kBAAkB,EAAE,kBAAkB,CAAC,OAAO;QAC9C,eAAe,EAAE,2BAA2B,CAAC,OAAO;QACpD,gBAAgB,EAAE,IAAI;QACtB,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,2BAAU,CAAC,KAAK;QACnC,eAAe,EAAE,KAAK;KACvB;QACD","sourcesContent":["import { Chain, ChainType, EVMGasType } from './response-types';\n\nexport enum NetworkName {\n // Mainnets\n Railgun = 'Railgun',\n Ethereum = 'Ethereum',\n BNBChain = 'BNB_Chain',\n Polygon = 'Polygon',\n // Arbitrum = 'Arbitrum',\n\n // Testnets\n EthereumRopsten_DEPRECATED = 'Ethereum_Ropsten',\n EthereumGoerli = 'Ethereum_Goerli',\n PolygonMumbai = 'Polygon_Mumbai',\n ArbitrumGoerli = 'Arbitrum_Goerli',\n\n // Dev only\n Hardhat = 'Hardhat',\n}\n\nexport type FeesSerialized = {\n shield: string;\n unshield: string;\n nft: string;\n};\n\ntype BaseToken = {\n symbol: string;\n wrappedSymbol: string;\n wrappedAddress: BaseTokenWrappedAddress;\n decimals: number;\n};\n\nexport type Network = {\n chain: Chain;\n name: NetworkName;\n publicName: string;\n shortPublicName: string;\n coingeckoId: string;\n baseToken: BaseToken;\n proxyContract: RailgunProxyContract;\n relayAdaptContract: RelayAdaptContract;\n deploymentBlock: RailgunProxyDeploymentBlock;\n isDevOnlyNetwork?: boolean;\n isTestnet?: boolean;\n defaultEVMGasType: EVMGasType;\n shouldQuickSync: boolean;\n deprecated?: boolean;\n};\n\nexport enum RailgunProxyContract {\n Ethereum = '0xfa7093cdd9ee6932b4eb2c9e1cde7ce00b1fa4b9',\n BNBChain = '0x590162bf4b50f6576a459b75309ee21d92178a10',\n PolygonPOS = '0x19b620929f97b7b990801496c3b361ca5def8c71',\n\n // Test nets\n EthereumRopsten = '',\n EthereumGoerli = '0xe8bEa99BB438C2f3D533604D33258d74d5eE4824',\n PolygonMumbai = '0x3ee8306321d992483BDC9c69B8F622Ba3FFF05B6',\n ArbitrumGoerli = '0xA0603e598F9Ac2fc7475a3fA08D0794066615D9a',\n Hardhat = '',\n}\n\nexport enum RelayAdaptContract {\n Ethereum = '0x4025ee6512DBbda97049Bcf5AA5D38C54aF6bE8a',\n BNBChain = '0x741936fb83DDf324636D3048b3E6bC800B8D9e12',\n PolygonPOS = '0xc7FfA542736321A3dd69246d73987566a5486968',\n\n // Test nets\n EthereumRopsten = '',\n EthereumGoerli = '0x14a57CA7C5c1AD54fB6c642f428d973fcD696ED4',\n PolygonMumbai = '0x17D36875D723Cf0dA250d404Ef4cA0aABE105837',\n ArbitrumGoerli = '0x3eAf99B5EDc79D833AA8B6d18F0a8dd041e13eF6',\n Hardhat = '',\n}\n\nexport enum RailgunProxyDeploymentBlock {\n Ethereum = 14737691,\n BNBChain = 17633701,\n PolygonPOS = 28083766,\n\n // Test nets\n EthereumRopsten = 12226000,\n EthereumGoerli = 7795991,\n PolygonMumbai = 28697343,\n ArbitrumGoerli = 2611949,\n Hardhat = 0,\n}\n\nexport enum BaseTokenWrappedAddress {\n EthereumWETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH\n BinanceWBNB = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', // WBNB\n PolygonWMATIC = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // WMATIC\n\n // Test nets\n EthereumRopstenWETH = '0xc778417e063141139fce010982780140aa0cd5ab', // (Ropsten) WETH\n EthereumGoerliWETH = '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6', // (Goerli) WETH\n PolygonMumbaiWMATIC = '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', // (Mumbai) WMATIC\n ArbitrumGoerliWETH = '0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3', // (Arbitrum Goerli) WETH\n HardhatWETH = '0x09635F643e140090A9A8Dcd712eD6285858ceBef', // (Hardhat) WETH\n}\n\nexport const NETWORK_CONFIG: { [name in NetworkName]: Network } = {\n [NetworkName.Railgun]: {\n chain: {\n type: -1,\n id: -1,\n },\n name: NetworkName.Railgun,\n publicName: 'RAILGUN',\n shortPublicName: '',\n coingeckoId: '',\n baseToken: {} as BaseToken,\n proxyContract: RailgunProxyContract.Ethereum,\n relayAdaptContract: RelayAdaptContract.Ethereum,\n deploymentBlock: RailgunProxyDeploymentBlock.Ethereum,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: false,\n },\n [NetworkName.Ethereum]: {\n chain: {\n type: ChainType.EVM,\n id: 1,\n },\n name: NetworkName.Ethereum,\n publicName: 'Ethereum',\n shortPublicName: 'Ethereum',\n coingeckoId: 'ethereum',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.EthereumWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.Ethereum,\n relayAdaptContract: RelayAdaptContract.Ethereum,\n deploymentBlock: RailgunProxyDeploymentBlock.Ethereum,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.BNBChain]: {\n chain: {\n type: ChainType.EVM,\n id: 56,\n },\n name: NetworkName.BNBChain,\n publicName: 'BNB Smart Chain',\n shortPublicName: 'BSC',\n coingeckoId: 'binance-smart-chain',\n baseToken: {\n symbol: 'BNB',\n wrappedSymbol: 'WBNB',\n wrappedAddress: BaseTokenWrappedAddress.BinanceWBNB,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.BNBChain,\n relayAdaptContract: RelayAdaptContract.BNBChain,\n deploymentBlock: RailgunProxyDeploymentBlock.BNBChain,\n defaultEVMGasType: EVMGasType.Type0,\n shouldQuickSync: true,\n },\n [NetworkName.Polygon]: {\n chain: {\n type: ChainType.EVM,\n id: 137,\n },\n name: NetworkName.Polygon,\n publicName: 'Polygon PoS',\n shortPublicName: 'Polygon',\n coingeckoId: 'polygon-pos',\n baseToken: {\n symbol: 'MATIC',\n wrappedSymbol: 'WMATIC',\n wrappedAddress: BaseTokenWrappedAddress.PolygonWMATIC,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.PolygonPOS,\n relayAdaptContract: RelayAdaptContract.PolygonPOS,\n deploymentBlock: RailgunProxyDeploymentBlock.PolygonPOS,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n\n // TEST NETS\n [NetworkName.EthereumRopsten_DEPRECATED]: {\n deprecated: true,\n chain: {\n type: ChainType.EVM,\n id: 3,\n },\n name: NetworkName.EthereumRopsten_DEPRECATED,\n publicName: 'Ropsten Testnet',\n shortPublicName: 'Ropsten',\n coingeckoId: 'ethereum',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.EthereumRopstenWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.EthereumRopsten,\n relayAdaptContract: RelayAdaptContract.EthereumRopsten,\n deploymentBlock: RailgunProxyDeploymentBlock.EthereumRopsten,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: false,\n },\n [NetworkName.EthereumGoerli]: {\n chain: {\n type: ChainType.EVM,\n id: 5,\n },\n name: NetworkName.EthereumGoerli,\n publicName: 'Görli Testnet',\n shortPublicName: 'Görli',\n coingeckoId: 'ethereum',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.EthereumGoerliWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.EthereumGoerli,\n relayAdaptContract: RelayAdaptContract.EthereumGoerli,\n deploymentBlock: RailgunProxyDeploymentBlock.EthereumGoerli,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.PolygonMumbai]: {\n chain: {\n type: ChainType.EVM,\n id: 80001,\n },\n name: NetworkName.PolygonMumbai,\n publicName: 'Mumbai Testnet',\n shortPublicName: 'Mumbai',\n coingeckoId: 'polygon-pos',\n baseToken: {\n symbol: 'MATIC',\n wrappedSymbol: 'WMATIC',\n wrappedAddress: BaseTokenWrappedAddress.PolygonMumbaiWMATIC,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.PolygonMumbai,\n relayAdaptContract: RelayAdaptContract.PolygonMumbai,\n deploymentBlock: RailgunProxyDeploymentBlock.PolygonMumbai,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.ArbitrumGoerli]: {\n chain: {\n type: ChainType.EVM,\n id: 421613,\n },\n name: NetworkName.ArbitrumGoerli,\n publicName: 'Arbitrum Görli Testnet',\n shortPublicName: 'Arbitrum Görli',\n coingeckoId: 'arbitrum-one',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.ArbitrumGoerliWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.ArbitrumGoerli,\n relayAdaptContract: RelayAdaptContract.ArbitrumGoerli,\n deploymentBlock: RailgunProxyDeploymentBlock.ArbitrumGoerli,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: true,\n },\n [NetworkName.Hardhat]: {\n chain: {\n type: ChainType.EVM,\n id: 31337,\n },\n name: NetworkName.Hardhat,\n publicName: 'Hardhat Testnet',\n shortPublicName: 'Hardhat',\n coingeckoId: '',\n baseToken: {\n symbol: 'ETH',\n wrappedSymbol: 'WETH',\n wrappedAddress: BaseTokenWrappedAddress.HardhatWETH,\n decimals: 18,\n },\n proxyContract: RailgunProxyContract.Hardhat,\n relayAdaptContract: RelayAdaptContract.Hardhat,\n deploymentBlock: RailgunProxyDeploymentBlock.Hardhat,\n isDevOnlyNetwork: true,\n isTestnet: true,\n defaultEVMGasType: EVMGasType.Type2,\n shouldQuickSync: false,\n },\n};\n"]}
@@ -1,10 +1,19 @@
1
1
  import { BigNumber } from '@ethersproject/bignumber';
2
2
  import { MerkletreeScanStatus } from './merkletree-scan';
3
- import { EVMGasType, FeesSerialized } from './network-config';
3
+ import { FeesSerialized } from './network-config';
4
4
  export declare type RailgunAPICiphertext = {
5
5
  iv: string;
6
6
  data: string[];
7
7
  };
8
+ /**
9
+ * Type0 / Type1 = non-EIP-1559 (gasPrice).
10
+ * Type2 = EIP-1559 (maxFeePerGas and maxPriorityFeePerGas).
11
+ */
12
+ export declare enum EVMGasType {
13
+ Type0 = 0,
14
+ Type1 = 1,
15
+ Type2 = 2
16
+ }
8
17
  export declare type TransactionGasDetails = TransactionGasDetailsType0 | TransactionGasDetailsType1 | TransactionGasDetailsType2;
9
18
  export declare type TransactionGasDetailsType0 = {
10
19
  evmGasType: EVMGasType.Type0;
@@ -88,8 +97,13 @@ export declare type RailgunBalanceResponse = {
88
97
  export declare type RailgunProveTransactionResponse = {
89
98
  error?: string;
90
99
  };
100
+ export declare type RailgunTxidFromNullifiersResponse = {
101
+ txid?: string;
102
+ error?: string;
103
+ };
91
104
  export declare type RailgunPopulateTransactionResponse = {
92
105
  serializedTransaction?: string;
106
+ nullifiers?: string[];
93
107
  error?: string;
94
108
  };
95
109
  export declare type RailgunTransactionGasEstimateResponse = {
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.NFTTokenType = exports.ChainType = void 0;
3
+ exports.NFTTokenType = exports.ChainType = exports.EVMGasType = void 0;
4
+ /**
5
+ * Type0 / Type1 = non-EIP-1559 (gasPrice).
6
+ * Type2 = EIP-1559 (maxFeePerGas and maxPriorityFeePerGas).
7
+ */
8
+ var EVMGasType;
9
+ (function (EVMGasType) {
10
+ EVMGasType[EVMGasType["Type0"] = 0] = "Type0";
11
+ EVMGasType[EVMGasType["Type1"] = 1] = "Type1";
12
+ EVMGasType[EVMGasType["Type2"] = 2] = "Type2";
13
+ })(EVMGasType = exports.EVMGasType || (exports.EVMGasType = {}));
4
14
  var ChainType;
5
15
  (function (ChainType) {
6
16
  ChainType[ChainType["EVM"] = 0] = "EVM";
@@ -1 +1 @@
1
- {"version":3,"file":"response-types.js","sourceRoot":"","sources":["../../src/models/response-types.ts"],"names":[],"mappings":";;;AAiEA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,uCAAO,CAAA;AACT,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;AAuED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mDAAU,CAAA;IACV,qDAAW,CAAA;AACb,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\nimport { MerkletreeScanStatus } from './merkletree-scan';\nimport { EVMGasType, FeesSerialized } from './network-config';\n\nexport type RailgunAPICiphertext = {\n iv: string;\n data: string[];\n};\n\nexport type TransactionGasDetails =\n | TransactionGasDetailsType0\n | TransactionGasDetailsType1\n | TransactionGasDetailsType2;\n\nexport type TransactionGasDetailsType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType1 = {\n evmGasType: EVMGasType.Type1;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimate: BigNumber;\n maxFeePerGas: BigNumber;\n maxPriorityFeePerGas: BigNumber;\n};\n\nexport type TransactionGasDetailsSerialized =\n | TransactionGasDetailsSerializedType0\n | TransactionGasDetailsSerializedType1\n | TransactionGasDetailsSerializedType2;\n\nexport type TransactionGasDetailsSerializedType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType1 = {\n evmGasType: EVMGasType.Type1;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimateString: string;\n maxFeePerGasString: string;\n maxPriorityFeePerGasString: string;\n};\n\nexport type StartRailgunEngineResponse = {\n error?: string;\n};\n\nexport type DownloadInitialArtifactsResponse = {\n error?: string;\n};\n\nexport enum ChainType {\n EVM = 0,\n}\n\nexport type Chain = {\n type: ChainType;\n id: number;\n};\n\nexport type RailgunBalancesEvent = {\n chain: Chain;\n erc20Amounts: RailgunERC20Amount[];\n nftAmounts: RailgunNFTAmount[];\n railgunWalletID: string;\n};\n\nexport type MerkletreeScanUpdateEvent = {\n chain: Chain;\n scanStatus: MerkletreeScanStatus;\n progress: number;\n};\n\nexport type LoadProviderResponse = {\n feesSerialized?: FeesSerialized;\n error?: string;\n};\n\nexport type RailgunWalletInfo = {\n id: string;\n railgunAddress: string;\n};\n\nexport type LoadRailgunWalletResponse = {\n railgunWalletInfo?: RailgunWalletInfo;\n error?: string;\n};\n\nexport type UnloadRailgunWalletResponse = {\n error?: string;\n};\n\nexport type RailgunWalletAddressDataSerialized = {\n masterPublicKey: string;\n viewingPublicKey: string;\n};\n\nexport type RailgunBalanceResponse = {\n error?: string;\n};\n\nexport type RailgunProveTransactionResponse = {\n error?: string;\n};\n\nexport type RailgunPopulateTransactionResponse = {\n serializedTransaction?: string;\n error?: string;\n};\n\nexport type RailgunTransactionGasEstimateResponse = {\n gasEstimateString?: string;\n error?: string;\n};\n\nexport type RailgunERC20Amount = {\n tokenAddress: string;\n amountString: string;\n};\n\nexport type RailgunERC20AmountRecipient = RailgunERC20Amount & {\n recipientAddress: string;\n};\n\n/**\n * Synced NFT types from TokenType (@railgun-community/engine).\n */\nexport enum NFTTokenType {\n ERC721 = 1,\n ERC1155 = 2,\n}\n\nexport type RailgunNFTAmount = {\n nftAddress: string;\n nftTokenType: NFTTokenType;\n tokenSubID: string;\n amountString: string;\n};\n\nexport type RailgunNFTAmountRecipient = RailgunNFTAmount & {\n recipientAddress: string;\n};\n\nexport type EncryptDataWithSharedKeyResponse = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: Uint8Array;\n};\n\nexport type EncryptDataWithSharedKeySerialized = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: string;\n};\n\nexport type ValidateCachedProvedTransactionResponse = {\n isValid: boolean;\n error?: string;\n};\n\nexport type Pbkdf2Response = string;\n\ntype SendAdditionalData = {\n recipientAddress?: string;\n walletSource?: string;\n memoText?: string;\n};\n\nexport type RailgunSendERC20Amount = RailgunERC20Amount & SendAdditionalData;\n\nexport type RailgunSendNFTAmount = RailgunNFTAmount & SendAdditionalData;\n\ntype ReceiveAdditionalData = {\n senderAddress?: string;\n memoText?: string;\n};\n\nexport type RailgunReceiveERC20Amount = RailgunERC20Amount &\n ReceiveAdditionalData;\n\nexport type RailgunReceiveNFTAmount = RailgunNFTAmount & ReceiveAdditionalData;\n\nexport type TransactionHistoryItem = {\n txid: string;\n receiveERC20Amounts: RailgunReceiveERC20Amount[];\n transferERC20Amounts: RailgunSendERC20Amount[];\n changeERC20Amounts: RailgunERC20Amount[];\n relayerFeeERC20Amount?: RailgunERC20Amount;\n unshieldERC20Amounts: RailgunSendERC20Amount[];\n receiveNFTAmounts: RailgunReceiveNFTAmount[];\n transferNFTAmounts: RailgunSendNFTAmount[];\n unshieldNFTAmounts: RailgunSendNFTAmount[];\n version: number;\n};\n\nexport type TransactionHistorySerializedResponse = {\n items?: TransactionHistoryItem[];\n error?: string;\n};\n"]}
1
+ {"version":3,"file":"response-types.js","sourceRoot":"","sources":["../../src/models/response-types.ts"],"names":[],"mappings":";;;AASA;;;GAGG;AACH,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6CAAS,CAAA;IACT,6CAAS,CAAA;IACT,6CAAS,CAAA;AACX,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;AA0DD,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,uCAAO,CAAA;AACT,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;AA6ED;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mDAAU,CAAA;IACV,qDAAW,CAAA;AACb,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\nimport { MerkletreeScanStatus } from './merkletree-scan';\nimport { FeesSerialized } from './network-config';\n\nexport type RailgunAPICiphertext = {\n iv: string;\n data: string[];\n};\n\n/**\n * Type0 / Type1 = non-EIP-1559 (gasPrice).\n * Type2 = EIP-1559 (maxFeePerGas and maxPriorityFeePerGas).\n */\nexport enum EVMGasType {\n Type0 = 0,\n Type1 = 1,\n Type2 = 2,\n}\n\nexport type TransactionGasDetails =\n | TransactionGasDetailsType0\n | TransactionGasDetailsType1\n | TransactionGasDetailsType2;\n\nexport type TransactionGasDetailsType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType1 = {\n evmGasType: EVMGasType.Type1;\n gasEstimate: BigNumber;\n gasPrice: BigNumber;\n};\n\nexport type TransactionGasDetailsType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimate: BigNumber;\n maxFeePerGas: BigNumber;\n maxPriorityFeePerGas: BigNumber;\n};\n\nexport type TransactionGasDetailsSerialized =\n | TransactionGasDetailsSerializedType0\n | TransactionGasDetailsSerializedType1\n | TransactionGasDetailsSerializedType2;\n\nexport type TransactionGasDetailsSerializedType0 = {\n evmGasType: EVMGasType.Type0;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType1 = {\n evmGasType: EVMGasType.Type1;\n gasEstimateString: string;\n gasPriceString: string;\n};\n\nexport type TransactionGasDetailsSerializedType2 = {\n evmGasType: EVMGasType.Type2;\n gasEstimateString: string;\n maxFeePerGasString: string;\n maxPriorityFeePerGasString: string;\n};\n\nexport type StartRailgunEngineResponse = {\n error?: string;\n};\n\nexport type DownloadInitialArtifactsResponse = {\n error?: string;\n};\n\nexport enum ChainType {\n EVM = 0,\n}\n\nexport type Chain = {\n type: ChainType;\n id: number;\n};\n\nexport type RailgunBalancesEvent = {\n chain: Chain;\n erc20Amounts: RailgunERC20Amount[];\n nftAmounts: RailgunNFTAmount[];\n railgunWalletID: string;\n};\n\nexport type MerkletreeScanUpdateEvent = {\n chain: Chain;\n scanStatus: MerkletreeScanStatus;\n progress: number;\n};\n\nexport type LoadProviderResponse = {\n feesSerialized?: FeesSerialized;\n error?: string;\n};\n\nexport type RailgunWalletInfo = {\n id: string;\n railgunAddress: string;\n};\n\nexport type LoadRailgunWalletResponse = {\n railgunWalletInfo?: RailgunWalletInfo;\n error?: string;\n};\n\nexport type UnloadRailgunWalletResponse = {\n error?: string;\n};\n\nexport type RailgunWalletAddressDataSerialized = {\n masterPublicKey: string;\n viewingPublicKey: string;\n};\n\nexport type RailgunBalanceResponse = {\n error?: string;\n};\n\nexport type RailgunProveTransactionResponse = {\n error?: string;\n};\n\nexport declare type RailgunTxidFromNullifiersResponse = {\n txid?: string;\n error?: string;\n};\n\nexport type RailgunPopulateTransactionResponse = {\n serializedTransaction?: string;\n nullifiers?: string[];\n error?: string;\n};\n\nexport type RailgunTransactionGasEstimateResponse = {\n gasEstimateString?: string;\n error?: string;\n};\n\nexport type RailgunERC20Amount = {\n tokenAddress: string;\n amountString: string;\n};\n\nexport type RailgunERC20AmountRecipient = RailgunERC20Amount & {\n recipientAddress: string;\n};\n\n/**\n * Synced NFT types from TokenType (@railgun-community/engine).\n */\nexport enum NFTTokenType {\n ERC721 = 1,\n ERC1155 = 2,\n}\n\nexport type RailgunNFTAmount = {\n nftAddress: string;\n nftTokenType: NFTTokenType;\n tokenSubID: string;\n amountString: string;\n};\n\nexport type RailgunNFTAmountRecipient = RailgunNFTAmount & {\n recipientAddress: string;\n};\n\nexport type EncryptDataWithSharedKeyResponse = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: Uint8Array;\n};\n\nexport type EncryptDataWithSharedKeySerialized = {\n encryptedData: [string, string];\n randomPubKey: string;\n sharedKey: string;\n};\n\nexport type ValidateCachedProvedTransactionResponse = {\n isValid: boolean;\n error?: string;\n};\n\nexport type Pbkdf2Response = string;\n\ntype SendAdditionalData = {\n recipientAddress?: string;\n walletSource?: string;\n memoText?: string;\n};\n\nexport type RailgunSendERC20Amount = RailgunERC20Amount & SendAdditionalData;\n\nexport type RailgunSendNFTAmount = RailgunNFTAmount & SendAdditionalData;\n\ntype ReceiveAdditionalData = {\n senderAddress?: string;\n memoText?: string;\n};\n\nexport type RailgunReceiveERC20Amount = RailgunERC20Amount &\n ReceiveAdditionalData;\n\nexport type RailgunReceiveNFTAmount = RailgunNFTAmount & ReceiveAdditionalData;\n\nexport type TransactionHistoryItem = {\n txid: string;\n receiveERC20Amounts: RailgunReceiveERC20Amount[];\n transferERC20Amounts: RailgunSendERC20Amount[];\n changeERC20Amounts: RailgunERC20Amount[];\n relayerFeeERC20Amount?: RailgunERC20Amount;\n unshieldERC20Amounts: RailgunSendERC20Amount[];\n receiveNFTAmounts: RailgunReceiveNFTAmount[];\n transferNFTAmounts: RailgunSendNFTAmount[];\n unshieldNFTAmounts: RailgunSendNFTAmount[];\n version: number;\n};\n\nexport type TransactionHistorySerializedResponse = {\n items?: TransactionHistoryItem[];\n error?: string;\n};\n"]}
@@ -36,7 +36,9 @@ var sanitizeError = function (err) {
36
36
  return new Error('Insufficient gas to process transaction.');
37
37
  }
38
38
  if (lowercaseMsg.includes('nonce has already been used')) {
39
- return new Error('Nonce already used: the transaction was already completed.');
39
+ return new Error(
40
+ // Do not change 'Nonce already used' string of Error message.
41
+ 'Nonce already used: the transaction was already completed.');
40
42
  }
41
43
  if (lowercaseMsg.includes('error while dialing dial tcp')) {
42
44
  return new Error('Error while connecting to RPC provider. Please try again.');
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":";;;AAAA,IAAM,uCAAuC,GAAG,KAAK,CAAC;AAEtD,IAAM,UAAU,GAAG,UAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,OAAO;IAChB,6CAA6C;IAC7C,iEAAiE,EACjE,EAAE,CACH,CAAC;AACJ,CAAC,CAAC;AAEK,IAAM,aAAa,GAAG,UAAC,GAAU;IACtC,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE;QACtB,IAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC/C,IACE,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC/B,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAC7C;YACA,OAAO,IAAI,KAAK,CAAC,oBAAoB,CAAC,C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QAAQ,CAAC,mBAAmB,CAAC,EAAE;gBAC9C,OAAO,IAAI,KAAK,CACd,8FAA8F,CAC/F,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;gBAC/C,OAAO,IAAI,KAAK,CACd,4FAA4F,CAC7F,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EAAE;gBAC7D,OAAO,IAAI,KAAK,CACd,qHAAqH,CACtH,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE;gBAChD,OAAO,IAAI,KAAK,CACd,mFAAmF,CACpF,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;gBAC/C,OAAO,IAAI,KAAK,CACd,kFAAkF,CACnF,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,sCAAsC,CAAC,EAAE;gBACjE,OAAO,IAAI,KAAK,CACd,+GAA+G,CAChH,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE;gBAClD,OAAO,IAAI,KAAK,CACd,gGAAgG,CACjG,CAAC;aACH;YACD,IAAI,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE;gBAChD,OAAO,IAAI,KAAK,CACd,4EAA4E,CAC7E,CAAC;aACH;SACF;QAED,OAAO,IAAI,KAAK,CACd,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAC7B,WAAI,uCAAuC,CAAE,EAC7C,IAAI,CACL,CACF,CAAC;KACH;IAED,OAAO,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACvD,CAAC,CAAC;AA3GW,QAAA,aAAa,iBA2GxB","sourcesContent":["const STRING_PREFIX_AFTER_UNICODE_REPLACEMENT = 'y %';\n\nconst validAscii = (str: string) => {\n return str.replace(\n // eslint-disable-next-line no-useless-escape\n /[^A-Za-z 0-9 \\.,\\?\"\"!@#\\$%\\^&\\*\\(\\)-_=\\+;:<>\\/\\\\\\|\\}\\{\\[\\]`~]*/g,\n '',\n );\n};\n\nexport const sanitizeError = (err: Error): Error => {\n if (err && err.message) {\n const lowercaseMsg = err.message.toLowerCase();\n if (\n lowercaseMsg.includes('quorum') ||\n lowercaseMsg.includes('could not connect to')\n ) {\n return new Error('Could not connect.');\n }\n if (lowercaseMsg.includes('call revert exception')) {\n return new Error('Failed to connect to RPC.');\n }\n if (lowercaseMsg.includes('missing revert data')) {\n return new Error('RPC connection error.');\n }\n if (\n lowercaseMsg.includes(\n 'transaction may fail or may require manual gas limit',\n )\n ) {\n return new Error('Unknown error. Transaction failed.');\n }\n if (lowercaseMsg.includes('replacement fee too low')) {\n return new Error(\n 'Nonce is used in a pending transaction, and replacement fee is too low. Please increase your network fee to replace the pending transaction.',\n );\n }\n if (lowercaseMsg.includes('intrinsic gas too low')) {\n return new Error(\n 'Gas price rejected. Please select a higher gas price or resubmit.',\n );\n }\n if (lowercaseMsg.includes('transaction underpriced')) {\n return new Error(\n 'Gas fee too low. Please select a higher gas price and resubmit.',\n );\n }\n if (lowercaseMsg.includes('insufficient funds for intrinsic')) {\n return new Error('Insufficient gas to process transaction.');\n }\n if (lowercaseMsg.includes('nonce has already been used')) {\n return new Error(\n 'Nonce already used: the transaction was already completed.',\n );\n }\n if (lowercaseMsg.includes('error while dialing dial tcp')) {\n return new Error(\n 'Error while connecting to RPC provider. Please try again.',\n );\n }\n\n // Custom RAILGUN contract error messages\n if (lowercaseMsg.includes('railgunsmartwallet')) {\n if (lowercaseMsg.includes('invalid nft note value')) {\n return new Error('RailgunSmartWallet: Invalid NFT Note Value.');\n }\n if (lowercaseMsg.includes('unsupported token')) {\n return new Error(\n 'RailgunSmartWallet: Unsupported Token. This token cannot interact with the RAILGUN contract.',\n );\n }\n if (lowercaseMsg.includes('invalid note value')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Note Value. Please submit transaction with a corrected amount.',\n );\n }\n if (lowercaseMsg.includes('invalid adapt contract as sender')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Adapt Contract as Sender. Please update your frontend to current Adapt module versions.',\n );\n }\n if (lowercaseMsg.includes('invalid merkle root')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Merkle Root. Please sync your balances and try again.',\n );\n }\n if (lowercaseMsg.includes('note already spent')) {\n return new Error(\n 'RailgunSmartWallet: Note Already Spent. Please sync your balances and try again.',\n );\n }\n if (lowercaseMsg.includes('invalid note ciphertext array length')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Note Ciphertext Array Length. Please sync balances and re-prove your transaction.',\n );\n }\n if (lowercaseMsg.includes('invalid withdraw note')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Unshield Note. Please sync balances and re-prove your transaction.',\n );\n }\n if (lowercaseMsg.includes('invalid snark proof')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Snark Proof. Please re-prove your transaction.',\n );\n }\n }\n\n return new Error(\n validAscii(err.message).replace(\n `:${STRING_PREFIX_AFTER_UNICODE_REPLACEMENT}`,\n ': ',\n ),\n );\n }\n\n return new Error('Unknown error. Please try again.');\n};\n"]}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":";;;AAAA,IAAM,uCAAuC,GAAG,KAAK,CAAC;AAEtD,IAAM,UAAU,GAAG,UAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,OAAO;IAChB,6CAA6C;IAC7C,iEAAiE,EACjE,EAAE,CACH,CAAC;AACJ,CAAC,CAAC;AAEK,IAAM,aAAa,GAAG,UAAC,GAAU;IACtC,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE;QACtB,IAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC/C,IACE,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC/B,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CA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MENT = 'y %';\n\nconst validAscii = (str: string) => {\n return str.replace(\n // eslint-disable-next-line no-useless-escape\n /[^A-Za-z 0-9 \\.,\\?\"\"!@#\\$%\\^&\\*\\(\\)-_=\\+;:<>\\/\\\\\\|\\}\\{\\[\\]`~]*/g,\n '',\n );\n};\n\nexport const sanitizeError = (err: Error): Error => {\n if (err && err.message) {\n const lowercaseMsg = err.message.toLowerCase();\n if (\n lowercaseMsg.includes('quorum') ||\n lowercaseMsg.includes('could not connect to')\n ) {\n return new Error('Could not connect.');\n }\n if (lowercaseMsg.includes('call revert exception')) {\n return new Error('Failed to connect to RPC.');\n }\n if (lowercaseMsg.includes('missing revert data')) {\n return new Error('RPC connection error.');\n }\n if (\n lowercaseMsg.includes(\n 'transaction may fail or may require manual gas limit',\n )\n ) {\n return new Error('Unknown error. Transaction failed.');\n }\n if (lowercaseMsg.includes('replacement fee too low')) {\n return new Error(\n 'Nonce is used in a pending transaction, and replacement fee is too low. Please increase your network fee to replace the pending transaction.',\n );\n }\n if (lowercaseMsg.includes('intrinsic gas too low')) {\n return new Error(\n 'Gas price rejected. Please select a higher gas price or resubmit.',\n );\n }\n if (lowercaseMsg.includes('transaction underpriced')) {\n return new Error(\n 'Gas fee too low. Please select a higher gas price and resubmit.',\n );\n }\n if (lowercaseMsg.includes('insufficient funds for intrinsic')) {\n return new Error('Insufficient gas to process transaction.');\n }\n if (lowercaseMsg.includes('nonce has already been used')) {\n return new Error(\n // Do not change 'Nonce already used' string of Error message.\n 'Nonce already used: the transaction was already completed.',\n );\n }\n if (lowercaseMsg.includes('error while dialing dial tcp')) {\n return new Error(\n 'Error while connecting to RPC provider. Please try again.',\n );\n }\n\n // Custom RAILGUN contract error messages\n if (lowercaseMsg.includes('railgunsmartwallet')) {\n if (lowercaseMsg.includes('invalid nft note value')) {\n return new Error('RailgunSmartWallet: Invalid NFT Note Value.');\n }\n if (lowercaseMsg.includes('unsupported token')) {\n return new Error(\n 'RailgunSmartWallet: Unsupported Token. This token cannot interact with the RAILGUN contract.',\n );\n }\n if (lowercaseMsg.includes('invalid note value')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Note Value. Please submit transaction with a corrected amount.',\n );\n }\n if (lowercaseMsg.includes('invalid adapt contract as sender')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Adapt Contract as Sender. Please update your frontend to current Adapt module versions.',\n );\n }\n if (lowercaseMsg.includes('invalid merkle root')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Merkle Root. Please sync your balances and try again.',\n );\n }\n if (lowercaseMsg.includes('note already spent')) {\n return new Error(\n 'RailgunSmartWallet: Note Already Spent. Please sync your balances and try again.',\n );\n }\n if (lowercaseMsg.includes('invalid note ciphertext array length')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Note Ciphertext Array Length. Please sync balances and re-prove your transaction.',\n );\n }\n if (lowercaseMsg.includes('invalid withdraw note')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Unshield Note. Please sync balances and re-prove your transaction.',\n );\n }\n if (lowercaseMsg.includes('invalid snark proof')) {\n return new Error(\n 'RailgunSmartWallet: Invalid Snark Proof. Please re-prove your transaction.',\n );\n }\n }\n\n return new Error(\n validAscii(err.message).replace(\n `:${STRING_PREFIX_AFTER_UNICODE_REPLACEMENT}`,\n ': ',\n ),\n );\n }\n\n return new Error('Unknown error. Please try again.');\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const decimalStringToHexString: (dec: string) => string;
2
+ export declare const decimalToHexString: (dec: number) => string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.decimalToHexString = exports.decimalStringToHexString = void 0;
4
+ var bignumber_1 = require("@ethersproject/bignumber");
5
+ var decimalStringToHexString = function (dec) {
6
+ return bignumber_1.BigNumber.from(dec).toHexString();
7
+ };
8
+ exports.decimalStringToHexString = decimalStringToHexString;
9
+ var decimalToHexString = function (dec) {
10
+ return bignumber_1.BigNumber.from(dec).toHexString();
11
+ };
12
+ exports.decimalToHexString = decimalToHexString;
13
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":";;;AAAA,sDAAqD;AAE9C,IAAM,wBAAwB,GAAG,UAAC,GAAW;IAClD,OAAO,qBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC;AAEK,IAAM,kBAAkB,GAAG,UAAC,GAAW;IAC5C,OAAO,qBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\n\nexport const decimalStringToHexString = (dec: string) => {\n return BigNumber.from(dec).toHexString();\n};\n\nexport const decimalToHexString = (dec: number) => {\n return BigNumber.from(dec).toHexString();\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { BigNumber } from '@ethersproject/bignumber';
2
- import { EVMGasType, NetworkName } from '../models/network-config';
3
- import { TransactionGasDetails } from '../models/response-types';
2
+ import { NetworkName } from '../models/network-config';
3
+ import { EVMGasType, TransactionGasDetails } from '../models/response-types';
4
4
  export declare const getEVMGasTypeForTransaction: (networkName: NetworkName, sendWithPublicWallet: boolean) => EVMGasType;
5
5
  export declare const calculateGasLimit: (gasEstimate: BigNumber) => BigNumber;
6
6
  export declare const calculateGasPrice: (gasDetails: TransactionGasDetails) => BigNumber;
package/dist/utils/gas.js CHANGED
@@ -2,12 +2,13 @@
2
2
  exports.__esModule = true;
3
3
  exports.calculateMaximumGas = exports.calculateTotalGas = exports.calculateGasPrice = exports.calculateGasLimit = exports.getEVMGasTypeForTransaction = void 0;
4
4
  var network_config_1 = require("../models/network-config");
5
+ var response_types_1 = require("../models/response-types");
5
6
  var getEVMGasTypeForTransaction = function (networkName, sendWithPublicWallet) {
6
7
  var defaultEVMGasType = network_config_1.NETWORK_CONFIG[networkName].defaultEVMGasType;
7
- if (defaultEVMGasType === network_config_1.EVMGasType.Type2 && !sendWithPublicWallet) {
8
+ if (defaultEVMGasType === response_types_1.EVMGasType.Type2 && !sendWithPublicWallet) {
8
9
  // Relayer transactions require overallBatchMinGasPrice.
9
10
  // This is only supported by type 1 transactions.
10
- return network_config_1.EVMGasType.Type1;
11
+ return response_types_1.EVMGasType.Type1;
11
12
  }
12
13
  return defaultEVMGasType;
13
14
  };
@@ -19,11 +20,11 @@ var calculateGasLimit = function (gasEstimate) {
19
20
  exports.calculateGasLimit = calculateGasLimit;
20
21
  var calculateGasPrice = function (gasDetails) {
21
22
  switch (gasDetails.evmGasType) {
22
- case network_config_1.EVMGasType.Type0:
23
- case network_config_1.EVMGasType.Type1: {
23
+ case response_types_1.EVMGasType.Type0:
24
+ case response_types_1.EVMGasType.Type1: {
24
25
  return gasDetails.gasPrice;
25
26
  }
26
- case network_config_1.EVMGasType.Type2: {
27
+ case response_types_1.EVMGasType.Type2: {
27
28
  return gasDetails.maxFeePerGas;
28
29
  }
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gas.js","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":";;;AACA,2DAIkC;AAG3B,IAAM,2BAA2B,GAAG,UACzC,WAAwB,EACxB,oBAA6B;IAErB,IAAA,iBAAiB,GAAK,+BAAc,CAAC,WAAW,CAAC,kBAAhC,CAAiC;IAE1D,IAAI,iBAAiB,KAAK,2BAAU,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE;QACnE,wDAAwD;QACxD,iDAAiD;QACjD,OAAO,2BAAU,CAAC,KAAK,CAAC;KACzB;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC;AAEK,IAAM,iBAAiB,GAAG,UAAC,WAAsB;IACtD,sCAAsC;IACtC,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC,CAAC;AAHW,QAAA,iBAAiB,qBAG5B;AAEK,IAAM,iBAAiB,GAAG,UAAC,UAAiC;IACjE,QAAQ,UAAU,CAAC,UAAU,EAAE;QAC7B,KAAK,2BAAU,CAAC,KAAK,CAAC;QACtB,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,UAAU,CAAC,QAAQ,CAAC;SAC5B;QACD,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,UAAU,CAAC,YAAY,CAAC;SAChC;KACF;AACH,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEK,IAAM,iBAAiB,GAAG,UAC/B,qBAA4C;IAE5C,IAAM,QAAQ,GAAG,IAAA,yBAAiB,EAAC,qBAAqB,CAAC,CAAC;IAClD,IAAA,WAAW,GAAK,qBAAqB,YAA1B,CAA2B;IAC9C,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAEK,IAAM,mBAAmB,GAAG,UACjC,qBAA4C;IAE5C,IAAM,QAAQ,GAAG,IAAA,yBAAiB,EAAC,qBAAqB,CAAC,CAAC;IAClD,IAAA,WAAW,GAAK,qBAAqB,YAA1B,CAA2B;IAC9C,OAAO,IAAA,yBAAiB,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\nimport {\n EVMGasType,\n NetworkName,\n NETWORK_CONFIG,\n} from '../models/network-config';\nimport { TransactionGasDetails } from '../models/response-types';\n\nexport const getEVMGasTypeForTransaction = (\n networkName: NetworkName,\n sendWithPublicWallet: boolean,\n): EVMGasType => {\n const { defaultEVMGasType } = NETWORK_CONFIG[networkName];\n\n if (defaultEVMGasType === EVMGasType.Type2 && !sendWithPublicWallet) {\n // Relayer transactions require overallBatchMinGasPrice.\n // This is only supported by type 1 transactions.\n return EVMGasType.Type1;\n }\n\n return defaultEVMGasType;\n};\n\nexport const calculateGasLimit = (gasEstimate: BigNumber): BigNumber => {\n // Gas Limit: Add 20% to gas estimate.\n return gasEstimate.mul(12000).div(10000);\n};\n\nexport const calculateGasPrice = (gasDetails: TransactionGasDetails) => {\n switch (gasDetails.evmGasType) {\n case EVMGasType.Type0:\n case EVMGasType.Type1: {\n return gasDetails.gasPrice;\n }\n case EVMGasType.Type2: {\n return gasDetails.maxFeePerGas;\n }\n }\n};\n\nexport const calculateTotalGas = (\n transactionGasDetails: TransactionGasDetails,\n) => {\n const gasPrice = calculateGasPrice(transactionGasDetails);\n const { gasEstimate } = transactionGasDetails;\n return gasEstimate.mul(gasPrice);\n};\n\nexport const calculateMaximumGas = (\n transactionGasDetails: TransactionGasDetails,\n): BigNumber => {\n const gasPrice = calculateGasPrice(transactionGasDetails);\n const { gasEstimate } = transactionGasDetails;\n return calculateGasLimit(gasEstimate).mul(gasPrice);\n};\n"]}
1
+ {"version":3,"file":"gas.js","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":";;;AACA,2DAAuE;AACvE,2DAA6E;AAEtE,IAAM,2BAA2B,GAAG,UACzC,WAAwB,EACxB,oBAA6B;IAErB,IAAA,iBAAiB,GAAK,+BAAc,CAAC,WAAW,CAAC,kBAAhC,CAAiC;IAE1D,IAAI,iBAAiB,KAAK,2BAAU,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE;QACnE,wDAAwD;QACxD,iDAAiD;QACjD,OAAO,2BAAU,CAAC,KAAK,CAAC;KACzB;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC;AAEK,IAAM,iBAAiB,GAAG,UAAC,WAAsB;IACtD,sCAAsC;IACtC,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC,CAAC;AAHW,QAAA,iBAAiB,qBAG5B;AAEK,IAAM,iBAAiB,GAAG,UAAC,UAAiC;IACjE,QAAQ,UAAU,CAAC,UAAU,EAAE;QAC7B,KAAK,2BAAU,CAAC,KAAK,CAAC;QACtB,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,UAAU,CAAC,QAAQ,CAAC;SAC5B;QACD,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,UAAU,CAAC,YAAY,CAAC;SAChC;KACF;AACH,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEK,IAAM,iBAAiB,GAAG,UAC/B,qBAA4C;IAE5C,IAAM,QAAQ,GAAG,IAAA,yBAAiB,EAAC,qBAAqB,CAAC,CAAC;IAClD,IAAA,WAAW,GAAK,qBAAqB,YAA1B,CAA2B;IAC9C,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAEK,IAAM,mBAAmB,GAAG,UACjC,qBAA4C;IAE5C,IAAM,QAAQ,GAAG,IAAA,yBAAiB,EAAC,qBAAqB,CAAC,CAAC;IAClD,IAAA,WAAW,GAAK,qBAAqB,YAA1B,CAA2B;IAC9C,OAAO,IAAA,yBAAiB,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B","sourcesContent":["import { BigNumber } from '@ethersproject/bignumber';\nimport { NetworkName, NETWORK_CONFIG } from '../models/network-config';\nimport { EVMGasType, TransactionGasDetails } from '../models/response-types';\n\nexport const getEVMGasTypeForTransaction = (\n networkName: NetworkName,\n sendWithPublicWallet: boolean,\n): EVMGasType => {\n const { defaultEVMGasType } = NETWORK_CONFIG[networkName];\n\n if (defaultEVMGasType === EVMGasType.Type2 && !sendWithPublicWallet) {\n // Relayer transactions require overallBatchMinGasPrice.\n // This is only supported by type 1 transactions.\n return EVMGasType.Type1;\n }\n\n return defaultEVMGasType;\n};\n\nexport const calculateGasLimit = (gasEstimate: BigNumber): BigNumber => {\n // Gas Limit: Add 20% to gas estimate.\n return gasEstimate.mul(12000).div(10000);\n};\n\nexport const calculateGasPrice = (gasDetails: TransactionGasDetails) => {\n switch (gasDetails.evmGasType) {\n case EVMGasType.Type0:\n case EVMGasType.Type1: {\n return gasDetails.gasPrice;\n }\n case EVMGasType.Type2: {\n return gasDetails.maxFeePerGas;\n }\n }\n};\n\nexport const calculateTotalGas = (\n transactionGasDetails: TransactionGasDetails,\n) => {\n const gasPrice = calculateGasPrice(transactionGasDetails);\n const { gasEstimate } = transactionGasDetails;\n return gasEstimate.mul(gasPrice);\n};\n\nexport const calculateMaximumGas = (\n transactionGasDetails: TransactionGasDetails,\n): BigNumber => {\n const gasPrice = calculateGasPrice(transactionGasDetails);\n const { gasEstimate } = transactionGasDetails;\n return calculateGasLimit(gasEstimate).mul(gasPrice);\n};\n"]}
@@ -0,0 +1,8 @@
1
+ export * from './compare';
2
+ export * from './error';
3
+ export * from './format';
4
+ export * from './gas';
5
+ export * from './network';
6
+ export * from './promises';
7
+ export * from './serializer';
8
+ export * from './versions';
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ exports.__esModule = true;
17
+ __exportStar(require("./compare"), exports);
18
+ __exportStar(require("./error"), exports);
19
+ __exportStar(require("./format"), exports);
20
+ __exportStar(require("./gas"), exports);
21
+ __exportStar(require("./network"), exports);
22
+ __exportStar(require("./promises"), exports);
23
+ __exportStar(require("./serializer"), exports);
24
+ __exportStar(require("./versions"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,+CAA6B;AAC7B,6CAA2B","sourcesContent":["export * from './compare';\nexport * from './error';\nexport * from './format';\nexport * from './gas';\nexport * from './network';\nexport * from './promises';\nexport * from './serializer';\nexport * from './versions';\n"]}
@@ -0,0 +1,3 @@
1
+ import { Network } from '../models/network-config';
2
+ import { Chain } from '../models/response-types';
3
+ export declare const networkForChain: (chain: Chain) => Optional<Network>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.networkForChain = void 0;
4
+ var network_config_1 = require("../models/network-config");
5
+ var networkForChain = function (chain) {
6
+ return Object.values(network_config_1.NETWORK_CONFIG).find(function (network) {
7
+ return network.chain.type === chain.type && network.chain.id === chain.id;
8
+ });
9
+ };
10
+ exports.networkForChain = networkForChain;
11
+ //# sourceMappingURL=network.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/utils/network.ts"],"names":[],"mappings":";;;AAAA,2DAAmE;AAG5D,IAAM,eAAe,GAAG,UAAC,KAAY;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,+BAAc,CAAC,CAAC,IAAI,CACvC,UAAA,OAAO;QACL,OAAA,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE;IAAlE,CAAkE,CACrE,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,eAAe,mBAK1B","sourcesContent":["import { Network, NETWORK_CONFIG } from '../models/network-config';\nimport { Chain } from '../models/response-types';\n\nexport const networkForChain = (chain: Chain): Optional<Network> => {\n return Object.values(NETWORK_CONFIG).find(\n network =>\n network.chain.type === chain.type && network.chain.id === chain.id,\n );\n};\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const delay: (delayInMS: number) => Promise<void>;
2
+ export declare function promiseTimeout<T>(promise: Promise<T>, ms: number, customTimeoutError?: Error): Promise<T>;
3
+ export declare function poll<T>(fn: () => Promise<T>, passCondition: (result: T) => boolean, delayInMS: number, allowedAttempts?: number): Promise<Optional<T>>;
@@ -0,0 +1,95 @@
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
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ exports.__esModule = true;
39
+ exports.poll = exports.promiseTimeout = exports.delay = void 0;
40
+ var delay = function (delayInMS) {
41
+ return new Promise(function (resolve) { return setTimeout(resolve, delayInMS); });
42
+ };
43
+ exports.delay = delay;
44
+ function promiseTimeout(promise, ms, customTimeoutError) {
45
+ // Create a promise that rejects in <ms> milliseconds
46
+ var timeout = new Promise(function (_resolve, reject) {
47
+ var id = setTimeout(function () {
48
+ clearTimeout(id);
49
+ reject(new Error("Timed out in ".concat(ms, " ms.")));
50
+ }, ms);
51
+ });
52
+ // Returns a race between our timeout and the passed in promise
53
+ return Promise.race([promise, timeout])
54
+ .then(function (result) { return result; })["catch"](function (err) {
55
+ if (!(err instanceof Error)) {
56
+ throw err;
57
+ }
58
+ if (err.message.startsWith('Timed out')) {
59
+ throw customTimeoutError !== null && customTimeoutError !== void 0 ? customTimeoutError : err;
60
+ }
61
+ throw err;
62
+ });
63
+ }
64
+ exports.promiseTimeout = promiseTimeout;
65
+ function poll(fn, passCondition, delayInMS, allowedAttempts) {
66
+ if (allowedAttempts === void 0) { allowedAttempts = 1; }
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var result, attempts;
69
+ return __generator(this, function (_a) {
70
+ switch (_a.label) {
71
+ case 0: return [4 /*yield*/, fn()];
72
+ case 1:
73
+ result = _a.sent();
74
+ attempts = 1;
75
+ _a.label = 2;
76
+ case 2:
77
+ if (!(attempts <= allowedAttempts)) return [3 /*break*/, 5];
78
+ if (passCondition(result)) {
79
+ return [2 /*return*/, result];
80
+ }
81
+ return [4 /*yield*/, (0, exports.delay)(delayInMS)];
82
+ case 3:
83
+ _a.sent();
84
+ return [4 /*yield*/, fn()];
85
+ case 4:
86
+ result = _a.sent();
87
+ attempts++;
88
+ return [3 /*break*/, 2];
89
+ case 5: return [2 /*return*/, undefined];
90
+ }
91
+ });
92
+ });
93
+ }
94
+ exports.poll = poll;
95
+ //# sourceMappingURL=promises.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promises.js","sourceRoot":"","sources":["../../src/utils/promises.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,KAAK,GAAG,UAAC,SAAiB;IACrC,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO,IAAI,OAAA,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,EAA9B,CAA8B,CAAC,CAAC;AAChE,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEF,SAAgB,cAAc,CAC5B,OAAmB,EACnB,EAAU,EACV,kBAA0B;IAE1B,qDAAqD;IACrD,IAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,QAAQ,EAAE,MAAM;QAC3C,IAAM,EAAE,GAAG,UAAU,CAAC;YACpB,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAgB,EAAE,SAAM,CAAC,CAAC,CAAC;QAC9C,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;IAEH,+DAA+D;IAC/D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;SACpC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,MAAW,EAAX,CAAW,CAAC,CAC3B,OAAK,CAAA,CAAC,UAAA,GAAG;QACR,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,EAAE;YAC3B,MAAM,GAAG,CAAC;SACX;QACD,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YACvC,MAAM,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,GAAG,CAAC;SACjC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;AACP,CAAC;AAzBD,wCAyBC;AAED,SAAsB,IAAI,CACxB,EAAoB,EACpB,aAAqC,EACrC,SAAiB,EACjB,eAAmB;IAAnB,gCAAA,EAAA,mBAAmB;;;;;wBAEN,qBAAM,EAAE,EAAE,EAAA;;oBAAnB,MAAM,GAAG,SAAU;oBACnB,QAAQ,GAAG,CAAC,CAAC;;;yBACV,CAAA,QAAQ,IAAI,eAAe,CAAA;oBAChC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;wBACzB,sBAAO,MAAM,EAAC;qBACf;oBACD,qBAAM,IAAA,aAAK,EAAC,SAAS,CAAC,EAAA;;oBAAtB,SAAsB,CAAC;oBACd,qBAAM,EAAE,EAAE,EAAA;;oBAAnB,MAAM,GAAG,SAAU,CAAC;oBACpB,QAAQ,EAAE,CAAC;;wBAEb,sBAAO,SAAS,EAAC;;;;CAClB;AAjBD,oBAiBC","sourcesContent":["export const delay = (delayInMS: number): Promise<void> => {\n return new Promise(resolve => setTimeout(resolve, delayInMS));\n};\n\nexport function promiseTimeout<T>(\n promise: Promise<T>,\n ms: number,\n customTimeoutError?: Error,\n): Promise<T> {\n // Create a promise that rejects in <ms> milliseconds\n const timeout = new Promise((_resolve, reject) => {\n const id = setTimeout(() => {\n clearTimeout(id);\n reject(new Error(`Timed out in ${ms} ms.`));\n }, ms);\n });\n\n // Returns a race between our timeout and the passed in promise\n return Promise.race([promise, timeout])\n .then(result => result as T)\n .catch(err => {\n if (!(err instanceof Error)) {\n throw err;\n }\n if (err.message.startsWith('Timed out')) {\n throw customTimeoutError ?? err;\n }\n throw err;\n });\n}\n\nexport async function poll<T>(\n fn: () => Promise<T>,\n passCondition: (result: T) => boolean,\n delayInMS: number,\n allowedAttempts = 1,\n): Promise<Optional<T>> {\n let result = await fn();\n let attempts = 1;\n while (attempts <= allowedAttempts) {\n if (passCondition(result)) {\n return result;\n }\n await delay(delayInMS);\n result = await fn();\n attempts++;\n }\n return undefined;\n}\n"]}
@@ -13,12 +13,12 @@ var __assign = (this && this.__assign) || function () {
13
13
  exports.__esModule = true;
14
14
  exports.deserializeTransaction = exports.serializeUnsignedTransaction = void 0;
15
15
  var transactions_1 = require("@ethersproject/transactions");
16
- var network_config_1 = require("../models/network-config");
16
+ var response_types_1 = require("../models/response-types");
17
17
  var validatePreserialize = function (transaction) {
18
18
  if (transaction.from) {
19
19
  throw new Error("Cannot serialize 'from' field on transaction.");
20
20
  }
21
- if (transaction.type === network_config_1.EVMGasType.Type0 && transaction.accessList) {
21
+ if (transaction.type === response_types_1.EVMGasType.Type0 && transaction.accessList) {
22
22
  throw new Error("Cannot serialize 'accessList' field on Type0 transaction.");
23
23
  }
24
24
  };
@@ -35,9 +35,15 @@ exports.serializeUnsignedTransaction = serializeUnsignedTransaction;
35
35
  // return serialize(transaction, signature);
36
36
  // };
37
37
  var deserializeTransaction = function (rawTransaction, nonce, chainId) {
38
- var _a;
38
+ var _a, _b, _c, _d, _e;
39
39
  var transaction = (0, transactions_1.parse)(rawTransaction);
40
- return __assign(__assign({}, transaction), { type: (_a = transaction.type) !== null && _a !== void 0 ? _a : undefined, nonce: nonce, chainId: chainId });
40
+ return __assign(__assign({}, transaction), { type: (_a = transaction.type) !== null && _a !== void 0 ? _a : undefined, nonce: nonce, chainId: chainId,
41
+ // Set gas-related vars as undefined if they're zero.
42
+ gasLimit: ((_b = transaction.gasLimit) === null || _b === void 0 ? void 0 : _b.eq(0)) ? undefined : transaction.gasLimit, gasPrice: ((_c = transaction.gasPrice) === null || _c === void 0 ? void 0 : _c.eq(0)) ? undefined : transaction.gasPrice, maxFeePerGas: ((_d = transaction.maxFeePerGas) === null || _d === void 0 ? void 0 : _d.eq(0))
43
+ ? undefined
44
+ : transaction.maxFeePerGas, maxPriorityFeePerGas: ((_e = transaction.maxPriorityFeePerGas) === null || _e === void 0 ? void 0 : _e.eq(0))
45
+ ? undefined
46
+ : transaction.maxPriorityFeePerGas });
41
47
  };
42
48
  exports.deserializeTransaction = deserializeTransaction;
43
49
  //# sourceMappingURL=serializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/utils/serializer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,4DAA4E;AAE5E,2DAAsD;AAEtD,IAAM,oBAAoB,GAAG,UAAC,WAAiC;IAC7D,IAAI,WAAW,CAAC,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IACD,IAAI,WAAW,CAAC,IAAI,KAAK,2BAAU,CAAC,KAAK,IAAI,WAAW,CAAC,UAAU,EAAE;QACnE,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;KACH;AACH,CAAC,CAAC;AAEK,IAAM,4BAA4B,GAAG,UAC1C,WAAiC;IAEjC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAClC,OAAO,IAAA,wBAAS,EAAC,WAAW,CAAC,CAAC;AAChC,CAAC,CAAC;AALW,QAAA,4BAA4B,gCAKvC;AAEF,8CAA8C;AAC9C,uCAAuC;AACvC,8BAA8B;AAC9B,iBAAiB;AACjB,uCAAuC;AACvC,8CAA8C;AAC9C,KAAK;AAEE,IAAM,sBAAsB,GAAG,UACpC,cAAsB,EACtB,KAAuB,EACvB,OAAe;;IAEf,IAAM,WAAW,GAAgB,IAAA,oBAAK,EAAC,cAAc,CAAC,CAAC;IACvD,6BACK,WAAW,KACd,IAAI,EAAE,MAAA,WAAW,CAAC,IAAI,mCAAI,SAAS,EACnC,KAAK,OAAA,EACL,OAAO,SAAA,IACP;AACJ,CAAC,CAAC;AAZW,QAAA,sBAAsB,0BAYjC","sourcesContent":["import { PopulatedTransaction } from '@ethersproject/contracts';\nimport { parse, serialize, Transaction } from '@ethersproject/transactions';\nimport { TransactionRequest } from '@ethersproject/providers';\nimport { EVMGasType } from '../models/network-config';\n\nconst validatePreserialize = (transaction: PopulatedTransaction) => {\n if (transaction.from) {\n throw new Error(`Cannot serialize 'from' field on transaction.`);\n }\n if (transaction.type === EVMGasType.Type0 && transaction.accessList) {\n throw new Error(\n `Cannot serialize 'accessList' field on Type0 transaction.`,\n );\n }\n};\n\nexport const serializeUnsignedTransaction = (\n transaction: PopulatedTransaction,\n): string => {\n validatePreserialize(transaction);\n return serialize(transaction);\n};\n\n// export const serializeSignedTransaction = (\n// transaction: PopulatedTransaction,\n// signature: SignatureLike,\n// ): string => {\n// validatePreserialize(transaction);\n// return serialize(transaction, signature);\n// };\n\nexport const deserializeTransaction = (\n rawTransaction: string,\n nonce: Optional<number>,\n chainId: number,\n): TransactionRequest => {\n const transaction: Transaction = parse(rawTransaction);\n return {\n ...transaction,\n type: transaction.type ?? undefined,\n nonce,\n chainId,\n };\n};\n"]}
1
+ {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/utils/serializer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,4DAA4E;AAE5E,2DAAsD;AAEtD,IAAM,oBAAoB,GAAG,UAAC,WAAiC;IAC7D,IAAI,WAAW,CAAC,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC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,CAAC,CAAC,WAAW,CAAC,oBAAoB,IACpC;AACJ,CAAC,CAAC;AAtBW,QAAA,sBAAsB,0BAsBjC","sourcesContent":["import { PopulatedTransaction } from '@ethersproject/contracts';\nimport { parse, serialize, Transaction } from '@ethersproject/transactions';\nimport { TransactionRequest } from '@ethersproject/providers';\nimport { EVMGasType } from '../models/response-types';\n\nconst validatePreserialize = (transaction: PopulatedTransaction) => {\n if (transaction.from) {\n throw new Error(`Cannot serialize 'from' field on transaction.`);\n }\n if (transaction.type === EVMGasType.Type0 && transaction.accessList) {\n throw new Error(\n `Cannot serialize 'accessList' field on Type0 transaction.`,\n );\n }\n};\n\nexport const serializeUnsignedTransaction = (\n transaction: PopulatedTransaction,\n): string => {\n validatePreserialize(transaction);\n return serialize(transaction);\n};\n\n// export const serializeSignedTransaction = (\n// transaction: PopulatedTransaction,\n// signature: SignatureLike,\n// ): string => {\n// validatePreserialize(transaction);\n// return serialize(transaction, signature);\n// };\n\nexport const deserializeTransaction = (\n rawTransaction: string,\n nonce: Optional<number>,\n chainId: number,\n): TransactionRequest => {\n const transaction: Transaction = parse(rawTransaction);\n return {\n ...transaction,\n type: transaction.type ?? undefined,\n nonce,\n chainId,\n\n // Set gas-related vars as undefined if they're zero.\n gasLimit: transaction.gasLimit?.eq(0) ? undefined : transaction.gasLimit,\n gasPrice: transaction.gasPrice?.eq(0) ? undefined : transaction.gasPrice,\n maxFeePerGas: transaction.maxFeePerGas?.eq(0)\n ? undefined\n : transaction.maxFeePerGas,\n maxPriorityFeePerGas: transaction.maxPriorityFeePerGas?.eq(0)\n ? undefined\n : transaction.maxPriorityFeePerGas,\n };\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const versionCompare: (appVersion?: string, minVersion?: string) => number;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.versionCompare = void 0;
4
+ var versionCompare = function (appVersion, minVersion) {
5
+ if (!appVersion || !minVersion) {
6
+ throw new Error('Requires two version numbers to compare.');
7
+ }
8
+ // Adapted from https://stackoverflow.com/a/6832721
9
+ var zeroExtend = true, v1parts = appVersion.split('.'), v2parts = minVersion.split('.');
10
+ function isValidPart(x) {
11
+ return /^\d+$/.test(x);
12
+ }
13
+ if (!v1parts.every(isValidPart) || !v2parts.every(isValidPart)) {
14
+ return NaN;
15
+ }
16
+ if (zeroExtend) {
17
+ while (v1parts.length < v2parts.length) {
18
+ v1parts.push('0');
19
+ }
20
+ while (v2parts.length < v1parts.length) {
21
+ v2parts.push('0');
22
+ }
23
+ }
24
+ var v1parts_number = v1parts.map(Number);
25
+ var v2parts_number = v2parts.map(Number);
26
+ for (var i = 0; i < v1parts_number.length; ++i) {
27
+ if (v2parts_number.length === i) {
28
+ return 1;
29
+ }
30
+ if (v1parts_number[i] === v2parts_number[i]) {
31
+ continue;
32
+ }
33
+ else if (v1parts_number[i] > v2parts_number[i]) {
34
+ return 1;
35
+ }
36
+ else {
37
+ return -1;
38
+ }
39
+ }
40
+ if (v1parts_number.length !== v2parts_number.length) {
41
+ return -1;
42
+ }
43
+ return 0;
44
+ };
45
+ exports.versionCompare = versionCompare;
46
+ //# sourceMappingURL=versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/utils/versions.ts"],"names":[],"mappings":";;;AAAO,IAAM,cAAc,GAAG,UAC5B,UAAmB,EACnB,UAAmB;IAEnB,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;IAED,mDAAmD;IACnD,IAAM,UAAU,GAAG,IAAI,EACrB,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAC/B,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,SAAS,WAAW,CAAC,CAAS;QAC5B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;QAC9D,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,UAAU,EAAE;QACd,OAAO,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE;YACtC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;QACD,OAAO,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE;YACtC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACnB;KACF;IAED,IAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QAC9C,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,OAAO,CAAC,CAAC;SACV;QACD,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,EAAE;YAC3C,SAAS;SACV;aAAM,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE;YAChD,OAAO,CAAC,CAAC;SACV;aAAM;YACL,OAAO,CAAC,CAAC,CAAC;SACX;KACF;IACD,IAAI,cAAc,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAAE;QACnD,OAAO,CAAC,CAAC,CAAC;KACX;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAhDW,QAAA,cAAc,kBAgDzB","sourcesContent":["export const versionCompare = (\n appVersion?: string,\n minVersion?: string,\n): number => {\n if (!appVersion || !minVersion) {\n throw new Error('Requires two version numbers to compare.');\n }\n\n // Adapted from https://stackoverflow.com/a/6832721\n const zeroExtend = true,\n v1parts = appVersion.split('.'),\n v2parts = minVersion.split('.');\n\n function isValidPart(x: string) {\n return /^\\d+$/.test(x);\n }\n\n if (!v1parts.every(isValidPart) || !v2parts.every(isValidPart)) {\n return NaN;\n }\n if (zeroExtend) {\n while (v1parts.length < v2parts.length) {\n v1parts.push('0');\n }\n while (v2parts.length < v1parts.length) {\n v2parts.push('0');\n }\n }\n\n const v1parts_number = v1parts.map(Number);\n const v2parts_number = v2parts.map(Number);\n\n for (let i = 0; i < v1parts_number.length; ++i) {\n if (v2parts_number.length === i) {\n return 1;\n }\n if (v1parts_number[i] === v2parts_number[i]) {\n continue;\n } else if (v1parts_number[i] > v2parts_number[i]) {\n return 1;\n } else {\n return -1;\n }\n }\n if (v1parts_number.length !== v2parts_number.length) {\n return -1;\n }\n return 0;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railgun-community/shared-models",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -9,6 +9,18 @@
9
9
  "exports": {
10
10
  ".": "./dist/index.js"
11
11
  },
12
+ "scripts": {
13
+ "clean": "rm -rf dist",
14
+ "build": "npm run clean && tsc",
15
+ "prepare": "npm run build",
16
+ "check-circular-deps": "madge --circular .",
17
+ "eslint": "eslint src --ext .ts,.tsx --fix",
18
+ "lint": "npm run check-circular-deps && npm run eslint",
19
+ "tsc-test": "tsc -p tsconfig.test.json && tsc-alias -p tsconfig.test.json",
20
+ "compile-test": "npm run clean && npm run tsc-test",
21
+ "test-coverage": "npm run compile-test && nyc mocha 'src/**/__tests__/*.test.ts'",
22
+ "test": "npm run compile-test && mocha 'src/**/__tests__/*.test.ts'"
23
+ },
12
24
  "peerDependencies": {
13
25
  "@ethersproject/bignumber": "^5.7.0",
14
26
  "@ethersproject/providers": "^5.7.1"
@@ -16,24 +28,24 @@
16
28
  "devDependencies": {
17
29
  "@ethersproject/bignumber": "^5.7.0",
18
30
  "@ethersproject/providers": "^5.7.1",
31
+ "@types/chai": "^4.3.4",
32
+ "@types/chai-as-promised": "^7.1.5",
33
+ "@types/mocha": "^10.0.1",
19
34
  "@types/node": "^18.7.23",
20
35
  "@typescript-eslint/eslint-plugin": "^5.38.1",
21
36
  "@typescript-eslint/parser": "^5.38.1",
37
+ "chai": "^4.3.7",
38
+ "chai-as-promised": "^7.1.1",
22
39
  "eslint": "^8.24.0",
23
40
  "eslint-config-prettier": "^8.5.0",
24
41
  "eslint-plugin-flowtype": "^8.0.3",
25
42
  "eslint-plugin-import": "^2.26.0",
26
43
  "madge": "^5.0.1",
44
+ "mocha": "^10.2.0",
45
+ "ts-node": "^10.9.1",
46
+ "tsc-alias": "^1.8.2",
27
47
  "typescript": "^4.8.3"
28
48
  },
29
- "scripts": {
30
- "clean": "rm -rf dist",
31
- "build": "npm run clean && tsc",
32
- "prepare": "npm run build",
33
- "check-circular-deps": "madge --circular --extensions tsx .",
34
- "eslint": "eslint src --ext .ts,.tsx --fix",
35
- "lint": "npm run check-circular-deps && npm run eslint"
36
- },
37
49
  "dependencies": {
38
50
  "@ethersproject/contracts": "^5.7.0",
39
51
  "@ethersproject/transactions": "^5.7.0"