@nktkas/hyperliquid 0.25.7 → 0.25.8
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/CONTRIBUTING.md +26 -19
- package/README.md +57 -5
- package/esm/bin/cli.js +1 -0
- package/esm/bin/cli.js.map +1 -1
- package/esm/src/api/_common_schemas.d.ts +19 -0
- package/esm/src/api/_common_schemas.d.ts.map +1 -1
- package/esm/src/api/_common_schemas.js +15 -0
- package/esm/src/api/_common_schemas.js.map +1 -1
- package/esm/src/api/exchange/_base/_execute.d.ts +6 -7
- package/esm/src/api/exchange/_base/_execute.d.ts.map +1 -1
- package/esm/src/api/exchange/_base/_execute.js +67 -43
- package/esm/src/api/exchange/_base/_execute.js.map +1 -1
- package/esm/src/api/exchange/_base/_types.d.ts +0 -7
- package/esm/src/api/exchange/_base/_types.d.ts.map +1 -1
- package/esm/src/api/exchange/_base/mod.d.ts +0 -2
- package/esm/src/api/exchange/_base/mod.d.ts.map +1 -1
- package/esm/src/api/exchange/_base/mod.js +0 -2
- package/esm/src/api/exchange/_base/mod.js.map +1 -1
- package/esm/src/api/exchange/agentEnableDexAbstraction.d.ts.map +1 -1
- package/esm/src/api/exchange/agentEnableDexAbstraction.js +14 -7
- package/esm/src/api/exchange/agentEnableDexAbstraction.js.map +1 -1
- package/esm/src/api/exchange/approveAgent.d.ts.map +1 -1
- package/esm/src/api/exchange/approveAgent.js +16 -8
- package/esm/src/api/exchange/approveAgent.js.map +1 -1
- package/esm/src/api/exchange/approveBuilderFee.d.ts.map +1 -1
- package/esm/src/api/exchange/approveBuilderFee.js +16 -8
- package/esm/src/api/exchange/approveBuilderFee.js.map +1 -1
- package/esm/src/api/exchange/batchModify.d.ts.map +1 -1
- package/esm/src/api/exchange/batchModify.js +16 -10
- package/esm/src/api/exchange/batchModify.js.map +1 -1
- package/esm/src/api/exchange/cDeposit.d.ts.map +1 -1
- package/esm/src/api/exchange/cDeposit.js +16 -8
- package/esm/src/api/exchange/cDeposit.js.map +1 -1
- package/esm/src/api/exchange/cSignerAction.d.ts.map +1 -1
- package/esm/src/api/exchange/cSignerAction.js +15 -8
- package/esm/src/api/exchange/cSignerAction.js.map +1 -1
- package/esm/src/api/exchange/cValidatorAction.d.ts.map +1 -1
- package/esm/src/api/exchange/cValidatorAction.js +15 -8
- package/esm/src/api/exchange/cValidatorAction.js.map +1 -1
- package/esm/src/api/exchange/cWithdraw.d.ts.map +1 -1
- package/esm/src/api/exchange/cWithdraw.js +16 -8
- package/esm/src/api/exchange/cWithdraw.js.map +1 -1
- package/esm/src/api/exchange/cancel.d.ts.map +1 -1
- package/esm/src/api/exchange/cancel.js +16 -10
- package/esm/src/api/exchange/cancel.js.map +1 -1
- package/esm/src/api/exchange/cancelByCloid.d.ts.map +1 -1
- package/esm/src/api/exchange/cancelByCloid.js +16 -10
- package/esm/src/api/exchange/cancelByCloid.js.map +1 -1
- package/esm/src/api/exchange/claimRewards.d.ts.map +1 -1
- package/esm/src/api/exchange/claimRewards.js +14 -7
- package/esm/src/api/exchange/claimRewards.js.map +1 -1
- package/esm/src/api/exchange/convertToMultiSigUser.d.ts.map +1 -1
- package/esm/src/api/exchange/convertToMultiSigUser.js +16 -8
- package/esm/src/api/exchange/convertToMultiSigUser.js.map +1 -1
- package/esm/src/api/exchange/createSubAccount.d.ts.map +1 -1
- package/esm/src/api/exchange/createSubAccount.js +15 -8
- package/esm/src/api/exchange/createSubAccount.js.map +1 -1
- package/esm/src/api/exchange/createVault.d.ts.map +1 -1
- package/esm/src/api/exchange/createVault.js +15 -8
- package/esm/src/api/exchange/createVault.js.map +1 -1
- package/esm/src/api/exchange/evmUserModify.d.ts +1 -1
- package/esm/src/api/exchange/evmUserModify.d.ts.map +1 -1
- package/esm/src/api/exchange/evmUserModify.js +16 -9
- package/esm/src/api/exchange/evmUserModify.js.map +1 -1
- package/esm/src/api/exchange/linkStakingUser.d.ts +112 -0
- package/esm/src/api/exchange/linkStakingUser.d.ts.map +1 -0
- package/esm/src/api/exchange/linkStakingUser.js +99 -0
- package/esm/src/api/exchange/linkStakingUser.js.map +1 -0
- package/esm/src/api/exchange/modify.d.ts.map +1 -1
- package/esm/src/api/exchange/modify.js +16 -10
- package/esm/src/api/exchange/modify.js.map +1 -1
- package/esm/src/api/exchange/multiSig.d.ts.map +1 -1
- package/esm/src/api/exchange/multiSig.js +17 -16
- package/esm/src/api/exchange/multiSig.js.map +1 -1
- package/esm/src/api/exchange/noop.d.ts.map +1 -1
- package/esm/src/api/exchange/noop.js +14 -7
- package/esm/src/api/exchange/noop.js.map +1 -1
- package/esm/src/api/exchange/order.d.ts.map +1 -1
- package/esm/src/api/exchange/order.js +16 -10
- package/esm/src/api/exchange/order.js.map +1 -1
- package/esm/src/api/exchange/perpDeploy.d.ts.map +1 -1
- package/esm/src/api/exchange/perpDeploy.js +15 -8
- package/esm/src/api/exchange/perpDeploy.js.map +1 -1
- package/esm/src/api/exchange/registerReferrer.d.ts.map +1 -1
- package/esm/src/api/exchange/registerReferrer.js +15 -8
- package/esm/src/api/exchange/registerReferrer.js.map +1 -1
- package/esm/src/api/exchange/reserveRequestWeight.d.ts.map +1 -1
- package/esm/src/api/exchange/reserveRequestWeight.js +15 -8
- package/esm/src/api/exchange/reserveRequestWeight.js.map +1 -1
- package/esm/src/api/exchange/scheduleCancel.js +16 -10
- package/esm/src/api/exchange/scheduleCancel.js.map +1 -1
- package/esm/src/api/exchange/sendAsset.d.ts.map +1 -1
- package/esm/src/api/exchange/sendAsset.js +16 -8
- package/esm/src/api/exchange/sendAsset.js.map +1 -1
- package/esm/src/api/exchange/setDisplayName.d.ts.map +1 -1
- package/esm/src/api/exchange/setDisplayName.js +15 -8
- package/esm/src/api/exchange/setDisplayName.js.map +1 -1
- package/esm/src/api/exchange/setReferrer.d.ts.map +1 -1
- package/esm/src/api/exchange/setReferrer.js +15 -8
- package/esm/src/api/exchange/setReferrer.js.map +1 -1
- package/esm/src/api/exchange/spotDeploy.d.ts.map +1 -1
- package/esm/src/api/exchange/spotDeploy.js +15 -8
- package/esm/src/api/exchange/spotDeploy.js.map +1 -1
- package/esm/src/api/exchange/spotSend.d.ts.map +1 -1
- package/esm/src/api/exchange/spotSend.js +16 -8
- package/esm/src/api/exchange/spotSend.js.map +1 -1
- package/esm/src/api/exchange/spotUser.d.ts.map +1 -1
- package/esm/src/api/exchange/spotUser.js +15 -8
- package/esm/src/api/exchange/spotUser.js.map +1 -1
- package/esm/src/api/exchange/subAccountModify.d.ts.map +1 -1
- package/esm/src/api/exchange/subAccountModify.js +15 -8
- package/esm/src/api/exchange/subAccountModify.js.map +1 -1
- package/esm/src/api/exchange/subAccountSpotTransfer.d.ts.map +1 -1
- package/esm/src/api/exchange/subAccountSpotTransfer.js +15 -8
- package/esm/src/api/exchange/subAccountSpotTransfer.js.map +1 -1
- package/esm/src/api/exchange/subAccountTransfer.d.ts.map +1 -1
- package/esm/src/api/exchange/subAccountTransfer.js +15 -8
- package/esm/src/api/exchange/subAccountTransfer.js.map +1 -1
- package/esm/src/api/exchange/tokenDelegate.d.ts.map +1 -1
- package/esm/src/api/exchange/tokenDelegate.js +16 -8
- package/esm/src/api/exchange/tokenDelegate.js.map +1 -1
- package/esm/src/api/exchange/twapCancel.d.ts.map +1 -1
- package/esm/src/api/exchange/twapCancel.js +16 -10
- package/esm/src/api/exchange/twapCancel.js.map +1 -1
- package/esm/src/api/exchange/twapOrder.d.ts.map +1 -1
- package/esm/src/api/exchange/twapOrder.js +16 -10
- package/esm/src/api/exchange/twapOrder.js.map +1 -1
- package/esm/src/api/exchange/updateIsolatedMargin.d.ts.map +1 -1
- package/esm/src/api/exchange/updateIsolatedMargin.js +16 -10
- package/esm/src/api/exchange/updateIsolatedMargin.js.map +1 -1
- package/esm/src/api/exchange/updateLeverage.d.ts.map +1 -1
- package/esm/src/api/exchange/updateLeverage.js +16 -10
- package/esm/src/api/exchange/updateLeverage.js.map +1 -1
- package/esm/src/api/exchange/usdClassTransfer.d.ts.map +1 -1
- package/esm/src/api/exchange/usdClassTransfer.js +16 -8
- package/esm/src/api/exchange/usdClassTransfer.js.map +1 -1
- package/esm/src/api/exchange/usdSend.d.ts.map +1 -1
- package/esm/src/api/exchange/usdSend.js +16 -8
- package/esm/src/api/exchange/usdSend.js.map +1 -1
- package/esm/src/api/exchange/userDexAbstraction.d.ts.map +1 -1
- package/esm/src/api/exchange/userDexAbstraction.js +16 -8
- package/esm/src/api/exchange/userDexAbstraction.js.map +1 -1
- package/esm/src/api/exchange/vaultDistribute.d.ts.map +1 -1
- package/esm/src/api/exchange/vaultDistribute.js +15 -8
- package/esm/src/api/exchange/vaultDistribute.js.map +1 -1
- package/esm/src/api/exchange/vaultModify.d.ts.map +1 -1
- package/esm/src/api/exchange/vaultModify.js +15 -8
- package/esm/src/api/exchange/vaultModify.js.map +1 -1
- package/esm/src/api/exchange/vaultTransfer.d.ts.map +1 -1
- package/esm/src/api/exchange/vaultTransfer.js +15 -8
- package/esm/src/api/exchange/vaultTransfer.js.map +1 -1
- package/esm/src/api/exchange/withdraw3.d.ts.map +1 -1
- package/esm/src/api/exchange/withdraw3.js +16 -8
- package/esm/src/api/exchange/withdraw3.js.map +1 -1
- package/esm/src/api/exchange/~client.d.ts +31 -3
- package/esm/src/api/exchange/~client.d.ts.map +1 -1
- package/esm/src/api/exchange/~client.js +27 -4
- package/esm/src/api/exchange/~client.js.map +1 -1
- package/esm/src/api/exchange/~mod.d.ts +1 -0
- package/esm/src/api/exchange/~mod.d.ts.map +1 -1
- package/esm/src/api/exchange/~mod.js +1 -0
- package/esm/src/api/exchange/~mod.js.map +1 -1
- package/esm/src/api/info/allPerpMetas.d.ts +5 -0
- package/esm/src/api/info/allPerpMetas.d.ts.map +1 -1
- package/esm/src/api/info/meta.d.ts +5 -0
- package/esm/src/api/info/meta.d.ts.map +1 -1
- package/esm/src/api/info/meta.js +2 -0
- package/esm/src/api/info/meta.js.map +1 -1
- package/esm/src/api/info/metaAndAssetCtxs.d.ts +5 -0
- package/esm/src/api/info/metaAndAssetCtxs.d.ts.map +1 -1
- package/esm/src/api/info/perpDexs.d.ts +4 -0
- package/esm/src/api/info/perpDexs.d.ts.map +1 -1
- package/esm/src/api/info/perpDexs.js +5 -0
- package/esm/src/api/info/perpDexs.js.map +1 -1
- package/esm/src/api/info/spotClearinghouseState.d.ts +0 -5
- package/esm/src/api/info/spotClearinghouseState.d.ts.map +1 -1
- package/esm/src/api/info/spotClearinghouseState.js +2 -14
- package/esm/src/api/info/spotClearinghouseState.js.map +1 -1
- package/esm/src/api/info/userFees.d.ts +27 -2
- package/esm/src/api/info/userFees.d.ts.map +1 -1
- package/esm/src/api/info/userFees.js +29 -1
- package/esm/src/api/info/userFees.js.map +1 -1
- package/esm/src/api/info/webData2.d.ts +6 -0
- package/esm/src/api/info/webData2.d.ts.map +1 -1
- package/esm/src/api/info/~client.d.ts +9 -1
- package/esm/src/api/info/~client.d.ts.map +1 -1
- package/esm/src/api/subscription/spotState.d.ts +91 -0
- package/esm/src/api/subscription/spotState.d.ts.map +1 -0
- package/esm/src/api/subscription/spotState.js +58 -0
- package/esm/src/api/subscription/spotState.js.map +1 -0
- package/esm/src/api/subscription/webData2.d.ts +5 -0
- package/esm/src/api/subscription/webData2.d.ts.map +1 -1
- package/esm/src/api/subscription/~client.d.ts +22 -0
- package/esm/src/api/subscription/~client.d.ts.map +1 -1
- package/esm/src/api/subscription/~client.js +23 -0
- package/esm/src/api/subscription/~client.js.map +1 -1
- package/esm/src/api/subscription/~mod.d.ts +1 -0
- package/esm/src/api/subscription/~mod.d.ts.map +1 -1
- package/esm/src/api/subscription/~mod.js +1 -0
- package/esm/src/api/subscription/~mod.js.map +1 -1
- package/esm/src/signing/_signTypedData.d.ts +1 -1
- package/esm/src/signing/_signTypedData.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData.js +1 -1
- package/esm/src/signing/_signTypedData.js.map +1 -1
- package/esm/src/utils/{_minimalEIP712Signer.d.ts → _eip712.d.ts} +16 -1
- package/esm/src/utils/_eip712.d.ts.map +1 -0
- package/esm/src/utils/{_minimalEIP712Signer.js → _eip712.js} +14 -11
- package/esm/src/utils/_eip712.js.map +1 -0
- package/esm/src/utils/_format.d.ts +3 -4
- package/esm/src/utils/_format.d.ts.map +1 -1
- package/esm/src/utils/_format.js +98 -88
- package/esm/src/utils/_format.js.map +1 -1
- package/esm/src/utils/_recover.d.ts +89 -0
- package/esm/src/utils/_recover.d.ts.map +1 -0
- package/esm/src/utils/_recover.js +119 -0
- package/esm/src/utils/_recover.js.map +1 -0
- package/esm/src/utils/mod.d.ts +1 -0
- package/esm/src/utils/mod.d.ts.map +1 -1
- package/esm/src/utils/mod.js +1 -0
- package/esm/src/utils/mod.js.map +1 -1
- package/package.json +3 -2
- package/script/bin/cli.js +1 -0
- package/script/bin/cli.js.map +1 -1
- package/script/src/api/_common_schemas.d.ts +19 -0
- package/script/src/api/_common_schemas.d.ts.map +1 -1
- package/script/src/api/_common_schemas.js +16 -1
- package/script/src/api/_common_schemas.js.map +1 -1
- package/script/src/api/exchange/_base/_execute.d.ts +6 -7
- package/script/src/api/exchange/_base/_execute.d.ts.map +1 -1
- package/script/src/api/exchange/_base/_execute.js +67 -43
- package/script/src/api/exchange/_base/_execute.js.map +1 -1
- package/script/src/api/exchange/_base/_types.d.ts +0 -7
- package/script/src/api/exchange/_base/_types.d.ts.map +1 -1
- package/script/src/api/exchange/_base/mod.d.ts +0 -2
- package/script/src/api/exchange/_base/mod.d.ts.map +1 -1
- package/script/src/api/exchange/_base/mod.js +0 -2
- package/script/src/api/exchange/_base/mod.js.map +1 -1
- package/script/src/api/exchange/agentEnableDexAbstraction.d.ts.map +1 -1
- package/script/src/api/exchange/agentEnableDexAbstraction.js +14 -7
- package/script/src/api/exchange/agentEnableDexAbstraction.js.map +1 -1
- package/script/src/api/exchange/approveAgent.d.ts.map +1 -1
- package/script/src/api/exchange/approveAgent.js +15 -7
- package/script/src/api/exchange/approveAgent.js.map +1 -1
- package/script/src/api/exchange/approveBuilderFee.d.ts.map +1 -1
- package/script/src/api/exchange/approveBuilderFee.js +15 -7
- package/script/src/api/exchange/approveBuilderFee.js.map +1 -1
- package/script/src/api/exchange/batchModify.d.ts.map +1 -1
- package/script/src/api/exchange/batchModify.js +16 -10
- package/script/src/api/exchange/batchModify.js.map +1 -1
- package/script/src/api/exchange/cDeposit.d.ts.map +1 -1
- package/script/src/api/exchange/cDeposit.js +15 -7
- package/script/src/api/exchange/cDeposit.js.map +1 -1
- package/script/src/api/exchange/cSignerAction.d.ts.map +1 -1
- package/script/src/api/exchange/cSignerAction.js +15 -8
- package/script/src/api/exchange/cSignerAction.js.map +1 -1
- package/script/src/api/exchange/cValidatorAction.d.ts.map +1 -1
- package/script/src/api/exchange/cValidatorAction.js +15 -8
- package/script/src/api/exchange/cValidatorAction.js.map +1 -1
- package/script/src/api/exchange/cWithdraw.d.ts.map +1 -1
- package/script/src/api/exchange/cWithdraw.js +15 -7
- package/script/src/api/exchange/cWithdraw.js.map +1 -1
- package/script/src/api/exchange/cancel.d.ts.map +1 -1
- package/script/src/api/exchange/cancel.js +16 -10
- package/script/src/api/exchange/cancel.js.map +1 -1
- package/script/src/api/exchange/cancelByCloid.d.ts.map +1 -1
- package/script/src/api/exchange/cancelByCloid.js +16 -10
- package/script/src/api/exchange/cancelByCloid.js.map +1 -1
- package/script/src/api/exchange/claimRewards.d.ts.map +1 -1
- package/script/src/api/exchange/claimRewards.js +14 -7
- package/script/src/api/exchange/claimRewards.js.map +1 -1
- package/script/src/api/exchange/convertToMultiSigUser.d.ts.map +1 -1
- package/script/src/api/exchange/convertToMultiSigUser.js +15 -7
- package/script/src/api/exchange/convertToMultiSigUser.js.map +1 -1
- package/script/src/api/exchange/createSubAccount.d.ts.map +1 -1
- package/script/src/api/exchange/createSubAccount.js +15 -8
- package/script/src/api/exchange/createSubAccount.js.map +1 -1
- package/script/src/api/exchange/createVault.d.ts.map +1 -1
- package/script/src/api/exchange/createVault.js +15 -8
- package/script/src/api/exchange/createVault.js.map +1 -1
- package/script/src/api/exchange/evmUserModify.d.ts +1 -1
- package/script/src/api/exchange/evmUserModify.d.ts.map +1 -1
- package/script/src/api/exchange/evmUserModify.js +16 -9
- package/script/src/api/exchange/evmUserModify.js.map +1 -1
- package/script/src/api/exchange/linkStakingUser.d.ts +112 -0
- package/script/src/api/exchange/linkStakingUser.d.ts.map +1 -0
- package/script/src/api/exchange/linkStakingUser.js +136 -0
- package/script/src/api/exchange/linkStakingUser.js.map +1 -0
- package/script/src/api/exchange/modify.d.ts.map +1 -1
- package/script/src/api/exchange/modify.js +16 -10
- package/script/src/api/exchange/modify.js.map +1 -1
- package/script/src/api/exchange/multiSig.d.ts.map +1 -1
- package/script/src/api/exchange/multiSig.js +17 -16
- package/script/src/api/exchange/multiSig.js.map +1 -1
- package/script/src/api/exchange/noop.d.ts.map +1 -1
- package/script/src/api/exchange/noop.js +14 -7
- package/script/src/api/exchange/noop.js.map +1 -1
- package/script/src/api/exchange/order.d.ts.map +1 -1
- package/script/src/api/exchange/order.js +16 -10
- package/script/src/api/exchange/order.js.map +1 -1
- package/script/src/api/exchange/perpDeploy.d.ts.map +1 -1
- package/script/src/api/exchange/perpDeploy.js +15 -8
- package/script/src/api/exchange/perpDeploy.js.map +1 -1
- package/script/src/api/exchange/registerReferrer.d.ts.map +1 -1
- package/script/src/api/exchange/registerReferrer.js +15 -8
- package/script/src/api/exchange/registerReferrer.js.map +1 -1
- package/script/src/api/exchange/reserveRequestWeight.d.ts.map +1 -1
- package/script/src/api/exchange/reserveRequestWeight.js +15 -8
- package/script/src/api/exchange/reserveRequestWeight.js.map +1 -1
- package/script/src/api/exchange/scheduleCancel.js +16 -10
- package/script/src/api/exchange/scheduleCancel.js.map +1 -1
- package/script/src/api/exchange/sendAsset.d.ts.map +1 -1
- package/script/src/api/exchange/sendAsset.js +15 -7
- package/script/src/api/exchange/sendAsset.js.map +1 -1
- package/script/src/api/exchange/setDisplayName.d.ts.map +1 -1
- package/script/src/api/exchange/setDisplayName.js +15 -8
- package/script/src/api/exchange/setDisplayName.js.map +1 -1
- package/script/src/api/exchange/setReferrer.d.ts.map +1 -1
- package/script/src/api/exchange/setReferrer.js +15 -8
- package/script/src/api/exchange/setReferrer.js.map +1 -1
- package/script/src/api/exchange/spotDeploy.d.ts.map +1 -1
- package/script/src/api/exchange/spotDeploy.js +15 -8
- package/script/src/api/exchange/spotDeploy.js.map +1 -1
- package/script/src/api/exchange/spotSend.d.ts.map +1 -1
- package/script/src/api/exchange/spotSend.js +15 -7
- package/script/src/api/exchange/spotSend.js.map +1 -1
- package/script/src/api/exchange/spotUser.d.ts.map +1 -1
- package/script/src/api/exchange/spotUser.js +15 -8
- package/script/src/api/exchange/spotUser.js.map +1 -1
- package/script/src/api/exchange/subAccountModify.d.ts.map +1 -1
- package/script/src/api/exchange/subAccountModify.js +15 -8
- package/script/src/api/exchange/subAccountModify.js.map +1 -1
- package/script/src/api/exchange/subAccountSpotTransfer.d.ts.map +1 -1
- package/script/src/api/exchange/subAccountSpotTransfer.js +15 -8
- package/script/src/api/exchange/subAccountSpotTransfer.js.map +1 -1
- package/script/src/api/exchange/subAccountTransfer.d.ts.map +1 -1
- package/script/src/api/exchange/subAccountTransfer.js +15 -8
- package/script/src/api/exchange/subAccountTransfer.js.map +1 -1
- package/script/src/api/exchange/tokenDelegate.d.ts.map +1 -1
- package/script/src/api/exchange/tokenDelegate.js +15 -7
- package/script/src/api/exchange/tokenDelegate.js.map +1 -1
- package/script/src/api/exchange/twapCancel.d.ts.map +1 -1
- package/script/src/api/exchange/twapCancel.js +16 -10
- package/script/src/api/exchange/twapCancel.js.map +1 -1
- package/script/src/api/exchange/twapOrder.d.ts.map +1 -1
- package/script/src/api/exchange/twapOrder.js +16 -10
- package/script/src/api/exchange/twapOrder.js.map +1 -1
- package/script/src/api/exchange/updateIsolatedMargin.d.ts.map +1 -1
- package/script/src/api/exchange/updateIsolatedMargin.js +16 -10
- package/script/src/api/exchange/updateIsolatedMargin.js.map +1 -1
- package/script/src/api/exchange/updateLeverage.d.ts.map +1 -1
- package/script/src/api/exchange/updateLeverage.js +16 -10
- package/script/src/api/exchange/updateLeverage.js.map +1 -1
- package/script/src/api/exchange/usdClassTransfer.d.ts.map +1 -1
- package/script/src/api/exchange/usdClassTransfer.js +15 -7
- package/script/src/api/exchange/usdClassTransfer.js.map +1 -1
- package/script/src/api/exchange/usdSend.d.ts.map +1 -1
- package/script/src/api/exchange/usdSend.js +15 -7
- package/script/src/api/exchange/usdSend.js.map +1 -1
- package/script/src/api/exchange/userDexAbstraction.d.ts.map +1 -1
- package/script/src/api/exchange/userDexAbstraction.js +15 -7
- package/script/src/api/exchange/userDexAbstraction.js.map +1 -1
- package/script/src/api/exchange/vaultDistribute.d.ts.map +1 -1
- package/script/src/api/exchange/vaultDistribute.js +15 -8
- package/script/src/api/exchange/vaultDistribute.js.map +1 -1
- package/script/src/api/exchange/vaultModify.d.ts.map +1 -1
- package/script/src/api/exchange/vaultModify.js +15 -8
- package/script/src/api/exchange/vaultModify.js.map +1 -1
- package/script/src/api/exchange/vaultTransfer.d.ts.map +1 -1
- package/script/src/api/exchange/vaultTransfer.js +15 -8
- package/script/src/api/exchange/vaultTransfer.js.map +1 -1
- package/script/src/api/exchange/withdraw3.d.ts.map +1 -1
- package/script/src/api/exchange/withdraw3.js +15 -7
- package/script/src/api/exchange/withdraw3.js.map +1 -1
- package/script/src/api/exchange/~client.d.ts +31 -3
- package/script/src/api/exchange/~client.d.ts.map +1 -1
- package/script/src/api/exchange/~client.js +29 -6
- package/script/src/api/exchange/~client.js.map +1 -1
- package/script/src/api/exchange/~mod.d.ts +1 -0
- package/script/src/api/exchange/~mod.d.ts.map +1 -1
- package/script/src/api/exchange/~mod.js +1 -0
- package/script/src/api/exchange/~mod.js.map +1 -1
- package/script/src/api/info/allPerpMetas.d.ts +5 -0
- package/script/src/api/info/allPerpMetas.d.ts.map +1 -1
- package/script/src/api/info/meta.d.ts +5 -0
- package/script/src/api/info/meta.d.ts.map +1 -1
- package/script/src/api/info/meta.js +2 -0
- package/script/src/api/info/meta.js.map +1 -1
- package/script/src/api/info/metaAndAssetCtxs.d.ts +5 -0
- package/script/src/api/info/metaAndAssetCtxs.d.ts.map +1 -1
- package/script/src/api/info/perpDexs.d.ts +4 -0
- package/script/src/api/info/perpDexs.d.ts.map +1 -1
- package/script/src/api/info/perpDexs.js +5 -0
- package/script/src/api/info/perpDexs.js.map +1 -1
- package/script/src/api/info/spotClearinghouseState.d.ts +0 -5
- package/script/src/api/info/spotClearinghouseState.d.ts.map +1 -1
- package/script/src/api/info/spotClearinghouseState.js +2 -14
- package/script/src/api/info/spotClearinghouseState.js.map +1 -1
- package/script/src/api/info/userFees.d.ts +27 -2
- package/script/src/api/info/userFees.d.ts.map +1 -1
- package/script/src/api/info/userFees.js +29 -1
- package/script/src/api/info/userFees.js.map +1 -1
- package/script/src/api/info/webData2.d.ts +6 -0
- package/script/src/api/info/webData2.d.ts.map +1 -1
- package/script/src/api/info/~client.d.ts +9 -1
- package/script/src/api/info/~client.d.ts.map +1 -1
- package/script/src/api/subscription/spotState.d.ts +91 -0
- package/script/src/api/subscription/spotState.d.ts.map +1 -0
- package/script/src/api/subscription/spotState.js +95 -0
- package/script/src/api/subscription/spotState.js.map +1 -0
- package/script/src/api/subscription/webData2.d.ts +5 -0
- package/script/src/api/subscription/webData2.d.ts.map +1 -1
- package/script/src/api/subscription/~client.d.ts +22 -0
- package/script/src/api/subscription/~client.d.ts.map +1 -1
- package/script/src/api/subscription/~client.js +23 -0
- package/script/src/api/subscription/~client.js.map +1 -1
- package/script/src/api/subscription/~mod.d.ts +1 -0
- package/script/src/api/subscription/~mod.d.ts.map +1 -1
- package/script/src/api/subscription/~mod.js +1 -0
- package/script/src/api/subscription/~mod.js.map +1 -1
- package/script/src/signing/_signTypedData.d.ts +1 -1
- package/script/src/signing/_signTypedData.d.ts.map +1 -1
- package/script/src/signing/_signTypedData.js +1 -1
- package/script/src/signing/_signTypedData.js.map +1 -1
- package/script/src/utils/{_minimalEIP712Signer.d.ts → _eip712.d.ts} +16 -1
- package/script/src/utils/_eip712.d.ts.map +1 -0
- package/script/src/utils/{_minimalEIP712Signer.js → _eip712.js} +14 -9
- package/script/src/utils/_eip712.js.map +1 -0
- package/script/src/utils/_format.d.ts +3 -4
- package/script/src/utils/_format.d.ts.map +1 -1
- package/script/src/utils/_format.js +98 -88
- package/script/src/utils/_format.js.map +1 -1
- package/script/src/utils/_recover.d.ts +89 -0
- package/script/src/utils/_recover.d.ts.map +1 -0
- package/script/src/utils/_recover.js +156 -0
- package/script/src/utils/_recover.js.map +1 -0
- package/script/src/utils/mod.d.ts +1 -0
- package/script/src/utils/mod.d.ts.map +1 -1
- package/script/src/utils/mod.js +1 -0
- package/script/src/utils/mod.js.map +1 -1
- package/src/bin/cli.ts +1 -0
- package/src/src/api/_common_schemas.ts +34 -0
- package/src/src/api/exchange/_base/_execute.ts +73 -49
- package/src/src/api/exchange/_base/_types.ts +0 -7
- package/src/src/api/exchange/_base/mod.ts +0 -2
- package/src/src/api/exchange/agentEnableDexAbstraction.ts +14 -9
- package/src/src/api/exchange/approveAgent.ts +15 -12
- package/src/src/api/exchange/approveBuilderFee.ts +15 -12
- package/src/src/api/exchange/batchModify.ts +16 -13
- package/src/src/api/exchange/cDeposit.ts +15 -12
- package/src/src/api/exchange/cSignerAction.ts +15 -10
- package/src/src/api/exchange/cValidatorAction.ts +15 -10
- package/src/src/api/exchange/cWithdraw.ts +15 -12
- package/src/src/api/exchange/cancel.ts +16 -13
- package/src/src/api/exchange/cancelByCloid.ts +16 -13
- package/src/src/api/exchange/claimRewards.ts +14 -9
- package/src/src/api/exchange/convertToMultiSigUser.ts +15 -12
- package/src/src/api/exchange/createSubAccount.ts +15 -10
- package/src/src/api/exchange/createVault.ts +15 -10
- package/src/src/api/exchange/evmUserModify.ts +16 -11
- package/src/src/api/exchange/linkStakingUser.ts +157 -0
- package/src/src/api/exchange/modify.ts +16 -13
- package/src/src/api/exchange/multiSig.ts +17 -23
- package/src/src/api/exchange/noop.ts +14 -9
- package/src/src/api/exchange/order.ts +16 -13
- package/src/src/api/exchange/perpDeploy.ts +15 -10
- package/src/src/api/exchange/registerReferrer.ts +15 -10
- package/src/src/api/exchange/reserveRequestWeight.ts +15 -10
- package/src/src/api/exchange/scheduleCancel.ts +16 -13
- package/src/src/api/exchange/sendAsset.ts +15 -12
- package/src/src/api/exchange/setDisplayName.ts +15 -10
- package/src/src/api/exchange/setReferrer.ts +15 -10
- package/src/src/api/exchange/spotDeploy.ts +15 -10
- package/src/src/api/exchange/spotSend.ts +15 -12
- package/src/src/api/exchange/spotUser.ts +15 -10
- package/src/src/api/exchange/subAccountModify.ts +15 -10
- package/src/src/api/exchange/subAccountSpotTransfer.ts +15 -10
- package/src/src/api/exchange/subAccountTransfer.ts +15 -10
- package/src/src/api/exchange/tokenDelegate.ts +15 -12
- package/src/src/api/exchange/twapCancel.ts +16 -13
- package/src/src/api/exchange/twapOrder.ts +16 -13
- package/src/src/api/exchange/updateIsolatedMargin.ts +16 -13
- package/src/src/api/exchange/updateLeverage.ts +16 -13
- package/src/src/api/exchange/usdClassTransfer.ts +15 -12
- package/src/src/api/exchange/usdSend.ts +15 -12
- package/src/src/api/exchange/userDexAbstraction.ts +15 -12
- package/src/src/api/exchange/vaultDistribute.ts +15 -10
- package/src/src/api/exchange/vaultModify.ts +15 -10
- package/src/src/api/exchange/vaultTransfer.ts +15 -10
- package/src/src/api/exchange/withdraw3.ts +15 -12
- package/src/src/api/exchange/~client.ts +30 -5
- package/src/src/api/exchange/~mod.ts +1 -0
- package/src/src/api/info/meta.ts +7 -0
- package/src/src/api/info/perpDexs.ts +10 -0
- package/src/src/api/info/spotClearinghouseState.ts +3 -33
- package/src/src/api/info/userFees.ts +46 -1
- package/src/src/api/subscription/spotState.ts +96 -0
- package/src/src/api/subscription/~client.ts +25 -0
- package/src/src/api/subscription/~mod.ts +1 -0
- package/src/src/signing/_signTypedData.ts +1 -1
- package/src/src/utils/{_minimalEIP712Signer.ts → _eip712.ts} +22 -29
- package/src/src/utils/_format.ts +99 -98
- package/src/src/utils/_recover.ts +178 -0
- package/src/src/utils/mod.ts +1 -0
- package/esm/src/api/exchange/_base/_sequential.d.ts +0 -30
- package/esm/src/api/exchange/_base/_sequential.d.ts.map +0 -1
- package/esm/src/api/exchange/_base/_sequential.js +0 -69
- package/esm/src/api/exchange/_base/_sequential.js.map +0 -1
- package/esm/src/utils/_minimalEIP712Signer.d.ts.map +0 -1
- package/esm/src/utils/_minimalEIP712Signer.js.map +0 -1
- package/script/src/api/exchange/_base/_sequential.d.ts +0 -30
- package/script/src/api/exchange/_base/_sequential.d.ts.map +0 -1
- package/script/src/api/exchange/_base/_sequential.js +0 -72
- package/script/src/api/exchange/_base/_sequential.js.map +0 -1
- package/script/src/utils/_minimalEIP712Signer.d.ts.map +0 -1
- package/script/src/utils/_minimalEIP712Signer.js.map +0 -1
- package/src/src/api/exchange/_base/_sequential.ts +0 -82
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getSemaphore } from "@henrygd/semaphore";
|
|
1
2
|
import { getWalletAddress, signL1Action, signMultiSigAction, signUserSignedAction } from "../../../signing/mod.js";
|
|
2
3
|
import { assertSuccessResponse } from "./_errors.js";
|
|
3
4
|
import type { AnyResponse, AnySuccessResponse, ExchangeRequestConfig, MultiSignRequestConfig } from "./_types.js";
|
|
4
5
|
import { globalNonceManager } from "./_nonce.js";
|
|
5
6
|
import { getSignatureChainId } from "./_helpers.js";
|
|
6
|
-
import { getRequestQueue } from "./_sequential.js";
|
|
7
7
|
|
|
8
8
|
export async function executeL1Action<T extends AnySuccessResponse>(
|
|
9
9
|
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
@@ -14,15 +14,26 @@ export async function executeL1Action<T extends AnySuccessResponse>(
|
|
|
14
14
|
},
|
|
15
15
|
signal?: AbortSignal,
|
|
16
16
|
): Promise<T> {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const { action, vaultAddress, expiresAfter } = request;
|
|
17
|
+
const { transport } = config;
|
|
18
|
+
const { action, vaultAddress, expiresAfter } = request;
|
|
20
19
|
|
|
20
|
+
// Sequential request execution to prevent nonce race conditions at the network layer
|
|
21
|
+
const walletAddress = "signers" in config
|
|
22
|
+
? await getWalletAddress(config.signers[0])
|
|
23
|
+
: await getWalletAddress(config.wallet);
|
|
24
|
+
const walletKey = `@nktkas/hyperliquid:${walletAddress}:${config.transport.isTestnet}`;
|
|
25
|
+
|
|
26
|
+
const sem = getSemaphore(walletKey);
|
|
27
|
+
await sem.acquire();
|
|
28
|
+
|
|
29
|
+
// Main logic
|
|
30
|
+
try {
|
|
21
31
|
const nonce = globalNonceManager.getNonce();
|
|
22
32
|
|
|
33
|
+
// Multi-signature request
|
|
23
34
|
if ("signers" in config) {
|
|
24
35
|
const { signers, multiSigUser } = config;
|
|
25
|
-
const outerSigner =
|
|
36
|
+
const outerSigner = walletAddress;
|
|
26
37
|
|
|
27
38
|
// Sign an L1 action for each signer
|
|
28
39
|
const signatures = await Promise.all(signers.map(async (signer) => {
|
|
@@ -41,12 +52,7 @@ export async function executeL1Action<T extends AnySuccessResponse>(
|
|
|
41
52
|
|
|
42
53
|
// Send a request via multi-sign action
|
|
43
54
|
return await executeMultiSigAction(
|
|
44
|
-
{
|
|
45
|
-
...config,
|
|
46
|
-
wallet: signers[0],
|
|
47
|
-
// Disable queue since we're already inside the queue
|
|
48
|
-
sequentialRequests: false,
|
|
49
|
-
},
|
|
55
|
+
{ ...config, wallet: signers[0] },
|
|
50
56
|
{
|
|
51
57
|
action: {
|
|
52
58
|
type: "multiSig",
|
|
@@ -59,8 +65,9 @@ export async function executeL1Action<T extends AnySuccessResponse>(
|
|
|
59
65
|
nonce,
|
|
60
66
|
},
|
|
61
67
|
signal,
|
|
68
|
+
false,
|
|
62
69
|
);
|
|
63
|
-
} else {
|
|
70
|
+
} else { // Single-signature request
|
|
64
71
|
const { wallet } = config;
|
|
65
72
|
|
|
66
73
|
// Sign an L1 action
|
|
@@ -82,11 +89,10 @@ export async function executeL1Action<T extends AnySuccessResponse>(
|
|
|
82
89
|
assertSuccessResponse(response);
|
|
83
90
|
return response as T;
|
|
84
91
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return queue ? await queue.enqueue(fn) : await fn();
|
|
92
|
+
} finally {
|
|
93
|
+
// Release semaphore
|
|
94
|
+
sem.release();
|
|
95
|
+
}
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
export async function executeUserSignedAction<T extends AnySuccessResponse>(
|
|
@@ -101,24 +107,37 @@ export async function executeUserSignedAction<T extends AnySuccessResponse>(
|
|
|
101
107
|
| { nonce: number; time?: undefined }
|
|
102
108
|
| { time: number; nonce?: undefined }
|
|
103
109
|
);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
+
},
|
|
111
|
+
types: {
|
|
112
|
+
[key: string]: {
|
|
113
|
+
name: string;
|
|
114
|
+
type: string;
|
|
115
|
+
}[];
|
|
110
116
|
},
|
|
111
117
|
signal?: AbortSignal,
|
|
112
118
|
): Promise<T> {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
const { transport } = config;
|
|
120
|
+
const { action } = request;
|
|
121
|
+
|
|
122
|
+
// Sequential request execution to prevent nonce race conditions at the network layer
|
|
123
|
+
const walletAddress = "signers" in config
|
|
124
|
+
? await getWalletAddress(config.signers[0])
|
|
125
|
+
: await getWalletAddress(config.wallet);
|
|
126
|
+
const walletKey = `@nktkas/hyperliquid:${walletAddress}:${config.transport.isTestnet}`;
|
|
116
127
|
|
|
117
|
-
|
|
128
|
+
const sem = getSemaphore(walletKey);
|
|
129
|
+
await sem.acquire();
|
|
118
130
|
|
|
131
|
+
// Main logic
|
|
132
|
+
try {
|
|
133
|
+
const nonce = globalNonceManager.getNonce();
|
|
134
|
+
if ("time" in action) request.action.time = nonce;
|
|
135
|
+
if ("nonce" in action) request.action.nonce = nonce;
|
|
136
|
+
|
|
137
|
+
// Multi-signature request
|
|
119
138
|
if ("signers" in config) {
|
|
120
139
|
const { signers, multiSigUser } = config;
|
|
121
|
-
const outerSigner =
|
|
140
|
+
const outerSigner = walletAddress;
|
|
122
141
|
|
|
123
142
|
// Sign a user-signed action for each signer
|
|
124
143
|
const signatures = await Promise.all(signers.map(async (signer) => {
|
|
@@ -138,12 +157,7 @@ export async function executeUserSignedAction<T extends AnySuccessResponse>(
|
|
|
138
157
|
|
|
139
158
|
// Send a request via multi-sign action
|
|
140
159
|
return await executeMultiSigAction(
|
|
141
|
-
{
|
|
142
|
-
...config,
|
|
143
|
-
wallet: signers[0],
|
|
144
|
-
// Disable queue since we're already inside the queue
|
|
145
|
-
sequentialRequests: false,
|
|
146
|
-
},
|
|
160
|
+
{ ...config, wallet: signers[0] },
|
|
147
161
|
{
|
|
148
162
|
action: {
|
|
149
163
|
type: "multiSig",
|
|
@@ -154,8 +168,9 @@ export async function executeUserSignedAction<T extends AnySuccessResponse>(
|
|
|
154
168
|
nonce,
|
|
155
169
|
},
|
|
156
170
|
signal,
|
|
171
|
+
false,
|
|
157
172
|
);
|
|
158
|
-
} else {
|
|
173
|
+
} else { // Single-signature request
|
|
159
174
|
const { wallet } = config;
|
|
160
175
|
|
|
161
176
|
// Sign a user-signed action
|
|
@@ -170,11 +185,10 @@ export async function executeUserSignedAction<T extends AnySuccessResponse>(
|
|
|
170
185
|
assertSuccessResponse(response);
|
|
171
186
|
return response as T;
|
|
172
187
|
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return queue ? await queue.enqueue(fn) : await fn();
|
|
188
|
+
} finally {
|
|
189
|
+
// Release semaphore and nonce manager
|
|
190
|
+
sem.release();
|
|
191
|
+
}
|
|
178
192
|
}
|
|
179
193
|
|
|
180
194
|
export async function executeMultiSigAction<T extends AnySuccessResponse>(
|
|
@@ -189,11 +203,22 @@ export async function executeMultiSigAction<T extends AnySuccessResponse>(
|
|
|
189
203
|
expiresAfter?: number;
|
|
190
204
|
},
|
|
191
205
|
signal?: AbortSignal,
|
|
206
|
+
semaphore = true,
|
|
192
207
|
): Promise<T> {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
208
|
+
const { transport, wallet } = config;
|
|
209
|
+
const { action, nonce, vaultAddress, expiresAfter } = request;
|
|
210
|
+
|
|
211
|
+
// Sequential request execution to prevent nonce race conditions at the network layer
|
|
212
|
+
let sem: ReturnType<typeof getSemaphore> | undefined;
|
|
213
|
+
if (semaphore) {
|
|
214
|
+
const walletAddress = await getWalletAddress(config.wallet);
|
|
215
|
+
const walletKey = `@nktkas/hyperliquid:${walletAddress}:${config.transport.isTestnet}`;
|
|
216
|
+
sem = getSemaphore(walletKey);
|
|
217
|
+
await sem.acquire();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Main logic
|
|
221
|
+
try {
|
|
197
222
|
// Sign a multi-signature action
|
|
198
223
|
const signature = await signMultiSigAction({
|
|
199
224
|
wallet,
|
|
@@ -212,9 +237,8 @@ export async function executeMultiSigAction<T extends AnySuccessResponse>(
|
|
|
212
237
|
) as AnyResponse;
|
|
213
238
|
assertSuccessResponse(response);
|
|
214
239
|
return response as T;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return queue ? await queue.enqueue(fn) : await fn();
|
|
240
|
+
} finally {
|
|
241
|
+
// Release semaphore if used
|
|
242
|
+
sem?.release();
|
|
243
|
+
}
|
|
220
244
|
}
|
|
@@ -54,13 +54,6 @@ export interface ExchangeRequestConfig<
|
|
|
54
54
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#expires-after
|
|
55
55
|
*/
|
|
56
56
|
defaultExpiresAfter?: number | (() => MaybePromise<number>);
|
|
57
|
-
/**
|
|
58
|
-
* Execute requests sequentially to prevent network-level race conditions.
|
|
59
|
-
* When enabled, requests are queued and executed one by one in order,
|
|
60
|
-
* ensuring they arrive at the server in the correct sequence.
|
|
61
|
-
* @default true
|
|
62
|
-
*/
|
|
63
|
-
sequentialRequests?: boolean;
|
|
64
57
|
}
|
|
65
58
|
|
|
66
59
|
/** Configuration for Exchange API requests using multi-signature wallets. */
|
|
@@ -86,14 +86,19 @@ export async function agentEnableDexAbstraction(
|
|
|
86
86
|
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
87
87
|
opts?: AgentEnableDexAbstractionOptions,
|
|
88
88
|
): Promise<SuccessResponse> {
|
|
89
|
-
const
|
|
90
|
-
|
|
89
|
+
const request = parser(AgentEnableDexAbstractionRequest)({
|
|
90
|
+
action: {
|
|
91
|
+
type: "agentEnableDexAbstraction",
|
|
92
|
+
},
|
|
93
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
94
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
95
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
96
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
97
|
+
v: 27,
|
|
98
|
+
},
|
|
99
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
100
|
+
? config.defaultExpiresAfter
|
|
101
|
+
: await config.defaultExpiresAfter?.(),
|
|
91
102
|
});
|
|
92
|
-
|
|
93
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
94
|
-
? config.defaultExpiresAfter
|
|
95
|
-
: await config.defaultExpiresAfter?.();
|
|
96
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
97
|
-
|
|
98
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
103
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
99
104
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type ExtractRequestAction,
|
|
7
7
|
type ExtractRequestOptions,
|
|
8
8
|
getSignatureChainId,
|
|
9
|
-
globalNonceManager,
|
|
10
9
|
type MultiSignRequestConfig,
|
|
11
10
|
Signature,
|
|
12
11
|
} from "./_base/mod.js";
|
|
@@ -123,16 +122,20 @@ export async function approveAgent(
|
|
|
123
122
|
params: DeepImmutable<ApproveAgentParameters>,
|
|
124
123
|
opts?: ApproveAgentOptions,
|
|
125
124
|
): Promise<SuccessResponse> {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
const request = parser(ApproveAgentRequest)({
|
|
126
|
+
action: {
|
|
127
|
+
type: "approveAgent",
|
|
128
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
129
|
+
signatureChainId: await getSignatureChainId(config),
|
|
130
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
131
|
+
...params,
|
|
132
|
+
},
|
|
133
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
134
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
135
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
136
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
137
|
+
v: 27,
|
|
138
|
+
},
|
|
132
139
|
});
|
|
133
|
-
return await executeUserSignedAction(
|
|
134
|
-
config,
|
|
135
|
-
{ action, types: ApproveAgentTypes },
|
|
136
|
-
opts?.signal,
|
|
137
|
-
);
|
|
140
|
+
return await executeUserSignedAction(config, request, ApproveAgentTypes, opts?.signal);
|
|
138
141
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type ExtractRequestAction,
|
|
7
7
|
type ExtractRequestOptions,
|
|
8
8
|
getSignatureChainId,
|
|
9
|
-
globalNonceManager,
|
|
10
9
|
type MultiSignRequestConfig,
|
|
11
10
|
Signature,
|
|
12
11
|
} from "./_base/mod.js";
|
|
@@ -123,16 +122,20 @@ export async function approveBuilderFee(
|
|
|
123
122
|
params: DeepImmutable<ApproveBuilderFeeParameters>,
|
|
124
123
|
opts?: ApproveBuilderFeeOptions,
|
|
125
124
|
): Promise<SuccessResponse> {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
const request = parser(ApproveBuilderFeeRequest)({
|
|
126
|
+
action: {
|
|
127
|
+
type: "approveBuilderFee",
|
|
128
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
129
|
+
signatureChainId: await getSignatureChainId(config),
|
|
130
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
131
|
+
...params,
|
|
132
|
+
},
|
|
133
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
134
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
135
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
136
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
137
|
+
v: 27,
|
|
138
|
+
},
|
|
132
139
|
});
|
|
133
|
-
return await executeUserSignedAction(
|
|
134
|
-
config,
|
|
135
|
-
{ action, types: ApproveBuilderFeeTypes },
|
|
136
|
-
opts?.signal,
|
|
137
|
-
);
|
|
140
|
+
return await executeUserSignedAction(config, request, ApproveBuilderFeeTypes, opts?.signal);
|
|
138
141
|
}
|
|
@@ -128,18 +128,21 @@ export async function batchModify(
|
|
|
128
128
|
params: DeepImmutable<BatchModifyParameters>,
|
|
129
129
|
opts?: BatchModifyOptions,
|
|
130
130
|
): Promise<OrderSuccessResponse> {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const request = parser(BatchModifyRequest)({
|
|
132
|
+
action: {
|
|
133
|
+
type: "batchModify",
|
|
134
|
+
...params,
|
|
135
|
+
},
|
|
136
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
137
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
138
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
139
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
140
|
+
v: 27,
|
|
141
|
+
},
|
|
142
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
143
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
144
|
+
? config.defaultExpiresAfter
|
|
145
|
+
: await config.defaultExpiresAfter?.(),
|
|
134
146
|
});
|
|
135
|
-
|
|
136
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
137
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
138
|
-
|
|
139
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
140
|
-
? config.defaultExpiresAfter
|
|
141
|
-
: await config.defaultExpiresAfter?.();
|
|
142
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
143
|
-
|
|
144
|
-
return await executeL1Action(config, { action, vaultAddress, expiresAfter }, opts?.signal);
|
|
147
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
145
148
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type ExtractRequestAction,
|
|
7
7
|
type ExtractRequestOptions,
|
|
8
8
|
getSignatureChainId,
|
|
9
|
-
globalNonceManager,
|
|
10
9
|
type MultiSignRequestConfig,
|
|
11
10
|
Signature,
|
|
12
11
|
} from "./_base/mod.js";
|
|
@@ -117,16 +116,20 @@ export async function cDeposit(
|
|
|
117
116
|
params: DeepImmutable<CDepositParameters>,
|
|
118
117
|
opts?: CDepositOptions,
|
|
119
118
|
): Promise<SuccessResponse> {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
const request = parser(CDepositRequest)({
|
|
120
|
+
action: {
|
|
121
|
+
type: "cDeposit",
|
|
122
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
123
|
+
signatureChainId: await getSignatureChainId(config),
|
|
124
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
125
|
+
...params,
|
|
126
|
+
},
|
|
127
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
128
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
129
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
130
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
131
|
+
v: 27,
|
|
132
|
+
},
|
|
126
133
|
});
|
|
127
|
-
return await executeUserSignedAction(
|
|
128
|
-
config,
|
|
129
|
-
{ action, types: CDepositTypes },
|
|
130
|
-
opts?.signal,
|
|
131
|
-
);
|
|
134
|
+
return await executeUserSignedAction(config, request, CDepositTypes, opts?.signal);
|
|
132
135
|
}
|
|
@@ -117,15 +117,20 @@ export async function cSignerAction(
|
|
|
117
117
|
params: DeepImmutable<CSignerActionParameters>,
|
|
118
118
|
opts?: CSignerActionOptions,
|
|
119
119
|
): Promise<SuccessResponse> {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const request = parser(CSignerActionRequest)({
|
|
121
|
+
action: {
|
|
122
|
+
type: "CSignerAction",
|
|
123
|
+
...params,
|
|
124
|
+
},
|
|
125
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
126
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
127
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
128
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
129
|
+
v: 27,
|
|
130
|
+
},
|
|
131
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
132
|
+
? config.defaultExpiresAfter
|
|
133
|
+
: await config.defaultExpiresAfter?.(),
|
|
123
134
|
});
|
|
124
|
-
|
|
125
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
126
|
-
? config.defaultExpiresAfter
|
|
127
|
-
: await config.defaultExpiresAfter?.();
|
|
128
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
129
|
-
|
|
130
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
135
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
131
136
|
}
|
|
@@ -257,15 +257,20 @@ export async function cValidatorAction(
|
|
|
257
257
|
params: DeepImmutable<CValidatorActionParameters>,
|
|
258
258
|
opts?: CValidatorActionOptions,
|
|
259
259
|
): Promise<SuccessResponse> {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
const request = parser(CValidatorActionRequest)({
|
|
261
|
+
action: {
|
|
262
|
+
type: "CValidatorAction",
|
|
263
|
+
...params,
|
|
264
|
+
},
|
|
265
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
266
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
267
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
268
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
269
|
+
v: 27,
|
|
270
|
+
},
|
|
271
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
272
|
+
? config.defaultExpiresAfter
|
|
273
|
+
: await config.defaultExpiresAfter?.(),
|
|
263
274
|
});
|
|
264
|
-
|
|
265
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
266
|
-
? config.defaultExpiresAfter
|
|
267
|
-
: await config.defaultExpiresAfter?.();
|
|
268
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
269
|
-
|
|
270
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
275
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
271
276
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type ExtractRequestAction,
|
|
7
7
|
type ExtractRequestOptions,
|
|
8
8
|
getSignatureChainId,
|
|
9
|
-
globalNonceManager,
|
|
10
9
|
type MultiSignRequestConfig,
|
|
11
10
|
Signature,
|
|
12
11
|
} from "./_base/mod.js";
|
|
@@ -117,16 +116,20 @@ export async function cWithdraw(
|
|
|
117
116
|
params: DeepImmutable<CWithdrawParameters>,
|
|
118
117
|
opts?: CWithdrawOptions,
|
|
119
118
|
): Promise<SuccessResponse> {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
const request = parser(CWithdrawRequest)({
|
|
120
|
+
action: {
|
|
121
|
+
type: "cWithdraw",
|
|
122
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
123
|
+
signatureChainId: await getSignatureChainId(config),
|
|
124
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
125
|
+
...params,
|
|
126
|
+
},
|
|
127
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
128
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
129
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
130
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
131
|
+
v: 27,
|
|
132
|
+
},
|
|
126
133
|
});
|
|
127
|
-
return await executeUserSignedAction(
|
|
128
|
-
config,
|
|
129
|
-
{ action, types: CWithdrawTypes },
|
|
130
|
-
opts?.signal,
|
|
131
|
-
);
|
|
134
|
+
return await executeUserSignedAction(config, request, CWithdrawTypes, opts?.signal);
|
|
132
135
|
}
|
|
@@ -198,18 +198,21 @@ export async function cancel(
|
|
|
198
198
|
params: DeepImmutable<CancelParameters>,
|
|
199
199
|
opts?: CancelOptions,
|
|
200
200
|
): Promise<CancelSuccessResponse> {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
const request = parser(CancelRequest)({
|
|
202
|
+
action: {
|
|
203
|
+
type: "cancel",
|
|
204
|
+
...params,
|
|
205
|
+
},
|
|
206
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
207
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
208
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
209
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
210
|
+
v: 27,
|
|
211
|
+
},
|
|
212
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
213
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
214
|
+
? config.defaultExpiresAfter
|
|
215
|
+
: await config.defaultExpiresAfter?.(),
|
|
204
216
|
});
|
|
205
|
-
|
|
206
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
207
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
208
|
-
|
|
209
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
210
|
-
? config.defaultExpiresAfter
|
|
211
|
-
: await config.defaultExpiresAfter?.();
|
|
212
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
213
|
-
|
|
214
|
-
return await executeL1Action(config, { action, vaultAddress, expiresAfter }, opts?.signal);
|
|
217
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
215
218
|
}
|
|
@@ -116,18 +116,21 @@ export async function cancelByCloid(
|
|
|
116
116
|
params: DeepImmutable<CancelByCloidParameters>,
|
|
117
117
|
opts?: CancelByCloidOptions,
|
|
118
118
|
): Promise<CancelSuccessResponse> {
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
const request = parser(CancelByCloidRequest)({
|
|
120
|
+
action: {
|
|
121
|
+
type: "cancelByCloid",
|
|
122
|
+
...params,
|
|
123
|
+
},
|
|
124
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
125
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
126
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
127
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
128
|
+
v: 27,
|
|
129
|
+
},
|
|
130
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
131
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
132
|
+
? config.defaultExpiresAfter
|
|
133
|
+
: await config.defaultExpiresAfter?.(),
|
|
122
134
|
});
|
|
123
|
-
|
|
124
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
125
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
126
|
-
|
|
127
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
128
|
-
? config.defaultExpiresAfter
|
|
129
|
-
: await config.defaultExpiresAfter?.();
|
|
130
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
131
|
-
|
|
132
|
-
return await executeL1Action(config, { action, vaultAddress, expiresAfter }, opts?.signal);
|
|
135
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
133
136
|
}
|
|
@@ -82,14 +82,19 @@ export async function claimRewards(
|
|
|
82
82
|
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
83
83
|
opts?: ClaimRewardsOptions,
|
|
84
84
|
): Promise<SuccessResponse> {
|
|
85
|
-
const
|
|
86
|
-
|
|
85
|
+
const request = parser(ClaimRewardsRequest)({
|
|
86
|
+
action: {
|
|
87
|
+
type: "claimRewards",
|
|
88
|
+
},
|
|
89
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
90
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
91
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
92
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
93
|
+
v: 27,
|
|
94
|
+
},
|
|
95
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
96
|
+
? config.defaultExpiresAfter
|
|
97
|
+
: await config.defaultExpiresAfter?.(),
|
|
87
98
|
});
|
|
88
|
-
|
|
89
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
90
|
-
? config.defaultExpiresAfter
|
|
91
|
-
: await config.defaultExpiresAfter?.();
|
|
92
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
93
|
-
|
|
94
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
99
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
95
100
|
}
|