@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,277 @@
|
|
|
1
|
+
export const WITHDRAW_POOL_ABI = [
|
|
2
|
+
{
|
|
3
|
+
anonymous: false,
|
|
4
|
+
inputs: [
|
|
5
|
+
{
|
|
6
|
+
indexed: false,
|
|
7
|
+
internalType: 'uint8',
|
|
8
|
+
name: 'version',
|
|
9
|
+
type: 'uint8',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
name: 'Initialized',
|
|
13
|
+
type: 'event',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
anonymous: false,
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
indexed: true,
|
|
20
|
+
internalType: 'address',
|
|
21
|
+
name: 'previousOwner',
|
|
22
|
+
type: 'address',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
indexed: true,
|
|
26
|
+
internalType: 'address',
|
|
27
|
+
name: 'newOwner',
|
|
28
|
+
type: 'address',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
name: 'OwnershipTransferred',
|
|
32
|
+
type: 'event',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
inputs: [
|
|
36
|
+
{
|
|
37
|
+
internalType: 'uint64[]',
|
|
38
|
+
name: 'idxs',
|
|
39
|
+
type: 'uint64[]',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
name: 'checkMarkedIdxs',
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
internalType: 'bool[]',
|
|
46
|
+
name: '',
|
|
47
|
+
type: 'bool[]',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
stateMutability: 'view',
|
|
51
|
+
type: 'function',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
inputs: [
|
|
55
|
+
{
|
|
56
|
+
internalType: 'uint32[]',
|
|
57
|
+
name: 'productIds',
|
|
58
|
+
type: 'uint32[]',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
name: 'checkProductBalances',
|
|
62
|
+
outputs: [
|
|
63
|
+
{
|
|
64
|
+
internalType: 'uint256[]',
|
|
65
|
+
name: '',
|
|
66
|
+
type: 'uint256[]',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
stateMutability: 'view',
|
|
70
|
+
type: 'function',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
inputs: [
|
|
74
|
+
{
|
|
75
|
+
internalType: 'contract IERC20Base',
|
|
76
|
+
name: 'token',
|
|
77
|
+
type: 'address',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
internalType: 'uint32',
|
|
81
|
+
name: 'productId',
|
|
82
|
+
type: 'uint32',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
internalType: 'uint128',
|
|
86
|
+
name: 'amount',
|
|
87
|
+
type: 'uint128',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
name: 'fastWithdrawalFeeAmount',
|
|
91
|
+
outputs: [
|
|
92
|
+
{
|
|
93
|
+
internalType: 'int128',
|
|
94
|
+
name: '',
|
|
95
|
+
type: 'int128',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
stateMutability: 'view',
|
|
99
|
+
type: 'function',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
inputs: [
|
|
103
|
+
{
|
|
104
|
+
internalType: 'uint32',
|
|
105
|
+
name: '',
|
|
106
|
+
type: 'uint32',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
name: 'fees',
|
|
110
|
+
outputs: [
|
|
111
|
+
{
|
|
112
|
+
internalType: 'int128',
|
|
113
|
+
name: '',
|
|
114
|
+
type: 'int128',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
stateMutability: 'view',
|
|
118
|
+
type: 'function',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
inputs: [
|
|
122
|
+
{
|
|
123
|
+
internalType: 'address',
|
|
124
|
+
name: '_clearinghouse',
|
|
125
|
+
type: 'address',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
internalType: 'address',
|
|
129
|
+
name: '_verifier',
|
|
130
|
+
type: 'address',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
name: 'initialize',
|
|
134
|
+
outputs: [],
|
|
135
|
+
stateMutability: 'nonpayable',
|
|
136
|
+
type: 'function',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
inputs: [
|
|
140
|
+
{
|
|
141
|
+
internalType: 'uint64',
|
|
142
|
+
name: '',
|
|
143
|
+
type: 'uint64',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
name: 'markedIdxs',
|
|
147
|
+
outputs: [
|
|
148
|
+
{
|
|
149
|
+
internalType: 'bool',
|
|
150
|
+
name: '',
|
|
151
|
+
type: 'bool',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
stateMutability: 'view',
|
|
155
|
+
type: 'function',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
inputs: [],
|
|
159
|
+
name: 'minIdx',
|
|
160
|
+
outputs: [
|
|
161
|
+
{
|
|
162
|
+
internalType: 'uint64',
|
|
163
|
+
name: '',
|
|
164
|
+
type: 'uint64',
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
stateMutability: 'view',
|
|
168
|
+
type: 'function',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
inputs: [],
|
|
172
|
+
name: 'owner',
|
|
173
|
+
outputs: [
|
|
174
|
+
{
|
|
175
|
+
internalType: 'address',
|
|
176
|
+
name: '',
|
|
177
|
+
type: 'address',
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
stateMutability: 'view',
|
|
181
|
+
type: 'function',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
inputs: [
|
|
185
|
+
{
|
|
186
|
+
internalType: 'uint32',
|
|
187
|
+
name: 'productId',
|
|
188
|
+
type: 'uint32',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
internalType: 'uint128',
|
|
192
|
+
name: 'amount',
|
|
193
|
+
type: 'uint128',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
internalType: 'address',
|
|
197
|
+
name: 'sendTo',
|
|
198
|
+
type: 'address',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
name: 'removeLiquidity',
|
|
202
|
+
outputs: [],
|
|
203
|
+
stateMutability: 'nonpayable',
|
|
204
|
+
type: 'function',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
inputs: [],
|
|
208
|
+
name: 'renounceOwnership',
|
|
209
|
+
outputs: [],
|
|
210
|
+
stateMutability: 'nonpayable',
|
|
211
|
+
type: 'function',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
inputs: [
|
|
215
|
+
{
|
|
216
|
+
internalType: 'uint64',
|
|
217
|
+
name: 'idx',
|
|
218
|
+
type: 'uint64',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
internalType: 'bytes',
|
|
222
|
+
name: 'transaction',
|
|
223
|
+
type: 'bytes',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
internalType: 'bytes[]',
|
|
227
|
+
name: 'signatures',
|
|
228
|
+
type: 'bytes[]',
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
name: 'submitFastWithdrawal',
|
|
232
|
+
outputs: [],
|
|
233
|
+
stateMutability: 'nonpayable',
|
|
234
|
+
type: 'function',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
inputs: [
|
|
238
|
+
{
|
|
239
|
+
internalType: 'contract IERC20Base',
|
|
240
|
+
name: 'token',
|
|
241
|
+
type: 'address',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
internalType: 'address',
|
|
245
|
+
name: 'sendTo',
|
|
246
|
+
type: 'address',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
internalType: 'uint128',
|
|
250
|
+
name: 'amount',
|
|
251
|
+
type: 'uint128',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
internalType: 'uint64',
|
|
255
|
+
name: 'idx',
|
|
256
|
+
type: 'uint64',
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
name: 'submitWithdrawal',
|
|
260
|
+
outputs: [],
|
|
261
|
+
stateMutability: 'nonpayable',
|
|
262
|
+
type: 'function',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
inputs: [
|
|
266
|
+
{
|
|
267
|
+
internalType: 'address',
|
|
268
|
+
name: 'newOwner',
|
|
269
|
+
type: 'address',
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
name: 'transferOwnership',
|
|
273
|
+
outputs: [],
|
|
274
|
+
stateMutability: 'nonpayable',
|
|
275
|
+
type: 'function',
|
|
276
|
+
},
|
|
277
|
+
] as const;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './ERC20';
|
|
2
|
+
export * from './MockERC20';
|
|
3
|
+
export * from './WithdrawPool';
|
|
4
|
+
export * from './SpotEngine';
|
|
5
|
+
export * from './Querier';
|
|
6
|
+
export * from './PerpEngine';
|
|
7
|
+
export * from './Endpoint';
|
|
8
|
+
export * from './Clearinghouse';
|
|
9
|
+
export * from './nadoAbis';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CLEARINGHOUSE_ABI } from './Clearinghouse';
|
|
2
|
+
import { ENDPOINT_ABI } from './Endpoint';
|
|
3
|
+
import { PERP_ENGINE_ABI } from './PerpEngine';
|
|
4
|
+
import { QUERIER_ABI } from './Querier';
|
|
5
|
+
import { SPOT_ENGINE_ABI } from './SpotEngine';
|
|
6
|
+
import { WITHDRAW_POOL_ABI } from './WithdrawPool';
|
|
7
|
+
|
|
8
|
+
export const NADO_ABIS = {
|
|
9
|
+
querier: QUERIER_ABI,
|
|
10
|
+
endpoint: ENDPOINT_ABI,
|
|
11
|
+
clearinghouse: CLEARINGHOUSE_ABI,
|
|
12
|
+
spotEngine: SPOT_ENGINE_ABI,
|
|
13
|
+
perpEngine: PERP_ENGINE_ABI,
|
|
14
|
+
withdrawPool: WITHDRAW_POOL_ABI,
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export type NadoAbis = typeof NADO_ABIS;
|
|
18
|
+
|
|
19
|
+
export type NadoContractName = keyof NadoAbis;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Chain } from 'viem';
|
|
2
|
+
import { arbitrum, inkSepolia, localhost } from 'viem/chains';
|
|
3
|
+
import { ChainEnv } from '../types';
|
|
4
|
+
|
|
5
|
+
export const CHAIN_ENV_TO_CHAIN = {
|
|
6
|
+
local: localhost,
|
|
7
|
+
arbitrum: arbitrum,
|
|
8
|
+
inkTestnet: inkSepolia,
|
|
9
|
+
} as const satisfies Record<ChainEnv, Chain>;
|
|
10
|
+
|
|
11
|
+
export const CHAIN_ID_TO_CHAIN_ENV = Object.fromEntries(
|
|
12
|
+
Object.entries(CHAIN_ENV_TO_CHAIN).map(([chainEnv, chain]) => [
|
|
13
|
+
chain.id,
|
|
14
|
+
chainEnv,
|
|
15
|
+
]),
|
|
16
|
+
) as Record<number, ChainEnv>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodeUrl": "https://rpc-gel-sepolia.inkonchain.com",
|
|
3
|
+
"explorerUrl": "https://explorer-sepolia.inkonchain.com",
|
|
4
|
+
"startBlock": 27233833,
|
|
5
|
+
"deployer": "0x8177A1b5bFaAa10A4b1178c6D42aDaa4b75c8146",
|
|
6
|
+
"quote": "0x5F65358d61A9a281ea3BB930d05889ACa21E3f4f",
|
|
7
|
+
"querier": "0x5A62e748b2630560Ffe9E928780cF9Fe0e086A21",
|
|
8
|
+
"clearinghouse": "0x5E9b4336104069467E57E843033e62c79C667F8F",
|
|
9
|
+
"endpoint": "0xf8963f7860aF7DE9b94893EDb9A3b5c155e1Fc0c",
|
|
10
|
+
"spotEngine": "0x61AA7A636df5e72eBe34c70a340eB76ABB3A15bE",
|
|
11
|
+
"perpEngine": "0x3D6Ac7105cA399884739a8CC19cAdB4178844466",
|
|
12
|
+
"withdrawPool": "0xa59613a3e4ce46E20d83b0632E3D857e3f116F66"
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodeUrl": "https://arb1.arbitrum.io/rpc",
|
|
3
|
+
"explorerUrl": "https://explorer.arbitrum.io",
|
|
4
|
+
"subgraphCoreUrl": "https://api.thegraph.com/subgraphs/name/nado-protocol/nado-prod-core",
|
|
5
|
+
"subgraphMarketsUrl": "https://api.thegraph.com/subgraphs/name/nado-protocol/nado-prod-markets",
|
|
6
|
+
"subgraphCandleSticksUrl": "https://api.thegraph.com/subgraphs/name/nado-protocol/nado-prod-candlesticks",
|
|
7
|
+
"startBlock": 67108377,
|
|
8
|
+
"deployer": "0xB746472C10f9F128FF9F5029f424cC91bb1D8C3a",
|
|
9
|
+
"quote": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
|
|
10
|
+
"querier": "0x1693273B443699bee277eCbc60e2C8027E91995d",
|
|
11
|
+
"feeCalculator": "0x2259440579447D0625a5E28dfF3E743d207e8890",
|
|
12
|
+
"clearinghouse": "0xAE1ec28d6225dCE2ff787dcb8CE11cF6D3AE064f",
|
|
13
|
+
"clearinghouseLiq": "0xca007C51Fc14eEA88252Cc4FD71e91E44026F020",
|
|
14
|
+
"endpoint": "0xbbEE07B3e8121227AfCFe1E2B82772246226128e",
|
|
15
|
+
"spotEngine": "0x32d91Af2B17054D575A7bF1ACfa7615f41CCEfaB",
|
|
16
|
+
"perpEngine": "0xb74C78cca0FADAFBeE52B2f48A67eE8c834b5fd1",
|
|
17
|
+
"withdrawPool": "0x3567a1f8d79046A7e93Fd76d71104A978cDC6d05"
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodeUrl": "http://0.0.0.0:8545",
|
|
3
|
+
"explorerUrl": "",
|
|
4
|
+
"subgraphCoreUrl": "http://localhost:8000/subgraphs/name/nado-subgraphs-core",
|
|
5
|
+
"subgraphMarketsUrl": "http://localhost:8000/subgraphs/name/nado-subgraphs-markets",
|
|
6
|
+
"subgraphCandleSticksUrl": "http://localhost:8000/subgraphs/name/nado-subgraphs-candlesticks",
|
|
7
|
+
"startBlock": 0,
|
|
8
|
+
"deployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
9
|
+
"quote": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
|
|
10
|
+
"querier": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
|
|
11
|
+
"feeCalculator": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
|
|
12
|
+
"clearinghouse": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
|
|
13
|
+
"clearinghouseLiq": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
|
|
14
|
+
"endpoint": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318",
|
|
15
|
+
"spotEngine": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
|
|
16
|
+
"perpEngine": "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
|
|
17
|
+
"withdrawPool": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c"
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { NadoContractName } from '../abis/nadoAbis';
|
|
3
|
+
|
|
4
|
+
import { ChainEnv } from '../types';
|
|
5
|
+
import { getValidatedAddress } from '../utils/getValidatedAddress';
|
|
6
|
+
import ArbitrumOneCoreDeployment from './core/deployment.arbitrumOne.json' with { type: 'json' };
|
|
7
|
+
import InkSepoliaCoreDeployment from './core/deployment.InkSepolia.json' with { type: 'json' };
|
|
8
|
+
import LocalCoreDeployment from './core/deployment.localhost.json' with { type: 'json' };
|
|
9
|
+
|
|
10
|
+
export type NadoDeploymentAddresses = {
|
|
11
|
+
[name in NadoContractName]: Address;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Known deployment addresses for the Nado contracts
|
|
16
|
+
*/
|
|
17
|
+
export const NADO_DEPLOYMENTS: Record<ChainEnv, NadoDeploymentAddresses> = {
|
|
18
|
+
arbitrum: validateDeployment({
|
|
19
|
+
...ArbitrumOneCoreDeployment,
|
|
20
|
+
}),
|
|
21
|
+
inkTestnet: validateDeployment({
|
|
22
|
+
...InkSepoliaCoreDeployment,
|
|
23
|
+
}),
|
|
24
|
+
local: validateDeployment({
|
|
25
|
+
...LocalCoreDeployment,
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function validateDeployment(
|
|
30
|
+
deployment: Record<NadoContractName, string>,
|
|
31
|
+
): Record<NadoContractName, Address> {
|
|
32
|
+
return {
|
|
33
|
+
clearinghouse: getValidatedAddress(deployment.clearinghouse),
|
|
34
|
+
endpoint: getValidatedAddress(deployment.endpoint),
|
|
35
|
+
perpEngine: getValidatedAddress(deployment.perpEngine),
|
|
36
|
+
querier: getValidatedAddress(deployment.querier),
|
|
37
|
+
spotEngine: getValidatedAddress(deployment.spotEngine),
|
|
38
|
+
withdrawPool: getValidatedAddress(deployment.withdrawPool),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Hex } from 'viem';
|
|
2
|
+
import { BigDecimalish } from '../utils/math';
|
|
3
|
+
import {
|
|
4
|
+
EIP712BurnNlpParams,
|
|
5
|
+
EIP712CancelOrdersParams,
|
|
6
|
+
EIP712CancelProductOrdersParams,
|
|
7
|
+
EIP712LeaderboardAuthenticationParams,
|
|
8
|
+
EIP712LinkSignerParams,
|
|
9
|
+
EIP712LiquidateSubaccountParams,
|
|
10
|
+
EIP712ListTriggerOrdersParams,
|
|
11
|
+
EIP712MintNlpParams,
|
|
12
|
+
EIP712OrderParams,
|
|
13
|
+
EIP712TransferQuoteParams,
|
|
14
|
+
EIP712WithdrawCollateralParams,
|
|
15
|
+
} from './signatureParamTypes';
|
|
16
|
+
|
|
17
|
+
type WithEIP712Sender<
|
|
18
|
+
T extends { subaccountOwner: string; subaccountName: string },
|
|
19
|
+
> = Omit<T, 'subaccountOwner' | 'subaccountName'> & {
|
|
20
|
+
// Hex encoded bytes32
|
|
21
|
+
sender: Hex;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type EIP712WithdrawCollateralValues =
|
|
25
|
+
WithEIP712Sender<EIP712WithdrawCollateralParams>;
|
|
26
|
+
|
|
27
|
+
export type EIP712LiquidateSubaccountValues = Omit<
|
|
28
|
+
WithEIP712Sender<EIP712LiquidateSubaccountParams>,
|
|
29
|
+
'liquidateeOwner' | 'liquidateeName'
|
|
30
|
+
> & {
|
|
31
|
+
// Hex encoded bytes32
|
|
32
|
+
liquidatee: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type EIP712OrderValues = Omit<
|
|
36
|
+
WithEIP712Sender<EIP712OrderParams>,
|
|
37
|
+
'price'
|
|
38
|
+
> & {
|
|
39
|
+
priceX18: BigDecimalish;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type EIP712ListTriggerOrdersValues =
|
|
43
|
+
WithEIP712Sender<EIP712ListTriggerOrdersParams>;
|
|
44
|
+
|
|
45
|
+
export type EIP712OrderCancellationValues =
|
|
46
|
+
WithEIP712Sender<EIP712CancelOrdersParams>;
|
|
47
|
+
|
|
48
|
+
export type EIP712ProductOrdersCancellationValues =
|
|
49
|
+
WithEIP712Sender<EIP712CancelProductOrdersParams>;
|
|
50
|
+
|
|
51
|
+
export type EIP712LinkSignerValues = WithEIP712Sender<EIP712LinkSignerParams>;
|
|
52
|
+
|
|
53
|
+
export type EIP712TransferQuoteValues = Omit<
|
|
54
|
+
WithEIP712Sender<EIP712TransferQuoteParams>,
|
|
55
|
+
'recipientSubaccountName'
|
|
56
|
+
> & {
|
|
57
|
+
// Hex encoded bytes32
|
|
58
|
+
recipient: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type EIP712LeaderboardAuthenticationValues =
|
|
62
|
+
WithEIP712Sender<EIP712LeaderboardAuthenticationParams>;
|
|
63
|
+
|
|
64
|
+
export type EIP712MintNlpValues = WithEIP712Sender<EIP712MintNlpParams>;
|
|
65
|
+
|
|
66
|
+
export type EIP712BurnNlpValues = WithEIP712Sender<EIP712BurnNlpParams>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* All possible requests to be signed, to the EIP712 value interface
|
|
70
|
+
*/
|
|
71
|
+
export interface SignableRequestTypeToEIP712Values {
|
|
72
|
+
burn_nlp: EIP712BurnNlpValues;
|
|
73
|
+
cancel_orders: EIP712OrderCancellationValues;
|
|
74
|
+
cancel_product_orders: EIP712ProductOrdersCancellationValues;
|
|
75
|
+
leaderboard_authentication: EIP712LeaderboardAuthenticationValues;
|
|
76
|
+
link_signer: EIP712LinkSignerValues;
|
|
77
|
+
liquidate_subaccount: EIP712LiquidateSubaccountValues;
|
|
78
|
+
list_trigger_orders: EIP712ListTriggerOrdersValues;
|
|
79
|
+
mint_nlp: EIP712MintNlpValues;
|
|
80
|
+
place_order: EIP712OrderValues;
|
|
81
|
+
transfer_quote: EIP712TransferQuoteValues;
|
|
82
|
+
withdraw_collateral: EIP712WithdrawCollateralValues;
|
|
83
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getValidatedAddress } from '../utils/getValidatedAddress';
|
|
2
|
+
import { TypedDataDomain } from 'abitype';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gives the EIP712 data domain for order signing
|
|
6
|
+
*
|
|
7
|
+
* @param contractAddress usually the address of the orderbook (for orders) or sequencer (for other operations)
|
|
8
|
+
* @param chainId
|
|
9
|
+
*/
|
|
10
|
+
export function getNadoEIP712Domain(
|
|
11
|
+
contractAddress: string,
|
|
12
|
+
chainId: number,
|
|
13
|
+
): TypedDataDomain {
|
|
14
|
+
return {
|
|
15
|
+
name: 'Nado',
|
|
16
|
+
version: '0.0.1',
|
|
17
|
+
chainId,
|
|
18
|
+
verifyingContract: getValidatedAddress(contractAddress),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getNadoEIP712Types } from './getNadoEIP712Types';
|
|
2
|
+
import { SignableRequestType } from './signableRequestType';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Return the primary EIP712 type for a given request
|
|
6
|
+
*
|
|
7
|
+
* @param requestType
|
|
8
|
+
*/
|
|
9
|
+
export function getNadoEIP712PrimaryType(requestType: SignableRequestType) {
|
|
10
|
+
const types = getNadoEIP712Types(requestType);
|
|
11
|
+
// We assume the first key is the primary type. Currently, all Nado EIP712 messages only have one type
|
|
12
|
+
return Object.keys(types)[0];
|
|
13
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { SignableRequestType } from './signableRequestType';
|
|
2
|
+
|
|
3
|
+
interface TypedDataField {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Return the EIP712 types for a given request
|
|
10
|
+
*
|
|
11
|
+
* @param requestType
|
|
12
|
+
*/
|
|
13
|
+
export function getNadoEIP712Types(
|
|
14
|
+
requestType: SignableRequestType,
|
|
15
|
+
): Record<string, Array<TypedDataField>> {
|
|
16
|
+
switch (requestType) {
|
|
17
|
+
case 'withdraw_collateral':
|
|
18
|
+
return {
|
|
19
|
+
WithdrawCollateral: [
|
|
20
|
+
{ name: 'sender', type: 'bytes32' },
|
|
21
|
+
{ name: 'productId', type: 'uint32' },
|
|
22
|
+
{ name: 'amount', type: 'uint128' },
|
|
23
|
+
{ name: 'nonce', type: 'uint64' },
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
case 'place_order':
|
|
27
|
+
return {
|
|
28
|
+
Order: [
|
|
29
|
+
{ name: 'sender', type: 'bytes32' },
|
|
30
|
+
{ name: 'priceX18', type: 'int128' },
|
|
31
|
+
{ name: 'amount', type: 'int128' },
|
|
32
|
+
{ name: 'expiration', type: 'uint64' },
|
|
33
|
+
{ name: 'nonce', type: 'uint64' },
|
|
34
|
+
{ name: 'appendix', type: 'uint128' },
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
case 'list_trigger_orders':
|
|
38
|
+
return {
|
|
39
|
+
ListTriggerOrders: [
|
|
40
|
+
{ name: 'sender', type: 'bytes32' },
|
|
41
|
+
{ name: 'recvTime', type: 'uint64' },
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
case 'cancel_orders':
|
|
45
|
+
return {
|
|
46
|
+
Cancellation: [
|
|
47
|
+
{ name: 'sender', type: 'bytes32' },
|
|
48
|
+
{ name: 'productIds', type: 'uint32[]' },
|
|
49
|
+
{ name: 'digests', type: 'bytes32[]' },
|
|
50
|
+
{ name: 'nonce', type: 'uint64' },
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
case 'cancel_product_orders':
|
|
54
|
+
return {
|
|
55
|
+
CancellationProducts: [
|
|
56
|
+
{ name: 'sender', type: 'bytes32' },
|
|
57
|
+
{ name: 'productIds', type: 'uint32[]' },
|
|
58
|
+
{ name: 'nonce', type: 'uint64' },
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
case 'liquidate_subaccount':
|
|
62
|
+
return {
|
|
63
|
+
LiquidateSubaccount: [
|
|
64
|
+
{ name: 'sender', type: 'bytes32' },
|
|
65
|
+
{ name: 'liquidatee', type: 'bytes32' },
|
|
66
|
+
{ name: 'mode', type: 'uint8' },
|
|
67
|
+
{ name: 'healthGroup', type: 'uint32' },
|
|
68
|
+
{ name: 'amount', type: 'int128' },
|
|
69
|
+
{ name: 'nonce', type: 'uint64' },
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
case 'link_signer':
|
|
73
|
+
return {
|
|
74
|
+
LinkSigner: [
|
|
75
|
+
{ name: 'sender', type: 'bytes32' },
|
|
76
|
+
{ name: 'signer', type: 'bytes32' },
|
|
77
|
+
{ name: 'nonce', type: 'uint64' },
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
case 'transfer_quote':
|
|
81
|
+
return {
|
|
82
|
+
TransferQuote: [
|
|
83
|
+
{ name: 'sender', type: 'bytes32' },
|
|
84
|
+
{ name: 'recipient', type: 'bytes32' },
|
|
85
|
+
{ name: 'amount', type: 'uint128' },
|
|
86
|
+
{ name: 'nonce', type: 'uint64' },
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
case 'leaderboard_authentication':
|
|
90
|
+
return {
|
|
91
|
+
LeaderboardAuthentication: [
|
|
92
|
+
{ name: 'sender', type: 'bytes32' },
|
|
93
|
+
{ name: 'expiration', type: 'uint64' },
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
case 'mint_nlp':
|
|
97
|
+
return {
|
|
98
|
+
MintNlp: [
|
|
99
|
+
{ name: 'sender', type: 'bytes32' },
|
|
100
|
+
{ name: 'quoteAmount', type: 'uint128' },
|
|
101
|
+
{ name: 'nonce', type: 'uint64' },
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
case 'burn_nlp':
|
|
105
|
+
return {
|
|
106
|
+
BurnNlp: [
|
|
107
|
+
{ name: 'sender', type: 'bytes32' },
|
|
108
|
+
{ name: 'nlpAmount', type: 'uint128' },
|
|
109
|
+
{ name: 'nonce', type: 'uint64' },
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|