@reyaxyz/sdk 0.80.0 → 0.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +1 -1
  2. package/dist/services/encode.js +7 -7
  3. package/dist/services/encode.js.map +1 -1
  4. package/dist/services/lp/bridgeAndDepositPassivePool.js +3 -4
  5. package/dist/services/lp/bridgeAndDepositPassivePool.js.map +1 -1
  6. package/dist/services/lp/encode.js +6 -6
  7. package/dist/services/lp/encode.js.map +1 -1
  8. package/dist/services/lp/lp.js +3 -4
  9. package/dist/services/lp/lp.js.map +1 -1
  10. package/dist/services/lp/transferFromMAToPool.js +7 -8
  11. package/dist/services/lp/transferFromMAToPool.js.map +1 -1
  12. package/dist/services/lp/withdrawPassivePoolAndBridge.js +2 -6
  13. package/dist/services/lp/withdrawPassivePoolAndBridge.js.map +1 -1
  14. package/dist/services/margin-accounts/account.js +3 -3
  15. package/dist/services/margin-accounts/account.js.map +1 -1
  16. package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js +5 -6
  17. package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js.map +1 -1
  18. package/dist/services/margin-accounts/bridgeAndDepositNewMA.js +3 -4
  19. package/dist/services/margin-accounts/bridgeAndDepositNewMA.js.map +1 -1
  20. package/dist/services/margin-accounts/deposit.js +4 -5
  21. package/dist/services/margin-accounts/deposit.js.map +1 -1
  22. package/dist/services/margin-accounts/encode.js +14 -19
  23. package/dist/services/margin-accounts/encode.js.map +1 -1
  24. package/dist/services/margin-accounts/transferMarginBetweenAccounts.js +3 -3
  25. package/dist/services/margin-accounts/transferMarginBetweenAccounts.js.map +1 -1
  26. package/dist/services/margin-accounts/withdraw.js +4 -5
  27. package/dist/services/margin-accounts/withdraw.js.map +1 -1
  28. package/dist/services/margin-accounts/withdrawMAAndBridge.js +8 -8
  29. package/dist/services/margin-accounts/withdrawMAAndBridge.js.map +1 -1
  30. package/dist/services/orders/encode.js +7 -9
  31. package/dist/services/orders/encode.js.map +1 -1
  32. package/dist/services/orders/order.js +10 -10
  33. package/dist/services/orders/order.js.map +1 -1
  34. package/dist/services/{executeTransaction.js → signAndBroadcastTransaction.js} +9 -88
  35. package/dist/services/signAndBroadcastTransaction.js.map +1 -0
  36. package/dist/services/token/approve.js +3 -3
  37. package/dist/services/token/approve.js.map +1 -1
  38. package/dist/services/token/getAllowance.js +2 -3
  39. package/dist/services/token/getAllowance.js.map +1 -1
  40. package/dist/types/services/encode.d.ts +1 -1
  41. package/dist/types/services/encode.d.ts.map +1 -1
  42. package/dist/types/services/lp/encode.d.ts +2 -2
  43. package/dist/types/services/lp/encode.d.ts.map +1 -1
  44. package/dist/types/services/lp/lp.d.ts.map +1 -1
  45. package/dist/types/services/lp/transferFromMAToPool.d.ts.map +1 -1
  46. package/dist/types/services/lp/withdrawPassivePoolAndBridge.d.ts.map +1 -1
  47. package/dist/types/services/margin-accounts/bridgeAndDepositExistingMA.d.ts.map +1 -1
  48. package/dist/types/services/margin-accounts/bridgeAndDepositNewMA.d.ts.map +1 -1
  49. package/dist/types/services/margin-accounts/deposit.d.ts.map +1 -1
  50. package/dist/types/services/margin-accounts/encode.d.ts +2 -2
  51. package/dist/types/services/margin-accounts/encode.d.ts.map +1 -1
  52. package/dist/types/services/margin-accounts/withdraw.d.ts.map +1 -1
  53. package/dist/types/services/orders/encode.d.ts +1 -1
  54. package/dist/types/services/orders/encode.d.ts.map +1 -1
  55. package/dist/types/services/signAndBroadcastTransaction.d.ts +8 -0
  56. package/dist/types/services/signAndBroadcastTransaction.d.ts.map +1 -0
  57. package/dist/types/services/token/getAllowance.d.ts.map +1 -1
  58. package/package.json +3 -3
  59. package/src/services/encode.ts +3 -4
  60. package/src/services/lp/bridgeAndDepositPassivePool.ts +2 -2
  61. package/src/services/lp/encode.ts +5 -7
  62. package/src/services/lp/lp.ts +1 -2
  63. package/src/services/lp/transferFromMAToPool.ts +4 -5
  64. package/src/services/lp/withdrawPassivePoolAndBridge.ts +5 -4
  65. package/src/services/margin-accounts/account.ts +2 -2
  66. package/src/services/margin-accounts/bridgeAndDepositExistingMA.ts +2 -3
  67. package/src/services/margin-accounts/bridgeAndDepositNewMA.ts +1 -2
  68. package/src/services/margin-accounts/deposit.ts +1 -2
  69. package/src/services/margin-accounts/encode.ts +15 -12
  70. package/src/services/margin-accounts/transferMarginBetweenAccounts.ts +2 -2
  71. package/src/services/margin-accounts/withdraw.ts +1 -2
  72. package/src/services/margin-accounts/withdrawMAAndBridge.ts +5 -5
  73. package/src/services/orders/encode.ts +12 -6
  74. package/src/services/orders/order.ts +3 -3
  75. package/src/services/signAndBroadcastTransaction.ts +42 -0
  76. package/src/services/token/approve.ts +1 -1
  77. package/src/services/token/getAllowance.ts +2 -1
  78. package/dist/abis/CoreProxy.json +0 -5600
  79. package/dist/abis/Periphery.json +0 -1464
  80. package/dist/abis/socket/VaultWithPayload.json +0 -40
  81. package/dist/services/executeTransaction.js.map +0 -1
  82. package/dist/services/sign.js +0 -146
  83. package/dist/services/sign.js.map +0 -1
  84. package/dist/types/services/executeTransaction.d.ts +0 -20
  85. package/dist/types/services/executeTransaction.d.ts.map +0 -1
  86. package/dist/types/services/sign.d.ts +0 -12
  87. package/dist/types/services/sign.d.ts.map +0 -1
  88. package/dist/types/utils/action.d.ts +0 -27
  89. package/dist/types/utils/action.d.ts.map +0 -1
  90. package/dist/types/utils/consts.d.ts +0 -4
  91. package/dist/types/utils/consts.d.ts.map +0 -1
  92. package/dist/types/utils/contractAddresses.d.ts +0 -8
  93. package/dist/types/utils/contractAddresses.d.ts.map +0 -1
  94. package/dist/types/utils/routerCommands.d.ts +0 -23
  95. package/dist/types/utils/routerCommands.d.ts.map +0 -1
  96. package/dist/types/utils/trade.d.ts +0 -2
  97. package/dist/types/utils/trade.d.ts.map +0 -1
  98. package/dist/types/utils/txHelpers.d.ts +0 -2
  99. package/dist/types/utils/txHelpers.d.ts.map +0 -1
  100. package/dist/utils/action.js +0 -22
  101. package/dist/utils/action.js.map +0 -1
  102. package/dist/utils/consts.js +0 -7
  103. package/dist/utils/consts.js.map +0 -1
  104. package/dist/utils/contractAddresses.js +0 -37
  105. package/dist/utils/contractAddresses.js.map +0 -1
  106. package/dist/utils/routerCommands.js +0 -45
  107. package/dist/utils/routerCommands.js.map +0 -1
  108. package/dist/utils/trade.js +0 -24
  109. package/dist/utils/trade.js.map +0 -1
  110. package/dist/utils/txHelpers.js +0 -8
  111. package/dist/utils/txHelpers.js.map +0 -1
  112. package/src/abis/CoreProxy.json +0 -5600
  113. package/src/abis/Periphery.json +0 -1464
  114. package/src/abis/socket/VaultWithPayload.json +0 -40
  115. package/src/services/executeTransaction.ts +0 -123
  116. package/src/services/sign.ts +0 -135
  117. package/src/utils/action.ts +0 -41
  118. package/src/utils/consts.ts +0 -3
  119. package/src/utils/contractAddresses.ts +0 -43
  120. package/src/utils/routerCommands.ts +0 -62
  121. package/src/utils/trade.ts +0 -25
  122. package/src/utils/txHelpers.ts +0 -3
