@nadohq/shared 0.1.0-alpha.5 → 0.1.0-alpha.50

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 (173) hide show
  1. package/dist/abis/index.cjs +12 -12
  2. package/dist/abis/index.cjs.map +1 -1
  3. package/dist/abis/index.d.cts +6 -6
  4. package/dist/abis/index.d.ts +6 -6
  5. package/dist/abis/index.js +6 -6
  6. package/dist/abis/index.js.map +1 -1
  7. package/dist/{chunk-TUJ4HQKF.js → chunk-2GPIH63F.js} +3 -3
  8. package/dist/chunk-2GPIH63F.js.map +1 -0
  9. package/dist/consts/chainEnvToChain.cjs +2 -2
  10. package/dist/consts/chainEnvToChain.cjs.map +1 -1
  11. package/dist/consts/chainEnvToChain.d.cts +345 -56
  12. package/dist/consts/chainEnvToChain.d.ts +345 -56
  13. package/dist/consts/chainEnvToChain.js +3 -3
  14. package/dist/consts/chainEnvToChain.js.map +1 -1
  15. package/dist/consts/index.d.cts +0 -1
  16. package/dist/consts/index.d.ts +0 -1
  17. package/dist/consts/productIds.cjs +1 -1
  18. package/dist/consts/productIds.cjs.map +1 -1
  19. package/dist/consts/productIds.d.cts +1 -1
  20. package/dist/consts/productIds.d.ts +1 -1
  21. package/dist/consts/productIds.js +1 -1
  22. package/dist/consts/productIds.js.map +1 -1
  23. package/dist/deployments/core/deployment.inkMainnet.json +13 -0
  24. package/dist/deployments/core/deployment.inkSepolia.json +13 -0
  25. package/dist/deployments/index.cjs +6 -6
  26. package/dist/deployments/index.cjs.map +1 -1
  27. package/dist/deployments/index.js +5 -5
  28. package/dist/deployments/index.js.map +1 -1
  29. package/dist/eip712/eip712ValueTypes.d.cts +1 -1
  30. package/dist/eip712/eip712ValueTypes.d.ts +1 -1
  31. package/dist/eip712/getNadoEIP712Domain.cjs.map +1 -1
  32. package/dist/eip712/getNadoEIP712Domain.js.map +1 -1
  33. package/dist/eip712/index.cjs +13 -13
  34. package/dist/eip712/index.cjs.map +1 -1
  35. package/dist/eip712/index.d.cts +9 -9
  36. package/dist/eip712/index.d.ts +9 -9
  37. package/dist/eip712/index.js +6 -6
  38. package/dist/eip712/index.js.map +1 -1
  39. package/dist/encoding/encoding.cjs +21 -0
  40. package/dist/encoding/encoding.cjs.map +1 -1
  41. package/dist/encoding/encoding.d.cts +27 -3
  42. package/dist/encoding/encoding.d.ts +27 -3
  43. package/dist/encoding/encoding.js +24 -1
  44. package/dist/encoding/encoding.js.map +1 -1
  45. package/dist/encoding/index.d.cts +2 -2
  46. package/dist/encoding/index.d.ts +2 -2
  47. package/dist/index.d.cts +35 -35
  48. package/dist/index.d.ts +35 -35
  49. package/dist/types/ChainEnv.cjs +1 -1
  50. package/dist/types/ChainEnv.cjs.map +1 -1
  51. package/dist/types/ChainEnv.d.cts +2 -2
  52. package/dist/types/ChainEnv.d.ts +2 -2
  53. package/dist/types/ChainEnv.js +1 -1
  54. package/dist/types/ChainEnv.js.map +1 -1
  55. package/dist/types/balanceTypes.d.cts +1 -1
  56. package/dist/types/balanceTypes.d.ts +1 -1
  57. package/dist/types/index.cjs +7 -7
  58. package/dist/types/index.cjs.map +1 -1
  59. package/dist/types/index.d.cts +4 -4
  60. package/dist/types/index.d.ts +4 -4
  61. package/dist/types/index.js +3 -3
  62. package/dist/types/index.js.map +1 -1
  63. package/dist/types/orderAppendixTypes.cjs.map +1 -1
  64. package/dist/types/orderAppendixTypes.d.cts +25 -1
  65. package/dist/types/orderAppendixTypes.d.ts +25 -1
  66. package/dist/types/viemTypes.d.cts +1 -1
  67. package/dist/types/viemTypes.d.ts +1 -1
  68. package/dist/utils/balanceValue.d.cts +1 -1
  69. package/dist/utils/balanceValue.d.ts +1 -1
  70. package/dist/utils/bytes32.d.cts +1 -1
  71. package/dist/utils/bytes32.d.ts +1 -1
  72. package/dist/utils/bytes32.test.cjs +2 -2
  73. package/dist/utils/bytes32.test.cjs.map +1 -1
  74. package/dist/utils/bytes32.test.js +1 -1
  75. package/dist/utils/createDeterministicLinkedSignerPrivateKey.cjs.map +1 -1
  76. package/dist/utils/createDeterministicLinkedSignerPrivateKey.js.map +1 -1
  77. package/dist/utils/index.cjs +12 -12
  78. package/dist/utils/index.cjs.map +1 -1
  79. package/dist/utils/index.d.cts +21 -21
  80. package/dist/utils/index.d.ts +21 -21
  81. package/dist/utils/index.js +6 -6
  82. package/dist/utils/index.js.map +1 -1
  83. package/dist/utils/math/bigDecimal.cjs +4 -3
  84. package/dist/utils/math/bigDecimal.cjs.map +1 -1
  85. package/dist/utils/math/bigDecimal.js +4 -3
  86. package/dist/utils/math/bigDecimal.js.map +1 -1
  87. package/dist/utils/math/index.cjs +8 -8
  88. package/dist/utils/math/index.cjs.map +1 -1
  89. package/dist/utils/math/index.d.cts +4 -4
  90. package/dist/utils/math/index.d.ts +4 -4
  91. package/dist/utils/math/index.js +4 -4
  92. package/dist/utils/math/index.js.map +1 -1
  93. package/dist/utils/orders/appendix/appendixIsolatedValue.cjs +50 -0
  94. package/dist/utils/orders/appendix/appendixIsolatedValue.cjs.map +1 -0
  95. package/dist/utils/orders/appendix/appendixIsolatedValue.d.cts +26 -0
  96. package/dist/utils/orders/appendix/appendixIsolatedValue.d.ts +26 -0
  97. package/dist/utils/orders/appendix/appendixIsolatedValue.js +31 -0
  98. package/dist/utils/orders/appendix/appendixIsolatedValue.js.map +1 -0
  99. package/dist/utils/orders/appendix/appendixTwapValue.cjs +3 -4
  100. package/dist/utils/orders/appendix/appendixTwapValue.cjs.map +1 -1
  101. package/dist/utils/orders/appendix/appendixTwapValue.d.cts +11 -13
  102. package/dist/utils/orders/appendix/appendixTwapValue.d.ts +11 -13
  103. package/dist/utils/orders/appendix/appendixTwapValue.js +3 -4
  104. package/dist/utils/orders/appendix/appendixTwapValue.js.map +1 -1
  105. package/dist/utils/orders/appendix/index.cjs +4 -4
  106. package/dist/utils/orders/appendix/index.cjs.map +1 -1
  107. package/dist/utils/orders/appendix/index.d.cts +2 -2
  108. package/dist/utils/orders/appendix/index.d.ts +2 -2
  109. package/dist/utils/orders/appendix/index.js +2 -2
  110. package/dist/utils/orders/appendix/index.js.map +1 -1
  111. package/dist/utils/orders/appendix/orderAppendix.test.cjs +67 -14
  112. package/dist/utils/orders/appendix/orderAppendix.test.cjs.map +1 -1
  113. package/dist/utils/orders/appendix/orderAppendix.test.js +66 -13
  114. package/dist/utils/orders/appendix/orderAppendix.test.js.map +1 -1
  115. package/dist/utils/orders/appendix/packOrderAppendix.cjs +9 -5
  116. package/dist/utils/orders/appendix/packOrderAppendix.cjs.map +1 -1
  117. package/dist/utils/orders/appendix/packOrderAppendix.js +9 -5
  118. package/dist/utils/orders/appendix/packOrderAppendix.js.map +1 -1
  119. package/dist/utils/orders/appendix/types.cjs.map +1 -1
  120. package/dist/utils/orders/appendix/types.d.cts +6 -4
  121. package/dist/utils/orders/appendix/types.d.ts +6 -4
  122. package/dist/utils/orders/appendix/unpackOrderAppendix.cjs +22 -5
  123. package/dist/utils/orders/appendix/unpackOrderAppendix.cjs.map +1 -1
  124. package/dist/utils/orders/appendix/unpackOrderAppendix.js +22 -5
  125. package/dist/utils/orders/appendix/unpackOrderAppendix.js.map +1 -1
  126. package/dist/utils/orders/index.cjs +3 -3
  127. package/dist/utils/orders/index.cjs.map +1 -1
  128. package/dist/utils/orders/index.d.cts +4 -4
  129. package/dist/utils/orders/index.d.ts +4 -4
  130. package/dist/utils/orders/index.js +1 -1
  131. package/dist/utils/orders/index.js.map +1 -1
  132. package/dist/utils/productTypeFilter.cjs.map +1 -1
  133. package/dist/utils/productTypeFilter.d.cts +2 -2
  134. package/dist/utils/productTypeFilter.d.ts +2 -2
  135. package/dist/utils/productTypeFilter.js.map +1 -1
  136. package/dist/utils/toPrintableObject.cjs +17 -9
  137. package/dist/utils/toPrintableObject.cjs.map +1 -1
  138. package/dist/utils/toPrintableObject.d.cts +7 -2
  139. package/dist/utils/toPrintableObject.d.ts +7 -2
  140. package/dist/utils/toPrintableObject.js +17 -9
  141. package/dist/utils/toPrintableObject.js.map +1 -1
  142. package/package.json +10 -3
  143. package/src/abis/index.ts +6 -6
  144. package/src/consts/chainEnvToChain.ts +2 -2
  145. package/src/consts/productIds.ts +1 -1
  146. package/src/deployments/core/deployment.inkMainnet.json +13 -0
  147. package/src/deployments/core/deployment.inkSepolia.json +13 -0
  148. package/src/deployments/index.ts +5 -5
  149. package/src/eip712/getNadoEIP712Domain.ts +1 -1
  150. package/src/eip712/index.ts +6 -6
  151. package/src/encoding/encoding.ts +43 -1
  152. package/src/types/ChainEnv.ts +1 -1
  153. package/src/types/index.ts +3 -3
  154. package/src/types/orderAppendixTypes.ts +25 -0
  155. package/src/utils/createDeterministicLinkedSignerPrivateKey.ts +1 -1
  156. package/src/utils/index.ts +6 -6
  157. package/src/utils/math/bigDecimal.ts +5 -3
  158. package/src/utils/math/index.ts +4 -4
  159. package/src/utils/orders/appendix/appendixIsolatedValue.ts +49 -0
  160. package/src/utils/orders/appendix/appendixTwapValue.ts +14 -19
  161. package/src/utils/orders/appendix/index.ts +2 -2
  162. package/src/utils/orders/appendix/orderAppendix.test.ts +68 -11
  163. package/src/utils/orders/appendix/packOrderAppendix.ts +10 -6
  164. package/src/utils/orders/appendix/types.ts +9 -7
  165. package/src/utils/orders/appendix/unpackOrderAppendix.ts +22 -5
  166. package/src/utils/orders/index.ts +1 -1
  167. package/src/utils/productTypeFilter.ts +2 -2
  168. package/src/utils/toPrintableObject.ts +30 -10
  169. package/dist/chunk-TUJ4HQKF.js.map +0 -1
  170. package/dist/deployments/core/deployment.InkSepolia.json +0 -13
  171. package/dist/deployments/core/deployment.arbitrumOne.json +0 -18
  172. package/src/deployments/core/deployment.InkSepolia.json +0 -13
  173. package/src/deployments/core/deployment.arbitrumOne.json +0 -18
