@instadapp/interop-x 0.0.0-dev.e916c22 → 0.0.0-dev.ea4acf6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/package.json +9 -2
  2. package/dist/src/abi/aaveV2Resolver.json +832 -0
  3. package/dist/src/abi/aaveV3Resolver.json +628 -0
  4. package/dist/src/abi/balanceResolver.json +211 -0
  5. package/dist/src/abi/index.js +6 -0
  6. package/dist/src/api/index.js +7 -0
  7. package/dist/src/constants/addresses.js +6 -0
  8. package/dist/src/constants/capPerChain.js +8 -0
  9. package/dist/src/constants/index.js +2 -0
  10. package/dist/src/constants/tokens.js +44 -44
  11. package/dist/src/constants/wrappedNativeToken.js +8 -0
  12. package/dist/src/crons/index.js +3 -0
  13. package/dist/src/crons/prices.js +16 -0
  14. package/dist/src/db/models/transaction.js +1 -1
  15. package/dist/src/errors/index.js +30 -0
  16. package/dist/src/gnosis/actions/aaveV2/source.js +26 -1
  17. package/dist/src/gnosis/actions/aaveV2/target.js +18 -4
  18. package/dist/src/gnosis/actions/aaveV3/index.js +11 -0
  19. package/dist/src/gnosis/actions/aaveV3/source.js +74 -0
  20. package/dist/src/gnosis/actions/aaveV3/target.js +87 -0
  21. package/dist/src/gnosis/actions/index.js +2 -0
  22. package/dist/src/index.js +2 -1
  23. package/dist/src/providers/index.js +17 -0
  24. package/dist/src/providers/retry-provider.js +45 -0
  25. package/dist/src/services/Prices.js +74 -0
  26. package/dist/src/services/index.js +8 -0
  27. package/dist/src/tasks/InteropX/{ProcessSubmitSubmitEvents.js → ProcessSubmitEvents.js} +108 -14
  28. package/dist/src/tasks/InteropX/ProcessValidateEvents.js +30 -10
  29. package/dist/src/tasks/InteropX/SyncLogExecuteEvents.js +3 -2
  30. package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +3 -2
  31. package/dist/src/tasks/InteropX/SyncLogValidateEvents.js +3 -2
  32. package/dist/src/tasks/index.js +3 -4
  33. package/dist/src/typechain/AaveV2Resolver.js +2 -0
  34. package/dist/src/typechain/AaveV3Resolver.js +2 -0
  35. package/dist/src/typechain/BalanceResolver.js +2 -0
  36. package/dist/src/typechain/factories/AaveV2Resolver__factory.js +1191 -0
  37. package/dist/src/typechain/factories/AaveV3Resolver__factory.js +887 -0
  38. package/dist/src/typechain/factories/BalanceResolver__factory.js +228 -0
  39. package/dist/src/typechain/factories/index.js +7 -1
  40. package/dist/src/typechain/index.js +7 -1
  41. package/dist/src/utils/async.js +18 -0
  42. package/dist/src/utils/dsa.js +36 -0
  43. package/dist/src/utils/formatting.js +67 -0
  44. package/dist/src/utils/gnosis.js +87 -0
  45. package/dist/src/utils/http.js +10 -0
  46. package/dist/src/utils/index.js +22 -220
  47. package/dist/src/utils/interop.js +16 -0
  48. package/dist/src/utils/tokens.js +22 -0
  49. package/dist/src/utils/validate.js +111 -0
  50. package/dist/src/utils/web3.js +93 -0
  51. package/package.json +9 -2
  52. package/src/abi/aaveV2Resolver.json +832 -0
  53. package/src/abi/aaveV3Resolver.json +628 -0
  54. package/src/abi/balanceResolver.json +211 -0
  55. package/src/abi/index.ts +6 -0
  56. package/src/api/index.ts +8 -0
  57. package/src/constants/addresses.ts +18 -1
  58. package/src/constants/capPerChain.ts +5 -0
  59. package/src/constants/index.ts +2 -0
  60. package/src/constants/tokens.ts +44 -44
  61. package/src/constants/wrappedNativeToken.ts +5 -0
  62. package/src/crons/index.ts +1 -0
  63. package/src/crons/prices.ts +12 -0
  64. package/src/db/models/transaction.ts +1 -1
  65. package/src/errors/index.ts +26 -0
  66. package/src/gnosis/actions/aaveV2/source.ts +56 -3
  67. package/src/gnosis/actions/aaveV2/target.ts +30 -11
  68. package/src/gnosis/actions/aaveV3/index.ts +9 -0
  69. package/src/gnosis/actions/aaveV3/source.ts +119 -0
  70. package/src/gnosis/actions/aaveV3/target.ts +142 -0
  71. package/src/gnosis/actions/index.ts +2 -0
  72. package/src/index.ts +1 -0
  73. package/src/providers/index.ts +1 -0
  74. package/src/providers/retry-provider.ts +51 -0
  75. package/src/services/Prices.ts +89 -0
  76. package/src/services/index.ts +1 -0
  77. package/src/tasks/InteropX/{ProcessSubmitSubmitEvents.ts → ProcessSubmitEvents.ts} +135 -20
  78. package/src/tasks/InteropX/ProcessValidateEvents.ts +42 -19
  79. package/src/tasks/InteropX/SyncLogExecuteEvents.ts +5 -6
  80. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +6 -7
  81. package/src/tasks/InteropX/SyncLogValidateEvents.ts +6 -7
  82. package/src/tasks/index.ts +3 -4
  83. package/src/typechain/AaveV2Resolver.ts +1017 -0
  84. package/src/typechain/AaveV3Resolver.ts +935 -0
  85. package/src/typechain/BalanceResolver.ts +266 -0
  86. package/src/typechain/factories/AaveV2Resolver__factory.ts +1198 -0
  87. package/src/typechain/factories/AaveV3Resolver__factory.ts +894 -0
  88. package/src/typechain/factories/BalanceResolver__factory.ts +235 -0
  89. package/src/typechain/factories/index.ts +3 -0
  90. package/src/typechain/index.ts +6 -0
  91. package/src/utils/async.ts +22 -0
  92. package/src/utils/dsa.ts +56 -0
  93. package/src/utils/formatting.ts +68 -0
  94. package/src/utils/gnosis.ts +166 -0
  95. package/src/utils/http.ts +6 -0
  96. package/src/utils/index.ts +9 -365
  97. package/src/utils/interop.ts +28 -0
  98. package/src/utils/tokens.ts +21 -0
  99. package/src/utils/validate.ts +179 -0
  100. package/src/utils/web3.ts +132 -0
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+ /* Autogenerated file. Do not edit manually. */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BalanceResolver__factory = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
+ {
10
+ inputs: [
11
+ {
12
+ internalType: "address",
13
+ name: "_wnativeToken",
14
+ type: "address",
15
+ },
16
+ ],
17
+ stateMutability: "nonpayable",
18
+ type: "constructor",
19
+ },
20
+ {
21
+ inputs: [
22
+ {
23
+ components: [
24
+ {
25
+ components: [
26
+ {
27
+ internalType: "address",
28
+ name: "sourceToken",
29
+ type: "address",
30
+ },
31
+ {
32
+ internalType: "address",
33
+ name: "targetToken",
34
+ type: "address",
35
+ },
36
+ {
37
+ internalType: "uint256",
38
+ name: "amount",
39
+ type: "uint256",
40
+ },
41
+ ],
42
+ internalType: "struct Variables.TokenInfo[]",
43
+ name: "supply",
44
+ type: "tuple[]",
45
+ },
46
+ {
47
+ components: [
48
+ {
49
+ internalType: "address",
50
+ name: "sourceToken",
51
+ type: "address",
52
+ },
53
+ {
54
+ internalType: "address",
55
+ name: "targetToken",
56
+ type: "address",
57
+ },
58
+ {
59
+ internalType: "uint256",
60
+ name: "amount",
61
+ type: "uint256",
62
+ },
63
+ ],
64
+ internalType: "struct Variables.TokenInfo[]",
65
+ name: "withdraw",
66
+ type: "tuple[]",
67
+ },
68
+ ],
69
+ internalType: "struct Variables.Position",
70
+ name: "position",
71
+ type: "tuple",
72
+ },
73
+ {
74
+ internalType: "address",
75
+ name: "liquidityContract",
76
+ type: "address",
77
+ },
78
+ {
79
+ internalType: "bool",
80
+ name: "isSupply",
81
+ type: "bool",
82
+ },
83
+ {
84
+ internalType: "bool",
85
+ name: "isTargetToken",
86
+ type: "bool",
87
+ },
88
+ ],
89
+ name: "checkLiquidity",
90
+ outputs: [
91
+ {
92
+ components: [
93
+ {
94
+ internalType: "bool",
95
+ name: "isOk",
96
+ type: "bool",
97
+ },
98
+ {
99
+ components: [
100
+ {
101
+ internalType: "address",
102
+ name: "token",
103
+ type: "address",
104
+ },
105
+ {
106
+ internalType: "uint256",
107
+ name: "liquidityAvailable",
108
+ type: "uint256",
109
+ },
110
+ {
111
+ internalType: "uint256",
112
+ name: "liquidityShort",
113
+ type: "uint256",
114
+ },
115
+ ],
116
+ internalType: "struct Helpers.LiquidityData[]",
117
+ name: "supply",
118
+ type: "tuple[]",
119
+ },
120
+ {
121
+ components: [
122
+ {
123
+ internalType: "address",
124
+ name: "token",
125
+ type: "address",
126
+ },
127
+ {
128
+ internalType: "uint256",
129
+ name: "liquidityAvailable",
130
+ type: "uint256",
131
+ },
132
+ {
133
+ internalType: "uint256",
134
+ name: "liquidityShort",
135
+ type: "uint256",
136
+ },
137
+ ],
138
+ internalType: "struct Helpers.LiquidityData[]",
139
+ name: "withdraw",
140
+ type: "tuple[]",
141
+ },
142
+ ],
143
+ internalType: "struct Helpers.PositionData",
144
+ name: "p",
145
+ type: "tuple",
146
+ },
147
+ ],
148
+ stateMutability: "view",
149
+ type: "function",
150
+ },
151
+ {
152
+ inputs: [
153
+ {
154
+ internalType: "address[]",
155
+ name: "tokens",
156
+ type: "address[]",
157
+ },
158
+ {
159
+ internalType: "address",
160
+ name: "liquidityContract",
161
+ type: "address",
162
+ },
163
+ ],
164
+ name: "getLiquidity",
165
+ outputs: [
166
+ {
167
+ components: [
168
+ {
169
+ internalType: "address",
170
+ name: "token",
171
+ type: "address",
172
+ },
173
+ {
174
+ internalType: "uint256",
175
+ name: "liquidityAvailable",
176
+ type: "uint256",
177
+ },
178
+ {
179
+ internalType: "uint256",
180
+ name: "liquidityShort",
181
+ type: "uint256",
182
+ },
183
+ ],
184
+ internalType: "struct Helpers.LiquidityData[]",
185
+ name: "l",
186
+ type: "tuple[]",
187
+ },
188
+ ],
189
+ stateMutability: "view",
190
+ type: "function",
191
+ },
192
+ {
193
+ inputs: [],
194
+ name: "nativeToken",
195
+ outputs: [
196
+ {
197
+ internalType: "address",
198
+ name: "",
199
+ type: "address",
200
+ },
201
+ ],
202
+ stateMutability: "view",
203
+ type: "function",
204
+ },
205
+ {
206
+ inputs: [],
207
+ name: "wnativeToken",
208
+ outputs: [
209
+ {
210
+ internalType: "address",
211
+ name: "",
212
+ type: "address",
213
+ },
214
+ ],
215
+ stateMutability: "view",
216
+ type: "function",
217
+ },
218
+ ];
219
+ class BalanceResolver__factory {
220
+ static createInterface() {
221
+ return new ethers_1.utils.Interface(_abi);
222
+ }
223
+ static connect(address, signerOrProvider) {
224
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
225
+ }
226
+ }
227
+ exports.BalanceResolver__factory = BalanceResolver__factory;
228
+ BalanceResolver__factory.abi = _abi;
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InteropX__factory = exports.InstList__factory = exports.GnosisSafe__factory = exports.Erc20__factory = void 0;
3
+ exports.InteropX__factory = exports.InstList__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.BalanceResolver__factory = exports.AaveV3Resolver__factory = exports.AaveV2Resolver__factory = void 0;
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
  /* tslint:disable */
