@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
package/dist/index.d.ts CHANGED
@@ -1,26 +1,26 @@
1
+ export { CLEARINGHOUSE_ABI } from './abis/Clearinghouse.js';
2
+ export { ENDPOINT_ABI } from './abis/Endpoint.js';
1
3
  export { ERC20_ABI } from './abis/ERC20.js';
2
4
  export { MOCK_ERC20_ABI } from './abis/MockERC20.js';
3
- export { WITHDRAW_POOL_ABI } from './abis/WithdrawPool.js';
4
- export { SPOT_ENGINE_ABI } from './abis/SpotEngine.js';
5
- export { QUERIER_ABI } from './abis/Querier.js';
6
- export { PERP_ENGINE_ABI } from './abis/PerpEngine.js';
7
- export { ENDPOINT_ABI } from './abis/Endpoint.js';
8
- export { CLEARINGHOUSE_ABI } from './abis/Clearinghouse.js';
9
5
  export { NADO_ABIS, NadoAbis, NadoContractName } from './abis/nadoAbis.js';
6
+ export { PERP_ENGINE_ABI } from './abis/PerpEngine.js';
7
+ export { QUERIER_ABI } from './abis/Querier.js';
8
+ export { SPOT_ENGINE_ABI } from './abis/SpotEngine.js';
9
+ export { WITHDRAW_POOL_ABI } from './abis/WithdrawPool.js';
10
10
  export { CHAIN_ENV_TO_CHAIN, CHAIN_ID_TO_CHAIN_ENV } from './consts/chainEnvToChain.js';
11
11
  export { NLP_PRODUCT_ID, QUOTE_PRODUCT_ID } from './consts/productIds.js';
12
12
  export { NADO_DEPLOYMENTS, NadoDeploymentAddresses } from './deployments/index.js';
13
- export { getSignedTransactionRequest } from './eip712/getSignedTransactionRequest.js';
14
- export { getNadoEIP712Values } from './eip712/getNadoEIP712Values.js';
15
- export { getNadoEIP712Types } from './eip712/getNadoEIP712Types.js';
16
- export { getNadoEIP712PrimaryType } from './eip712/getNadoEIP712PrimaryType.js';
13
+ export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712/eip712ValueTypes.js';
17
14
  export { getNadoEIP712Domain } from './eip712/getNadoEIP712Domain.js';
15
+ export { getNadoEIP712PrimaryType } from './eip712/getNadoEIP712PrimaryType.js';
16
+ export { getNadoEIP712Types } from './eip712/getNadoEIP712Types.js';
17
+ export { getNadoEIP712Values } from './eip712/getNadoEIP712Values.js';
18
+ export { getOrderVerifyingAddress } from './eip712/getOrderVerifyingAddress.js';
19
+ export { getSignedTransactionRequest } from './eip712/getSignedTransactionRequest.js';
18
20
  export { getOrderDigest } from './eip712/orderDigest.js';
19
21
  export { SignableRequestType, SignableRequestTypeToParams } from './eip712/signableRequestType.js';
20
22
  export { EIP712BurnNlpParams, EIP712CancelOrdersParams, EIP712CancelProductOrdersParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712OrderParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams, SignedEIP712OrderParams, SignedTx } from './eip712/signatureParamTypes.js';
21
- export { EIP712BurnNlpValues, EIP712LeaderboardAuthenticationValues, EIP712LinkSignerValues, EIP712LiquidateSubaccountValues, EIP712ListTriggerOrdersValues, EIP712MintNlpValues, EIP712OrderCancellationValues, EIP712OrderValues, EIP712ProductOrdersCancellationValues, EIP712TransferQuoteValues, EIP712WithdrawCollateralValues, SignableRequestTypeToEIP712Values } from './eip712/eip712ValueTypes.js';
22
- export { getOrderVerifyingAddress } from './eip712/getOrderVerifyingAddress.js';
23
- export { encodeSignedOrder, encodeSignedWithdrawCollateralTx } from './encoding/encoding.js';
23
+ export { ClaimBuilderFeeParams, SlowModeTxType, encodeClaimBuilderFeeTx, encodeSignedOrder, encodeSignedWithdrawCollateralTx } from './encoding/encoding.js';
24
24
  export { ApproveDepositAllowanceParams, approveDepositAllowance } from './execute/approveDepositAllowance.js';
25
25
  export { DepositCollateralParams, depositCollateral } from './execute/depositCollateral.js';
26
26
  export { Balance, BalanceHealthContributions, BalanceSide, BalanceWithProduct, PerpBalance, PerpBalanceWithProduct, SpotBalance, SpotBalanceWithProduct } from './types/balanceTypes.js';
@@ -28,40 +28,40 @@ export { Bytes } from './types/bytes.js';
28
28
  export { ALL_CHAIN_ENVS, ChainEnv, LOCAL_CHAIN_ENVS, MAINNET_CHAIN_ENVS, TESTNET_CHAIN_ENVS } from './types/ChainEnv.js';
29
29
  export { HealthGroup, HealthStatus, HealthStatusByType, HealthType } from './types/healthTypes.js';
30
30
  export { Market, MarketWithProduct, PerpMarket, SpotMarket } from './types/marketTypes.js';
31
+ export { NadoContracts, WithContract, WithContracts } from './types/nadoContractTypes.js';
32
+ export { OrderAppendix, OrderAppendixBuilderFields, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields } from './types/orderAppendixTypes.js';
33
+ export { OrderExecutionType } from './types/OrderExecutionType.js';
31
34
  export { PerpProduct, Product, ProductEngineType, SpotProduct, toProductEngineType } from './types/productTypes.js';
32
35
  export { Subaccount, SubaccountBytes32, SubaccountNameBytes12 } from './types/subaccountTypes.js';
33
- export { NadoContracts, WithContract, WithContracts } from './types/nadoContractTypes.js';
34
36
  export { AccountWithPrivateKey, ContractInstance, WalletClientWithAccount, WriteableContractInstance } from './types/viemTypes.js';
35
- export { OrderExecutionType } from './types/OrderExecutionType.js';
36
- export { OrderAppendix, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields } from './types/orderAppendixTypes.js';
37
- export { getOrderNonce, getRecvTimeFromOrderNonce } from './utils/orders/orderNonce.js';
38
- export { getDefaultRecvTime } from './utils/orders/recvTime.js';
39
- export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './utils/orders/appendix/appendixTwapValue.js';
40
- export { unpackOrderAppendix } from './utils/orders/appendix/unpackOrderAppendix.js';
41
- export { packOrderAppendix } from './utils/orders/appendix/packOrderAppendix.js';
42
- export { PackedOrderAppendixBits } from './utils/orders/appendix/types.js';
43
- export { bitMaskValue } from './utils/orders/appendix/bitMaskValue.js';
44
- export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio } from './utils/interest.js';
45
- export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './utils/productTypeFilter.js';
37
+ export { AsyncResult, asyncResult } from './utils/asyncResult.js';
46
38
  export { calcPerpBalanceNotionalValue, calcPerpBalanceValue, calcSpotBalanceValue } from './utils/balanceValue.js';
47
39
  export { subaccountFromBytes32, subaccountFromHex, subaccountNameBytesToStr, subaccountNameToBytes12, subaccountToBytes32, subaccountToHex } from './utils/bytes32.js';
48
40
  export { createDeterministicLinkedSignerPrivateKey } from './utils/createDeterministicLinkedSignerPrivateKey.js';
49
- export { isWriteableContract } from './utils/isWriteableContract.js';
50
41
  export { WalletNotProvidedError } from './utils/errors/WalletNotProvidedError.js';