@@ -24,6 +24,7 @@ __export(unpackOrderAppendix_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(unpackOrderAppendix_exports);
26
26
  var import_math = require("../../math/index.cjs");
27
+ var import_appendixIsolatedValue = require("./appendixIsolatedValue.cjs");
27
28
  var import_appendixTwapValue = require("./appendixTwapValue.cjs");
28
29
  var import_bitMaskValue = require("./bitMaskValue.cjs");
29
30
  function mapBitValuesToAppendix(bits) {
@@ -57,7 +58,7 @@ function mapBitValuesToAppendix(bits) {
57
58
  })();
58
59
  const isolatedFields = (() => {
59
60
  if (bits.isolated) {
60
- return { margin: bits.value };
61
+ return (0, import_appendixIsolatedValue.unpackIsolatedOrderAppendixValue)(bits.value);
61
62
  }
62
63
  return void 0;
63
64
  })();
@@ -66,12 +67,22 @@ function mapBitValuesToAppendix(bits) {
66
67
  return (0, import_appendixTwapValue.unpackTwapOrderAppendixValue)(bits.value);
67
68
  }
68
69
  })();
70
+ const builderFields = (() => {
71
+ if (bits.builderId) {
72
+ return {
73
+ builderId: bits.builderId,
74
+ builderFeeRate: bits.builderFeeRate
75
+ };
76
+ }
77
+ return void 0;
78
+ })();
69
79
  return {
70
80
  reduceOnly: !!bits.reduceOnly,
71
81
  orderExecutionType,
72
82
  triggerType,
73
83
  isolated: isolatedFields,
74
- twap: twapFields
84
+ twap: twapFields,
85
+ builder: builderFields
75
86
  };
76
87
  }