6
6
  /* eslint-disable */
7
+ var AaveV2Resolver__factory_1 = require("./AaveV2Resolver__factory");
8
+ Object.defineProperty(exports, "AaveV2Resolver__factory", { enumerable: true, get: function () { return AaveV2Resolver__factory_1.AaveV2Resolver__factory; } });
9
+ var AaveV3Resolver__factory_1 = require("./AaveV3Resolver__factory");
10
+ Object.defineProperty(exports, "AaveV3Resolver__factory", { enumerable: true, get: function () { return AaveV3Resolver__factory_1.AaveV3Resolver__factory; } });
11
+ var BalanceResolver__factory_1 = require("./BalanceResolver__factory");
12
+ Object.defineProperty(exports, "BalanceResolver__factory", { enumerable: true, get: function () { return BalanceResolver__factory_1.BalanceResolver__factory; } });
7
13
  var Erc20__factory_1 = require("./Erc20__factory");
8
14
  Object.defineProperty(exports, "Erc20__factory", { enumerable: true, get: function () { return Erc20__factory_1.Erc20__factory; } });
9
15
  var GnosisSafe__factory_1 = require("./GnosisSafe__factory");
@@ -23,8 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.InteropX__factory = exports.InstList__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.factories = void 0;
26
+ exports.InteropX__factory = exports.InstList__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.BalanceResolver__factory = exports.AaveV3Resolver__factory = exports.AaveV2Resolver__factory = exports.factories = void 0;
27
27
  exports.factories = __importStar(require("./factories"));