51
- export { BigDecimalish, toBigDecimal } from './utils/math/bigDecimal.js';
52
- export { toIntegerString } from './utils/math/toIntegerString.js';
53
- export { toBigInt } from './utils/math/toBigInt.js';
54
- export { clampBigDecimal } from './utils/math/clamp.js';
55
- export { sumBigDecimalBy } from './utils/math/sumBigDecimalBy.js';
56
- export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './utils/math/decimalAdjustment.js';
57
- export { BigDecimals } from './utils/math/BigDecimals.js';
58
- export { AsyncResult, asyncResult } from './utils/asyncResult.js';
59
42
  export { getValidatedAddress } from './utils/getValidatedAddress.js';
60
43
  export { getValidatedHex } from './utils/getValidatedHex.js';
44
+ export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio } from './utils/interest.js';
45
+ export { isWriteableContract } from './utils/isWriteableContract.js';
61
46
  export { mapValues } from './utils/mapValues.js';
47
+ export { BigDecimalish, toBigDecimal } from './utils/math/bigDecimal.js';
48
+ export { BigDecimals } from './utils/math/BigDecimals.js';
49
+ export { clampBigDecimal } from './utils/math/clamp.js';
50
+ export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './utils/math/decimalAdjustment.js';
51
+ export { sumBigDecimalBy } from './utils/math/sumBigDecimalBy.js';
52
+ export { toBigInt } from './utils/math/toBigInt.js';
53
+ export { toIntegerString } from './utils/math/toIntegerString.js';
54
+ export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './utils/orders/appendix/appendixTwapValue.js';
55
+ export { bitMaskValue } from './utils/orders/appendix/bitMaskValue.js';
56
+ export { packOrderAppendix } from './utils/orders/appendix/packOrderAppendix.js';
57
+ export { PackedOrderAppendixBits } from './utils/orders/appendix/types.js';
58
+ export { unpackOrderAppendix } from './utils/orders/appendix/unpackOrderAppendix.js';
59
+ export { getOrderNonce, getRecvTimeFromOrderNonce } from './utils/orders/orderNonce.js';
60
+ export { getDefaultRecvTime } from './utils/orders/recvTime.js';
61
+ export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './utils/productTypeFilter.js';
62
62
  export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.js';
63
63
  export { toPrintableObject } from './utils/toPrintableObject.js';
64
64
  export { default as BigDecimal } from 'bignumber.js';
65
- import 'abitype';
66
65
  import 'viem/chains';
67
66
  import 'viem';
