@reyaxyz/common 0.97.0 → 0.98.1

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 (61) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +1 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/services/getSocketBridgeTime.js +5 -5
  5. package/dist/services/getSocketBridgeTime.js.map +1 -1
  6. package/dist/transactions/abis/CoreProxy.json +5600 -0
  7. package/dist/transactions/abis/Periphery.json +1464 -0
  8. package/dist/transactions/abis/socket/VaultWithPayload.json +40 -0
  9. package/dist/transactions/action.js +22 -0
  10. package/dist/transactions/action.js.map +1 -0
  11. package/dist/transactions/consts.js +7 -0
  12. package/dist/transactions/consts.js.map +1 -0
  13. package/dist/transactions/contractAddresses.js +36 -0
  14. package/dist/transactions/contractAddresses.js.map +1 -0
  15. package/dist/transactions/executeTransaction.js +120 -0
  16. package/dist/transactions/executeTransaction.js.map +1 -0
  17. package/dist/transactions/index.js +32 -0
  18. package/dist/transactions/index.js.map +1 -0
  19. package/dist/transactions/routerCommands.js +45 -0
  20. package/dist/transactions/routerCommands.js.map +1 -0
  21. package/dist/transactions/sign.js +146 -0
  22. package/dist/transactions/sign.js.map +1 -0
  23. package/dist/transactions/trade.js +24 -0
  24. package/dist/transactions/trade.js.map +1 -0
  25. package/dist/transactions/txHelpers.js +8 -0
  26. package/dist/transactions/txHelpers.js.map +1 -0
  27. package/dist/types/index.d.ts +1 -0
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/transactions/action.d.ts +27 -0
  30. package/dist/types/transactions/action.d.ts.map +1 -0
  31. package/dist/types/transactions/consts.d.ts +4 -0
  32. package/dist/types/transactions/consts.d.ts.map +1 -0
  33. package/dist/types/transactions/contractAddresses.d.ts +8 -0
  34. package/dist/types/transactions/contractAddresses.d.ts.map +1 -0
  35. package/dist/types/transactions/executeTransaction.d.ts +15 -0
  36. package/dist/types/transactions/executeTransaction.d.ts.map +1 -0
  37. package/dist/types/transactions/index.d.ts +12 -0
  38. package/dist/types/transactions/index.d.ts.map +1 -0
  39. package/dist/types/transactions/routerCommands.d.ts +23 -0
  40. package/dist/types/transactions/routerCommands.d.ts.map +1 -0
  41. package/dist/types/transactions/sign.d.ts +12 -0
  42. package/dist/types/transactions/sign.d.ts.map +1 -0
  43. package/dist/types/transactions/trade.d.ts +2 -0
  44. package/dist/types/transactions/trade.d.ts.map +1 -0
  45. package/dist/types/transactions/txHelpers.d.ts +2 -0
  46. package/dist/types/transactions/txHelpers.d.ts.map +1 -0
  47. package/package.json +2 -2
  48. package/src/index.ts +1 -0
  49. package/src/services/getSocketBridgeTime.ts +5 -5
  50. package/src/transactions/abis/CoreProxy.json +5600 -0
  51. package/src/transactions/abis/Periphery.json +1464 -0
  52. package/src/transactions/abis/socket/VaultWithPayload.json +40 -0
  53. package/src/transactions/action.ts +41 -0
  54. package/src/transactions/consts.ts +3 -0
  55. package/src/transactions/contractAddresses.ts +41 -0
  56. package/src/transactions/executeTransaction.ts +83 -0
  57. package/src/transactions/index.ts +11 -0
  58. package/src/transactions/routerCommands.ts +62 -0
  59. package/src/transactions/sign.ts +135 -0
  60. package/src/transactions/trade.ts +25 -0
  61. package/src/transactions/txHelpers.ts +3 -0