28
+ var AaveV2Resolver__factory_1 = require("./factories/AaveV2Resolver__factory");
29
+ Object.defineProperty(exports, "AaveV2Resolver__factory", { enumerable: true, get: function () { return AaveV2Resolver__factory_1.AaveV2Resolver__factory; } });
30
+ var AaveV3Resolver__factory_1 = require("./factories/AaveV3Resolver__factory");
31
+ Object.defineProperty(exports, "AaveV3Resolver__factory", { enumerable: true, get: function () { return AaveV3Resolver__factory_1.AaveV3Resolver__factory; } });
32
+ var BalanceResolver__factory_1 = require("./factories/BalanceResolver__factory");
33
+ Object.defineProperty(exports, "BalanceResolver__factory", { enumerable: true, get: function () { return BalanceResolver__factory_1.BalanceResolver__factory; } });
28
34
  var Erc20__factory_1 = require("./factories/Erc20__factory");
29
35
  Object.defineProperty(exports, "Erc20__factory", { enumerable: true, get: function () { return Erc20__factory_1.Erc20__factory; } });
30
36
  var GnosisSafe__factory_1 = require("./factories/GnosisSafe__factory");
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asyncCallWithTimeout = void 0;
4
+ /**
5
+ * Call an async function with a maximum time limit (in milliseconds) for the timeout
6
+ * Resolved promise for async function call, or an error if time limit reached
7
+ */
8
+ const asyncCallWithTimeout = async (asyncPromise, timeout) => {
9
+ let timeoutHandle;
10
+ const timeoutPromise = new Promise((_resolve, reject) => {
11
+ timeoutHandle = setTimeout(() => reject(new Error("Async call timeout limit reached")), timeout);
12
+ });
13
+ return Promise.race([asyncPromise, timeoutPromise]).then((result) => {
14
+ clearTimeout(timeoutHandle);
15
+ return result;
16
+ });
17
+ };
18
+ exports.asyncCallWithTimeout = asyncCallWithTimeout;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDsaAccountAddress = exports.encodeConnectorMethod = void 0;
7
+ const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
8
+ const connectors_1 = require("@/abi/connectors");
9
+ const web3_1 = require("./web3");
10
+ const constants_1 = require("@/constants");
11
+ const abi_1 = __importDefault(require("@/abi"));
12
+ const providers_1 = require("@/providers");
13
+ const encodeConnectorMethod = (params) => {
14
+ const connectorInterface = getInterface(connectors_1.connectors.versions[2][params.connector], params.method);
15
+ if (!connectorInterface)
16
+ throw new Error(`ConnectorInterface '${params.method}' not found`);
17
+ //@ts-ignore
18
+ return web3_eth_abi_1.default.encodeFunctionCall(connectorInterface, params.args);
19
+ };
20
+ exports.encodeConnectorMethod = encodeConnectorMethod;
21
+ const getInterface = (abiItems, method) => {
22
+ const abiItem = abiItems.find((abiItem) => abiItem.name === method);
23
+ if (!abiItem) {
24
+ console.error(`${method} is an invalid method.`);
25
+ return;
26
+ }
27
+ return abiItem;
28
+ };
29
+ const getDsaAccountAddress = async ({ dsaId, chainId, provider = null, }) => {
30
+ if (!dsaId)
31
+ throw new Error("DSA id is required");
32
+ provider = provider || new providers_1.JsonRpcRetryProvider((0, web3_1.getRpcProviderUrl)(chainId));
33
+ const instListContract = (0, web3_1.getContract)(constants_1.addresses[chainId].instList, abi_1.default.instList, provider);
34
+ return await instListContract.accountAddr(dsaId);
35
+ };
36
+ exports.getDsaAccountAddress = getDsaAccountAddress;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExplorerUrl = exports.getChainIdNativeSymbol = exports.chainIdToName = exports.short = exports.shortenHash = exports.formatUsd = void 0;
4
+ const locale = "en-US";
5
+ function formatUsd(value, fractionDigits = 0) {
6
+ const formatter = new Intl.NumberFormat(locale, {
7
+ style: "currency",
8
+ currency: "USD",
9
+ minimumFractionDigits: fractionDigits,
10
+ maximumFractionDigits: fractionDigits
11
+ });
12
+ return formatter.format(value);
13
+ }
14
+ exports.formatUsd = formatUsd;
15
+ function shortenHash(hash, length = 4) {
16
+ if (!hash)
17
+ return;
18
+ if (hash.length < 12)
19
+ return hash;
20
+ const beginningChars = hash.startsWith("0x") ? length + 2 : length;
21
+ const shortened = hash.substr(0, beginningChars) + "…" + hash.substr(-length);
22
+ return shortened;
23
+ }
24
+ exports.shortenHash = shortenHash;
25
+ function short(buffer) {
26
+ return buffer.toString("hex").slice(0, 8) + "...";
27
+ }
28
+ exports.short = short;
29
+ const chainIdToName = (chainId) => {
30
+ switch (String(chainId)) {
31
+ case "1":
32
+ return "Mainnet";
33
+ case "137":
34
+ return "Polygon";
35
+ case "43114":
36
+ return "Avalanche";
37
+ default:
38
+ return "Mainnet";
39
+ }
40
+ };
41
+ exports.chainIdToName = chainIdToName;
42
+ const getChainIdNativeSymbol = (chainId) => {
43
+ switch (String(chainId)) {
44
+ case "137":
45
+ return "MATIC";
46
+ case "43114":
47
+ return "AVAX";
48
+ case "1":
49
+ return "ETH";
50
+ default:
51
+ return "ETH";
52
+ }
53
+ };
54
+ exports.getChainIdNativeSymbol = getChainIdNativeSymbol;
55
+ const getExplorerUrl = (chainId, suffix = '/') => {
56
+ switch (String(chainId)) {
57
+ case "1":
58
+ return `https://etherscan.io${suffix}`;
59
+ case "137":
60
+ return `https://polygonscan.com${suffix}`;
61
+ case "43114":
62
+ return `https://snowtrace.io${suffix}`;
63
+ default:
64
+ return `https://etherscan.io${suffix}`;
65
+ }
66
+ };
67
+ exports.getExplorerUrl = getExplorerUrl;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGnosisOwnerPeerIds = exports.generateGnosisTransaction = exports.signGnosisSafeTx = exports.generateGnosisSignatureMessage = exports.getGnosisSignatureAddress = exports.buildSignatureBytes = void 0;
4
+ const constants_1 = require("@/constants");
5
+ const net_1 = require("@/net");
6
+ const ethers_1 = require("ethers");
7
+ const buildSignatureBytes = (signatures) => {
8
+ signatures.sort((left, right) => left.signer.toLowerCase().localeCompare(right.signer.toLowerCase()));
9
+ let signatureBytes = "0x";
10
+ for (const sig of signatures) {
11
+ signatureBytes += sig.data.slice(2);
12
+ }
13
+ return signatureBytes;
14
+ };
15
+ exports.buildSignatureBytes = buildSignatureBytes;
16
+ const gnosisSignatureTypes = {
17
+ SafeTx: [
18
+ { type: "address", name: "to" },
19
+ { type: "uint256", name: "value" },
20
+ { type: "bytes", name: "data" },
21
+ { type: "uint8", name: "operation" },
22
+ { type: "uint256", name: "safeTxGas" },
23
+ { type: "uint256", name: "baseGas" },
24
+ { type: "uint256", name: "gasPrice" },
25
+ { type: "address", name: "gasToken" },
26
+ { type: "address", name: "refundReceiver" },
27
+ { type: "uint256", name: "nonce" },
28
+ ],
29
+ };
30
+ const getGnosisSignatureAddress = ({ signature, message, chainId }) => {
31
+ const gnosisSafe = constants_1.addresses[chainId].gnosisSafe;
32
+ const domain = {
33
+ verifyingContract: gnosisSafe,
34
+ chainId,
35
+ };
36
+ return ethers_1.ethers.utils.verifyTypedData(domain, gnosisSignatureTypes, message, signature);
37
+ };
38
+ exports.getGnosisSignatureAddress = getGnosisSignatureAddress;
39
+ const generateGnosisSignatureMessage = ({ to, data = null, value = "0", operation = "1", baseGas = "0", gasPrice = "0", gasToken = "0x0000000000000000000000000000000000000000", refundReceiver = "0x0000000000000000000000000000000000000000", safeTxGas = "79668", nonce = "0", chainId = 137, }) => {
40
+ const gnosisSafe = constants_1.addresses[chainId].gnosisSafe;
41
+ const message = {
42
+ baseGas,
43
+ data,
44
+ gasPrice,
45
+ gasToken,
46
+ nonce: Number(nonce),
47
+ operation,
48
+ refundReceiver,
49
+ safeAddress: gnosisSafe,
50
+ safeTxGas: String(safeTxGas),
51
+ to,
52
+ value,
53
+ };
54
+ return message;
55
+ };
56
+ exports.generateGnosisSignatureMessage = generateGnosisSignatureMessage;
57
+ const signGnosisSafeTx = async ({ to, data = null, value = "0", operation = "1", baseGas = "0", gasPrice = "0", gasToken = "0x0000000000000000000000000000000000000000", refundReceiver = "0x0000000000000000000000000000000000000000", safeTxGas = "79668", nonce = "0", chainId = 137, }, { signer }) => {
58
+ const gnosisSafe = constants_1.addresses[chainId].gnosisSafe;
59
+ const domain = {
60
+ verifyingContract: gnosisSafe,
61
+ chainId,
62
+ };
63
+ const message = (0, exports.generateGnosisSignatureMessage)({ to, data, value, operation, baseGas, gasPrice, gasToken, refundReceiver, safeTxGas, nonce, chainId });
64
+ return await signer._signTypedData(domain, gnosisSignatureTypes, message);
65
+ };
66
+ exports.signGnosisSafeTx = signGnosisSafeTx;
67
+ const generateGnosisTransaction = async (transactionData, safeContract) => {
68
+ console.log(transactionData);
69
+ let isExecuted = await safeContract.dataHashes(await safeContract.getTransactionHash(transactionData.to, transactionData.value, transactionData.data, transactionData.operation, transactionData.safeTxGas, transactionData.baseGas, transactionData.gasPrice, transactionData.gasToken, transactionData.refundReceiver, transactionData.nonce));
70
+ while (isExecuted == 1) {
71
+ transactionData.safeTxGas = ethers_1.ethers.BigNumber.from(String(transactionData.safeTxGas))
72
+ .add(1)
73
+ .toString();
74
+ isExecuted = await safeContract.dataHashes(await safeContract.getTransactionHash(transactionData.to, transactionData.value, transactionData.data, transactionData.operation, transactionData.safeTxGas, transactionData.baseGas, transactionData.gasPrice, transactionData.gasToken, transactionData.refundReceiver, transactionData.nonce));
75
+ }
76
+ return transactionData;
77
+ };
78
+ exports.generateGnosisTransaction = generateGnosisTransaction;
79
+ const getGnosisOwnerPeerIds = async ({ gnosisContract = null }) => {
80
+ const owners = await gnosisContract
81
+ .getOwners()
82
+ .then((owners) => owners.map((owner) => owner.toLowerCase()));
83
+ return net_1.peerPool.activePeers
84
+ .filter((peer) => owners.includes(peer.publicAddress.toLowerCase()))
85
+ .map((peer) => peer.id);
86
+ };
87
+ exports.getGnosisOwnerPeerIds = getGnosisOwnerPeerIds;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.http = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const axios_retry_1 = __importDefault(require("axios-retry"));
9
+ exports.http = axios_1.default.create();
10
+ (0, axios_retry_1.default)(exports.http, { retries: 3, retryDelay: axios_retry_1.default.exponentialDelay });