77
88
  function unpackOrderAppendix(packed) {
@@ -86,11 +97,17 @@ function unpackOrderAppendix(packed) {
86
97
  temp >>= 1n;
87
98
  const trigger = Number((0, import_bitMaskValue.bitMaskValue)(temp, 2));
88
99
  temp >>= 2n;
89
- const reserved = Number((0, import_bitMaskValue.bitMaskValue)(temp, 18));
90
- temp >>= 18n;
91
- const value = (0, import_bitMaskValue.bitMaskValue)(temp, 96);
100
+ const reserved = Number((0, import_bitMaskValue.bitMaskValue)(temp, 24));
101
+ temp >>= 24n;
102
+ const builderFeeRate = Number((0, import_bitMaskValue.bitMaskValue)(temp, 10));
103
+ temp >>= 10n;
104
+ const builderId = Number((0, import_bitMaskValue.bitMaskValue)(temp, 16));
105
+ temp >>= 16n;
106
+ const value = (0, import_bitMaskValue.bitMaskValue)(temp, 64);
92
107
  return mapBitValuesToAppendix({
93
108
  value,
109
+ builderId,
110
+ builderFeeRate,
94
111
  reserved,
95
112
  trigger,
96
113
  reduceOnly,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigDecimalish, toBigInt } from '../../math';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return { margin: bits.value };\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 18));\n temp >>= 18n;\n // The remaining bits are the value, which should be 96 bits\n const value = bitMaskValue(temp, 96);\n\n return mapBitValuesToAppendix({\n value,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAwC;AACxC,+BAA6C;AAC7C,0BAA6B;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,sBAAsB,MAAM;AAChC,YAAQ,KAAK,WAAW;AAAA,MACtB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,cAAM,IAAI;AAAA,UACR,gDAAgD,KAAK,SAAS;AAAA,QAChE;AAAA,IACJ;AAAA,EACF,GAAG;AACH,QAAM,kBAAkB,MAAM;AAC5B,QAAI,KAAK,UAAU;AACjB,aAAO,EAAE,QAAQ,KAAK,MAAM;AAAA,IAC9B;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,cAAc,MAAM;AACxB,QAAI,gBAAgB,UAAU,gBAAgB,uBAAuB;AACnE,iBAAO,uDAA6B,KAAK,KAAK;AAAA,IAChD;AAAA,EACF,GAAG;AAEH,SAAO;AAAA,IACL,YAAY,CAAC,CAAC,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AACF;AAMO,SAAS,oBAAoB,QAAsC;AACxE,MAAI,WAAO,sBAAS,MAAM;AAE1B,QAAM,UAAU,WAAO,kCAAa,MAAM,CAAC,CAAC;AAE5C,WAAS;AAET,QAAM,WAAW,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC7C,WAAS;AACT,QAAM,YAAY,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC9C,WAAS;AACT,QAAM,aAAa,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC/C,WAAS;AACT,QAAM,UAAU,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC5C,WAAS;AACT,QAAM,WAAW,WAAO,kCAAa,MAAM,EAAE,CAAC;AAC9C,WAAS;AAET,QAAM,YAAQ,kCAAa,MAAM,EAAE;AAEnC,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigDecimalish, toBigInt } from '../../math';\nimport { unpackIsolatedOrderAppendixValue } from './appendixIsolatedValue';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return unpackIsolatedOrderAppendixValue(bits.value);\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n const builderFields = (() => {\n if (bits.builderId) {\n return {\n builderId: bits.builderId,\n builderFeeRate: bits.builderFeeRate,\n };\n }\n return undefined;\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n builder: builderFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 24));\n temp >>= 24n;\n const builderFeeRate = Number(bitMaskValue(temp, 10));\n temp >>= 10n;\n const builderId = Number(bitMaskValue(temp, 16));\n temp >>= 16n;\n // The remaining bits are the value, which should be 64 bits\n const value = bitMaskValue(temp, 64);\n\n return mapBitValuesToAppendix({\n value,\n builderId,\n builderFeeRate,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAwC;AACxC,mCAAiD;AACjD,+BAA6C;AAC7C,0BAA6B;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,sBAAsB,MAAM;AAChC,YAAQ,KAAK,WAAW;AAAA,MACtB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,cAAM,IAAI;AAAA,UACR,gDAAgD,KAAK,SAAS;AAAA,QAChE;AAAA,IACJ;AAAA,EACF,GAAG;AACH,QAAM,kBAAkB,MAAM;AAC5B,QAAI,KAAK,UAAU;AACjB,iBAAO,+DAAiC,KAAK,KAAK;AAAA,IACpD;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,cAAc,MAAM;AACxB,QAAI,gBAAgB,UAAU,gBAAgB,uBAAuB;AACnE,iBAAO,uDAA6B,KAAK,KAAK;AAAA,IAChD;AAAA,EACF,GAAG;AACH,QAAM,iBAAiB,MAAM;AAC3B,QAAI,KAAK,WAAW;AAClB,aAAO;AAAA,QACL,WAAW,KAAK;AAAA,QAChB,gBAAgB,KAAK;AAAA,MACvB;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG;AAEH,SAAO;AAAA,IACL,YAAY,CAAC,CAAC,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAMO,SAAS,oBAAoB,QAAsC;AACxE,MAAI,WAAO,sBAAS,MAAM;AAE1B,QAAM,UAAU,WAAO,kCAAa,MAAM,CAAC,CAAC;AAE5C,WAAS;AAET,QAAM,WAAW,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC7C,WAAS;AACT,QAAM,YAAY,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC9C,WAAS;AACT,QAAM,aAAa,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC/C,WAAS;AACT,QAAM,UAAU,WAAO,kCAAa,MAAM,CAAC,CAAC;AAC5C,WAAS;AACT,QAAM,WAAW,WAAO,kCAAa,MAAM,EAAE,CAAC;AAC9C,WAAS;AACT,QAAM,iBAAiB,WAAO,kCAAa,MAAM,EAAE,CAAC;AACpD,WAAS;AACT,QAAM,YAAY,WAAO,kCAAa,MAAM,EAAE,CAAC;AAC/C,WAAS;AAET,QAAM,YAAQ,kCAAa,MAAM,EAAE;AAEnC,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -2,6 +2,7 @@ import "../../../chunk-5WRI5ZAA.js";
2
2
 
3
3
  // src/utils/orders/appendix/unpackOrderAppendix.ts
4
4
  import { toBigInt } from "../../math/index.js";
5
+ import { unpackIsolatedOrderAppendixValue } from "./appendixIsolatedValue.js";
5
6
  import { unpackTwapOrderAppendixValue } from "./appendixTwapValue.js";
6
7
  import { bitMaskValue } from "./bitMaskValue.js";
7
8
  function mapBitValuesToAppendix(bits) {
@@ -35,7 +36,7 @@ function mapBitValuesToAppendix(bits) {
35
36
  })();
36
37
  const isolatedFields = (() => {
37
38
  if (bits.isolated) {
38
- return { margin: bits.value };
39
+ return unpackIsolatedOrderAppendixValue(bits.value);
39
40
  }
40
41
  return void 0;
41
42
  })();
@@ -44,12 +45,22 @@ function mapBitValuesToAppendix(bits) {
44
45
  return unpackTwapOrderAppendixValue(bits.value);
45
46
  }
46
47
  })();