67
+ import 'abitype';
@@ -28,7 +28,7 @@ __export(ChainEnv_exports, {
28
28
  module.exports = __toCommonJS(ChainEnv_exports);
29
29
  var LOCAL_CHAIN_ENVS = ["local"];
30
30
  var TESTNET_CHAIN_ENVS = ["inkTestnet"];
31
- var MAINNET_CHAIN_ENVS = ["arbitrum"];
31
+ var MAINNET_CHAIN_ENVS = ["inkMainnet"];
32
32
  var ALL_CHAIN_ENVS = [
33
33
  ...LOCAL_CHAIN_ENVS,
34
34
  ...TESTNET_CHAIN_ENVS,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/ChainEnv.ts"],"sourcesContent":["export const LOCAL_CHAIN_ENVS = ['local'] as const satisfies string[];\n\nexport const TESTNET_CHAIN_ENVS = ['inkTestnet'] as const satisfies string[];\n\nexport const MAINNET_CHAIN_ENVS = ['arbitrum'] as const satisfies string[];\n\nexport const ALL_CHAIN_ENVS = [\n ...LOCAL_CHAIN_ENVS,\n ...TESTNET_CHAIN_ENVS,\n ...MAINNET_CHAIN_ENVS,\n] as const satisfies string[];\n\nexport type ChainEnv = (typeof ALL_CHAIN_ENVS)[number];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,mBAAmB,CAAC,OAAO;AAEjC,IAAM,qBAAqB,CAAC,YAAY;AAExC,IAAM,qBAAqB,CAAC,UAAU;AAEtC,IAAM,iBAAiB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
1
+ {"version":3,"sources":["../../src/types/ChainEnv.ts"],"sourcesContent":["export const LOCAL_CHAIN_ENVS = ['local'] as const satisfies string[];\n\nexport const TESTNET_CHAIN_ENVS = ['inkTestnet'] as const satisfies string[];\n\nexport const MAINNET_CHAIN_ENVS = ['inkMainnet'] as const satisfies string[];\n\nexport const ALL_CHAIN_ENVS = [\n ...LOCAL_CHAIN_ENVS,\n ...TESTNET_CHAIN_ENVS,\n ...MAINNET_CHAIN_ENVS,\n] as const satisfies string[];\n\nexport type ChainEnv = (typeof ALL_CHAIN_ENVS)[number];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,mBAAmB,CAAC,OAAO;AAEjC,IAAM,qBAAqB,CAAC,YAAY;AAExC,IAAM,qBAAqB,CAAC,YAAY;AAExC,IAAM,iBAAiB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
@@ -1,7 +1,7 @@
1
1
  declare const LOCAL_CHAIN_ENVS: ["local"];
2
2
  declare const TESTNET_CHAIN_ENVS: ["inkTestnet"];
3
- declare const MAINNET_CHAIN_ENVS: ["arbitrum"];
4
- declare const ALL_CHAIN_ENVS: ["local", "inkTestnet", "arbitrum"];
3
+ declare const MAINNET_CHAIN_ENVS: ["inkMainnet"];
4
+ declare const ALL_CHAIN_ENVS: ["local", "inkTestnet", "inkMainnet"];
5
5
  type ChainEnv = (typeof ALL_CHAIN_ENVS)[number];
6
6
 
7
7
  export { ALL_CHAIN_ENVS, type ChainEnv, LOCAL_CHAIN_ENVS, MAINNET_CHAIN_ENVS, TESTNET_CHAIN_ENVS };
@@ -1,7 +1,7 @@
1
1
  declare const LOCAL_CHAIN_ENVS: ["local"];
2
2
  declare const TESTNET_CHAIN_ENVS: ["inkTestnet"];
3
- declare const MAINNET_CHAIN_ENVS: ["arbitrum"];
4
- declare const ALL_CHAIN_ENVS: ["local", "inkTestnet", "arbitrum"];
3
+ declare const MAINNET_CHAIN_ENVS: ["inkMainnet"];
4
+ declare const ALL_CHAIN_ENVS: ["local", "inkTestnet", "inkMainnet"];
5
5
  type ChainEnv = (typeof ALL_CHAIN_ENVS)[number];
6
6
 
7
7
  export { ALL_CHAIN_ENVS, type ChainEnv, LOCAL_CHAIN_ENVS, MAINNET_CHAIN_ENVS, TESTNET_CHAIN_ENVS };
@@ -3,7 +3,7 @@ import "../chunk-5WRI5ZAA.js";
3
3
  // src/types/ChainEnv.ts
4
4
  var LOCAL_CHAIN_ENVS = ["local"];
5
5
  var TESTNET_CHAIN_ENVS = ["inkTestnet"];
6
- var MAINNET_CHAIN_ENVS = ["arbitrum"];
6
+ var MAINNET_CHAIN_ENVS = ["inkMainnet"];
7
7
  var ALL_CHAIN_ENVS = [
8
8
  ...LOCAL_CHAIN_ENVS,
9
9
  ...TESTNET_CHAIN_ENVS,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/ChainEnv.ts"],"sourcesContent":["export const LOCAL_CHAIN_ENVS = ['local'] as const satisfies string[];\n\nexport const TESTNET_CHAIN_ENVS = ['inkTestnet'] as const satisfies string[];\n\nexport const MAINNET_CHAIN_ENVS = ['arbitrum'] as const satisfies string[];\n\nexport const ALL_CHAIN_ENVS = [\n ...LOCAL_CHAIN_ENVS,\n ...TESTNET_CHAIN_ENVS,\n ...MAINNET_CHAIN_ENVS,\n] as const satisfies string[];\n\nexport type ChainEnv = (typeof ALL_CHAIN_ENVS)[number];\n"],"mappings":";;;AAAO,IAAM,mBAAmB,CAAC,OAAO;AAEjC,IAAM,qBAAqB,CAAC,YAAY;AAExC,IAAM,qBAAqB,CAAC,UAAU;AAEtC,IAAM,iBAAiB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
1
+ {"version":3,"sources":["../../src/types/ChainEnv.ts"],"sourcesContent":["export const LOCAL_CHAIN_ENVS = ['local'] as const satisfies string[];\n\nexport const TESTNET_CHAIN_ENVS = ['inkTestnet'] as const satisfies string[];\n\nexport const MAINNET_CHAIN_ENVS = ['inkMainnet'] as const satisfies string[];\n\nexport const ALL_CHAIN_ENVS = [\n ...LOCAL_CHAIN_ENVS,\n ...TESTNET_CHAIN_ENVS,\n ...MAINNET_CHAIN_ENVS,\n] as const satisfies string[];\n\nexport type ChainEnv = (typeof ALL_CHAIN_ENVS)[number];\n"],"mappings":";;;AAAO,IAAM,mBAAmB,CAAC,OAAO;AAEjC,IAAM,qBAAqB,CAAC,YAAY;AAExC,IAAM,qBAAqB,CAAC,YAAY;AAExC,IAAM,iBAAiB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import BigDecimal from 'bignumber.js';
2
2
  import { HealthType } from './healthTypes.cjs';
3
- import { ProductEngineType, PerpProduct, SpotProduct } from './productTypes.cjs';
3
+ import { ProductEngineType, SpotProduct, PerpProduct } from './productTypes.cjs';
4
4
 
5
5
  type BalanceSide = 'long' | 'short';
6
6
  type BalanceHealthContributions = Record<HealthType, BigDecimal>;
@@ -1,6 +1,6 @@
1
1
  import BigDecimal from 'bignumber.js';
2
2
  import { HealthType } from './healthTypes.js';
3
- import { ProductEngineType, PerpProduct, SpotProduct } from './productTypes.js';
3
+ import { ProductEngineType, SpotProduct, PerpProduct } from './productTypes.js';
4
4
 
5
5
  type BalanceSide = 'long' | 'short';
6
6
  type BalanceHealthContributions = Record<HealthType, BigDecimal>;
@@ -22,12 +22,12 @@ __reExport(types_exports, require("./bytes.cjs"), module.exports);
22
22
  __reExport(types_exports, require("./ChainEnv.cjs"), module.exports);
23
23
  __reExport(types_exports, require("./healthTypes.cjs"), module.exports);
24
24
  __reExport(types_exports, require("./marketTypes.cjs"), module.exports);
25
+ __reExport(types_exports, require("./nadoContractTypes.cjs"), module.exports);
26
+ __reExport(types_exports, require("./orderAppendixTypes.cjs"), module.exports);
27
+ __reExport(types_exports, require("./OrderExecutionType.cjs"), module.exports);
25
28
  __reExport(types_exports, require("./productTypes.cjs"), module.exports);
26
29
  __reExport(types_exports, require("./subaccountTypes.cjs"), module.exports);
27
- __reExport(types_exports, require("./nadoContractTypes.cjs"), module.exports);
28
30
  __reExport(types_exports, require("./viemTypes.cjs"), module.exports);
29
- __reExport(types_exports, require("./OrderExecutionType.cjs"), module.exports);
30
- __reExport(types_exports, require("./orderAppendixTypes.cjs"), module.exports);
31
31
  // Annotate the CommonJS export names for ESM import in node:
32
32
  0 && (module.exports = {
33
33
  ...require("./balanceTypes.cjs"),
@@ -35,11 +35,11 @@ __reExport(types_exports, require("./orderAppendixTypes.cjs"), module.exports);
35
35
  ...require("./ChainEnv.cjs"),
36
36
  ...require("./healthTypes.cjs"),
37
37
  ...require("./marketTypes.cjs"),
38
- ...require("./productTypes.cjs"),
39
- ...require("./subaccountTypes.cjs"),
40
38
  ...require("./nadoContractTypes.cjs"),
41
- ...require("./viemTypes.cjs"),
39
+ ...require("./orderAppendixTypes.cjs"),
42
40
  ...require("./OrderExecutionType.cjs"),
43
- ...require("./orderAppendixTypes.cjs")
41
+ ...require("./productTypes.cjs"),
42
+ ...require("./subaccountTypes.cjs"),
43
+ ...require("./viemTypes.cjs")
44
44
  });
45
45
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from './balanceTypes';\nexport * from './bytes';\nexport * from './ChainEnv';\nexport * from './healthTypes';\nexport * from './marketTypes';\nexport * from './productTypes';\nexport * from './subaccountTypes';\nexport * from './nadoContractTypes';\nexport * from './viemTypes';\nexport * from './OrderExecutionType';\nexport * from './orderAppendixTypes';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,wBADd;AAEA,0BAAc,2BAFd;AAGA,0BAAc,8BAHd;AAIA,0BAAc,8BAJd;AAKA,0BAAc,+BALd;AAMA,0BAAc,kCANd;AAOA,0BAAc,oCAPd;AAQA,0BAAc,4BARd;AASA,0BAAc,qCATd;AAUA,0BAAc,qCAVd;","names":[]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from './balanceTypes';\nexport * from './bytes';\nexport * from './ChainEnv';\nexport * from './healthTypes';\nexport * from './marketTypes';\nexport * from './nadoContractTypes';\nexport * from './orderAppendixTypes';\nexport * from './OrderExecutionType';\nexport * from './productTypes';\nexport * from './subaccountTypes';\nexport * from './viemTypes';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,wBADd;AAEA,0BAAc,2BAFd;AAGA,0BAAc,8BAHd;AAIA,0BAAc,8BAJd;AAKA,0BAAc,oCALd;AAMA,0BAAc,qCANd;AAOA,0BAAc,qCAPd;AAQA,0BAAc,+BARd;AASA,0BAAc,kCATd;AAUA,0BAAc,4BAVd;","names":[]}
@@ -3,13 +3,13 @@ export { Bytes } from './bytes.cjs';
3
3
  export { ALL_CHAIN_ENVS, ChainEnv, LOCAL_CHAIN_ENVS, MAINNET_CHAIN_ENVS, TESTNET_CHAIN_ENVS } from './ChainEnv.cjs';
4
4
  export { HealthGroup, HealthStatus, HealthStatusByType, HealthType } from './healthTypes.cjs';
5
5
  export { Market, MarketWithProduct, PerpMarket, SpotMarket } from './marketTypes.cjs';
6
+ export { NadoContracts, WithContract, WithContracts } from './nadoContractTypes.cjs';
7
+ export { OrderAppendix, OrderAppendixBuilderFields, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields } from './orderAppendixTypes.cjs';
8
+ export { OrderExecutionType } from './OrderExecutionType.cjs';
6
9
  export { PerpProduct, Product, ProductEngineType, SpotProduct, toProductEngineType } from './productTypes.cjs';
7
10
  export { Subaccount, SubaccountBytes32, SubaccountNameBytes12 } from './subaccountTypes.cjs';
8
- export { NadoContracts, WithContract, WithContracts } from './nadoContractTypes.cjs';
9
11
  export { AccountWithPrivateKey, ContractInstance, WalletClientWithAccount, WriteableContractInstance } from './viemTypes.cjs';
10
- export { OrderExecutionType } from './OrderExecutionType.cjs';
11
- export { OrderAppendix, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields } from './orderAppendixTypes.cjs';
12
12
  import 'bignumber.js';
13
13
  import '../abis/nadoAbis.cjs';
14
- import 'viem';
15
14
  import '../utils/math/bigDecimal.cjs';
15
+ import 'viem';
@@ -3,13 +3,13 @@ export { Bytes } from './bytes.js';
3
3
  export { ALL_CHAIN_ENVS, ChainEnv, LOCAL_CHAIN_ENVS, MAINNET_CHAIN_ENVS, TESTNET_CHAIN_ENVS } from './ChainEnv.js';
4
4
  export { HealthGroup, HealthStatus, HealthStatusByType, HealthType } from './healthTypes.js';
5
5
  export { Market, MarketWithProduct, PerpMarket, SpotMarket } from './marketTypes.js';
6
+ export { NadoContracts, WithContract, WithContracts } from './nadoContractTypes.js';
7
+ export { OrderAppendix, OrderAppendixBuilderFields, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields } from './orderAppendixTypes.js';
8
+ export { OrderExecutionType } from './OrderExecutionType.js';
6
9
  export { PerpProduct, Product, ProductEngineType, SpotProduct, toProductEngineType } from './productTypes.js';
7
10
  export { Subaccount, SubaccountBytes32, SubaccountNameBytes12 } from './subaccountTypes.js';
8
- export { NadoContracts, WithContract, WithContracts } from './nadoContractTypes.js';
9
11
  export { AccountWithPrivateKey, ContractInstance, WalletClientWithAccount, WriteableContractInstance } from './viemTypes.js';
10
- export { OrderExecutionType } from './OrderExecutionType.js';
11
- export { OrderAppendix, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields } from './orderAppendixTypes.js';
12
12
  import 'bignumber.js';
13
13
  import '../abis/nadoAbis.js';
14
- import 'viem';
15
14
  import '../utils/math/bigDecimal.js';
15
+ import 'viem';
@@ -4,10 +4,10 @@ export * from "./bytes.js";
4
4
  export * from "./ChainEnv.js";
5
5
  export * from "./healthTypes.js";
6
6
  export * from "./marketTypes.js";
7
+ export * from "./nadoContractTypes.js";
8
+ export * from "./orderAppendixTypes.js";
9
+ export * from "./OrderExecutionType.js";
7
10
  export * from "./productTypes.js";
8
11
  export * from "./subaccountTypes.js";
9
- export * from "./nadoContractTypes.js";
10
12
  export * from "./viemTypes.js";
11
- export * from "./OrderExecutionType.js";
12
- export * from "./orderAppendixTypes.js";
13
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from './balanceTypes';\nexport * from './bytes';\nexport * from './ChainEnv';\nexport * from './healthTypes';\nexport * from './marketTypes';\nexport * from './productTypes';\nexport * from './subaccountTypes';\nexport * from './nadoContractTypes';\nexport * from './viemTypes';\nexport * from './OrderExecutionType';\nexport * from './orderAppendixTypes';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from './balanceTypes';\nexport * from './bytes';\nexport * from './ChainEnv';\nexport * from './healthTypes';\nexport * from './marketTypes';\nexport * from './nadoContractTypes';\nexport * from './orderAppendixTypes';\nexport * from './OrderExecutionType';\nexport * from './productTypes';\nexport * from './subaccountTypes';\nexport * from './viemTypes';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/orderAppendixTypes.ts"],"sourcesContent":["import { BigDecimalish } from '../utils/math';\nimport { OrderExecutionType } from './OrderExecutionType';\n\n/**\n * Encodes whether the order will be sent to the trigger service\n */\nexport type OrderAppendixTriggerType =\n | 'price'\n | 'twap'\n // TWAP with specified order amounts, which will be specified in the Trigger Order itself\n | 'twap_custom_amounts';\n\n/**\n * Fields associated with a TWAP trigger order.\n */\nexport interface OrderAppendixTwapFields {\n /**\n * Number of TWAP orders to be placed.\n */\n numOrders: number;\n /**\n * Maximum slippage on each TWAP order, based on the oracle price at time of order execution.\n * Ex: 0.01 means 1% slippage.\n */\n slippageFrac: number;\n}\n\n/**\n * Fields associated with an isolated order\n */\nexport interface OrderAppendixIsolatedFields {\n /**\n * Amount of margin to transfer into the isolated position.\n */\n margin: BigDecimalish;\n}\n\n/**\n * All the fields encoded by the order appendix\n */\nexport interface OrderAppendix {\n reduceOnly?: boolean;\n orderExecutionType: OrderExecutionType;\n /**\n * Specify the type of trigger that will be used for the order if the order will be sent to the trigger service.\n */\n triggerType?: OrderAppendixTriggerType;\n /**\n * Specify if the order is for an isolated position\n * An order CANNOT be both a TWAP order and an isolated order.\n */\n isolated?: OrderAppendixIsolatedFields;\n /**\n * Specify if the order is a TWAP order\n * An order CANNOT be both a TWAP order and an isolated order.\n */\n twap?: OrderAppendixTwapFields;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/orderAppendixTypes.ts"],"sourcesContent":["import { BigDecimalish } from '../utils/math';\nimport { OrderExecutionType } from './OrderExecutionType';\n\n/**\n * Encodes whether the order will be sent to the trigger service\n */\nexport type OrderAppendixTriggerType =\n | 'price'\n | 'twap'\n // TWAP with specified order amounts, which will be specified in the Trigger Order itself\n | 'twap_custom_amounts';\n\n/**\n * Fields associated with a TWAP trigger order.\n */\nexport interface OrderAppendixTwapFields {\n /**\n * Number of TWAP orders to be placed.\n */\n numOrders: number;\n /**\n * Maximum slippage on each TWAP order, based on the oracle price at time of order execution.\n * Ex: 0.01 means 1% slippage.\n */\n slippageFrac: number;\n}\n\n/**\n * Fields associated with an isolated order\n */\nexport interface OrderAppendixIsolatedFields {\n /**\n * Amount of margin to transfer into the isolated position.\n *\n * Implementation Note:\n * Packed appendix uses precision of 6 decimals on backend.\n * SDK automatically converts to/from x18 during packing/unpacking.\n */\n margin: BigDecimalish;\n}\n\n/**\n * Fields for specifying a builder (fee recipient) for the order\n */\nexport interface OrderAppendixBuilderFields {\n /**\n * The builder ID (registered builder identifier)\n */\n builderId: number;\n /**\n * The builder fee rate. This is a raw 10-bit integer (0-1023) where each unit = 0.1 bps.\n * The actual fee is calculated on notional value: builder_fee = price * amount * rate\n */\n builderFeeRate: number;\n}\n\n/**\n * All the fields encoded by the order appendix\n */\nexport interface OrderAppendix {\n reduceOnly?: boolean;\n orderExecutionType: OrderExecutionType;\n /**\n * Specify the type of trigger that will be used for the order if the order will be sent to the trigger service.\n */\n triggerType?: OrderAppendixTriggerType;\n /**\n * Specify if the order is for an isolated position\n * An order CANNOT be both a TWAP order and an isolated order.\n */\n isolated?: OrderAppendixIsolatedFields;\n /**\n * Specify if the order is a TWAP order\n * An order CANNOT be both a TWAP order and an isolated order.\n */\n twap?: OrderAppendixTwapFields;\n /**\n * Specify the builder for fee sharing.\n * Builder ID is encoded in bits 48-63 (16 bits).\n * Builder fee rate is encoded in bits 38-47 (10 bits).\n */\n builder?: OrderAppendixBuilderFields;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -26,9 +26,27 @@ interface OrderAppendixTwapFields {
26
26
  interface OrderAppendixIsolatedFields {
27
27
  /**
28
28
  * Amount of margin to transfer into the isolated position.
29
+ *
30
+ * Implementation Note:
31
+ * Packed appendix uses precision of 6 decimals on backend.
32
+ * SDK automatically converts to/from x18 during packing/unpacking.
29
33
  */
30
34
  margin: BigDecimalish;
31
35
  }
36
+ /**
37
+ * Fields for specifying a builder (fee recipient) for the order
38
+ */
39
+ interface OrderAppendixBuilderFields {
40
+ /**
41
+ * The builder ID (registered builder identifier)
42
+ */
43
+ builderId: number;
44
+ /**
45
+ * The builder fee rate. This is a raw 10-bit integer (0-1023) where each unit = 0.1 bps.
46
+ * The actual fee is calculated on notional value: builder_fee = price * amount * rate
47
+ */
48
+ builderFeeRate: number;
49
+ }
32
50
  /**
33
51
  * All the fields encoded by the order appendix
34
52
  */
@@ -49,6 +67,12 @@ interface OrderAppendix {
49
67
  * An order CANNOT be both a TWAP order and an isolated order.
50
68
  */
51
69
  twap?: OrderAppendixTwapFields;
70
+ /**
71
+ * Specify the builder for fee sharing.
72
+ * Builder ID is encoded in bits 48-63 (16 bits).
73
+ * Builder fee rate is encoded in bits 38-47 (10 bits).
74
+ */
75
+ builder?: OrderAppendixBuilderFields;
52
76
  }
53
77
 
54
- export type { OrderAppendix, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields };
78
+ export type { OrderAppendix, OrderAppendixBuilderFields, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields };
@@ -26,9 +26,27 @@ interface OrderAppendixTwapFields {
26
26
  interface OrderAppendixIsolatedFields {
27
27
  /**
28
28
  * Amount of margin to transfer into the isolated position.
29
+ *
30
+ * Implementation Note:
31
+ * Packed appendix uses precision of 6 decimals on backend.
32
+ * SDK automatically converts to/from x18 during packing/unpacking.
29
33
  */
30
34
  margin: BigDecimalish;
31
35
  }
36
+ /**
37
+ * Fields for specifying a builder (fee recipient) for the order
38
+ */
39
+ interface OrderAppendixBuilderFields {
40
+ /**
41
+ * The builder ID (registered builder identifier)
42
+ */
43
+ builderId: number;
44
+ /**
45
+ * The builder fee rate. This is a raw 10-bit integer (0-1023) where each unit = 0.1 bps.
46
+ * The actual fee is calculated on notional value: builder_fee = price * amount * rate
47
+ */
48
+ builderFeeRate: number;
49
+ }
32
50
  /**
33
51
  * All the fields encoded by the order appendix
34
52
  */
@@ -49,6 +67,12 @@ interface OrderAppendix {
49
67
  * An order CANNOT be both a TWAP order and an isolated order.
50
68
  */
51
69
  twap?: OrderAppendixTwapFields;
70
+ /**
71
+ * Specify the builder for fee sharing.
72
+ * Builder ID is encoded in bits 48-63 (16 bits).
73
+ * Builder fee rate is encoded in bits 38-47 (10 bits).
74
+ */
75
+ builder?: OrderAppendixBuilderFields;
52
76
  }
53
77
 
54
- export type { OrderAppendix, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields };
78
+ export type { OrderAppendix, OrderAppendixBuilderFields, OrderAppendixIsolatedFields, OrderAppendixTriggerType, OrderAppendixTwapFields };
@@ -1,4 +1,4 @@
1
- import { WalletClient, Transport, Chain, Account, RpcSchema, Abi, GetContractReturnType, PublicClient } from 'viem';
1
+ import { Account, Abi, GetContractReturnType, WalletClient, Transport, Chain, RpcSchema, PublicClient } from 'viem';
2
2
 
3
3
  /**
4
4
  * An account with its corresponding private key. Viem does not allow private keys to be accessible from an account
@@ -1,4 +1,4 @@
1
- import { WalletClient, Transport, Chain, Account, RpcSchema, Abi, GetContractReturnType, PublicClient } from 'viem';
1
+ import { Account, Abi, GetContractReturnType, WalletClient, Transport, Chain, RpcSchema, PublicClient } from 'viem';
2
2
 
3
3
  /**
4
4
  * An account with its corresponding private key. Viem does not allow private keys to be accessible from an account
@@ -1,4 +1,4 @@
1
- import { SpotBalanceWithProduct, PerpBalanceWithProduct } from '../types/balanceTypes.cjs';
1
+ import { PerpBalanceWithProduct, SpotBalanceWithProduct } from '../types/balanceTypes.cjs';
2
2
  import BigDecimal from 'bignumber.js';
3
3
  import '../types/healthTypes.cjs';
4
4
  import '../types/productTypes.cjs';
@@ -1,4 +1,4 @@
1
- import { SpotBalanceWithProduct, PerpBalanceWithProduct } from '../types/balanceTypes.js';
1
+ import { PerpBalanceWithProduct, SpotBalanceWithProduct } from '../types/balanceTypes.js';
2
2
  import BigDecimal from 'bignumber.js';
3
3
  import '../types/healthTypes.js';
4
4
  import '../types/productTypes.js';
@@ -1,6 +1,6 @@
1
1
  import { Hex } from 'viem';
2
2
  import { Bytes } from '../types/bytes.cjs';
3
- import { Subaccount, SubaccountBytes32, SubaccountNameBytes12 } from '../types/subaccountTypes.cjs';
3
+ import { SubaccountBytes32, Subaccount, SubaccountNameBytes12 } from '../types/subaccountTypes.cjs';
4
4
 
5
5
  /**
6
6
  * Converts a subaccount object (owner + name) to its bytes32 representation.
@@ -1,6 +1,6 @@
1
1
  import { Hex } from 'viem';
2
2
  import { Bytes } from '../types/bytes.js';
3
- import { Subaccount, SubaccountBytes32, SubaccountNameBytes12 } from '../types/subaccountTypes.js';
3
+ import { SubaccountBytes32, Subaccount, SubaccountNameBytes12 } from '../types/subaccountTypes.js';
4
4
 
5
5
  /**
6
6
  * Converts a subaccount object (owner + name) to its bytes32 representation.
@@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
 
28
- // ../../node_modules/@jest/globals/build/index.js
28
+ // ../../node_modules/.bun/@jest+globals@30.2.0/node_modules/@jest/globals/build/index.js
29
29
  var require_build = __commonJS({
30
- "../../node_modules/@jest/globals/build/index.js"(exports2, module2) {
30
+ "../../node_modules/.bun/@jest+globals@30.2.0/node_modules/@jest/globals/build/index.js"(exports2, module2) {
31
31
  "use strict";
32
32
  (() => {
33
33
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/@jest/globals/build/index.js","../../src/utils/bytes32.test.ts"],"sourcesContent":["/*!\n * /**\n * * Copyright (c) Meta Platforms, Inc. and affiliates.\n * *\n * * This source code is licensed under the MIT license found in the\n * * LICENSE file in the root directory of this source tree.\n * * /\n */\n/******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\nvar __webpack_exports__ = {};\n\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n\nthrow new Error('Do not import `@jest/globals` outside of the Jest test environment');\nmodule.exports = __webpack_exports__;\n/******/ })()\n;","import { describe, expect, it } from '@jest/globals';\nimport { Subaccount } from '../types/subaccountTypes';\nimport {\n subaccountFromBytes32,\n subaccountFromHex,\n subaccountNameBytesToStr,\n subaccountNameToBytes12,\n subaccountToBytes32,\n subaccountToHex,\n} from './bytes32';\n\nconst TEST_ADDRESS = '0xb92EFcF519EDC2f1FE60b4491Ef51d97Ed4d7685';\n\ndescribe('bytes32', () => {\n it('converts a subaccount to bytes', () => {\n const expectedBytes = new Uint8Array([\n 185, 46, 252, 245, 25, 237, 194, 241, 254, 96, 180, 73, 30, 245, 29, 151,\n 237, 77, 118, 133, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0,\n ]);\n expect(\n subaccountToBytes32({\n subaccountName: 'test',\n subaccountOwner: TEST_ADDRESS,\n }),\n ).toStrictEqual(expectedBytes);\n });\n\n it('converts bytes to a subaccount', () => {\n const subaccountBytes = new Uint8Array([\n 185, 46, 252, 245, 25, 237, 194, 241, 254, 96, 180, 73, 30, 245, 29, 151,\n 237, 77, 118, 133, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0,\n ]);\n const expectedSubaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n subaccountName: 'test',\n };\n const convertedSubaccount = subaccountFromBytes32(subaccountBytes);\n\n expect(convertedSubaccount.subaccountOwner.toLowerCase()).toBe(\n expectedSubaccount.subaccountOwner.toLowerCase(),\n );\n expect(convertedSubaccount.subaccountName).toBe(\n expectedSubaccount.subaccountName,\n );\n });\n\n it('converts a string subaccount name to bytes', () => {\n const nameBytes = subaccountNameToBytes12('test');\n\n expect(nameBytes).toStrictEqual(\n new Uint8Array([116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0]),\n );\n });\n\n it('converts a hex string subaccount name to bytes', () => {\n // `test` in hex form\n const nameBytes = subaccountNameToBytes12('0x74657374');\n\n expect(nameBytes).toStrictEqual(\n new Uint8Array([116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0]),\n );\n });\n\n it('converts a subaccount with a string subaccount name to a hex string', () => {\n const subaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n subaccountName: 'test',\n };\n\n expect(subaccountToHex(subaccount)).toBe(\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d7685746573740000000000000000',\n );\n });\n\n it('converts a subaccount with a hex subaccount name to a hex string', () => {\n const subaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n // `test` in hex form\n subaccountName: '0x74657374',\n };\n\n expect(subaccountToHex(subaccount)).toBe(\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d7685746573740000000000000000',\n );\n });\n\n it('converts a hex string to a subaccount', () => {\n const convertedSubaccount = subaccountFromHex(\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d7685746573740000000000000000',\n );\n\n expect(convertedSubaccount.subaccountOwner.toLowerCase()).toBe(\n TEST_ADDRESS.toLowerCase(),\n );\n expect(convertedSubaccount.subaccountName).toBe('test');\n });\n\n it('handles leading zero bytes in subaccount name properly', () => {\n const subaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n subaccountName: '\\u0000\\u0000\\u0002\\u0000iso\\u0000',\n };\n const subaccountHex =\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d76850000020069736f0000000000';\n\n expect(subaccountToHex(subaccount)).toBe(subaccountHex);\n // Trailing 0 bytes are trimmed\n expect(subaccountFromHex(subaccountHex).subaccountName).toBe(\n '\\u0000\\u0000\\u0002\\u0000iso',\n );\n });\n\n it('handles converting non-utf8 byte sequences by converting bytes to a hex string', () => {\n const invalidUtf8Array = new Uint8Array([0x80, 0x81, 0x82]);\n expect(subaccountNameBytesToStr(invalidUtf8Array)).toBe('0x808182');\n });\n});\n"],"mappings":"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","names":["exports","module"]}
1
+ {"version":3,"sources":["../../../../node_modules/.bun/@jest+globals@30.2.0/node_modules/@jest/globals/build/index.js","../../src/utils/bytes32.test.ts"],"sourcesContent":["/*!\n * /**\n * * Copyright (c) Meta Platforms, Inc. and affiliates.\n * *\n * * This source code is licensed under the MIT license found in the\n * * LICENSE file in the root directory of this source tree.\n * * /\n */\n/******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\nvar __webpack_exports__ = {};\n\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\n\nthrow new Error('Do not import `@jest/globals` outside of the Jest test environment');\nmodule.exports = __webpack_exports__;\n/******/ })()\n;","import { describe, expect, it } from '@jest/globals';\nimport { Subaccount } from '../types/subaccountTypes';\nimport {\n subaccountFromBytes32,\n subaccountFromHex,\n subaccountNameBytesToStr,\n subaccountNameToBytes12,\n subaccountToBytes32,\n subaccountToHex,\n} from './bytes32';\n\nconst TEST_ADDRESS = '0xb92EFcF519EDC2f1FE60b4491Ef51d97Ed4d7685';\n\ndescribe('bytes32', () => {\n it('converts a subaccount to bytes', () => {\n const expectedBytes = new Uint8Array([\n 185, 46, 252, 245, 25, 237, 194, 241, 254, 96, 180, 73, 30, 245, 29, 151,\n 237, 77, 118, 133, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0,\n ]);\n expect(\n subaccountToBytes32({\n subaccountName: 'test',\n subaccountOwner: TEST_ADDRESS,\n }),\n ).toStrictEqual(expectedBytes);\n });\n\n it('converts bytes to a subaccount', () => {\n const subaccountBytes = new Uint8Array([\n 185, 46, 252, 245, 25, 237, 194, 241, 254, 96, 180, 73, 30, 245, 29, 151,\n 237, 77, 118, 133, 116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0,\n ]);\n const expectedSubaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n subaccountName: 'test',\n };\n const convertedSubaccount = subaccountFromBytes32(subaccountBytes);\n\n expect(convertedSubaccount.subaccountOwner.toLowerCase()).toBe(\n expectedSubaccount.subaccountOwner.toLowerCase(),\n );\n expect(convertedSubaccount.subaccountName).toBe(\n expectedSubaccount.subaccountName,\n );\n });\n\n it('converts a string subaccount name to bytes', () => {\n const nameBytes = subaccountNameToBytes12('test');\n\n expect(nameBytes).toStrictEqual(\n new Uint8Array([116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0]),\n );\n });\n\n it('converts a hex string subaccount name to bytes', () => {\n // `test` in hex form\n const nameBytes = subaccountNameToBytes12('0x74657374');\n\n expect(nameBytes).toStrictEqual(\n new Uint8Array([116, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0]),\n );\n });\n\n it('converts a subaccount with a string subaccount name to a hex string', () => {\n const subaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n subaccountName: 'test',\n };\n\n expect(subaccountToHex(subaccount)).toBe(\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d7685746573740000000000000000',\n );\n });\n\n it('converts a subaccount with a hex subaccount name to a hex string', () => {\n const subaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n // `test` in hex form\n subaccountName: '0x74657374',\n };\n\n expect(subaccountToHex(subaccount)).toBe(\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d7685746573740000000000000000',\n );\n });\n\n it('converts a hex string to a subaccount', () => {\n const convertedSubaccount = subaccountFromHex(\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d7685746573740000000000000000',\n );\n\n expect(convertedSubaccount.subaccountOwner.toLowerCase()).toBe(\n TEST_ADDRESS.toLowerCase(),\n );\n expect(convertedSubaccount.subaccountName).toBe('test');\n });\n\n it('handles leading zero bytes in subaccount name properly', () => {\n const subaccount: Subaccount = {\n subaccountOwner: TEST_ADDRESS,\n subaccountName: '\\u0000\\u0000\\u0002\\u0000iso\\u0000',\n };\n const subaccountHex =\n '0xb92efcf519edc2f1fe60b4491ef51d97ed4d76850000020069736f0000000000';\n\n expect(subaccountToHex(subaccount)).toBe(subaccountHex);\n // Trailing 0 bytes are trimmed\n expect(subaccountFromHex(subaccountHex).subaccountName).toBe(\n '\\u0000\\u0000\\u0002\\u0000iso',\n );\n });\n\n it('handles converting non-utf8 byte sequences by converting bytes to a hex string', () => {\n const invalidUtf8Array = new Uint8Array([0x80, 0x81, 0x82]);\n expect(subaccountNameBytesToStr(invalidUtf8Array)).toBe('0x808182');\n });\n});\n"],"mappings":"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","names":["exports","module"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_build
3
- } from "../chunk-TUJ4HQKF.js";
3
+ } from "../chunk-2GPIH63F.js";
4
4
  import {
5
5
  __toESM
6
6
  } from "../chunk-5WRI5ZAA.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/createDeterministicLinkedSignerPrivateKey.ts"],"sourcesContent":["import { keccak256 } from 'viem';\nimport { Subaccount } from '../types/subaccountTypes';\nimport { WalletClientWithAccount } from '../types/viemTypes';\nimport { getNadoEIP712Domain } from '../eip712/getNadoEIP712Domain';\nimport { subaccountToHex } from './bytes32';\n\ninterface Params extends Subaccount {\n walletClient: WalletClientWithAccount;\n chainId: number;\n endpointAddress: string;\n}\n\n/**\n * Deterministically creates a new private key from a predetermined EIP712 message. This is used to\n * reliably create an authorized signer delegate for the subaccount across different clients. Used on the FE in order\n * to have a consistent private key for the subaccount linked signer across different clients.\n *\n * @param params\n */\nexport async function createDeterministicLinkedSignerPrivateKey(\n params: Params,\n) {\n const {\n chainId,\n endpointAddress,\n walletClient,\n subaccountName,\n subaccountOwner,\n } = params;\n\n const signedMessage = await walletClient.signTypedData({\n domain: getNadoEIP712Domain(endpointAddress, chainId),\n types: {\n CreateLinkedSignerWallet: [{ name: 'subaccount', type: 'bytes32' }],\n },\n primaryType: 'CreateLinkedSignerWallet',\n message: {\n subaccount: subaccountToHex({\n subaccountOwner,\n subaccountName,\n }),\n },\n });\n\n return keccak256(signedMessage);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAG1B,iCAAoC;AACpC,qBAAgC;AAehC,eAAsB,0CACpB,QACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,gBAAgB,MAAM,aAAa,cAAc;AAAA,IACrD,YAAQ,gDAAoB,iBAAiB,OAAO;AAAA,IACpD,OAAO;AAAA,MACL,0BAA0B,CAAC,EAAE,MAAM,cAAc,MAAM,UAAU,CAAC;AAAA,IACpE;AAAA,IACA,aAAa;AAAA,IACb,SAAS;AAAA,MACP,gBAAY,gCAAgB;AAAA,QAC1B;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,aAAO,uBAAU,aAAa;AAChC;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/createDeterministicLinkedSignerPrivateKey.ts"],"sourcesContent":["import { keccak256 } from 'viem';\nimport { getNadoEIP712Domain } from '../eip712/getNadoEIP712Domain';\nimport { Subaccount } from '../types/subaccountTypes';\nimport { WalletClientWithAccount } from '../types/viemTypes';\nimport { subaccountToHex } from './bytes32';\n\ninterface Params extends Subaccount {\n walletClient: WalletClientWithAccount;\n chainId: number;\n endpointAddress: string;\n}\n\n/**\n * Deterministically creates a new private key from a predetermined EIP712 message. This is used to\n * reliably create an authorized signer delegate for the subaccount across different clients. Used on the FE in order\n * to have a consistent private key for the subaccount linked signer across different clients.\n *\n * @param params\n */\nexport async function createDeterministicLinkedSignerPrivateKey(\n params: Params,\n) {\n const {\n chainId,\n endpointAddress,\n walletClient,\n subaccountName,\n subaccountOwner,\n } = params;\n\n const signedMessage = await walletClient.signTypedData({\n domain: getNadoEIP712Domain(endpointAddress, chainId),\n types: {\n CreateLinkedSignerWallet: [{ name: 'subaccount', type: 'bytes32' }],\n },\n primaryType: 'CreateLinkedSignerWallet',\n message: {\n subaccount: subaccountToHex({\n subaccountOwner,\n subaccountName,\n }),\n },\n });\n\n return keccak256(signedMessage);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAC1B,iCAAoC;AAGpC,qBAAgC;AAehC,eAAsB,0CACpB,QACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,gBAAgB,MAAM,aAAa,cAAc;AAAA,IACrD,YAAQ,gDAAoB,iBAAiB,OAAO;AAAA,IACpD,OAAO;AAAA,MACL,0BAA0B,CAAC,EAAE,MAAM,cAAc,MAAM,UAAU,CAAC;AAAA,IACpE;AAAA,IACA,aAAa;AAAA,IACb,SAAS;AAAA,MACP,gBAAY,gCAAgB;AAAA,QAC1B;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,aAAO,uBAAU,aAAa;AAChC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/createDeterministicLinkedSignerPrivateKey.ts"],"sourcesContent":["import { keccak256 } from 'viem';\nimport { Subaccount } from '../types/subaccountTypes';\nimport { WalletClientWithAccount } from '../types/viemTypes';\nimport { getNadoEIP712Domain } from '../eip712/getNadoEIP712Domain';\nimport { subaccountToHex } from './bytes32';\n\ninterface Params extends Subaccount {\n walletClient: WalletClientWithAccount;\n chainId: number;\n endpointAddress: string;\n}\n\n/**\n * Deterministically creates a new private key from a predetermined EIP712 message. This is used to\n * reliably create an authorized signer delegate for the subaccount across different clients. Used on the FE in order\n * to have a consistent private key for the subaccount linked signer across different clients.\n *\n * @param params\n */\nexport async function createDeterministicLinkedSignerPrivateKey(\n params: Params,\n) {\n const {\n chainId,\n endpointAddress,\n walletClient,\n subaccountName,\n subaccountOwner,\n } = params;\n\n const signedMessage = await walletClient.signTypedData({\n domain: getNadoEIP712Domain(endpointAddress, chainId),\n types: {\n CreateLinkedSignerWallet: [{ name: 'subaccount', type: 'bytes32' }],\n },\n primaryType: 'CreateLinkedSignerWallet',\n message: {\n subaccount: subaccountToHex({\n subaccountOwner,\n subaccountName,\n }),\n },\n });\n\n return keccak256(signedMessage);\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAG1B,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAehC,eAAsB,0CACpB,QACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,gBAAgB,MAAM,aAAa,cAAc;AAAA,IACrD,QAAQ,oBAAoB,iBAAiB,OAAO;AAAA,IACpD,OAAO;AAAA,MACL,0BAA0B,CAAC,EAAE,MAAM,cAAc,MAAM,UAAU,CAAC;AAAA,IACpE;AAAA,IACA,aAAa;AAAA,IACb,SAAS;AAAA,MACP,YAAY,gBAAgB;AAAA,QAC1B;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO,UAAU,aAAa;AAChC;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/createDeterministicLinkedSignerPrivateKey.ts"],"sourcesContent":["import { keccak256 } from 'viem';\nimport { getNadoEIP712Domain } from '../eip712/getNadoEIP712Domain';\nimport { Subaccount } from '../types/subaccountTypes';\nimport { WalletClientWithAccount } from '../types/viemTypes';\nimport { subaccountToHex } from './bytes32';\n\ninterface Params extends Subaccount {\n walletClient: WalletClientWithAccount;\n chainId: number;\n endpointAddress: string;\n}\n\n/**\n * Deterministically creates a new private key from a predetermined EIP712 message. This is used to\n * reliably create an authorized signer delegate for the subaccount across different clients. Used on the FE in order\n * to have a consistent private key for the subaccount linked signer across different clients.\n *\n * @param params\n */\nexport async function createDeterministicLinkedSignerPrivateKey(\n params: Params,\n) {\n const {\n chainId,\n endpointAddress,\n walletClient,\n subaccountName,\n subaccountOwner,\n } = params;\n\n const signedMessage = await walletClient.signTypedData({\n domain: getNadoEIP712Domain(endpointAddress, chainId),\n types: {\n CreateLinkedSignerWallet: [{ name: 'subaccount', type: 'bytes32' }],\n },\n primaryType: 'CreateLinkedSignerWallet',\n message: {\n subaccount: subaccountToHex({\n subaccountOwner,\n subaccountName,\n }),\n },\n });\n\n return keccak256(signedMessage);\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AAGpC,SAAS,uBAAuB;AAehC,eAAsB,0CACpB,QACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,gBAAgB,MAAM,aAAa,cAAc;AAAA,IACrD,QAAQ,oBAAoB,iBAAiB,OAAO;AAAA,IACpD,OAAO;AAAA,MACL,0BAA0B,CAAC,EAAE,MAAM,cAAc,MAAM,UAAU,CAAC;AAAA,IACpE;AAAA,IACA,aAAa;AAAA,IACb,SAAS;AAAA,MACP,YAAY,gBAAgB;AAAA,QAC1B;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO,UAAU,aAAa;AAChC;","names":[]}
@@ -17,36 +17,36 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // src/utils/index.ts
18
18
  var utils_exports = {};
19
19
  module.exports = __toCommonJS(utils_exports);
20
- __reExport(utils_exports, require("./orders/index.cjs"), module.exports);
21
- __reExport(utils_exports, require("./interest.cjs"), module.exports);
22
- __reExport(utils_exports, require("./productTypeFilter.cjs"), module.exports);
20
+ __reExport(utils_exports, require("./asyncResult.cjs"), module.exports);
23
21
  __reExport(utils_exports, require("./balanceValue.cjs"), module.exports);
24
22
  __reExport(utils_exports, require("./bytes32.cjs"), module.exports);
25
23
  __reExport(utils_exports, require("./createDeterministicLinkedSignerPrivateKey.cjs"), module.exports);
26
- __reExport(utils_exports, require("./isWriteableContract.cjs"), module.exports);
27
24
  __reExport(utils_exports, require("./errors/index.cjs"), module.exports);
28
- __reExport(utils_exports, require("./math/index.cjs"), module.exports);
29
- __reExport(utils_exports, require("./asyncResult.cjs"), module.exports);
30
25
  __reExport(utils_exports, require("./getValidatedAddress.cjs"), module.exports);
31
26
  __reExport(utils_exports, require("./getValidatedHex.cjs"), module.exports);
27
+ __reExport(utils_exports, require("./interest.cjs"), module.exports);
28
+ __reExport(utils_exports, require("./isWriteableContract.cjs"), module.exports);
32
29
  __reExport(utils_exports, require("./mapValues.cjs"), module.exports);
30
+ __reExport(utils_exports, require("./math/index.cjs"), module.exports);
31
+ __reExport(utils_exports, require("./orders/index.cjs"), module.exports);
32
+ __reExport(utils_exports, require("./productTypeFilter.cjs"), module.exports);
33
33
  __reExport(utils_exports, require("./time.cjs"), module.exports);
34
34
  __reExport(utils_exports, require("./toPrintableObject.cjs"), module.exports);
35
35
  // Annotate the CommonJS export names for ESM import in node:
36
36
  0 && (module.exports = {
37
- ...require("./orders/index.cjs"),
38
- ...require("./interest.cjs"),
39
- ...require("./productTypeFilter.cjs"),
37
+ ...require("./asyncResult.cjs"),
40
38
  ...require("./balanceValue.cjs"),
41
39
  ...require("./bytes32.cjs"),
42
40
  ...require("./createDeterministicLinkedSignerPrivateKey.cjs"),
43
- ...require("./isWriteableContract.cjs"),
44
41
  ...require("./errors/index.cjs"),
45
- ...require("./math/index.cjs"),
46
- ...require("./asyncResult.cjs"),
47
42
  ...require("./getValidatedAddress.cjs"),
48
43
  ...require("./getValidatedHex.cjs"),
44
+ ...require("./interest.cjs"),
45
+ ...require("./isWriteableContract.cjs"),
49
46
  ...require("./mapValues.cjs"),
47
+ ...require("./math/index.cjs"),
48
+ ...require("./orders/index.cjs"),
49
+ ...require("./productTypeFilter.cjs"),
50
50
  ...require("./time.cjs"),
51
51
  ...require("./toPrintableObject.cjs")
52
52
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './orders';\nexport * from './interest';\nexport * from './productTypeFilter';\nexport * from './balanceValue';\nexport * from './bytes32';\nexport * from './createDeterministicLinkedSignerPrivateKey';\nexport * from './isWriteableContract';\nexport * from './errors';\nexport * from './math';\nexport * from './asyncResult';\nexport * from './getValidatedAddress';\nexport * from './getValidatedHex';\nexport * from './mapValues';\nexport * from './time';\nexport * from './toPrintableObject';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,2BADd;AAEA,0BAAc,oCAFd;AAGA,0BAAc,+BAHd;AAIA,0BAAc,0BAJd;AAKA,0BAAc,4DALd;AAMA,0BAAc,sCANd;AAOA,0BAAc,+BAPd;AAQA,0BAAc,6BARd;AASA,0BAAc,8BATd;AAUA,0BAAc,sCAVd;AAWA,0BAAc,kCAXd;AAYA,0BAAc,4BAZd;AAaA,0BAAc,uBAbd;AAcA,0BAAc,oCAdd;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './asyncResult';\nexport * from './balanceValue';\nexport * from './bytes32';\nexport * from './createDeterministicLinkedSignerPrivateKey';\nexport * from './errors';\nexport * from './getValidatedAddress';\nexport * from './getValidatedHex';\nexport * from './interest';\nexport * from './isWriteableContract';\nexport * from './mapValues';\nexport * from './math';\nexport * from './orders';\nexport * from './productTypeFilter';\nexport * from './time';\nexport * from './toPrintableObject';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,8BAAd;AACA,0BAAc,+BADd;AAEA,0BAAc,0BAFd;AAGA,0BAAc,4DAHd;AAIA,0BAAc,+BAJd;AAKA,0BAAc,sCALd;AAMA,0BAAc,kCANd;AAOA,0BAAc,2BAPd;AAQA,0BAAc,sCARd;AASA,0BAAc,4BATd;AAUA,0BAAc,6BAVd;AAWA,0BAAc,+BAXd;AAYA,0BAAc,oCAZd;AAaA,0BAAc,uBAbd;AAcA,0BAAc,oCAdd;","names":[]}