@@ -1,40 +0,0 @@
1
- {
2
- "abi": [
3
- {
4
- "type": "function",
5
- "name": "bridge",
6
- "inputs": [
7
- {
8
- "name": "receiver_",
9
- "type": "address",
10
- "internalType": "address"
11
- },
12
- {
13
- "name": "amount_",
14
- "type": "uint256",
15
- "internalType": "uint256"
16
- },
17
- {
18
- "name": "msgGasLimit_",
19
- "type": "uint256",
20
- "internalType": "uint256"
21
- },
22
- {
23
- "name": "connector_",
24
- "type": "address",
25
- "internalType": "address"
26
- },
27
- {
28
- "name": "execPayload_",
29
- "type": "bytes",
30
- "internalType": "bytes"
31
- },
32
- {
33
- "name": "options_",
34
- "type": "bytes",
35
- "internalType": "bytes"
36
- }
37
- ]
38
- }
39
- ]
40
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["services/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAAsE;AACt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,CACT,EAAA;;oBALG,KACJ,SAIC,EALK,MAAM,YAAA,EAAE,SAAS,eAAA;oBAOzB,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;oBAC/C,CAAC;oBACD,sBAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,WAAA,EAAE,EAAC;;;oBAEnC,OAAO,CAAC,IAAI,CAAC,OAAK,CAAC,CAAC;oBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;;;;;CAElD;AAlCD,kEAkCC","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { ContractType, getAddress } from '../utils/contractAddresses';\nimport { getGasBuffer } from '../utils/txHelpers';\nimport {\n BroadcastTransactionMetadata,\n getTransactionModuleClient,\n} from '../config';\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const gasEstimate = await signer.estimateGas(tx);\n gasLimit = getGasBuffer(gasEstimate);\n } catch (error) {\n // sentry error & thorw\n console.warn(error);\n throw new Error('Error executing transaction'); // @todo introduce error parsing\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGas(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\n\nexport async function signAndBroadcastTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n metadata: BroadcastTransactionMetadata,\n): Promise<{ hash: string; accountId?: string }> {\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n\n // used to catch error in advance since gelato is slow in failing down\n // on reya chain usually takes around 100ms, should be monitored!\n await estimateGas(signer, data, value, chainId, targetContract);\n try {\n const transactionModuleClient = getTransactionModuleClient();\n const { txHash, accountId } =\n await transactionModuleClient.executeTransaction(\n { to: contractAddress, data: data },\n contractAddress,\n metadata,\n );\n\n if (!txHash) {\n throw new Error('Error sending transaction');\n }\n return { hash: txHash, accountId };\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\n"]}
@@ -1,146 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- 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 (g && (g = 0, op[0] && (_ = 0)), _) 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
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.signPoolRemoveLiquidity = exports.signCoreCommands = void 0;
40
- var ethers_1 = require("ethers");
41
- var contractAddresses_1 = require("../utils/contractAddresses");
42
- var ethers_2 = require("ethers");
43
- function convertEthersSignatureToEIP712Signature(signature, deadline) {
44
- return {
45
- v: signature.v,
46
- r: signature.r,
47
- s: signature.s,
48
- deadline: deadline,
49
- };
50
- }
51
- function signCoreCommands(signer, reyaChainId, caller, accountId, commands, nonce, deadline, extraSignatureData) {
52
- return __awaiter(this, void 0, void 0, function () {
53
- var signature;
54
- return __generator(this, function (_a) {
55
- switch (_a.label) {
56
- case 0: return [4 /*yield*/, signReyaTypedData(signer, (0, contractAddresses_1.getAddress)(reyaChainId, contractAddresses_1.ContractType.CORE_PROXY), {
57
- ExecuteBySig: [
58
- { name: 'verifyingChainId', type: 'uint256' },
59
- { name: 'caller', type: 'address' },
60
- { name: 'accountId', type: 'uint128' },
61
- { name: 'commands', type: 'Command[]' },
62
- { name: 'nonce', type: 'uint256' },
63
- { name: 'deadline', type: 'uint256' },
64
- { name: 'extraSignatureData', type: 'bytes' },
65
- ],
66
- Command: [
67
- { name: 'commandType', type: 'uint8' },
68
- { name: 'inputs', type: 'bytes' },
69
- { name: 'marketId', type: 'uint128' },
70
- { name: 'exchangeId', type: 'uint128' },
71
- ],
72
- }, {
73
- verifyingChainId: reyaChainId,
74
- caller: caller,
75
- accountId: accountId,
76
- commands: commands,
77
- nonce: nonce,
78
- deadline: deadline,
79
- extraSignatureData: extraSignatureData,
80
- })];
81
- case 1:
82
- signature = _a.sent();
83
- return [2 /*return*/, convertEthersSignatureToEIP712Signature(signature, deadline)];
84
- }
85
- });
86
- });
87
- }
88
- exports.signCoreCommands = signCoreCommands;
89
- function signPoolRemoveLiquidity(signer, reyaChainId, caller, owner, poolId, sharesAmount, minOut, nonce, deadline, socketMsgGasLimit, chainId, receiver) {
90
- return __awaiter(this, void 0, void 0, function () {
91
- var signature;
92
- return __generator(this, function (_a) {
93
- switch (_a.label) {
94
- case 0: return [4 /*yield*/, signReyaTypedData(signer, (0, contractAddresses_1.getAddress)(reyaChainId, contractAddresses_1.ContractType.PASSIVE_POOL_PROXY), {
95
- RemoveLiquidityBySig: [
96
- { name: 'verifyingChainId', type: 'uint256' },
97
- { name: 'caller', type: 'address' },
98
- { name: 'owner', type: 'address' },
99
- { name: 'poolId', type: 'uint128' },
100
- { name: 'sharesAmount', type: 'uint256' },
101
- { name: 'minOut', type: 'uint256' },
102
- { name: 'nonce', type: 'uint256' },
103
- { name: 'deadline', type: 'uint256' },
104
- { name: 'extraSignatureData', type: 'bytes' },
105
- ],
106
- }, {
107
- verifyingChainId: reyaChainId,
108
- caller: caller,
109
- owner: owner,
110
- poolId: poolId,
111
- sharesAmount: sharesAmount,
112
- minOut: minOut,
113
- nonce: nonce,
114
- deadline: deadline,
115
- extraSignatureData: ethers_2.ethers.AbiCoder.defaultAbiCoder().encode(['address', 'uint256', 'uint256'], [receiver, chainId, socketMsgGasLimit]),
116
- })];
117
- case 1:
118
- signature = _a.sent();
119
- return [2 /*return*/, convertEthersSignatureToEIP712Signature(signature, deadline)];
120
- }
121
- });
122
- });
123
- }
124
- exports.signPoolRemoveLiquidity = signPoolRemoveLiquidity;
125
- function signReyaTypedData(signer, verifyingContract, types,
126
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
- value) {
128
- return __awaiter(this, void 0, void 0, function () {
129
- var domain, signatureString;
130
- return __generator(this, function (_a) {
131
- switch (_a.label) {
132
- case 0:
133
- domain = {
134
- name: 'Reya',
135
- version: '1',
136
- verifyingContract: verifyingContract,
137
- };
138
- return [4 /*yield*/, signer.signTypedData(domain, types, value)];
139
- case 1:
140
- signatureString = _a.sent();
141
- return [2 /*return*/, ethers_1.Signature.from(signatureString)];
142
- }
143
- });
144
- });
145
- }
146
- //# sourceMappingURL=sign.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sign.js","sourceRoot":"/","sources":["services/sign.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA0E;AAC1E,gEAAsE;AAGtE,iCAAgC;AAShC,SAAS,uCAAuC,CAC9C,SAAoB,EACpB,QAAgB;IAEhB,OAAO;QACL,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,CAA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ACZ,QAAQ,EAAE,QAAQ;wBAClB,kBAAkB,EAAE,eAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAC1D,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EACjC,CAAC,QAAQ,EAAE,OAAO,EAAE,iBAAiB,CAAC,CACvC;qBACF,CACF,EAAA;;oBA9BK,SAAS,GAAG,SA8BjB;oBAED,sBAAO,uCAAuC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAC;;;;CACrE;AA/CD,0DA+CC;AAED,SAAe,iBAAiB,CAC9B,MAA8B,EAC9B,iBAAyB,EACzB,KAA4C;AAC5C,8DAA8D;AAC9D,KAA0B;;;;;;oBAEpB,MAAM,GAAG;wBACb,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,GAAG;wBACZ,iBAAiB,EAAE,iBAAiB;qBACrC,CAAC;oBAEsB,qBAAM,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,EAAA;;oBAAlE,eAAe,GAAG,SAAgD;oBAExE,sBAAO,kBAAS,CAAC,IAAI,CAAC,eAAe,CAAC,EAAC;;;;CACxC","sourcesContent":["import { JsonRpcSigner, Signature, Signer, TypedDataField } from 'ethers';\nimport { ContractType, getAddress } from '../utils/contractAddresses';\nimport { Address, ReyaChainId } from '@reyaxyz/common';\nimport { Command } from '../utils/action';\nimport { ethers } from 'ethers';\n\nexport type EIP712Signature = {\n v: number;\n r: string;\n s: string;\n deadline: number;\n};\n\nfunction convertEthersSignatureToEIP712Signature(\n signature: Signature,\n deadline: number,\n): EIP712Signature {\n return {\n v: signature.v,\n r: signature.r,\n s: signature.s,\n deadline: deadline,\n };\n}\n\nexport async function signCoreCommands(\n signer: Signer | JsonRpcSigner,\n reyaChainId: ReyaChainId,\n caller: Address,\n accountId: number,\n commands: Command[],\n nonce: number,\n deadline: number,\n extraSignatureData: string,\n): Promise<EIP712Signature> {\n const signature = await signReyaTypedData(\n signer,\n getAddress(reyaChainId, ContractType.CORE_PROXY),\n {\n ExecuteBySig: [\n { name: 'verifyingChainId', type: 'uint256' },\n { name: 'caller', type: 'address' },\n { name: 'accountId', type: 'uint128' },\n { name: 'commands', type: 'Command[]' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n { name: 'extraSignatureData', type: 'bytes' },\n ],\n Command: [\n { name: 'commandType', type: 'uint8' },\n { name: 'inputs', type: 'bytes' },\n { name: 'marketId', type: 'uint128' },\n { name: 'exchangeId', type: 'uint128' },\n ],\n },\n {\n verifyingChainId: reyaChainId,\n caller: caller,\n accountId: accountId,\n commands: commands,\n nonce: nonce,\n deadline: deadline,\n extraSignatureData: extraSignatureData,\n },\n );\n\n return convertEthersSignatureToEIP712Signature(signature, deadline);\n}\n\nexport async function signPoolRemoveLiquidity(\n signer: Signer | JsonRpcSigner,\n reyaChainId: ReyaChainId,\n caller: Address,\n owner: Address,\n poolId: number,\n sharesAmount: bigint,\n minOut: bigint,\n nonce: number,\n deadline: number,\n socketMsgGasLimit: bigint,\n chainId: number,\n receiver: string,\n): Promise<EIP712Signature> {\n const signature = await signReyaTypedData(\n signer,\n getAddress(reyaChainId, ContractType.PASSIVE_POOL_PROXY),\n {\n RemoveLiquidityBySig: [\n { name: 'verifyingChainId', type: 'uint256' },\n { name: 'caller', type: 'address' },\n { name: 'owner', type: 'address' },\n { name: 'poolId', type: 'uint128' },\n { name: 'sharesAmount', type: 'uint256' },\n { name: 'minOut', type: 'uint256' },\n { name: 'nonce', type: 'uint256' },\n { name: 'deadline', type: 'uint256' },\n { name: 'extraSignatureData', type: 'bytes' },\n ],\n },\n {\n verifyingChainId: reyaChainId,\n caller: caller,\n owner: owner,\n poolId: poolId,\n sharesAmount: sharesAmount,\n minOut: minOut,\n nonce: nonce,\n deadline: deadline,\n extraSignatureData: ethers.AbiCoder.defaultAbiCoder().encode(\n ['address', 'uint256', 'uint256'],\n [receiver, chainId, socketMsgGasLimit],\n ),\n },\n );\n\n return convertEthersSignatureToEIP712Signature(signature, deadline);\n}\n\nasync function signReyaTypedData(\n signer: Signer | JsonRpcSigner,\n verifyingContract: string,\n types: Record<string, Array<TypedDataField>>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: Record<string, any>,\n): Promise<Signature> {\n const domain = {\n name: 'Reya',\n version: '1',\n verifyingContract: verifyingContract,\n };\n\n const signatureString = await signer.signTypedData(domain, types, value);\n\n return Signature.from(signatureString);\n}\n"]}
@@ -1,20 +0,0 @@
1
- import { JsonRpcSigner, Signer } from 'ethers';
2
- import { ContractType } from '../utils/contractAddresses';
3
- import { BroadcastTransactionMetadata } from '../config';
4
- export type Transaction = {
5
- from: string;
6
- to: string;
7
- data: string;
8
- value?: string;
9
- };
10
- export declare function estimateGas(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<Transaction & {
11
- gasLimit: bigint;
12
- maxPriorityFeePerGas?: bigint;
13
- maxFeePerGas?: bigint;
14
- }>;
15
- export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<import("ethers").TransactionReceipt | null>;
16
- export declare function signAndBroadcastTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string, metadata: BroadcastTransactionMetadata): Promise<{
17
- hash: string;
18
- accountId?: string;
19
- }>;
20
- //# sourceMappingURL=executeTransaction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["services/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAc,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EACL,4BAA4B,EAE7B,MAAM,WAAW,CAAC;AAGnB,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,GACpC,OAAO,CACR,WAAW,GAAG;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CACF,CAiCA;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,uDAkBtC;AAED,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,EACrC,QAAQ,EAAE,4BAA4B,GACrC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA2B/C"}
@@ -1,12 +0,0 @@
1
- import { JsonRpcSigner, Signer } from 'ethers';
2
- import { Address, ReyaChainId } from '@reyaxyz/common';
3
- import { Command } from '../utils/action';
4
- export type EIP712Signature = {
5
- v: number;
6
- r: string;
7
- s: string;
8
- deadline: number;
9
- };
10
- export declare function signCoreCommands(signer: Signer | JsonRpcSigner, reyaChainId: ReyaChainId, caller: Address, accountId: number, commands: Command[], nonce: number, deadline: number, extraSignatureData: string): Promise<EIP712Signature>;
11
- export declare function signPoolRemoveLiquidity(signer: Signer | JsonRpcSigner, reyaChainId: ReyaChainId, caller: Address, owner: Address, poolId: number, sharesAmount: bigint, minOut: bigint, nonce: number, deadline: number, socketMsgGasLimit: bigint, chainId: number, receiver: string): Promise<EIP712Signature>;
12
- //# sourceMappingURL=sign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sign.d.ts","sourceRoot":"/","sources":["services/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAcF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,eAAe,CAAC,CAiC1B;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CAkC1B"}
@@ -1,27 +0,0 @@
1
- import { CommandType } from './routerCommands';
2
- export type MethodParameters = {
3
- /**
4
- * The hex encoded calldata to perform the given operation
5
- */
6
- calldata: string;
7
- /**
8
- * The amount of ether (wei) to send in hex.
9
- */
10
- value: string;
11
- };
12
- export type Command = {
13
- commandType: CommandType;
14
- inputs: string;
15
- marketId: number;
16
- exchangeId: number;
17
- };
18
- export type SingleAction = {
19
- command: Command;
20
- };
21
- export declare class MultiAction {
22
- commands: Command[];
23
- constructor();
24
- get length(): number;
25
- newAction(singleAction: SingleAction): void;
26
- }
27
- //# sourceMappingURL=action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"/","sources":["utils/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,qBAAa,WAAW;IACf,QAAQ,EAAE,OAAO,EAAE,CAAC;;IAM3B,IAAW,MAAM,IAAI,MAAM,CAE1B;IAEM,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;CAGnD"}
@@ -1,4 +0,0 @@
1
- export declare const BRIDGE_DEADLINE_IN_SECONDS: number;
2
- export declare const CORE_DEADLINE_IN_SECONDS = 60;
3
- export declare const RELAYER_ACCOUNT = "0xb43c317c9c9215d268881d7d6b59c2d3d0247da1";
4
- //# sourceMappingURL=consts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,QAAU,CAAC;AAClD,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,eAAe,+CAA+C,CAAC"}
@@ -1,8 +0,0 @@
1
- export type Address = Lowercase<string>;
2
- export declare enum ContractType {
3
- CORE_PROXY = "core_proxy",
4
- PASSIVE_POOL_PROXY = "passive_pool_proxy",
5
- PERIPHERY_PROXY = "periphery_proxy"
6
- }
7
- export declare const getAddress: (chainId: number, contractName: ContractType) => Address;
8
- //# sourceMappingURL=contractAddresses.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAIxC,oBAAY,YAAY;IACtB,UAAU,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,eAAe,oBAAoB;CACpC;AAkBD,eAAO,MAAM,UAAU,YACZ,MAAM,gBACD,YAAY,KACzB,OAaF,CAAC"}
@@ -1,23 +0,0 @@
1
- import { SingleAction } from './action';
2
- /**
3
- * CommandTypes
4
- * @description Flags that modify a command's execution
5
- * @enum {number}
6
- */
7
- export declare enum CommandType {
8
- DEPOSIT = 0,
9
- WITHDRAW = 1,
10
- DUTCH_LIQUIDATION = 2,
11
- MATCH_ORDER = 3,
12
- PROPAGATE_CACHE_FLOW = 4,
13
- TRANSFER_MARGIN_ACCOUNT = 5
14
- }
15
- export type RouterCommand = {
16
- type: CommandType;
17
- encodedInput: string;
18
- marketId: number;
19
- exchangeId: number;
20
- };
21
- export declare function createCommand(type: CommandType, parameters: unknown[], marketId: number, exchangeId: number): RouterCommand;
22
- export declare function getCommand(type: CommandType, parameters: unknown[], marketId: number, exchangeId: number): SingleAction;
23
- //# sourceMappingURL=routerCommands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routerCommands.d.ts","sourceRoot":"/","sources":["utils/routerCommands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,oBAAY,WAAW;IACrB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,iBAAiB,IAAA;IACjB,WAAW,IAAA;IACX,oBAAoB,IAAA;IACpB,uBAAuB,IAAA;CACxB;AAWD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,OAAO,EAAE,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,aAAa,CAMf;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,OAAO,EAAE,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,YAAY,CAUd"}
@@ -1,2 +0,0 @@
1
- export declare function calculatePriceLimitForTrade(orderPrice: number, amount: number): bigint;
2
- //# sourceMappingURL=trade.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trade.d.ts","sourceRoot":"/","sources":["utils/trade.ts"],"names":[],"mappings":"AAGA,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAkBR"}
@@ -1,2 +0,0 @@
1
- export declare function getGasBuffer(value: bigint): bigint;
2
- //# sourceMappingURL=txHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"txHelpers.d.ts","sourceRoot":"/","sources":["utils/txHelpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // ENCODED ACTIONS
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.MultiAction = void 0;
5
- var MultiAction = /** @class */ (function () {
6
- function MultiAction() {
7
- this.commands = [];
8
- }
9
- Object.defineProperty(MultiAction.prototype, "length", {
10
- get: function () {
11
- return this.commands.length;
12
- },
13
- enumerable: false,
14
- configurable: true
15
- });
16
- MultiAction.prototype.newAction = function (singleAction) {
17
- this.commands.push(singleAction.command);
18
- };
19
- return MultiAction;
20
- }());
21
- exports.MultiAction = MultiAction;
22
- //# sourceMappingURL=action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.js","sourceRoot":"/","sources":["utils/action.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AA0BlB;IAGE;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,sBAAW,+BAAM;aAAjB;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC9B,CAAC;;;OAAA;IAEM,+BAAS,GAAhB,UAAiB,YAA0B;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IACH,kBAAC;AAAD,CAAC,AAdD,IAcC;AAdY,kCAAW","sourcesContent":["// ENCODED ACTIONS\n\nimport { CommandType } from './routerCommands';\n\nexport type MethodParameters = {\n /**\n * The hex encoded calldata to perform the given operation\n */\n calldata: string;\n /**\n * The amount of ether (wei) to send in hex.\n */\n value: string;\n};\n\nexport type Command = {\n commandType: CommandType;\n inputs: string;\n marketId: number;\n exchangeId: number;\n};\n\nexport type SingleAction = {\n command: Command;\n};\n\nexport class MultiAction {\n public commands: Command[];\n\n constructor() {\n this.commands = [];\n }\n\n public get length(): number {\n return this.commands.length;\n }\n\n public newAction(singleAction: SingleAction): void {\n this.commands.push(singleAction.command);\n }\n}\n"]}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RELAYER_ACCOUNT = exports.CORE_DEADLINE_IN_SECONDS = exports.BRIDGE_DEADLINE_IN_SECONDS = void 0;
4
- exports.BRIDGE_DEADLINE_IN_SECONDS = 15 * 60; // 15 minutes
5
- exports.CORE_DEADLINE_IN_SECONDS = 60; // 1 minute
6
- exports.RELAYER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value
7
- //# sourceMappingURL=consts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa;AACnD,QAAA,wBAAwB,GAAG,EAAE,CAAC,CAAC,WAAW;AAC1C,QAAA,eAAe,GAAG,4CAA4C,CAAC,CAAC,qBAAqB","sourcesContent":["export const BRIDGE_DEADLINE_IN_SECONDS = 15 * 60; // 15 minutes\nexport const CORE_DEADLINE_IN_SECONDS = 60; // 1 minute\nexport const RELAYER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value\n"]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var _a, _b, _c;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getAddress = exports.ContractType = void 0;
5
- // @todo update with proper chainId for mainnet
6
- var common_1 = require("@reyaxyz/common");
7
- var ContractType;
8
- (function (ContractType) {
9
- ContractType["CORE_PROXY"] = "core_proxy";
10
- ContractType["PASSIVE_POOL_PROXY"] = "passive_pool_proxy";
11
- ContractType["PERIPHERY_PROXY"] = "periphery_proxy";
12
- })(ContractType || (exports.ContractType = ContractType = {}));
13
- var addresses = (_a = {},
14
- _a[common_1.ReyaChainId.reyaCronos] = (_b = {},
15
- _b[ContractType.CORE_PROXY] = '0x20da8f7aa44f858a3a3e3f03ba6ffad039d1eb28',
16
- _b[ContractType.PASSIVE_POOL_PROXY] = '0x9afc30bed29d636e566fd9d7dd89d51773724be6',
17
- _b[ContractType.PERIPHERY_PROXY] = '0xa45d0566144956b6012d461ad509dad2bacacaaf',
18
- _b),
19
- _a[common_1.ReyaChainId.reyaNetwork] = (_c = {},
20
- _c[ContractType.CORE_PROXY] = '0xa763b6a5e09378434406c003dae6487fbbdc1a80',
21
- _c[ContractType.PASSIVE_POOL_PROXY] = '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',
22
- _c[ContractType.PERIPHERY_PROXY] = '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',
23
- _c),
24
- _a);
25
- var getAddress = function (chainId, contractName) {
26
- var keyChainId = chainId.toString();
27
- if (!Object.keys(addresses).includes(keyChainId)) {
28
- throw new Error("Unspecified addresses for chain id ".concat(keyChainId));
29
- }
30
- var networkAddresses = addresses[chainId];
31
- if (!Object.keys(networkAddresses).includes(contractName)) {
32
- throw new Error("Unspecified address for ".concat(contractName, " contract"));
33
- }
34
- return networkAddresses[contractName];
35
- };
36
- exports.getAddress = getAddress;
37
- //# sourceMappingURL=contractAddresses.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;AACA,+CAA+C;AAC/C,0CAA8C;AAE9C,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,yDAAyC,CAAA;IACzC,mDAAmC,CAAA;AACrC,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED,IAAM,SAAS;IACb,GAAC,oBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;WAC/C;IACD,GAAC,oBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;WAC/C;OACF,CAAC;AACK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,6CAAsC,UAAU,CAAE,CAAC,CAAC;IACtE,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,kCAA2B,YAAY,cAAW,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["export type Address = Lowercase<string>;\n// @todo update with proper chainId for mainnet\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport enum ContractType {\n CORE_PROXY = 'core_proxy',\n PASSIVE_POOL_PROXY = 'passive_pool_proxy',\n PERIPHERY_PROXY = 'periphery_proxy',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.CORE_PROXY]: '0x20da8f7aa44f858a3a3e3f03ba6ffad039d1eb28',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0x9afc30bed29d636e566fd9d7dd89d51773724be6',\n [ContractType.PERIPHERY_PROXY]:\n '0xa45d0566144956b6012d461ad509dad2bacacaaf',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.CORE_PROXY]: '0xa763b6a5e09378434406c003dae6487fbbdc1a80',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',\n [ContractType.PERIPHERY_PROXY]:\n '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',\n },\n};\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): Address => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n throw new Error(`Unspecified addresses for chain id ${keyChainId}`);\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n throw new Error(`Unspecified address for ${contractName} contract`);\n }\n\n return networkAddresses[contractName];\n};\n"]}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getCommand = exports.createCommand = exports.CommandType = void 0;
5
- var ethers_1 = require("ethers");
6
- /**
7
- * CommandTypes
8
- * @description Flags that modify a command's execution
9
- * @enum {number}
10
- */
11
- var CommandType;
12
- (function (CommandType) {
13
- CommandType[CommandType["DEPOSIT"] = 0] = "DEPOSIT";
14
- CommandType[CommandType["WITHDRAW"] = 1] = "WITHDRAW";
15
- CommandType[CommandType["DUTCH_LIQUIDATION"] = 2] = "DUTCH_LIQUIDATION";
16
- CommandType[CommandType["MATCH_ORDER"] = 3] = "MATCH_ORDER";
17
- CommandType[CommandType["PROPAGATE_CACHE_FLOW"] = 4] = "PROPAGATE_CACHE_FLOW";
18
- CommandType[CommandType["TRANSFER_MARGIN_ACCOUNT"] = 5] = "TRANSFER_MARGIN_ACCOUNT";
19
- })(CommandType || (exports.CommandType = CommandType = {}));
20
- var ABI_DEFINITION = (_a = {},
21
- _a[CommandType.DEPOSIT] = ['address', 'uint256'],
22
- _a[CommandType.WITHDRAW] = ['address', 'uint256'],
23
- _a[CommandType.MATCH_ORDER] = ['uint128[]', 'bytes'],
24
- _a[CommandType.PROPAGATE_CACHE_FLOW] = [],
25
- _a[CommandType.DUTCH_LIQUIDATION] = [],
26
- _a[CommandType.TRANSFER_MARGIN_ACCOUNT] = ['tuple(uint128,address,uint256)'],
27
- _a);
28
- function createCommand(type, parameters, marketId, exchangeId) {
29
- var encodedInput = ethers_1.AbiCoder.defaultAbiCoder().encode(ABI_DEFINITION[type], parameters);
30
- return { type: type, encodedInput: encodedInput, marketId: marketId, exchangeId: exchangeId };
31
- }
32
- exports.createCommand = createCommand;
33
- function getCommand(type, parameters, marketId, exchangeId) {
34
- var command = createCommand(type, parameters, marketId, exchangeId);
35
- return {
36
- command: {
37
- commandType: command.type,
38
- inputs: command.encodedInput,
39
- marketId: command.marketId,
40
- exchangeId: command.exchangeId,
41
- },
42
- };
43
- }
44
- exports.getCommand = getCommand;
45
- //# sourceMappingURL=routerCommands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routerCommands.js","sourceRoot":"/","sources":["utils/routerCommands.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAGlC;;;;GAIG;AACH,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,mDAAO,CAAA;IACP,qDAAQ,CAAA;IACR,uEAAiB,CAAA;IACjB,2DAAW,CAAA;IACX,6EAAoB,CAAA;IACpB,mFAAuB,CAAA;AACzB,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB;AAED,IAAM,cAAc;IAClB,GAAC,WAAW,CAAC,OAAO,IAAG,CAAC,SAAS,EAAE,SAAS,CAAC;IAC7C,GAAC,WAAW,CAAC,QAAQ,IAAG,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9C,GAAC,WAAW,CAAC,WAAW,IAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IACjD,GAAC,WAAW,CAAC,oBAAoB,IAAG,EAAE;IACtC,GAAC,WAAW,CAAC,iBAAiB,IAAG,EAAE;IACnC,GAAC,WAAW,CAAC,uBAAuB,IAAG,CAAC,gCAAgC,CAAC;OAC1E,CAAC;AASF,SAAgB,aAAa,CAC3B,IAAiB,EACjB,UAAqB,EACrB,QAAgB,EAChB,UAAkB;IAElB,IAAM,YAAY,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CACpD,cAAc,CAAC,IAAI,CAAC,EACpB,UAAU,CACX,CAAC;IACF,OAAO,EAAE,IAAI,MAAA,EAAE,YAAY,cAAA,EAAE,QAAQ,UAAA,EAAE,UAAU,YAAA,EAAE,CAAC;AACtD,CAAC;AAXD,sCAWC;AAED,SAAgB,UAAU,CACxB,IAAiB,EACjB,UAAqB,EACrB,QAAgB,EAChB,UAAkB;IAElB,IAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtE,OAAO;QACL,OAAO,EAAE;YACP,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,MAAM,EAAE,OAAO,CAAC,YAAY;YAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;KACF,CAAC;AACJ,CAAC;AAfD,gCAeC","sourcesContent":["import { AbiCoder } from 'ethers';\nimport { SingleAction } from './action';\n\n/**\n * CommandTypes\n * @description Flags that modify a command's execution\n * @enum {number}\n */\nexport enum CommandType {\n DEPOSIT,\n WITHDRAW,\n DUTCH_LIQUIDATION,\n MATCH_ORDER,\n PROPAGATE_CACHE_FLOW,\n TRANSFER_MARGIN_ACCOUNT,\n}\n\nconst ABI_DEFINITION: { [key in CommandType]: string[] } = {\n [CommandType.DEPOSIT]: ['address', 'uint256'],\n [CommandType.WITHDRAW]: ['address', 'uint256'],\n [CommandType.MATCH_ORDER]: ['uint128[]', 'bytes'],\n [CommandType.PROPAGATE_CACHE_FLOW]: [], // @todo Check if correct\n [CommandType.DUTCH_LIQUIDATION]: [], // @todo update once needed\n [CommandType.TRANSFER_MARGIN_ACCOUNT]: ['tuple(uint128,address,uint256)'], // @todo update once needed\n};\n\nexport type RouterCommand = {\n type: CommandType;\n encodedInput: string;\n marketId: number;\n exchangeId: number;\n};\n\nexport function createCommand(\n type: CommandType,\n parameters: unknown[],\n marketId: number,\n exchangeId: number,\n): RouterCommand {\n const encodedInput = AbiCoder.defaultAbiCoder().encode(\n ABI_DEFINITION[type],\n parameters,\n );\n return { type, encodedInput, marketId, exchangeId };\n}\n\nexport function getCommand(\n type: CommandType,\n parameters: unknown[],\n marketId: number,\n exchangeId: number,\n): SingleAction {\n const command = createCommand(type, parameters, marketId, exchangeId);\n return {\n command: {\n commandType: command.type,\n inputs: command.encodedInput,\n marketId: command.marketId,\n exchangeId: command.exchangeId,\n },\n };\n}\n"]}
@@ -1,24 +0,0 @@
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.calculatePriceLimitForTrade = void 0;
7
- var bignumber_js_1 = __importDefault(require("bignumber.js"));
8
- // todo: need the ability to supply custom slippage or use a more conservative default for the slippage tolerance
9
- function calculatePriceLimitForTrade(orderPrice, amount) {
10
- // Ensure orderPrice is BigInt
11
- var orderPriceBigInt = (0, bignumber_js_1.default)(orderPrice);
12
- // Calculate 50% of the order price
13
- var offset = orderPriceBigInt.div(2);
14
- // Determine if the amount is positive or negative and adjust the price accordingly
15
- if (amount > 0) {
16
- // Trade is long, so add
17
- return BigInt((0, bignumber_js_1.default)(orderPriceBigInt).plus(offset).times(1e18).toFixed(0));
18
- }
19
- else {
20
- return BigInt((0, bignumber_js_1.default)(orderPriceBigInt).minus(offset).times(1e18).toFixed(0));
21
- }
22
- }
23
- exports.calculatePriceLimitForTrade = calculatePriceLimitForTrade;
24
- //# sourceMappingURL=trade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trade.js","sourceRoot":"/","sources":["utils/trade.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAqC;AAErC,iHAAiH;AACjH,SAAgB,2BAA2B,CACzC,UAAkB,EAClB,MAAc;IAEd,8BAA8B;IAC9B,IAAM,gBAAgB,GAAG,IAAA,sBAAS,EAAC,UAAU,CAAC,CAAC;IAE/C,mCAAmC;IACnC,IAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEvC,mFAAmF;IACnF,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,wBAAwB;QACxB,OAAO,MAAM,CACX,IAAA,sBAAS,EAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAChE,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CACX,IAAA,sBAAS,EAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACjE,CAAC;IACJ,CAAC;AACH,CAAC;AArBD,kEAqBC","sourcesContent":["import BigNumber from 'bignumber.js';\n\n// todo: need the ability to supply custom slippage or use a more conservative default for the slippage tolerance\nexport function calculatePriceLimitForTrade(\n orderPrice: number,\n amount: number,\n): bigint {\n // Ensure orderPrice is BigInt\n const orderPriceBigInt = BigNumber(orderPrice);\n\n // Calculate 50% of the order price\n const offset = orderPriceBigInt.div(2);\n\n // Determine if the amount is positive or negative and adjust the price accordingly\n if (amount > 0) {\n // Trade is long, so add\n return BigInt(\n BigNumber(orderPriceBigInt).plus(offset).times(1e18).toFixed(0),\n );\n } else {\n return BigInt(\n BigNumber(orderPriceBigInt).minus(offset).times(1e18).toFixed(0),\n );\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGasBuffer = void 0;
4
- function getGasBuffer(value) {
5
- return (value * BigInt(120)) / BigInt(100);
6
- }
7
- exports.getGasBuffer = getGasBuffer;
8
- //# sourceMappingURL=txHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"txHelpers.js","sourceRoot":"/","sources":["utils/txHelpers.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,oCAEC","sourcesContent":["export function getGasBuffer(value: bigint): bigint {\n return (value * BigInt(120)) / BigInt(100);\n}\n"]}