48
+ const builderFields = (() => {
49
+ if (bits.builderId) {
50
+ return {
51
+ builderId: bits.builderId,
52
+ builderFeeRate: bits.builderFeeRate
53
+ };
54
+ }
55
+ return void 0;
56
+ })();
47
57
  return {
48
58
  reduceOnly: !!bits.reduceOnly,
49
59
  orderExecutionType,
50
60
  triggerType,
51
61
  isolated: isolatedFields,
52
- twap: twapFields
62
+ twap: twapFields,
63
+ builder: builderFields
53
64
  };
54
65
  }
55
66
  function unpackOrderAppendix(packed) {
@@ -64,11 +75,17 @@ function unpackOrderAppendix(packed) {
64
75
  temp >>= 1n;
65
76
  const trigger = Number(bitMaskValue(temp, 2));
66
77
  temp >>= 2n;
67
- const reserved = Number(bitMaskValue(temp, 18));
68
- temp >>= 18n;
69
- const value = bitMaskValue(temp, 96);
78
+ const reserved = Number(bitMaskValue(temp, 24));
79
+ temp >>= 24n;
80
+ const builderFeeRate = Number(bitMaskValue(temp, 10));
81
+ temp >>= 10n;
82
+ const builderId = Number(bitMaskValue(temp, 16));
83
+ temp >>= 16n;
84
+ const value = bitMaskValue(temp, 64);
70
85
  return mapBitValuesToAppendix({
71
86
  value,
87
+ builderId,
88
+ builderFeeRate,
72
89
  reserved,
73
90
  trigger,
74
91
  reduceOnly,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigDecimalish, toBigInt } from '../../math';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return { margin: bits.value };\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 18));\n temp >>= 18n;\n // The remaining bits are the value, which should be 96 bits\n const value = bitMaskValue(temp, 96);\n\n return mapBitValuesToAppendix({\n value,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;AACA,SAAwB,gBAAgB;AACxC,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,sBAAsB,MAAM;AAChC,YAAQ,KAAK,WAAW;AAAA,MACtB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,cAAM,IAAI;AAAA,UACR,gDAAgD,KAAK,SAAS;AAAA,QAChE;AAAA,IACJ;AAAA,EACF,GAAG;AACH,QAAM,kBAAkB,MAAM;AAC5B,QAAI,KAAK,UAAU;AACjB,aAAO,EAAE,QAAQ,KAAK,MAAM;AAAA,IAC9B;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,cAAc,MAAM;AACxB,QAAI,gBAAgB,UAAU,gBAAgB,uBAAuB;AACnE,aAAO,6BAA6B,KAAK,KAAK;AAAA,IAChD;AAAA,EACF,GAAG;AAEH,SAAO;AAAA,IACL,YAAY,CAAC,CAAC,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AACF;AAMO,SAAS,oBAAoB,QAAsC;AACxE,MAAI,OAAO,SAAS,MAAM;AAE1B,QAAM,UAAU,OAAO,aAAa,MAAM,CAAC,CAAC;AAE5C,WAAS;AAET,QAAM,WAAW,OAAO,aAAa,MAAM,CAAC,CAAC;AAC7C,WAAS;AACT,QAAM,YAAY,OAAO,aAAa,MAAM,CAAC,CAAC;AAC9C,WAAS;AACT,QAAM,aAAa,OAAO,aAAa,MAAM,CAAC,CAAC;AAC/C,WAAS;AACT,QAAM,UAAU,OAAO,aAAa,MAAM,CAAC,CAAC;AAC5C,WAAS;AACT,QAAM,WAAW,OAAO,aAAa,MAAM,EAAE,CAAC;AAC9C,WAAS;AAET,QAAM,QAAQ,aAAa,MAAM,EAAE;AAEnC,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigDecimalish, toBigInt } from '../../math';\nimport { unpackIsolatedOrderAppendixValue } from './appendixIsolatedValue';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return unpackIsolatedOrderAppendixValue(bits.value);\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n const builderFields = (() => {\n if (bits.builderId) {\n return {\n builderId: bits.builderId,\n builderFeeRate: bits.builderFeeRate,\n };\n }\n return undefined;\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n builder: builderFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 24));\n temp >>= 24n;\n const builderFeeRate = Number(bitMaskValue(temp, 10));\n temp >>= 10n;\n const builderId = Number(bitMaskValue(temp, 16));\n temp >>= 16n;\n // The remaining bits are the value, which should be 64 bits\n const value = bitMaskValue(temp, 64);\n\n return mapBitValuesToAppendix({\n value,\n builderId,\n builderFeeRate,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;AACA,SAAwB,gBAAgB;AACxC,SAAS,wCAAwC;AACjD,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,sBAAsB,MAAM;AAChC,YAAQ,KAAK,WAAW;AAAA,MACtB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,cAAM,IAAI;AAAA,UACR,gDAAgD,KAAK,SAAS;AAAA,QAChE;AAAA,IACJ;AAAA,EACF,GAAG;AACH,QAAM,kBAAkB,MAAM;AAC5B,QAAI,KAAK,UAAU;AACjB,aAAO,iCAAiC,KAAK,KAAK;AAAA,IACpD;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,cAAc,MAAM;AACxB,QAAI,gBAAgB,UAAU,gBAAgB,uBAAuB;AACnE,aAAO,6BAA6B,KAAK,KAAK;AAAA,IAChD;AAAA,EACF,GAAG;AACH,QAAM,iBAAiB,MAAM;AAC3B,QAAI,KAAK,WAAW;AAClB,aAAO;AAAA,QACL,WAAW,KAAK;AAAA,QAChB,gBAAgB,KAAK;AAAA,MACvB;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG;AAEH,SAAO;AAAA,IACL,YAAY,CAAC,CAAC,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAMO,SAAS,oBAAoB,QAAsC;AACxE,MAAI,OAAO,SAAS,MAAM;AAE1B,QAAM,UAAU,OAAO,aAAa,MAAM,CAAC,CAAC;AAE5C,WAAS;AAET,QAAM,WAAW,OAAO,aAAa,MAAM,CAAC,CAAC;AAC7C,WAAS;AACT,QAAM,YAAY,OAAO,aAAa,MAAM,CAAC,CAAC;AAC9C,WAAS;AACT,QAAM,aAAa,OAAO,aAAa,MAAM,CAAC,CAAC;AAC/C,WAAS;AACT,QAAM,UAAU,OAAO,aAAa,MAAM,CAAC,CAAC;AAC5C,WAAS;AACT,QAAM,WAAW,OAAO,aAAa,MAAM,EAAE,CAAC;AAC9C,WAAS;AACT,QAAM,iBAAiB,OAAO,aAAa,MAAM,EAAE,CAAC;AACpD,WAAS;AACT,QAAM,YAAY,OAAO,aAAa,MAAM,EAAE,CAAC;AAC/C,WAAS;AAET,QAAM,QAAQ,aAAa,MAAM,EAAE;AAEnC,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -17,13 +17,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // src/utils/orders/index.ts
18
18
  var orders_exports = {};
19
19
  module.exports = __toCommonJS(orders_exports);
20
+ __reExport(orders_exports, require("./appendix/index.cjs"), module.exports);
20
21
  __reExport(orders_exports, require("./orderNonce.cjs"), module.exports);
21
22
  __reExport(orders_exports, require("./recvTime.cjs"), module.exports);
22
- __reExport(orders_exports, require("./appendix/index.cjs"), module.exports);
23
23
  // Annotate the CommonJS export names for ESM import in node:
24
24
  0 && (module.exports = {
25
+ ...require("./appendix/index.cjs"),
25
26
  ...require("./orderNonce.cjs"),
26
- ...require("./recvTime.cjs"),
27
- ...require("./appendix/index.cjs")
27
+ ...require("./recvTime.cjs")
28
28
  });
29
29
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/orders/index.ts"],"sourcesContent":["export * from './orderNonce';\nexport * from './recvTime';\nexport * from './appendix';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,6BAAd;AACA,2BAAc,2BADd;AAEA,2BAAc,iCAFd;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/orders/index.ts"],"sourcesContent":["export * from './appendix';\nexport * from './orderNonce';\nexport * from './recvTime';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,iCAAd;AACA,2BAAc,6BADd;AAEA,2BAAc,2BAFd;","names":[]}
@@ -1,10 +1,10 @@
1
- export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.cjs';
2
- export { getDefaultRecvTime } from './recvTime.cjs';
3
1
  export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './appendix/appendixTwapValue.cjs';
4
- export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.cjs';
2
+ export { bitMaskValue } from './appendix/bitMaskValue.cjs';
5
3
  export { packOrderAppendix } from './appendix/packOrderAppendix.cjs';
6
4
  export { PackedOrderAppendixBits } from './appendix/types.cjs';
7
- export { bitMaskValue } from './appendix/bitMaskValue.cjs';
5
+ export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.cjs';
6
+ export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.cjs';
7
+ export { getDefaultRecvTime } from './recvTime.cjs';
8
8
  import '../../types/orderAppendixTypes.cjs';
9
9
  import '../math/bigDecimal.cjs';
10
10
  import 'bignumber.js';
@@ -1,10 +1,10 @@
1
- export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.js';
2
- export { getDefaultRecvTime } from './recvTime.js';
3
1
  export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './appendix/appendixTwapValue.js';
4
- export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.js';
2
+ export { bitMaskValue } from './appendix/bitMaskValue.js';
5
3
  export { packOrderAppendix } from './appendix/packOrderAppendix.js';
6
4
  export { PackedOrderAppendixBits } from './appendix/types.js';
7
- export { bitMaskValue } from './appendix/bitMaskValue.js';
5
+ export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.js';
6
+ export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.js';
7
+ export { getDefaultRecvTime } from './recvTime.js';
8
8
  import '../../types/orderAppendixTypes.js';
9
9
  import '../math/bigDecimal.js';
10
10
  import 'bignumber.js';
@@ -1,5 +1,5 @@
1
1
  // src/utils/orders/index.ts
2
+ export * from "./appendix/index.js";
2
3
  export * from "./orderNonce.js";
3
4
  export * from "./recvTime.js";
4
- export * from "./appendix/index.js";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/orders/index.ts"],"sourcesContent":["export * from './orderNonce';\nexport * from './recvTime';\nexport * from './appendix';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/orders/index.ts"],"sourcesContent":["export * from './appendix';\nexport * from './orderNonce';\nexport * from './recvTime';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/productTypeFilter.ts"],"sourcesContent":["import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes';\nimport {\n ProductEngineType,\n PerpProduct,\n SpotProduct,\n Product,\n} from '../types/productTypes';\n\nexport function isSpotProduct(product: Product): product is SpotProduct {\n return product.type === ProductEngineType.SPOT;\n}\n\nexport function isSpotBalance(balance: Balance): balance is SpotBalance {\n return balance.type === ProductEngineType.SPOT;\n}\n\nexport function isPerpProduct(product: Product): product is PerpProduct {\n return product.type === ProductEngineType.PERP;\n}\n\nexport function isPerpBalance(balance: Balance): balance is PerpBalance {\n return balance.type === ProductEngineType.PERP;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAKO;AAEA,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/productTypeFilter.ts"],"sourcesContent":["import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes';\nimport {\n PerpProduct,\n Product,\n ProductEngineType,\n SpotProduct,\n} from '../types/productTypes';\n\nexport function isSpotProduct(product: Product): product is SpotProduct {\n return product.type === ProductEngineType.SPOT;\n}\n\nexport function isSpotBalance(balance: Balance): balance is SpotBalance {\n return balance.type === ProductEngineType.SPOT;\n}\n\nexport function isPerpProduct(product: Product): product is PerpProduct {\n return product.type === ProductEngineType.PERP;\n}\n\nexport function isPerpBalance(balance: Balance): balance is PerpBalance {\n return balance.type === ProductEngineType.PERP;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAKO;AAEA,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,sCAAkB;AAC5C;","names":[]}
@@ -1,5 +1,5 @@
1
- import { Balance, SpotBalance, PerpBalance } from '../types/balanceTypes.cjs';
2
- import { Product, SpotProduct, PerpProduct } from '../types/productTypes.cjs';
1
+ import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes.cjs';
2
+ import { Product, PerpProduct, SpotProduct } from '../types/productTypes.cjs';
3
3
  import 'bignumber.js';
4
4
  import '../types/healthTypes.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
- import { Balance, SpotBalance, PerpBalance } from '../types/balanceTypes.js';
2
- import { Product, SpotProduct, PerpProduct } from '../types/productTypes.js';
1
+ import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes.js';
2
+ import { Product, PerpProduct, SpotProduct } from '../types/productTypes.js';
3
3
  import 'bignumber.js';
4
4
  import '../types/healthTypes.js';
5
5
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/productTypeFilter.ts"],"sourcesContent":["import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes';\nimport {\n ProductEngineType,\n PerpProduct,\n SpotProduct,\n Product,\n} from '../types/productTypes';\n\nexport function isSpotProduct(product: Product): product is SpotProduct {\n return product.type === ProductEngineType.SPOT;\n}\n\nexport function isSpotBalance(balance: Balance): balance is SpotBalance {\n return balance.type === ProductEngineType.SPOT;\n}\n\nexport function isPerpProduct(product: Product): product is PerpProduct {\n return product.type === ProductEngineType.PERP;\n}\n\nexport function isPerpBalance(balance: Balance): balance is PerpBalance {\n return balance.type === ProductEngineType.PERP;\n}\n"],"mappings":";;;AACA;AAAA,EACE;AAAA,OAIK;AAEA,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/productTypeFilter.ts"],"sourcesContent":["import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes';\nimport {\n PerpProduct,\n Product,\n ProductEngineType,\n SpotProduct,\n} from '../types/productTypes';\n\nexport function isSpotProduct(product: Product): product is SpotProduct {\n return product.type === ProductEngineType.SPOT;\n}\n\nexport function isSpotBalance(balance: Balance): balance is SpotBalance {\n return balance.type === ProductEngineType.SPOT;\n}\n\nexport function isPerpProduct(product: Product): product is PerpProduct {\n return product.type === ProductEngineType.PERP;\n}\n\nexport function isPerpBalance(balance: Balance): balance is PerpBalance {\n return balance.type === ProductEngineType.PERP;\n}\n"],"mappings":";;;AACA;AAAA,EAGE;AAAA,OAEK;AAEA,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;AAEO,SAAS,cAAc,SAA0C;AACtE,SAAO,QAAQ,SAAS,kBAAkB;AAC5C;","names":[]}
@@ -24,23 +24,31 @@ __export(toPrintableObject_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(toPrintableObject_exports);
26
26
  var import_bigDecimal = require("./math/bigDecimal.cjs");
27
- function toPrintableObject(obj) {
28
- if (obj == null) {
27
+ function toPrintableObject(obj, seen = /* @__PURE__ */ new WeakSet()) {
28
+ if (obj === null || obj === void 0) {
29
29
  return null;
30
30
  }
31
31
  if (obj instanceof import_bigDecimal.BigDecimal || typeof obj === "bigint") {
32
32
  return obj.toString();
33
33
  }
34
34
  if (Array.isArray(obj)) {
35
- return obj.map(toPrintableObject);
35
+ return obj.map((item) => toPrintableObject(item, seen));
36
36
  }
37
37
  if (typeof obj === "object") {
38
- return Object.fromEntries(
39
- Object.entries(obj).map(([key, value]) => [
40
- key,
41
- toPrintableObject(value)
42
- ])
43
- );
38
+ if (seen.has(obj)) {
39
+ return "[Circular]";
40
+ }
41
+ seen.add(obj);
42
+ try {
43
+ return Object.fromEntries(
44
+ Object.entries(obj).map(([key, value]) => [
45
+ key,
46
+ toPrintableObject(value, seen)
47
+ ])
48
+ );
49
+ } catch {
50
+ return { error: "[Unserializable Object]" };
51
+ }
44
52
  }
45
53
  return obj;
46
54
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely\n */\nexport function toPrintableObject(obj: unknown): unknown {\n if (obj == null) {\n return null;\n }\n if (obj instanceof BigDecimal || typeof obj === 'bigint') {\n return obj.toString();\n }\n if (Array.isArray(obj)) {\n return obj.map(toPrintableObject);\n }\n if (typeof obj === 'object') {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n toPrintableObject(value),\n ]),\n );\n }\n return obj;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAKpB,SAAS,kBAAkB,KAAuB;AACvD,MAAI,OAAO,MAAM;AACf,WAAO;AAAA,EACT;AACA,MAAI,eAAe,gCAAc,OAAO,QAAQ,UAAU;AACxD,WAAO,IAAI,SAAS;AAAA,EACtB;AACA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,iBAAiB;AAAA,EAClC;AACA,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,OAAO;AAAA,MACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,QACxC;AAAA,QACA,kBAAkB,KAAK;AAAA,MACzB,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely.\n * Handles cyclic references by returning '[Circular]' for already-visited objects.\n */\nexport function toPrintableObject(\n obj: null | undefined,\n seen?: WeakSet<object>,\n): null;\nexport function toPrintableObject(\n obj: BigDecimal | bigint,\n seen?: WeakSet<object>,\n): string;\nexport function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;\nexport function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {\n if (obj === null || obj === undefined) {\n return null;\n }\n if (obj instanceof BigDecimal || typeof obj === 'bigint') {\n return obj.toString();\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => toPrintableObject(item, seen));\n }\n if (typeof obj === 'object') {\n // Detect cyclic references\n if (seen.has(obj)) {\n return '[Circular]';\n }\n seen.add(obj);\n\n try {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n toPrintableObject(value, seen),\n ]),\n );\n } catch {\n return { error: '[Unserializable Object]' };\n }\n }\n return obj;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAepB,SAAS,kBAAkB,KAAc,OAAO,oBAAI,QAAQ,GAAY;AAC7E,MAAI,QAAQ,QAAQ,QAAQ,QAAW;AACrC,WAAO;AAAA,EACT;AACA,MAAI,eAAe,gCAAc,OAAO,QAAQ,UAAU;AACxD,WAAO,IAAI,SAAS;AAAA,EACtB;AACA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,CAAC,SAAS,kBAAkB,MAAM,IAAI,CAAC;AAAA,EACxD;AACA,MAAI,OAAO,QAAQ,UAAU;AAE3B,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACA,SAAK,IAAI,GAAG;AAEZ,QAAI;AACF,aAAO,OAAO;AAAA,QACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,UACxC;AAAA,UACA,kBAAkB,OAAO,IAAI;AAAA,QAC/B,CAAC;AAAA,MACH;AAAA,IACF,QAAQ;AACN,aAAO,EAAE,OAAO,0BAA0B;AAAA,IAC5C;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,6 +1,11 @@
1
+ import BigDecimal from 'bignumber.js';
2
+
1
3
  /**
2
- * Util for converting any BigDecimal types into a string so that it can be logged nicely
4
+ * Util for converting any BigDecimal types into a string so that it can be logged nicely.
5
+ * Handles cyclic references by returning '[Circular]' for already-visited objects.
3
6
  */
4
- declare function toPrintableObject(obj: unknown): unknown;
7
+ declare function toPrintableObject(obj: null | undefined, seen?: WeakSet<object>): null;
8
+ declare function toPrintableObject(obj: BigDecimal | bigint, seen?: WeakSet<object>): string;
9
+ declare function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
5
10
 
6
11
  export { toPrintableObject };
@@ -1,6 +1,11 @@
1
+ import BigDecimal from 'bignumber.js';
2
+
1
3
  /**
2
- * Util for converting any BigDecimal types into a string so that it can be logged nicely
4
+ * Util for converting any BigDecimal types into a string so that it can be logged nicely.
5
+ * Handles cyclic references by returning '[Circular]' for already-visited objects.
3
6
  */
4
- declare function toPrintableObject(obj: unknown): unknown;
7
+ declare function toPrintableObject(obj: null | undefined, seen?: WeakSet<object>): null;
8
+ declare function toPrintableObject(obj: BigDecimal | bigint, seen?: WeakSet<object>): string;
9
+ declare function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
5
10
 
6
11
  export { toPrintableObject };
@@ -2,23 +2,31 @@ import "../chunk-5WRI5ZAA.js";
2
2
 
3
3
  // src/utils/toPrintableObject.ts
4
4
  import { BigDecimal } from "./math/bigDecimal.js";
5
- function toPrintableObject(obj) {
6
- if (obj == null) {
5
+ function toPrintableObject(obj, seen = /* @__PURE__ */ new WeakSet()) {
6
+ if (obj === null || obj === void 0) {
7
7
  return null;
8
8
  }
9
9
  if (obj instanceof BigDecimal || typeof obj === "bigint") {
10
10
  return obj.toString();
11
11
  }
12
12
  if (Array.isArray(obj)) {
13
- return obj.map(toPrintableObject);
13
+ return obj.map((item) => toPrintableObject(item, seen));
14
14
  }
15
15
  if (typeof obj === "object") {
16
- return Object.fromEntries(
17
- Object.entries(obj).map(([key, value]) => [
18
- key,
19
- toPrintableObject(value)
20
- ])
21
- );
16
+ if (seen.has(obj)) {
17
+ return "[Circular]";
18
+ }
19
+ seen.add(obj);
20
+ try {
21
+ return Object.fromEntries(
22
+ Object.entries(obj).map(([key, value]) => [
23
+ key,
24
+ toPrintableObject(value, seen)
25
+ ])
26
+ );
27
+ } catch {
28
+ return { error: "[Unserializable Object]" };
29
+ }
22
30
  }
23
31
  return obj;
24
32
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely\n */\nexport function toPrintableObject(obj: unknown): unknown {\n if (obj == null) {\n return null;\n }\n if (obj instanceof BigDecimal || typeof obj === 'bigint') {\n return obj.toString();\n }\n if (Array.isArray(obj)) {\n return obj.map(toPrintableObject);\n }\n if (typeof obj === 'object') {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n toPrintableObject(value),\n ]),\n );\n }\n return obj;\n}\n"],"mappings":";;;AAAA,SAAS,kBAAkB;AAKpB,SAAS,kBAAkB,KAAuB;AACvD,MAAI,OAAO,MAAM;AACf,WAAO;AAAA,EACT;AACA,MAAI,eAAe,cAAc,OAAO,QAAQ,UAAU;AACxD,WAAO,IAAI,SAAS;AAAA,EACtB;AACA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,iBAAiB;AAAA,EAClC;AACA,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,OAAO;AAAA,MACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,QACxC;AAAA,QACA,kBAAkB,KAAK;AAAA,MACzB,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely.\n * Handles cyclic references by returning '[Circular]' for already-visited objects.\n */\nexport function toPrintableObject(\n obj: null | undefined,\n seen?: WeakSet<object>,\n): null;\nexport function toPrintableObject(\n obj: BigDecimal | bigint,\n seen?: WeakSet<object>,\n): string;\nexport function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;\nexport function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {\n if (obj === null || obj === undefined) {\n return null;\n }\n if (obj instanceof BigDecimal || typeof obj === 'bigint') {\n return obj.toString();\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => toPrintableObject(item, seen));\n }\n if (typeof obj === 'object') {\n // Detect cyclic references\n if (seen.has(obj)) {\n return '[Circular]';\n }\n seen.add(obj);\n\n try {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n toPrintableObject(value, seen),\n ]),\n );\n } catch {\n return { error: '[Unserializable Object]' };\n }\n }\n return obj;\n}\n"],"mappings":";;;AAAA,SAAS,kBAAkB;AAepB,SAAS,kBAAkB,KAAc,OAAO,oBAAI,QAAQ,GAAY;AAC7E,MAAI,QAAQ,QAAQ,QAAQ,QAAW;AACrC,WAAO;AAAA,EACT;AACA,MAAI,eAAe,cAAc,OAAO,QAAQ,UAAU;AACxD,WAAO,IAAI,SAAS;AAAA,EACtB;AACA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,CAAC,SAAS,kBAAkB,MAAM,IAAI,CAAC;AAAA,EACxD;AACA,MAAI,OAAO,QAAQ,UAAU;AAE3B,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACA,SAAK,IAAI,GAAG;AAEZ,QAAI;AACF,aAAO,OAAO;AAAA,QACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,UACxC;AAAA,UACA,kBAAkB,OAAO,IAAI;AAAA,QAC/B,CAAC;AAAA,MACH;AAAA,IACF,QAAQ;AACN,aAAO,EAAE,OAAO,0BAA0B;AAAA,IAC5C;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/shared",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.50",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Shared utilities, types, and contract helpers for Nado SDK",
@@ -36,14 +36,21 @@
36
36
  }
37
37
  }
38
38
  },
39
+ "react-native": "./dist/index.js",
40
+ "main": "./dist/index.cjs",
41
+ "module": "./dist/index.js",
42
+ "types": "./dist/index.d.ts",
39
43
  "peerDependencies": {
40
44
  "bignumber.js": "^9.3.0",
41
45
  "viem": "*"
42
46
  },
47
+ "dependencies": {
48
+ "abitype": "^1.2.3"
49
+ },
43
50
  "devDependencies": {
44
51
  "@jest/globals": "*",
45
52
  "bignumber.js": "^9.3.0",
46
- "viem": "*"
53
+ "viem": "workspace:*"
47
54
  },
48
- "gitHead": "de119d61db2be44b2cab79b8d373b66eb0f8ffe6"
55
+ "gitHead": "f9a83705f16561c58f3b1cad75c0b69d60913fa8"
49
56
  }
package/src/abis/index.ts CHANGED
@@ -1,9 +1,9 @@
1
+ export * from './Clearinghouse';
2
+ export * from './Endpoint';
1
3
  export * from './ERC20';
2
4
  export * from './MockERC20';
3
- export * from './WithdrawPool';
4
- export * from './SpotEngine';
5
- export * from './Querier';
6
- export * from './PerpEngine';
7
- export * from './Endpoint';
8
- export * from './Clearinghouse';
9
5
  export * from './nadoAbis';
6
+ export * from './PerpEngine';
7
+ export * from './Querier';
8
+ export * from './SpotEngine';
9
+ export * from './WithdrawPool';
@@ -1,11 +1,11 @@
1
1
  import { Chain } from 'viem';
2
- import { arbitrum, inkSepolia, localhost } from 'viem/chains';
2
+ import { ink, inkSepolia, localhost } from 'viem/chains';
3
3
  import { ChainEnv } from '../types';
4
4
 
5
5
  export const CHAIN_ENV_TO_CHAIN = {
6
6
  local: localhost,
7
- arbitrum: arbitrum,
8
7
  inkTestnet: inkSepolia,
8
+ inkMainnet: ink,
9
9
  } as const satisfies Record<ChainEnv, Chain>;
10
10
 
11
11
  export const CHAIN_ID_TO_CHAIN_ENV = Object.fromEntries(
@@ -1,3 +1,3 @@
1
1
  export const QUOTE_PRODUCT_ID = 0;
2
2
 
3
- export const NLP_PRODUCT_ID = 153;
3
+ export const NLP_PRODUCT_ID = 11;
@@ -0,0 +1,13 @@
1
+ {
2
+ "nodeUrl": "https://ink.drpc.org",
3
+ "explorerUrl": "https://explorer.inkonchain.com",
4
+ "startBlock": 29851015,
5
+ "deployer": "0xC1cC56caB60e832665E6c3780BfEBe3C1C971603",
6
+ "quote": "0x0200C29006150606B650577BBE7B6248F58470c1",
7
+ "querier": "0x68798229F88251b31D534733D6C4098318c9dff8",
8
+ "clearinghouse": "0xD218103918C19D0A10cf35300E4CfAfbD444c5fE",
9
+ "endpoint": "0x05ec92D78ED421f3D3Ada77FFdE167106565974E",
10
+ "spotEngine": "0xFcD94770B95fd9Cc67143132BB172EB17A0907fE",
11
+ "perpEngine": "0xF8599D58d1137fC56EcDd9C16ee139C8BDf96da1",
12
+ "withdrawPool": "0x09fb495AA7859635f755E827d64c4C9A2e5b9651"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "nodeUrl": "https://rpc-gel-sepolia.inkonchain.com",
3
+ "explorerUrl": "https://explorer-sepolia.inkonchain.com",
4
+ "startBlock": 33809962,
5
+ "deployer": "0x59841b3761Ed1D089a783E4d7CB49E4534CD4F85",
6
+ "quote": "0x60F50F902b2E91aef7D6c700Eb22599e297fa86F",
7
+ "querier": "0x8E693BEa316bcC0F4f8be403081b954a0E3743C8",
8
+ "clearinghouse": "0x23a283B359D55A941bBeEC58801B6b17D955CC73",
9
+ "endpoint": "0x698D87105274292B5673367DEC81874Ce3633Ac2",
10
+ "spotEngine": "0x3352b2fF0fAc4ce38A6eA1C188cF4F924df54E5D",
11
+ "perpEngine": "0x4E859C47fea3666B5053B16C81AF64e77567702e",
12
+ "withdrawPool": "0xBD672Fe513acbA5c1ceE7b02F998A1B542852b3b"
13
+ }
@@ -3,8 +3,8 @@ import { NadoContractName } from '../abis/nadoAbis';
3
3
 
4
4
  import { ChainEnv } from '../types';
5
5
  import { getValidatedAddress } from '../utils/getValidatedAddress';
6
- import ArbitrumOneCoreDeployment from './core/deployment.arbitrumOne.json' with { type: 'json' };
7
- import InkSepoliaCoreDeployment from './core/deployment.InkSepolia.json' with { type: 'json' };
6
+ import InkMainnetCoreDeployment from './core/deployment.inkMainnet.json' with { type: 'json' };
7
+ import InkSepoliaCoreDeployment from './core/deployment.inkSepolia.json' with { type: 'json' };
8
8
  import LocalCoreDeployment from './core/deployment.localhost.json' with { type: 'json' };
9
9
 
10
10
  export type NadoDeploymentAddresses = {
@@ -15,12 +15,12 @@ export type NadoDeploymentAddresses = {
15
15
  * Known deployment addresses for the Nado contracts
16
16
  */
17
17
  export const NADO_DEPLOYMENTS: Record<ChainEnv, NadoDeploymentAddresses> = {
18
- arbitrum: validateDeployment({
19
- ...ArbitrumOneCoreDeployment,
20
- }),
21
18
  inkTestnet: validateDeployment({
22
19
  ...InkSepoliaCoreDeployment,
23
20
  }),
21
+ inkMainnet: validateDeployment({
22
+ ...InkMainnetCoreDeployment,
23
+ }),
24
24
  local: validateDeployment({
25
25
  ...LocalCoreDeployment,
26
26
  }),
@@ -1,5 +1,5 @@
1
- import { getValidatedAddress } from '../utils/getValidatedAddress';
2
1
  import { TypedDataDomain } from 'abitype';
2
+ import { getValidatedAddress } from '../utils/getValidatedAddress';
3
3
 
4
4
  /**
5
5
  * Gives the EIP712 data domain for order signing
@@ -1,10 +1,10 @@
1
- export * from './getSignedTransactionRequest';
2
- export * from './getNadoEIP712Values';
3
- export * from './getNadoEIP712Types';
4
- export * from './getNadoEIP712PrimaryType';
1
+ export * from './eip712ValueTypes';
5
2
  export * from './getNadoEIP712Domain';
3
+ export * from './getNadoEIP712PrimaryType';
4
+ export * from './getNadoEIP712Types';
5
+ export * from './getNadoEIP712Values';
6
+ export * from './getOrderVerifyingAddress';
7
+ export * from './getSignedTransactionRequest';
6
8
  export * from './orderDigest';
7
9
  export * from './signableRequestType';
8
10
  export * from './signatureParamTypes';
9
- export * from './eip712ValueTypes';
10
- export * from './getOrderVerifyingAddress';
@@ -1,4 +1,9 @@
1
- import { encodeAbiParameters, parseAbiParameters } from 'viem';
1
+ import {
2
+ encodeAbiParameters,
3
+ encodePacked,
4
+ parseAbiParameters,
5
+ type Hex,
6
+ } from 'viem';
2
7
  import {
3
8
  EIP712WithdrawCollateralParams,
4
9
  SignedEIP712OrderParams,
@@ -6,6 +11,16 @@ import {
6
11
  } from '../eip712';
7
12
  import { addDecimals, toBigInt } from '../utils';
8
13
 
14
+ /**
15
+ * Transaction type identifiers for slow mode transactions.
16
+ */
17
+ export enum SlowModeTxType {
18
+ DepositCollateral = 1,
19
+ WithdrawCollateral = 2,
20
+ LinkSigner = 13,
21
+ ClaimBuilderFee = 31,
22
+ }
23
+
9
24
  export function encodeSignedWithdrawCollateralTx(
10
25
  signed: SignedTx<EIP712WithdrawCollateralParams>,
11
26
  ) {
@@ -48,3 +63,30 @@ export function encodeSignedOrder(signed: SignedEIP712OrderParams) {
48
63
  ],
49
64
  );
50
65
  }
66
+
67
+ export interface ClaimBuilderFeeParams {
68
+ /** The sender subaccount as bytes32 */
69
+ sender: Hex;
70
+ /** The builder ID to claim fees for */
71
+ builderId: number;
72
+ }
73
+
74
+ /**
75
+ * Encodes a ClaimBuilderFee slow mode transaction.
76
+ *
77
+ * Format: [tx_type_byte] + [abi_encoded_params]
78
+ *
79
+ * @param params - The claim builder fee parameters
80
+ * @returns The encoded transaction bytes ready to submit via endpoint.submitSlowModeTransaction
81
+ */
82
+ export function encodeClaimBuilderFeeTx(params: ClaimBuilderFeeParams): Hex {
83
+ const txBytes = encodeAbiParameters(
84
+ parseAbiParameters('bytes32 sender, uint32 builderId'),
85
+ [params.sender, params.builderId],
86
+ );
87
+
88
+ return encodePacked(
89
+ ['uint8', 'bytes'],
90
+ [SlowModeTxType.ClaimBuilderFee, txBytes],
91
+ );
92
+ }