@@ -0,0 +1,15 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+ import { ContractType } from './contractAddresses';
3
+ export type Transaction = {
4
+ from: string;
5
+ to: string;
6
+ data: string;
7
+ value?: string;
8
+ };
9
+ export declare function estimateGas(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<Transaction & {
10
+ gasLimit: bigint;
11
+ maxPriorityFeePerGas?: bigint;
12
+ maxFeePerGas?: bigint;
13
+ }>;
14
+ export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<import("ethers").TransactionReceipt | null>;
15
+ //# sourceMappingURL=executeTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAG/D,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"}
@@ -0,0 +1,12 @@
1
+ export * from './action';
2
+ export { abi as CoreAbi } from './abis/CoreProxy.json';
3
+ export { abi as PeripheryAbi } from './abis/Periphery.json';
4
+ export { abi as Socket_VaultWithPayloadAbi } from './abis/socket/VaultWithPayload.json';
5
+ export * from './contractAddresses';
6
+ export * from './routerCommands';
7
+ export * from './sign';
8
+ export * from './trade';
9
+ export * from './txHelpers';
10
+ export * from './consts';
11
+ export * from './executeTransaction';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["transactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,GAAG,IAAI,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACxF,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,23 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routerCommands.d.ts","sourceRoot":"/","sources":["transactions/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"}
@@ -0,0 +1,12 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+ import { Command } from './action';
3
+ import { Address, ReyaChainId } from '../types';
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"/","sources":["transactions/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEhD,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"}
@@ -0,0 +1,2 @@
1
+ export declare function calculatePriceLimitForTrade(orderPrice: number, amount: number): bigint;
2
+ //# sourceMappingURL=trade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trade.d.ts","sourceRoot":"/","sources":["transactions/trade.ts"],"names":[],"mappings":"AAGA,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAkBR"}
@@ -0,0 +1,2 @@
1
+ export declare function getGasBuffer(value: bigint): bigint;
2
+ //# sourceMappingURL=txHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txHelpers.d.ts","sourceRoot":"/","sources":["transactions/txHelpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/common",
3
- "version": "0.97.0",
3
+ "version": "0.98.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -42,5 +42,5 @@
42
42
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
43
43
  },
44
44
  "packageManager": "pnpm@8.3.1",
45
- "gitHead": "90d8d3a86d3ac2b38c2102ebf645486e799af959"
45
+ "gitHead": "97c1070b09e50ca0fdf2fbd451aebab41787dfbd"
46
46
  }
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from './services';
5
5
  export * from './modules';
6
6
  export * from './rest';
7
7
  export * from './decorators';
8
+ export * from './transactions';
@@ -7,19 +7,19 @@ import {
7
7
  const socketFees: Record<MoneyInOutChainId, GetSocketBridgeTimeResult> = {
8
8
  // mainnet
9
9
  [MoneyInOutChainId.ethereumMainnet]: {
10
- bridgeTimeInMS: 3 * 60 * 1000,
10
+ bridgeTimeInMS: 15 * 60 * 1000,
11
11
  },
12
12
  [MoneyInOutChainId.opMainnet]: {
13
- bridgeTimeInMS: 3 * 60 * 1000,
13
+ bridgeTimeInMS: 15 * 60 * 1000,
14
14
  },
15
15
  [MoneyInOutChainId.polygonMainnet]: {
16
- bridgeTimeInMS: 3 * 60 * 1000,
16
+ bridgeTimeInMS: 15 * 60 * 1000,
17
17
  },
18
18
  [MoneyInOutChainId.arbitrumOne]: {
19
- bridgeTimeInMS: 3 * 60 * 1000,
19
+ bridgeTimeInMS: 15 * 60 * 1000,
20
20
  },
21
21
  [MoneyInOutChainId.baseMainnet]: {
22
- bridgeTimeInMS: 3 * 60 * 1000,
22
+ bridgeTimeInMS: 15 * 60 * 1000,
23
23
  },
24
24
  // testnet
25
25
  [MoneyInOutChainId.polygonMumbai]: {