@nadohq/shared 0.1.0-alpha.4
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.
- package/README.md +2 -0
- package/dist/abis/Clearinghouse.cjs +891 -0
- package/dist/abis/Clearinghouse.cjs.map +1 -0
- package/dist/abis/Clearinghouse.d.cts +669 -0
- package/dist/abis/Clearinghouse.d.ts +669 -0
- package/dist/abis/Clearinghouse.js +868 -0
- package/dist/abis/Clearinghouse.js.map +1 -0
- package/dist/abis/ERC20.cjs +215 -0
- package/dist/abis/ERC20.cjs.map +1 -0
- package/dist/abis/ERC20.d.cts +143 -0
- package/dist/abis/ERC20.d.ts +143 -0
- package/dist/abis/ERC20.js +192 -0
- package/dist/abis/ERC20.js.map +1 -0
- package/dist/abis/Endpoint.cjs +589 -0
- package/dist/abis/Endpoint.cjs.map +1 -0
- package/dist/abis/Endpoint.d.cts +433 -0
- package/dist/abis/Endpoint.d.ts +433 -0
- package/dist/abis/Endpoint.js +566 -0
- package/dist/abis/Endpoint.js.map +1 -0
- package/dist/abis/MockERC20.cjs +341 -0
- package/dist/abis/MockERC20.cjs.map +1 -0
- package/dist/abis/MockERC20.d.cts +239 -0
- package/dist/abis/MockERC20.d.ts +239 -0
- package/dist/abis/MockERC20.js +318 -0
- package/dist/abis/MockERC20.js.map +1 -0
- package/dist/abis/PerpEngine.cjs +886 -0
- package/dist/abis/PerpEngine.cjs.map +1 -0
- package/dist/abis/PerpEngine.d.cts +661 -0
- package/dist/abis/PerpEngine.d.ts +661 -0
- package/dist/abis/PerpEngine.js +863 -0
- package/dist/abis/PerpEngine.js.map +1 -0
- package/dist/abis/Querier.cjs +1522 -0
- package/dist/abis/Querier.cjs.map +1 -0
- package/dist/abis/Querier.d.cts +1149 -0
- package/dist/abis/Querier.d.ts +1149 -0
- package/dist/abis/Querier.js +1499 -0
- package/dist/abis/Querier.js.map +1 -0
- package/dist/abis/SpotEngine.cjs +937 -0
- package/dist/abis/SpotEngine.cjs.map +1 -0
- package/dist/abis/SpotEngine.d.cts +701 -0
- package/dist/abis/SpotEngine.d.ts +701 -0
- package/dist/abis/SpotEngine.js +914 -0
- package/dist/abis/SpotEngine.js.map +1 -0
- package/dist/abis/WithdrawPool.cjs +307 -0
- package/dist/abis/WithdrawPool.cjs.map +1 -0
- package/dist/abis/WithdrawPool.d.cts +214 -0
- package/dist/abis/WithdrawPool.d.ts +214 -0
- package/dist/abis/WithdrawPool.js +284 -0
- package/dist/abis/WithdrawPool.js.map +1 -0
- package/dist/abis/index.cjs +41 -0
- package/dist/abis/index.cjs.map +1 -0
- package/dist/abis/index.d.cts +9 -0
- package/dist/abis/index.d.ts +9 -0
- package/dist/abis/index.js +11 -0
- package/dist/abis/index.js.map +1 -0
- package/dist/abis/nadoAbis.cjs +44 -0
- package/dist/abis/nadoAbis.cjs.map +1 -0
- package/dist/abis/nadoAbis.d.cts +3821 -0
- package/dist/abis/nadoAbis.d.ts +3821 -0
- package/dist/abis/nadoAbis.js +21 -0
- package/dist/abis/nadoAbis.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/chunk-TUJ4HQKF.js +33 -0
- package/dist/chunk-TUJ4HQKF.js.map +1 -0
- package/dist/consts/chainEnvToChain.cjs +44 -0
- package/dist/consts/chainEnvToChain.cjs.map +1 -0
- package/dist/consts/chainEnvToChain.d.cts +388 -0
- package/dist/consts/chainEnvToChain.d.ts +388 -0
- package/dist/consts/chainEnvToChain.js +20 -0
- package/dist/consts/chainEnvToChain.js.map +1 -0
- package/dist/consts/index.cjs +27 -0
- package/dist/consts/index.cjs.map +1 -0
- package/dist/consts/index.d.cts +6 -0
- package/dist/consts/index.d.ts +6 -0
- package/dist/consts/index.js +4 -0
- package/dist/consts/index.js.map +1 -0
- package/dist/consts/productIds.cjs +34 -0
- package/dist/consts/productIds.cjs.map +1 -0
- package/dist/consts/productIds.d.cts +4 -0
- package/dist/consts/productIds.d.ts +4 -0
- package/dist/consts/productIds.js +10 -0
- package/dist/consts/productIds.js.map +1 -0
- package/dist/deployments/core/deployment.InkSepolia.json +13 -0
- package/dist/deployments/core/deployment.arbitrumOne.json +18 -0
- package/dist/deployments/core/deployment.localhost.json +18 -0
- package/dist/deployments/index.cjs +65 -0
- package/dist/deployments/index.cjs.map +1 -0
- package/dist/deployments/index.d.cts +13 -0
- package/dist/deployments/index.d.ts +13 -0
- package/dist/deployments/index.js +32 -0
- package/dist/deployments/index.js.map +1 -0
- package/dist/eip712/eip712ValueTypes.cjs +19 -0
- package/dist/eip712/eip712ValueTypes.cjs.map +1 -0
- package/dist/eip712/eip712ValueTypes.d.cts +48 -0
- package/dist/eip712/eip712ValueTypes.d.ts +48 -0
- package/dist/eip712/eip712ValueTypes.js +1 -0
- package/dist/eip712/eip712ValueTypes.js.map +1 -0
- package/dist/eip712/getNadoEIP712Domain.cjs +39 -0
- package/dist/eip712/getNadoEIP712Domain.cjs.map +1 -0
- package/dist/eip712/getNadoEIP712Domain.d.cts +11 -0
- package/dist/eip712/getNadoEIP712Domain.d.ts +11 -0
- package/dist/eip712/getNadoEIP712Domain.js +16 -0
- package/dist/eip712/getNadoEIP712Domain.js.map +1 -0
- package/dist/eip712/getNadoEIP712PrimaryType.cjs +35 -0
- package/dist/eip712/getNadoEIP712PrimaryType.cjs.map +1 -0
- package/dist/eip712/getNadoEIP712PrimaryType.d.cts +16 -0
- package/dist/eip712/getNadoEIP712PrimaryType.d.ts +16 -0
- package/dist/eip712/getNadoEIP712PrimaryType.js +12 -0
- package/dist/eip712/getNadoEIP712PrimaryType.js.map +1 -0
- package/dist/eip712/getNadoEIP712Types.cjs +129 -0
- package/dist/eip712/getNadoEIP712Types.cjs.map +1 -0
- package/dist/eip712/getNadoEIP712Types.d.cts +20 -0
- package/dist/eip712/getNadoEIP712Types.d.ts +20 -0
- package/dist/eip712/getNadoEIP712Types.js +106 -0
- package/dist/eip712/getNadoEIP712Types.js.map +1 -0
- package/dist/eip712/getNadoEIP712Values.cjs +206 -0
- package/dist/eip712/getNadoEIP712Values.cjs.map +1 -0
- package/dist/eip712/getNadoEIP712Values.d.cts +20 -0
- package/dist/eip712/getNadoEIP712Values.d.ts +20 -0
- package/dist/eip712/getNadoEIP712Values.js +183 -0
- package/dist/eip712/getNadoEIP712Values.js.map +1 -0
- package/dist/eip712/getOrderVerifyingAddress.cjs +34 -0
- package/dist/eip712/getOrderVerifyingAddress.cjs.map +1 -0
- package/dist/eip712/getOrderVerifyingAddress.d.cts +9 -0
- package/dist/eip712/getOrderVerifyingAddress.d.ts +9 -0
- package/dist/eip712/getOrderVerifyingAddress.js +11 -0
- package/dist/eip712/getOrderVerifyingAddress.js.map +1 -0
- package/dist/eip712/getSignedTransactionRequest.cjs +42 -0
- package/dist/eip712/getSignedTransactionRequest.cjs.map +1 -0
- package/dist/eip712/getSignedTransactionRequest.d.cts +19 -0
- package/dist/eip712/getSignedTransactionRequest.d.ts +19 -0
- package/dist/eip712/getSignedTransactionRequest.js +19 -0
- package/dist/eip712/getSignedTransactionRequest.js.map +1 -0
- package/dist/eip712/index.cjs +43 -0
- package/dist/eip712/index.cjs.map +1 -0
- package/dist/eip712/index.d.cts +17 -0
- package/dist/eip712/index.d.ts +17 -0
- package/dist/eip712/index.js +12 -0
- package/dist/eip712/index.js.map +1 -0
- package/dist/eip712/orderDigest.cjs +45 -0
- package/dist/eip712/orderDigest.cjs.map +1 -0
- package/dist/eip712/orderDigest.d.cts +20 -0
- package/dist/eip712/orderDigest.d.ts +20 -0
- package/dist/eip712/orderDigest.js +22 -0
- package/dist/eip712/orderDigest.js.map +1 -0
- package/dist/eip712/signableRequestType.cjs +19 -0
- package/dist/eip712/signableRequestType.cjs.map +1 -0
- package/dist/eip712/signableRequestType.d.cts +26 -0
- package/dist/eip712/signableRequestType.d.ts +26 -0
- package/dist/eip712/signableRequestType.js +1 -0
- package/dist/eip712/signableRequestType.js.map +1 -0
- package/dist/eip712/signatureParamTypes.cjs +19 -0
- package/dist/eip712/signatureParamTypes.cjs.map +1 -0
- package/dist/eip712/signatureParamTypes.d.cts +68 -0
- package/dist/eip712/signatureParamTypes.d.ts +68 -0
- package/dist/eip712/signatureParamTypes.js +1 -0
- package/dist/eip712/signatureParamTypes.js.map +1 -0
- package/dist/encoding/encoding.cjs +73 -0
- package/dist/encoding/encoding.cjs.map +1 -0
- package/dist/encoding/encoding.d.cts +11 -0
- package/dist/encoding/encoding.d.ts +11 -0
- package/dist/encoding/encoding.js +49 -0
- package/dist/encoding/encoding.js.map +1 -0
- package/dist/encoding/index.cjs +25 -0
- package/dist/encoding/index.cjs.map +1 -0
- package/dist/encoding/index.d.cts +7 -0
- package/dist/encoding/index.d.ts +7 -0
- package/dist/encoding/index.js +3 -0
- package/dist/encoding/index.js.map +1 -0
- package/dist/execute/approveDepositAllowance.cjs +38 -0
- package/dist/execute/approveDepositAllowance.cjs.map +1 -0
- package/dist/execute/approveDepositAllowance.d.cts +18 -0
- package/dist/execute/approveDepositAllowance.d.ts +18 -0
- package/dist/execute/approveDepositAllowance.js +15 -0
- package/dist/execute/approveDepositAllowance.js.map +1 -0
- package/dist/execute/depositCollateral.cjs +59 -0
- package/dist/execute/depositCollateral.cjs.map +1 -0
- package/dist/execute/depositCollateral.d.cts +21 -0
- package/dist/execute/depositCollateral.d.ts +21 -0
- package/dist/execute/depositCollateral.js +36 -0
- package/dist/execute/depositCollateral.js.map +1 -0
- package/dist/execute/index.cjs +27 -0
- package/dist/execute/index.cjs.map +1 -0
- package/dist/execute/index.d.cts +9 -0
- package/dist/execute/index.d.ts +9 -0
- package/dist/execute/index.js +4 -0
- package/dist/execute/index.js.map +1 -0
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +67 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/types/ChainEnv.cjs +44 -0
- package/dist/types/ChainEnv.cjs.map +1 -0
- package/dist/types/ChainEnv.d.cts +7 -0
- package/dist/types/ChainEnv.d.ts +7 -0
- package/dist/types/ChainEnv.js +18 -0
- package/dist/types/ChainEnv.js.map +1 -0
- package/dist/types/OrderExecutionType.cjs +19 -0
- package/dist/types/OrderExecutionType.cjs.map +1 -0
- package/dist/types/OrderExecutionType.d.cts +10 -0
- package/dist/types/OrderExecutionType.d.ts +10 -0
- package/dist/types/OrderExecutionType.js +1 -0
- package/dist/types/OrderExecutionType.js.map +1 -0
- package/dist/types/balanceTypes.cjs +19 -0
- package/dist/types/balanceTypes.cjs.map +1 -0
- package/dist/types/balanceTypes.d.cts +38 -0
- package/dist/types/balanceTypes.d.ts +38 -0
- package/dist/types/balanceTypes.js +1 -0
- package/dist/types/balanceTypes.js.map +1 -0
- package/dist/types/bytes.cjs +19 -0
- package/dist/types/bytes.cjs.map +1 -0
- package/dist/types/bytes.d.cts +3 -0
- package/dist/types/bytes.d.ts +3 -0
- package/dist/types/bytes.js +1 -0
- package/dist/types/bytes.js.map +1 -0
- package/dist/types/healthTypes.cjs +19 -0
- package/dist/types/healthTypes.cjs.map +1 -0
- package/dist/types/healthTypes.d.cts +15 -0
- package/dist/types/healthTypes.d.ts +15 -0
- package/dist/types/healthTypes.js +1 -0
- package/dist/types/healthTypes.js.map +1 -0
- package/dist/types/index.cjs +45 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +15 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/marketTypes.cjs +19 -0
- package/dist/types/marketTypes.cjs.map +1 -0
- package/dist/types/marketTypes.d.cts +31 -0
- package/dist/types/marketTypes.d.ts +31 -0
- package/dist/types/marketTypes.js +1 -0
- package/dist/types/marketTypes.js.map +1 -0
- package/dist/types/nadoContractTypes.cjs +19 -0
- package/dist/types/nadoContractTypes.cjs.map +1 -0
- package/dist/types/nadoContractTypes.d.cts +14 -0
- package/dist/types/nadoContractTypes.d.ts +14 -0
- package/dist/types/nadoContractTypes.js +1 -0
- package/dist/types/nadoContractTypes.js.map +1 -0
- package/dist/types/orderAppendixTypes.cjs +19 -0
- package/dist/types/orderAppendixTypes.cjs.map +1 -0
- package/dist/types/orderAppendixTypes.d.cts +54 -0
- package/dist/types/orderAppendixTypes.d.ts +54 -0
- package/dist/types/orderAppendixTypes.js +1 -0
- package/dist/types/orderAppendixTypes.js.map +1 -0
- package/dist/types/productTypes.cjs +47 -0
- package/dist/types/productTypes.cjs.map +1 -0
- package/dist/types/productTypes.d.cts +55 -0
- package/dist/types/productTypes.d.ts +55 -0
- package/dist/types/productTypes.js +23 -0
- package/dist/types/productTypes.js.map +1 -0
- package/dist/types/subaccountTypes.cjs +19 -0
- package/dist/types/subaccountTypes.cjs.map +1 -0
- package/dist/types/subaccountTypes.d.cts +13 -0
- package/dist/types/subaccountTypes.d.ts +13 -0
- package/dist/types/subaccountTypes.js +1 -0
- package/dist/types/subaccountTypes.js.map +1 -0
- package/dist/types/viemTypes.cjs +19 -0
- package/dist/types/viemTypes.cjs.map +1 -0
- package/dist/types/viemTypes.d.cts +23 -0
- package/dist/types/viemTypes.d.ts +23 -0
- package/dist/types/viemTypes.js +1 -0
- package/dist/types/viemTypes.js.map +1 -0
- package/dist/utils/asyncResult.cjs +36 -0
- package/dist/utils/asyncResult.cjs.map +1 -0
- package/dist/utils/asyncResult.d.cts +4 -0
- package/dist/utils/asyncResult.d.ts +4 -0
- package/dist/utils/asyncResult.js +13 -0
- package/dist/utils/asyncResult.js.map +1 -0
- package/dist/utils/balanceValue.cjs +43 -0
- package/dist/utils/balanceValue.cjs.map +1 -0
- package/dist/utils/balanceValue.d.cts +25 -0
- package/dist/utils/balanceValue.d.ts +25 -0
- package/dist/utils/balanceValue.js +18 -0
- package/dist/utils/balanceValue.js.map +1 -0
- package/dist/utils/bytes32.cjs +92 -0
- package/dist/utils/bytes32.cjs.map +1 -0
- package/dist/utils/bytes32.d.cts +47 -0
- package/dist/utils/bytes32.d.ts +47 -0
- package/dist/utils/bytes32.js +64 -0
- package/dist/utils/bytes32.js.map +1 -0
- package/dist/utils/bytes32.test.cjs +203 -0
- package/dist/utils/bytes32.test.cjs.map +1 -0
- package/dist/utils/bytes32.test.d.cts +2 -0
- package/dist/utils/bytes32.test.d.ts +2 -0
- package/dist/utils/bytes32.test.js +165 -0
- package/dist/utils/bytes32.test.js.map +1 -0
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.cjs +56 -0
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.cjs.map +1 -0
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.d.cts +20 -0
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.d.ts +20 -0
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.js +33 -0
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.js.map +1 -0
- package/dist/utils/errors/WalletNotProvidedError.cjs +36 -0
- package/dist/utils/errors/WalletNotProvidedError.cjs.map +1 -0
- package/dist/utils/errors/WalletNotProvidedError.d.cts +5 -0
- package/dist/utils/errors/WalletNotProvidedError.d.ts +5 -0
- package/dist/utils/errors/WalletNotProvidedError.js +13 -0
- package/dist/utils/errors/WalletNotProvidedError.js.map +1 -0
- package/dist/utils/errors/index.cjs +25 -0
- package/dist/utils/errors/index.cjs.map +1 -0
- package/dist/utils/errors/index.d.cts +1 -0
- package/dist/utils/errors/index.d.ts +1 -0
- package/dist/utils/errors/index.js +3 -0
- package/dist/utils/errors/index.js.map +1 -0
- package/dist/utils/getValidatedAddress.cjs +37 -0
- package/dist/utils/getValidatedAddress.cjs.map +1 -0
- package/dist/utils/getValidatedAddress.d.cts +9 -0
- package/dist/utils/getValidatedAddress.d.ts +9 -0
- package/dist/utils/getValidatedAddress.js +14 -0
- package/dist/utils/getValidatedAddress.js.map +1 -0
- package/dist/utils/getValidatedHex.cjs +37 -0
- package/dist/utils/getValidatedHex.cjs.map +1 -0
- package/dist/utils/getValidatedHex.d.cts +9 -0
- package/dist/utils/getValidatedHex.d.ts +9 -0
- package/dist/utils/getValidatedHex.js +14 -0
- package/dist/utils/getValidatedHex.js.map +1 -0
- package/dist/utils/index.cjs +53 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +37 -0
- package/dist/utils/index.d.ts +37 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/interest.cjs +94 -0
- package/dist/utils/interest.cjs.map +1 -0
- package/dist/utils/interest.d.cts +50 -0
- package/dist/utils/interest.d.ts +50 -0
- package/dist/utils/interest.js +70 -0
- package/dist/utils/interest.js.map +1 -0
- package/dist/utils/isWriteableContract.cjs +33 -0
- package/dist/utils/isWriteableContract.cjs.map +1 -0
- package/dist/utils/isWriteableContract.d.cts +6 -0
- package/dist/utils/isWriteableContract.d.ts +6 -0
- package/dist/utils/isWriteableContract.js +10 -0
- package/dist/utils/isWriteableContract.js.map +1 -0
- package/dist/utils/mapValues.cjs +38 -0
- package/dist/utils/mapValues.cjs.map +1 -0
- package/dist/utils/mapValues.d.cts +6 -0
- package/dist/utils/mapValues.d.ts +6 -0
- package/dist/utils/mapValues.js +15 -0
- package/dist/utils/mapValues.js.map +1 -0
- package/dist/utils/math/BigDecimals.cjs +37 -0
- package/dist/utils/math/BigDecimals.cjs.map +1 -0
- package/dist/utils/math/BigDecimals.d.cts +8 -0
- package/dist/utils/math/BigDecimals.d.ts +8 -0
- package/dist/utils/math/BigDecimals.js +14 -0
- package/dist/utils/math/BigDecimals.js.map +1 -0
- package/dist/utils/math/bigDecimal.cjs +57 -0
- package/dist/utils/math/bigDecimal.cjs.map +1 -0
- package/dist/utils/math/bigDecimal.d.cts +18 -0
- package/dist/utils/math/bigDecimal.d.ts +18 -0
- package/dist/utils/math/bigDecimal.js +23 -0
- package/dist/utils/math/bigDecimal.js.map +1 -0
- package/dist/utils/math/clamp.cjs +38 -0
- package/dist/utils/math/clamp.cjs.map +1 -0
- package/dist/utils/math/clamp.d.cts +15 -0
- package/dist/utils/math/clamp.d.ts +15 -0
- package/dist/utils/math/clamp.js +15 -0
- package/dist/utils/math/clamp.js.map +1 -0
- package/dist/utils/math/decimalAdjustment.cjs +60 -0
- package/dist/utils/math/decimalAdjustment.cjs.map +1 -0
- package/dist/utils/math/decimalAdjustment.d.cts +31 -0
- package/dist/utils/math/decimalAdjustment.d.ts +31 -0
- package/dist/utils/math/decimalAdjustment.js +35 -0
- package/dist/utils/math/decimalAdjustment.js.map +1 -0
- package/dist/utils/math/index.cjs +37 -0
- package/dist/utils/math/index.cjs.map +1 -0
- package/dist/utils/math/index.d.cts +8 -0
- package/dist/utils/math/index.d.ts +8 -0
- package/dist/utils/math/index.js +9 -0
- package/dist/utils/math/index.js.map +1 -0
- package/dist/utils/math/sumBigDecimalBy.cjs +36 -0
- package/dist/utils/math/sumBigDecimalBy.cjs.map +1 -0
- package/dist/utils/math/sumBigDecimalBy.d.cts +10 -0
- package/dist/utils/math/sumBigDecimalBy.d.ts +10 -0
- package/dist/utils/math/sumBigDecimalBy.js +13 -0
- package/dist/utils/math/sumBigDecimalBy.js.map +1 -0
- package/dist/utils/math/toBigInt.cjs +34 -0
- package/dist/utils/math/toBigInt.cjs.map +1 -0
- package/dist/utils/math/toBigInt.d.cts +11 -0
- package/dist/utils/math/toBigInt.d.ts +11 -0
- package/dist/utils/math/toBigInt.js +11 -0
- package/dist/utils/math/toBigInt.js.map +1 -0
- package/dist/utils/math/toIntegerString.cjs +34 -0
- package/dist/utils/math/toIntegerString.cjs.map +1 -0
- package/dist/utils/math/toIntegerString.d.cts +11 -0
- package/dist/utils/math/toIntegerString.d.ts +11 -0
- package/dist/utils/math/toIntegerString.js +11 -0
- package/dist/utils/math/toIntegerString.js.map +1 -0
- package/dist/utils/orders/appendix/appendixTWAPValue.cjs +50 -0
- package/dist/utils/orders/appendix/appendixTWAPValue.cjs.map +1 -0
- package/dist/utils/orders/appendix/appendixTWAPValue.d.cts +31 -0
- package/dist/utils/orders/appendix/appendixTWAPValue.d.ts +31 -0
- package/dist/utils/orders/appendix/appendixTWAPValue.js +26 -0
- package/dist/utils/orders/appendix/appendixTWAPValue.js.map +1 -0
- package/dist/utils/orders/appendix/bitMaskValue.cjs +34 -0
- package/dist/utils/orders/appendix/bitMaskValue.cjs.map +1 -0
- package/dist/utils/orders/appendix/bitMaskValue.d.cts +10 -0
- package/dist/utils/orders/appendix/bitMaskValue.d.ts +10 -0
- package/dist/utils/orders/appendix/bitMaskValue.js +11 -0
- package/dist/utils/orders/appendix/bitMaskValue.js.map +1 -0
- package/dist/utils/orders/appendix/index.cjs +33 -0
- package/dist/utils/orders/appendix/index.cjs.map +1 -0
- package/dist/utils/orders/appendix/index.d.cts +9 -0
- package/dist/utils/orders/appendix/index.d.ts +9 -0
- package/dist/utils/orders/appendix/index.js +7 -0
- package/dist/utils/orders/appendix/index.js.map +1 -0
- package/dist/utils/orders/appendix/orderAppendix.test.cjs +165 -0
- package/dist/utils/orders/appendix/orderAppendix.test.cjs.map +1 -0
- package/dist/utils/orders/appendix/orderAppendix.test.d.cts +2 -0
- package/dist/utils/orders/appendix/orderAppendix.test.d.ts +2 -0
- package/dist/utils/orders/appendix/orderAppendix.test.js +120 -0
- package/dist/utils/orders/appendix/orderAppendix.test.js.map +1 -0
- package/dist/utils/orders/appendix/packOrderAppendix.cjs +88 -0
- package/dist/utils/orders/appendix/packOrderAppendix.cjs.map +1 -0
- package/dist/utils/orders/appendix/packOrderAppendix.d.cts +12 -0
- package/dist/utils/orders/appendix/packOrderAppendix.d.ts +12 -0
- package/dist/utils/orders/appendix/packOrderAppendix.js +65 -0
- package/dist/utils/orders/appendix/packOrderAppendix.js.map +1 -0
- package/dist/utils/orders/appendix/types.cjs +19 -0
- package/dist/utils/orders/appendix/types.cjs.map +1 -0
- package/dist/utils/orders/appendix/types.d.cts +19 -0
- package/dist/utils/orders/appendix/types.d.ts +19 -0
- package/dist/utils/orders/appendix/types.js +1 -0
- package/dist/utils/orders/appendix/types.js.map +1 -0
- package/dist/utils/orders/appendix/unpackOrderAppendix.cjs +106 -0
- package/dist/utils/orders/appendix/unpackOrderAppendix.cjs.map +1 -0
- package/dist/utils/orders/appendix/unpackOrderAppendix.d.cts +12 -0
- package/dist/utils/orders/appendix/unpackOrderAppendix.d.ts +12 -0
- package/dist/utils/orders/appendix/unpackOrderAppendix.js +83 -0
- package/dist/utils/orders/appendix/unpackOrderAppendix.js.map +1 -0
- package/dist/utils/orders/index.cjs +29 -0
- package/dist/utils/orders/index.cjs.map +1 -0
- package/dist/utils/orders/index.d.cts +11 -0
- package/dist/utils/orders/index.d.ts +11 -0
- package/dist/utils/orders/index.js +5 -0
- package/dist/utils/orders/index.js.map +1 -0
- package/dist/utils/orders/orderNonce.cjs +44 -0
- package/dist/utils/orders/orderNonce.cjs.map +1 -0
- package/dist/utils/orders/orderNonce.d.cts +14 -0
- package/dist/utils/orders/orderNonce.d.ts +14 -0
- package/dist/utils/orders/orderNonce.js +20 -0
- package/dist/utils/orders/orderNonce.js.map +1 -0
- package/dist/utils/orders/recvTime.cjs +33 -0
- package/dist/utils/orders/recvTime.cjs.map +1 -0
- package/dist/utils/orders/recvTime.d.cts +9 -0
- package/dist/utils/orders/recvTime.d.ts +9 -0
- package/dist/utils/orders/recvTime.js +10 -0
- package/dist/utils/orders/recvTime.js.map +1 -0
- package/dist/utils/productTypeFilter.cjs +49 -0
- package/dist/utils/productTypeFilter.cjs.map +1 -0
- package/dist/utils/productTypeFilter.d.cts +11 -0
- package/dist/utils/productTypeFilter.d.ts +11 -0
- package/dist/utils/productTypeFilter.js +25 -0
- package/dist/utils/productTypeFilter.js.map +1 -0
- package/dist/utils/time.cjs +47 -0
- package/dist/utils/time.cjs.map +1 -0
- package/dist/utils/time.d.cts +17 -0
- package/dist/utils/time.d.ts +17 -0
- package/dist/utils/time.js +22 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/toPrintableObject.cjs +51 -0
- package/dist/utils/toPrintableObject.cjs.map +1 -0
- package/dist/utils/toPrintableObject.d.cts +6 -0
- package/dist/utils/toPrintableObject.d.ts +6 -0
- package/dist/utils/toPrintableObject.js +28 -0
- package/dist/utils/toPrintableObject.js.map +1 -0
- package/package.json +49 -0
- package/src/abis/Clearinghouse.ts +861 -0
- package/src/abis/ERC20.ts +185 -0
- package/src/abis/Endpoint.ts +559 -0
- package/src/abis/MockERC20.ts +311 -0
- package/src/abis/PerpEngine.ts +856 -0
- package/src/abis/Querier.ts +1492 -0
- package/src/abis/SpotEngine.ts +907 -0
- package/src/abis/WithdrawPool.ts +277 -0
- package/src/abis/index.ts +9 -0
- package/src/abis/nadoAbis.ts +19 -0
- package/src/consts/chainEnvToChain.ts +16 -0
- package/src/consts/index.ts +2 -0
- package/src/consts/productIds.ts +3 -0
- package/src/deployments/core/deployment.InkSepolia.json +13 -0
- package/src/deployments/core/deployment.arbitrumOne.json +18 -0
- package/src/deployments/core/deployment.localhost.json +18 -0
- package/src/deployments/index.ts +40 -0
- package/src/eip712/eip712ValueTypes.ts +83 -0
- package/src/eip712/getNadoEIP712Domain.ts +20 -0
- package/src/eip712/getNadoEIP712PrimaryType.ts +13 -0
- package/src/eip712/getNadoEIP712Types.ts +113 -0
- package/src/eip712/getNadoEIP712Values.ts +248 -0
- package/src/eip712/getOrderVerifyingAddress.ts +9 -0
- package/src/eip712/getSignedTransactionRequest.ts +30 -0
- package/src/eip712/index.ts +10 -0
- package/src/eip712/orderDigest.ts +28 -0
- package/src/eip712/signableRequestType.ts +32 -0
- package/src/eip712/signatureParamTypes.ts +84 -0
- package/src/encoding/encoding.ts +50 -0
- package/src/encoding/index.ts +1 -0
- package/src/execute/approveDepositAllowance.ts +20 -0
- package/src/execute/depositCollateral.ts +43 -0
- package/src/execute/index.ts +2 -0
- package/src/index.ts +8 -0
- package/src/types/ChainEnv.ts +13 -0
- package/src/types/OrderExecutionType.ts +8 -0
- package/src/types/balanceTypes.ts +47 -0
- package/src/types/bytes.ts +1 -0
- package/src/types/healthTypes.ts +17 -0
- package/src/types/index.ts +11 -0
- package/src/types/marketTypes.ts +40 -0
- package/src/types/nadoContractTypes.ts +14 -0
- package/src/types/orderAppendixTypes.ts +58 -0
- package/src/types/productTypes.ts +76 -0
- package/src/types/subaccountTypes.ts +13 -0
- package/src/types/viemTypes.ts +42 -0
- package/src/utils/asyncResult.ts +12 -0
- package/src/utils/balanceValue.ts +42 -0
- package/src/utils/bytes32.test.ts +117 -0
- package/src/utils/bytes32.ts +110 -0
- package/src/utils/createDeterministicLinkedSignerPrivateKey.ts +46 -0
- package/src/utils/errors/WalletNotProvidedError.ts +6 -0
- package/src/utils/errors/index.ts +1 -0
- package/src/utils/getValidatedAddress.ts +13 -0
- package/src/utils/getValidatedHex.ts +13 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/interest.ts +133 -0
- package/src/utils/isWriteableContract.ts +11 -0
- package/src/utils/mapValues.ts +18 -0
- package/src/utils/math/BigDecimals.ts +8 -0
- package/src/utils/math/bigDecimal.ts +32 -0
- package/src/utils/math/clamp.ts +26 -0
- package/src/utils/math/decimalAdjustment.ts +65 -0
- package/src/utils/math/index.ts +7 -0
- package/src/utils/math/sumBigDecimalBy.ts +18 -0
- package/src/utils/math/toBigInt.ts +11 -0
- package/src/utils/math/toIntegerString.ts +11 -0
- package/src/utils/orders/appendix/appendixTWAPValue.ts +51 -0
- package/src/utils/orders/appendix/bitMaskValue.ts +11 -0
- package/src/utils/orders/appendix/index.ts +5 -0
- package/src/utils/orders/appendix/orderAppendix.test.ts +121 -0
- package/src/utils/orders/appendix/packOrderAppendix.ts +71 -0
- package/src/utils/orders/appendix/types.ts +17 -0
- package/src/utils/orders/appendix/unpackOrderAppendix.ts +90 -0
- package/src/utils/orders/index.ts +3 -0
- package/src/utils/orders/orderNonce.ts +32 -0
- package/src/utils/orders/recvTime.ts +9 -0
- package/src/utils/productTypeFilter.ts +23 -0
- package/src/utils/time.ts +21 -0
- package/src/utils/toPrintableObject.ts +25 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/orders/appendix/unpackOrderAppendix.ts
|
|
21
|
+
var unpackOrderAppendix_exports = {};
|
|
22
|
+
__export(unpackOrderAppendix_exports, {
|
|
23
|
+
unpackOrderAppendix: () => unpackOrderAppendix
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(unpackOrderAppendix_exports);
|
|
26
|
+
var import_math = require("../../math/index.cjs");
|
|
27
|
+
var import_appendixTWAPValue = require("./appendixTWAPValue.cjs");
|
|
28
|
+
var import_bitMaskValue = require("./bitMaskValue.cjs");
|
|
29
|
+
function mapBitValuesToAppendix(bits) {
|
|
30
|
+
const triggerType = (() => {
|
|
31
|
+
switch (bits.trigger) {
|
|
32
|
+
case 1:
|
|
33
|
+
return "price";
|
|
34
|
+
case 2:
|
|
35
|
+
return "twap";
|
|
36
|
+
case 3:
|
|
37
|
+
return "twap_custom_amounts";
|
|
38
|
+
default:
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
const orderExecutionType = (() => {
|
|
43
|
+
switch (bits.orderType) {
|
|
44
|
+
case 0:
|
|
45
|
+
return "default";
|
|
46
|
+
case 1:
|
|
47
|
+
return "ioc";
|
|
48
|
+
case 2:
|
|
49
|
+
return "fok";
|
|
50
|
+
case 3:
|
|
51
|
+
return "post_only";
|
|
52
|
+
default:
|
|
53
|
+
throw new Error(
|
|
54
|
+
`[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
const isolatedFields = (() => {
|
|
59
|
+
if (bits.isolated) {
|
|
60
|
+
return { margin: bits.value };
|
|
61
|
+
}
|
|
62
|
+
return void 0;
|
|
63
|
+
})();
|
|
64
|
+
const twapFields = (() => {
|
|
65
|
+
if (triggerType === "twap" || triggerType === "twap_custom_amounts") {
|
|
66
|
+
return (0, import_appendixTWAPValue.unpackTWAPOrderAppendixValue)(bits.value);
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
69
|
+
return {
|
|
70
|
+
reduceOnly: !!bits.reduceOnly,
|
|
71
|
+
orderExecutionType,
|
|
72
|
+
triggerType,
|
|
73
|
+
isolated: isolatedFields,
|
|
74
|
+
twap: twapFields
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function unpackOrderAppendix(packed) {
|
|
78
|
+
let temp = (0, import_math.toBigInt)(packed);
|
|
79
|
+
const version = Number((0, import_bitMaskValue.bitMaskValue)(temp, 8));
|
|
80
|
+
temp >>= 8n;
|
|
81
|
+
const isolated = Number((0, import_bitMaskValue.bitMaskValue)(temp, 1));
|
|
82
|
+
temp >>= 1n;
|
|
83
|
+
const orderType = Number((0, import_bitMaskValue.bitMaskValue)(temp, 2));
|
|
84
|
+
temp >>= 2n;
|
|
85
|
+
const reduceOnly = Number((0, import_bitMaskValue.bitMaskValue)(temp, 1));
|
|
86
|
+
temp >>= 1n;
|
|
87
|
+
const trigger = Number((0, import_bitMaskValue.bitMaskValue)(temp, 2));
|
|
88
|
+
temp >>= 2n;
|
|
89
|
+
const reserved = Number((0, import_bitMaskValue.bitMaskValue)(temp, 18));
|
|
90
|
+
temp >>= 18n;
|
|
91
|
+
const value = (0, import_bitMaskValue.bitMaskValue)(temp, 96);
|
|
92
|
+
return mapBitValuesToAppendix({
|
|
93
|
+
value,
|
|
94
|
+
reserved,
|
|
95
|
+
trigger,
|
|
96
|
+
reduceOnly,
|
|
97
|
+
orderType,
|
|
98
|
+
isolated,
|
|
99
|
+
version
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
unpackOrderAppendix
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=unpackOrderAppendix.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OrderAppendix } from '../../../types/orderAppendixTypes.cjs';
|
|
2
|
+
import { BigDecimalish } from '../../math/bigDecimal.cjs';
|
|
3
|
+
import '../../../types/OrderExecutionType.cjs';
|
|
4
|
+
import 'bignumber.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Unpack the OrderAppendix fields from a packed bigint.
|
|
8
|
+
* @param packed
|
|
9
|
+
*/
|
|
10
|
+
declare function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix;
|
|
11
|
+
|
|
12
|
+
export { unpackOrderAppendix };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OrderAppendix } from '../../../types/orderAppendixTypes.js';
|
|
2
|
+
import { BigDecimalish } from '../../math/bigDecimal.js';
|
|
3
|
+
import '../../../types/OrderExecutionType.js';
|
|
4
|
+
import 'bignumber.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Unpack the OrderAppendix fields from a packed bigint.
|
|
8
|
+
* @param packed
|
|
9
|
+
*/
|
|
10
|
+
declare function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix;
|
|
11
|
+
|
|
12
|
+
export { unpackOrderAppendix };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import "../../../chunk-5WRI5ZAA.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/orders/appendix/unpackOrderAppendix.ts
|
|
4
|
+
import { toBigInt } from "../../math/index.js";
|
|
5
|
+
import { unpackTWAPOrderAppendixValue } from "./appendixTWAPValue.js";
|
|
6
|
+
import { bitMaskValue } from "./bitMaskValue.js";
|
|
7
|
+
function mapBitValuesToAppendix(bits) {
|
|
8
|
+
const triggerType = (() => {
|
|
9
|
+
switch (bits.trigger) {
|
|
10
|
+
case 1:
|
|
11
|
+
return "price";
|
|
12
|
+
case 2:
|
|
13
|
+
return "twap";
|
|
14
|
+
case 3:
|
|
15
|
+
return "twap_custom_amounts";
|
|
16
|
+
default:
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
const orderExecutionType = (() => {
|
|
21
|
+
switch (bits.orderType) {
|
|
22
|
+
case 0:
|
|
23
|
+
return "default";
|
|
24
|
+
case 1:
|
|
25
|
+
return "ioc";
|
|
26
|
+
case 2:
|
|
27
|
+
return "fok";
|
|
28
|
+
case 3:
|
|
29
|
+
return "post_only";
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(
|
|
32
|
+
`[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
const isolatedFields = (() => {
|
|
37
|
+
if (bits.isolated) {
|
|
38
|
+
return { margin: bits.value };
|
|
39
|
+
}
|
|
40
|
+
return void 0;
|
|
41
|
+
})();
|
|
42
|
+
const twapFields = (() => {
|
|
43
|
+
if (triggerType === "twap" || triggerType === "twap_custom_amounts") {
|
|
44
|
+
return unpackTWAPOrderAppendixValue(bits.value);
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
return {
|
|
48
|
+
reduceOnly: !!bits.reduceOnly,
|
|
49
|
+
orderExecutionType,
|
|
50
|
+
triggerType,
|
|
51
|
+
isolated: isolatedFields,
|
|
52
|
+
twap: twapFields
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function unpackOrderAppendix(packed) {
|
|
56
|
+
let temp = toBigInt(packed);
|
|
57
|
+
const version = Number(bitMaskValue(temp, 8));
|
|
58
|
+
temp >>= 8n;
|
|
59
|
+
const isolated = Number(bitMaskValue(temp, 1));
|
|
60
|
+
temp >>= 1n;
|
|
61
|
+
const orderType = Number(bitMaskValue(temp, 2));
|
|
62
|
+
temp >>= 2n;
|
|
63
|
+
const reduceOnly = Number(bitMaskValue(temp, 1));
|
|
64
|
+
temp >>= 1n;
|
|
65
|
+
const trigger = Number(bitMaskValue(temp, 2));
|
|
66
|
+
temp >>= 2n;
|
|
67
|
+
const reserved = Number(bitMaskValue(temp, 18));
|
|
68
|
+
temp >>= 18n;
|
|
69
|
+
const value = bitMaskValue(temp, 96);
|
|
70
|
+
return mapBitValuesToAppendix({
|
|
71
|
+
value,
|
|
72
|
+
reserved,
|
|
73
|
+
trigger,
|
|
74
|
+
reduceOnly,
|
|
75
|
+
orderType,
|
|
76
|
+
isolated,
|
|
77
|
+
version
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
unpackOrderAppendix
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=unpackOrderAppendix.js.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/utils/orders/index.ts
|
|
18
|
+
var orders_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(orders_exports);
|
|
20
|
+
__reExport(orders_exports, require("./orderNonce.cjs"), module.exports);
|
|
21
|
+
__reExport(orders_exports, require("./recvTime.cjs"), module.exports);
|
|
22
|
+
__reExport(orders_exports, require("./appendix/index.cjs"), module.exports);
|
|
23
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
+
0 && (module.exports = {
|
|
25
|
+
...require("./orderNonce.cjs"),
|
|
26
|
+
...require("./recvTime.cjs"),
|
|
27
|
+
...require("./appendix/index.cjs")
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.cjs';
|
|
2
|
+
export { getDefaultRecvTime } from './recvTime.cjs';
|
|
3
|
+
export { packTWAPOrderAppendixValue, unpackTWAPOrderAppendixValue } from './appendix/appendixTWAPValue.cjs';
|
|
4
|
+
export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.cjs';
|
|
5
|
+
export { packOrderAppendix } from './appendix/packOrderAppendix.cjs';
|
|
6
|
+
export { PackedOrderAppendixBits } from './appendix/types.cjs';
|
|
7
|
+
export { bitMaskValue } from './appendix/bitMaskValue.cjs';
|
|
8
|
+
import '../../types/orderAppendixTypes.cjs';
|
|
9
|
+
import '../math/bigDecimal.cjs';
|
|
10
|
+
import 'bignumber.js';
|
|
11
|
+
import '../../types/OrderExecutionType.cjs';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.js';
|
|
2
|
+
export { getDefaultRecvTime } from './recvTime.js';
|
|
3
|
+
export { packTWAPOrderAppendixValue, unpackTWAPOrderAppendixValue } from './appendix/appendixTWAPValue.js';
|
|
4
|
+
export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.js';
|
|
5
|
+
export { packOrderAppendix } from './appendix/packOrderAppendix.js';
|
|
6
|
+
export { PackedOrderAppendixBits } from './appendix/types.js';
|
|
7
|
+
export { bitMaskValue } from './appendix/bitMaskValue.js';
|
|
8
|
+
import '../../types/orderAppendixTypes.js';
|
|
9
|
+
import '../math/bigDecimal.js';
|
|
10
|
+
import 'bignumber.js';
|
|
11
|
+
import '../../types/OrderExecutionType.js';
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/orders/orderNonce.ts
|
|
21
|
+
var orderNonce_exports = {};
|
|
22
|
+
__export(orderNonce_exports, {
|
|
23
|
+
getOrderNonce: () => getOrderNonce,
|
|
24
|
+
getRecvTimeFromOrderNonce: () => getRecvTimeFromOrderNonce
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(orderNonce_exports);
|
|
27
|
+
var import_toIntegerString = require("../math/toIntegerString.cjs");
|
|
28
|
+
var import_recvTime = require("./recvTime.cjs");
|
|
29
|
+
function getOrderNonce(recvTimeMillis = (0, import_recvTime.getDefaultRecvTime)(), randomInt = Math.floor(Math.random() * 1e3)) {
|
|
30
|
+
return (0, import_toIntegerString.toIntegerString)(getOrderNonceBigInt(recvTimeMillis, randomInt));
|
|
31
|
+
}
|
|
32
|
+
function getRecvTimeFromOrderNonce(orderNonce) {
|
|
33
|
+
const bigIntRecvTime = BigInt(orderNonce) >> 20n;
|
|
34
|
+
return Number(bigIntRecvTime.toString());
|
|
35
|
+
}
|
|
36
|
+
function getOrderNonceBigInt(recvTimeMillis, randomInt) {
|
|
37
|
+
return (BigInt(recvTimeMillis) << 20n) + BigInt(randomInt);
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
getOrderNonce,
|
|
42
|
+
getRecvTimeFromOrderNonce
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=orderNonce.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/orders/orderNonce.ts"],"sourcesContent":["import { toIntegerString } from '../math/toIntegerString';\nimport { getDefaultRecvTime } from './recvTime';\n\n/**\n * Generates an order nonce based on recvTime in milliseconds, defaulting to Date.now() + 90 seconds\n * @param recvTimeMillis\n * @param randomInt a random integer to avoid hash collisions\n */\nexport function getOrderNonce(\n recvTimeMillis: number = getDefaultRecvTime(),\n randomInt: number = Math.floor(Math.random() * 1000),\n): string {\n return toIntegerString(getOrderNonceBigInt(recvTimeMillis, randomInt));\n}\n\n/**\n * Gets the recvTime in millis from an order nonce\n *\n * @param orderNonce\n */\nexport function getRecvTimeFromOrderNonce(orderNonce: string): number {\n // Right shift by 20 to remove the random int portion\n const bigIntRecvTime = BigInt(orderNonce) >> 20n;\n return Number(bigIntRecvTime.toString());\n}\n\nfunction getOrderNonceBigInt(\n recvTimeMillis: number,\n randomInt: number,\n): bigint {\n return (BigInt(recvTimeMillis) << 20n) + BigInt(randomInt);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,sBAAmC;AAO5B,SAAS,cACd,qBAAyB,oCAAmB,GAC5C,YAAoB,KAAK,MAAM,KAAK,OAAO,IAAI,GAAI,GAC3C;AACR,aAAO,wCAAgB,oBAAoB,gBAAgB,SAAS,CAAC;AACvE;AAOO,SAAS,0BAA0B,YAA4B;AAEpE,QAAM,iBAAiB,OAAO,UAAU,KAAK;AAC7C,SAAO,OAAO,eAAe,SAAS,CAAC;AACzC;AAEA,SAAS,oBACP,gBACA,WACQ;AACR,UAAQ,OAAO,cAAc,KAAK,OAAO,OAAO,SAAS;AAC3D;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates an order nonce based on recvTime in milliseconds, defaulting to Date.now() + 90 seconds
|
|
3
|
+
* @param recvTimeMillis
|
|
4
|
+
* @param randomInt a random integer to avoid hash collisions
|
|
5
|
+
*/
|
|
6
|
+
declare function getOrderNonce(recvTimeMillis?: number, randomInt?: number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the recvTime in millis from an order nonce
|
|
9
|
+
*
|
|
10
|
+
* @param orderNonce
|
|
11
|
+
*/
|
|
12
|
+
declare function getRecvTimeFromOrderNonce(orderNonce: string): number;
|
|
13
|
+
|
|
14
|
+
export { getOrderNonce, getRecvTimeFromOrderNonce };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates an order nonce based on recvTime in milliseconds, defaulting to Date.now() + 90 seconds
|
|
3
|
+
* @param recvTimeMillis
|
|
4
|
+
* @param randomInt a random integer to avoid hash collisions
|
|
5
|
+
*/
|
|
6
|
+
declare function getOrderNonce(recvTimeMillis?: number, randomInt?: number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the recvTime in millis from an order nonce
|
|
9
|
+
*
|
|
10
|
+
* @param orderNonce
|
|
11
|
+
*/
|
|
12
|
+
declare function getRecvTimeFromOrderNonce(orderNonce: string): number;
|
|
13
|
+
|
|
14
|
+
export { getOrderNonce, getRecvTimeFromOrderNonce };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../../chunk-5WRI5ZAA.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/orders/orderNonce.ts
|
|
4
|
+
import { toIntegerString } from "../math/toIntegerString.js";
|
|
5
|
+
import { getDefaultRecvTime } from "./recvTime.js";
|
|
6
|
+
function getOrderNonce(recvTimeMillis = getDefaultRecvTime(), randomInt = Math.floor(Math.random() * 1e3)) {
|
|
7
|
+
return toIntegerString(getOrderNonceBigInt(recvTimeMillis, randomInt));
|
|
8
|
+
}
|
|
9
|
+
function getRecvTimeFromOrderNonce(orderNonce) {
|
|
10
|
+
const bigIntRecvTime = BigInt(orderNonce) >> 20n;
|
|
11
|
+
return Number(bigIntRecvTime.toString());
|
|
12
|
+
}
|
|
13
|
+
function getOrderNonceBigInt(recvTimeMillis, randomInt) {
|
|
14
|
+
return (BigInt(recvTimeMillis) << 20n) + BigInt(randomInt);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
getOrderNonce,
|
|
18
|
+
getRecvTimeFromOrderNonce
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=orderNonce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/orders/orderNonce.ts"],"sourcesContent":["import { toIntegerString } from '../math/toIntegerString';\nimport { getDefaultRecvTime } from './recvTime';\n\n/**\n * Generates an order nonce based on recvTime in milliseconds, defaulting to Date.now() + 90 seconds\n * @param recvTimeMillis\n * @param randomInt a random integer to avoid hash collisions\n */\nexport function getOrderNonce(\n recvTimeMillis: number = getDefaultRecvTime(),\n randomInt: number = Math.floor(Math.random() * 1000),\n): string {\n return toIntegerString(getOrderNonceBigInt(recvTimeMillis, randomInt));\n}\n\n/**\n * Gets the recvTime in millis from an order nonce\n *\n * @param orderNonce\n */\nexport function getRecvTimeFromOrderNonce(orderNonce: string): number {\n // Right shift by 20 to remove the random int portion\n const bigIntRecvTime = BigInt(orderNonce) >> 20n;\n return Number(bigIntRecvTime.toString());\n}\n\nfunction getOrderNonceBigInt(\n recvTimeMillis: number,\n randomInt: number,\n): bigint {\n return (BigInt(recvTimeMillis) << 20n) + BigInt(randomInt);\n}\n"],"mappings":";;;AAAA,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AAO5B,SAAS,cACd,iBAAyB,mBAAmB,GAC5C,YAAoB,KAAK,MAAM,KAAK,OAAO,IAAI,GAAI,GAC3C;AACR,SAAO,gBAAgB,oBAAoB,gBAAgB,SAAS,CAAC;AACvE;AAOO,SAAS,0BAA0B,YAA4B;AAEpE,QAAM,iBAAiB,OAAO,UAAU,KAAK;AAC7C,SAAO,OAAO,eAAe,SAAS,CAAC;AACzC;AAEA,SAAS,oBACP,gBACA,WACQ;AACR,UAAQ,OAAO,cAAc,KAAK,OAAO,OAAO,SAAS;AAC3D;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/orders/recvTime.ts
|
|
21
|
+
var recvTime_exports = {};
|
|
22
|
+
__export(recvTime_exports, {
|
|
23
|
+
getDefaultRecvTime: () => getDefaultRecvTime
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(recvTime_exports);
|
|
26
|
+
function getDefaultRecvTime(currentTimeMillis = Date.now()) {
|
|
27
|
+
return currentTimeMillis + 90 * 1e3;
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
getDefaultRecvTime
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=recvTime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/orders/recvTime.ts"],"sourcesContent":["/**\n * Generates a default recvTime based on the time given in milliseconds.\n * The default recvTime is 90 seconds from the current time.\n *\n * @param currentTimeMillis defaults to Date.now()\n */\nexport function getDefaultRecvTime(currentTimeMillis: number = Date.now()) {\n return currentTimeMillis + 90 * 1000;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,mBAAmB,oBAA4B,KAAK,IAAI,GAAG;AACzE,SAAO,oBAAoB,KAAK;AAClC;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a default recvTime based on the time given in milliseconds.
|
|
3
|
+
* The default recvTime is 90 seconds from the current time.
|
|
4
|
+
*
|
|
5
|
+
* @param currentTimeMillis defaults to Date.now()
|
|
6
|
+
*/
|
|
7
|
+
declare function getDefaultRecvTime(currentTimeMillis?: number): number;
|
|
8
|
+
|
|
9
|
+
export { getDefaultRecvTime };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a default recvTime based on the time given in milliseconds.
|
|
3
|
+
* The default recvTime is 90 seconds from the current time.
|
|
4
|
+
*
|
|
5
|
+
* @param currentTimeMillis defaults to Date.now()
|
|
6
|
+
*/
|
|
7
|
+
declare function getDefaultRecvTime(currentTimeMillis?: number): number;
|
|
8
|
+
|
|
9
|
+
export { getDefaultRecvTime };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/orders/recvTime.ts"],"sourcesContent":["/**\n * Generates a default recvTime based on the time given in milliseconds.\n * The default recvTime is 90 seconds from the current time.\n *\n * @param currentTimeMillis defaults to Date.now()\n */\nexport function getDefaultRecvTime(currentTimeMillis: number = Date.now()) {\n return currentTimeMillis + 90 * 1000;\n}\n"],"mappings":";;;AAMO,SAAS,mBAAmB,oBAA4B,KAAK,IAAI,GAAG;AACzE,SAAO,oBAAoB,KAAK;AAClC;","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/productTypeFilter.ts
|
|
21
|
+
var productTypeFilter_exports = {};
|
|
22
|
+
__export(productTypeFilter_exports, {
|
|
23
|
+
isPerpBalance: () => isPerpBalance,
|
|
24
|
+
isPerpProduct: () => isPerpProduct,
|
|
25
|
+
isSpotBalance: () => isSpotBalance,
|
|
26
|
+
isSpotProduct: () => isSpotProduct
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(productTypeFilter_exports);
|
|
29
|
+
var import_productTypes = require("../types/productTypes.cjs");
|
|
30
|
+
function isSpotProduct(product) {
|
|
31
|
+
return product.type === import_productTypes.ProductEngineType.SPOT;
|
|
32
|
+
}
|
|
33
|
+
function isSpotBalance(balance) {
|
|
34
|
+
return balance.type === import_productTypes.ProductEngineType.SPOT;
|
|
35
|
+
}
|
|
36
|
+
function isPerpProduct(product) {
|
|
37
|
+
return product.type === import_productTypes.ProductEngineType.PERP;
|
|
38
|
+
}
|
|
39
|
+
function isPerpBalance(balance) {
|
|
40
|
+
return balance.type === import_productTypes.ProductEngineType.PERP;
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
isPerpBalance,
|
|
45
|
+
isPerpProduct,
|
|
46
|
+
isSpotBalance,
|
|
47
|
+
isSpotProduct
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=productTypeFilter.cjs.map
|
|
@@ -0,0 +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":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Balance, SpotBalance, PerpBalance } from '../types/balanceTypes.cjs';
|
|
2
|
+
import { Product, SpotProduct, PerpProduct } from '../types/productTypes.cjs';
|
|
3
|
+
import 'bignumber.js';
|
|
4
|
+
import '../types/healthTypes.cjs';
|
|
5
|
+
|
|
6
|
+
declare function isSpotProduct(product: Product): product is SpotProduct;
|
|
7
|
+
declare function isSpotBalance(balance: Balance): balance is SpotBalance;
|
|
8
|
+
declare function isPerpProduct(product: Product): product is PerpProduct;
|
|
9
|
+
declare function isPerpBalance(balance: Balance): balance is PerpBalance;
|
|
10
|
+
|
|
11
|
+
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Balance, SpotBalance, PerpBalance } from '../types/balanceTypes.js';
|
|
2
|
+
import { Product, SpotProduct, PerpProduct } from '../types/productTypes.js';
|
|
3
|
+
import 'bignumber.js';
|
|
4
|
+
import '../types/healthTypes.js';
|
|
5
|
+
|
|
6
|
+
declare function isSpotProduct(product: Product): product is SpotProduct;
|
|
7
|
+
declare function isSpotBalance(balance: Balance): balance is SpotBalance;
|
|
8
|
+
declare function isPerpProduct(product: Product): product is PerpProduct;
|
|
9
|
+
declare function isPerpBalance(balance: Balance): balance is PerpBalance;
|
|
10
|
+
|
|
11
|
+
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../chunk-5WRI5ZAA.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/productTypeFilter.ts
|
|
4
|
+
import {
|
|
5
|
+
ProductEngineType
|
|
6
|
+
} from "../types/productTypes.js";
|
|
7
|
+
function isSpotProduct(product) {
|
|
8
|
+
return product.type === ProductEngineType.SPOT;
|
|
9
|
+
}
|
|
10
|
+
function isSpotBalance(balance) {
|
|
11
|
+
return balance.type === ProductEngineType.SPOT;
|
|
12
|
+
}
|
|
13
|
+
function isPerpProduct(product) {
|
|
14
|
+
return product.type === ProductEngineType.PERP;
|
|
15
|
+
}
|
|
16
|
+
function isPerpBalance(balance) {
|
|
17
|
+
return balance.type === ProductEngineType.PERP;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
isPerpBalance,
|
|
21
|
+
isPerpProduct,
|
|
22
|
+
isSpotBalance,
|
|
23
|
+
isSpotProduct
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=productTypeFilter.js.map
|
|
@@ -0,0 +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":[]}
|