@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
|
@@ -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";
|
|
@@ -174,16 +173,20 @@ export async function convertToMultiSigUser(
|
|
|
174
173
|
params: DeepImmutable<ConvertToMultiSigUserParameters>,
|
|
175
174
|
opts?: ConvertToMultiSigUserOptions,
|
|
176
175
|
): Promise<SuccessResponse> {
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
const request = parser(ConvertToMultiSigUserRequest)({
|
|
177
|
+
action: {
|
|
178
|
+
type: "convertToMultiSigUser",
|
|
179
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
180
|
+
signatureChainId: await getSignatureChainId(config),
|
|
181
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
182
|
+
...params,
|
|
183
|
+
},
|
|
184
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
185
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
186
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
187
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
188
|
+
v: 27,
|
|
189
|
+
},
|
|
183
190
|
});
|
|
184
|
-
return await executeUserSignedAction(
|
|
185
|
-
config,
|
|
186
|
-
{ action, types: ConvertToMultiSigUserTypes },
|
|
187
|
-
opts?.signal,
|
|
188
|
-
);
|
|
191
|
+
return await executeUserSignedAction(config, request, ConvertToMultiSigUserTypes, opts?.signal);
|
|
189
192
|
}
|
|
@@ -125,15 +125,20 @@ export async function createSubAccount(
|
|
|
125
125
|
params: DeepImmutable<CreateSubAccountParameters>,
|
|
126
126
|
opts?: CreateSubAccountOptions,
|
|
127
127
|
): Promise<CreateSubAccountResponse> {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const request = parser(CreateSubAccountRequest)({
|
|
129
|
+
action: {
|
|
130
|
+
type: "createSubAccount",
|
|
131
|
+
...params,
|
|
132
|
+
},
|
|
133
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
134
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
135
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
136
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
137
|
+
v: 27,
|
|
138
|
+
},
|
|
139
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
140
|
+
? config.defaultExpiresAfter
|
|
141
|
+
: await config.defaultExpiresAfter?.(),
|
|
131
142
|
});
|
|
132
|
-
|
|
133
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
134
|
-
? config.defaultExpiresAfter
|
|
135
|
-
: await config.defaultExpiresAfter?.();
|
|
136
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
137
|
-
|
|
138
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
143
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
139
144
|
}
|
|
@@ -146,15 +146,20 @@ export async function createVault(
|
|
|
146
146
|
params: DeepImmutable<CreateVaultParameters>,
|
|
147
147
|
opts?: CreateVaultOptions,
|
|
148
148
|
): Promise<CreateVaultResponse> {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
const request = parser(CreateVaultRequest)({
|
|
150
|
+
action: {
|
|
151
|
+
type: "createVault",
|
|
152
|
+
...params,
|
|
153
|
+
},
|
|
154
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
155
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
156
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
157
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
158
|
+
v: 27,
|
|
159
|
+
},
|
|
160
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
161
|
+
? config.defaultExpiresAfter
|
|
162
|
+
: await config.defaultExpiresAfter?.(),
|
|
152
163
|
});
|
|
153
|
-
|
|
154
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
155
|
-
? config.defaultExpiresAfter
|
|
156
|
-
: await config.defaultExpiresAfter?.();
|
|
157
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
158
|
-
|
|
159
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
164
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
160
165
|
}
|
|
@@ -70,7 +70,7 @@ export type EvmUserModifyOptions = ExtractRequestOptions<v.InferInput<typeof Evm
|
|
|
70
70
|
* @param config - General configuration for Exchange API requests.
|
|
71
71
|
* @param params - Parameters specific to the API request.
|
|
72
72
|
* @param opts - Request execution options.
|
|
73
|
-
* @returns
|
|
73
|
+
* @returns Successful response without specific data.
|
|
74
74
|
*
|
|
75
75
|
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
76
76
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -96,15 +96,20 @@ export async function evmUserModify(
|
|
|
96
96
|
params: DeepImmutable<EvmUserModifyParameters>,
|
|
97
97
|
opts?: EvmUserModifyOptions,
|
|
98
98
|
): Promise<SuccessResponse> {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const request = parser(EvmUserModifyRequest)({
|
|
100
|
+
action: {
|
|
101
|
+
type: "evmUserModify",
|
|
102
|
+
...params,
|
|
103
|
+
},
|
|
104
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
105
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
106
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
107
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
108
|
+
v: 27,
|
|
109
|
+
},
|
|
110
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
111
|
+
? config.defaultExpiresAfter
|
|
112
|
+
: await config.defaultExpiresAfter?.(),
|
|
102
113
|
});
|
|
103
|
-
|
|
104
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
105
|
-
? config.defaultExpiresAfter
|
|
106
|
-
: await config.defaultExpiresAfter?.();
|
|
107
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
108
|
-
|
|
109
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
114
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
110
115
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { Address, type DeepImmutable, Hex, parser, UnsignedInteger } from "../_base.js";
|
|
3
|
+
import {
|
|
4
|
+
type ExchangeRequestConfig,
|
|
5
|
+
executeUserSignedAction,
|
|
6
|
+
type ExtractRequestAction,
|
|
7
|
+
type ExtractRequestOptions,
|
|
8
|
+
getSignatureChainId,
|
|
9
|
+
type MultiSignRequestConfig,
|
|
10
|
+
Signature,
|
|
11
|
+
} from "./_base/mod.js";
|
|
12
|
+
|
|
13
|
+
// -------------------- Schemas --------------------
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Link staking and trading accounts for fee discount attribution.
|
|
17
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#staking-linking
|
|
18
|
+
*/
|
|
19
|
+
export const LinkStakingUserRequest = /* @__PURE__ */ (() => {
|
|
20
|
+
return v.pipe(
|
|
21
|
+
v.object({
|
|
22
|
+
/** Action to perform. */
|
|
23
|
+
action: v.pipe(
|
|
24
|
+
v.object({
|
|
25
|
+
/** Type of action. */
|
|
26
|
+
type: v.pipe(
|
|
27
|
+
v.literal("linkStakingUser"),
|
|
28
|
+
v.description("Type of action."),
|
|
29
|
+
),
|
|
30
|
+
/** Chain ID used for signing. */
|
|
31
|
+
signatureChainId: v.pipe(
|
|
32
|
+
Hex,
|
|
33
|
+
v.description("Chain ID used for signing."),
|
|
34
|
+
),
|
|
35
|
+
/** HyperLiquid network. */
|
|
36
|
+
hyperliquidChain: v.pipe(
|
|
37
|
+
v.union([v.literal("Mainnet"), v.literal("Testnet")]),
|
|
38
|
+
v.description("HyperLiquid network."),
|
|
39
|
+
),
|
|
40
|
+
/**
|
|
41
|
+
* Target account address.
|
|
42
|
+
* - Trading user initiating: enter staking account address.
|
|
43
|
+
* - Staking user finalizing: enter trading account address.
|
|
44
|
+
*/
|
|
45
|
+
user: v.pipe(
|
|
46
|
+
Address,
|
|
47
|
+
v.description(
|
|
48
|
+
"Target account address." +
|
|
49
|
+
"\n- Trading user initiating: enter staking account address." +
|
|
50
|
+
"\n- Staking user finalizing: enter trading account address.",
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
/**
|
|
54
|
+
* Link phase.
|
|
55
|
+
* - `false` = trading user initiates link request.
|
|
56
|
+
* - `true` = staking user finalizes permanent link.
|
|
57
|
+
*/
|
|
58
|
+
isFinalize: v.pipe(
|
|
59
|
+
v.boolean(),
|
|
60
|
+
v.description(
|
|
61
|
+
"Link phase." +
|
|
62
|
+
"\n- `false` = trading user initiates link request." +
|
|
63
|
+
"\n- `true` = staking user finalizes permanent link.",
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
67
|
+
nonce: v.pipe(
|
|
68
|
+
UnsignedInteger,
|
|
69
|
+
v.description("Unique request identifier (current timestamp in ms)."),
|
|
70
|
+
),
|
|
71
|
+
}),
|
|
72
|
+
v.description("Action to perform."),
|
|
73
|
+
),
|
|
74
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
75
|
+
nonce: v.pipe(
|
|
76
|
+
UnsignedInteger,
|
|
77
|
+
v.description("Unique request identifier (current timestamp in ms)."),
|
|
78
|
+
),
|
|
79
|
+
/** Cryptographic signature. */
|
|
80
|
+
signature: v.pipe(
|
|
81
|
+
Signature,
|
|
82
|
+
v.description("Cryptographic signature."),
|
|
83
|
+
),
|
|
84
|
+
}),
|
|
85
|
+
v.description(""),
|
|
86
|
+
);
|
|
87
|
+
})();
|
|
88
|
+
export type LinkStakingUserRequest = v.InferOutput<typeof LinkStakingUserRequest>;
|
|
89
|
+
|
|
90
|
+
import { SuccessResponse } from "./_base/mod.js";
|
|
91
|
+
export { SuccessResponse };
|
|
92
|
+
|
|
93
|
+
// -------------------- Function --------------------
|
|
94
|
+
|
|
95
|
+
/** Action parameters for the {@linkcode linkStakingUser} function. */
|
|
96
|
+
export type LinkStakingUserParameters = ExtractRequestAction<v.InferInput<typeof LinkStakingUserRequest>>;
|
|
97
|
+
/** Request options for the {@linkcode linkStakingUser} function. */
|
|
98
|
+
export type LinkStakingUserOptions = ExtractRequestOptions<v.InferInput<typeof LinkStakingUserRequest>>;
|
|
99
|
+
|
|
100
|
+
/** EIP-712 types for the {@linkcode linkStakingUser} function. */
|
|
101
|
+
export const LinkStakingUserTypes = {
|
|
102
|
+
"HyperliquidTransaction:LinkStakingUser": [
|
|
103
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
104
|
+
{ name: "user", type: "address" },
|
|
105
|
+
{ name: "isFinalize", type: "bool" },
|
|
106
|
+
{ name: "nonce", type: "uint64" },
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Link staking and trading accounts for fee discount attribution.
|
|
112
|
+
* @param config - General configuration for Exchange API requests.
|
|
113
|
+
* @param params - Parameters specific to the API request.
|
|
114
|
+
* @param opts - Request execution options.
|
|
115
|
+
* @returns Successful response without specific data.
|
|
116
|
+
*
|
|
117
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
118
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
119
|
+
*
|
|
120
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#staking-linking
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
124
|
+
* import { linkStakingUser } from "@nktkas/hyperliquid/api/exchange";
|
|
125
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
126
|
+
*
|
|
127
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
128
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
129
|
+
*
|
|
130
|
+
* await linkStakingUser(
|
|
131
|
+
* { transport, wallet },
|
|
132
|
+
* { user: "0x...", isFinalize: false },
|
|
133
|
+
* );
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export async function linkStakingUser(
|
|
137
|
+
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
138
|
+
params: DeepImmutable<LinkStakingUserParameters>,
|
|
139
|
+
opts?: LinkStakingUserOptions,
|
|
140
|
+
): Promise<SuccessResponse> {
|
|
141
|
+
const request = parser(LinkStakingUserRequest)({
|
|
142
|
+
action: {
|
|
143
|
+
type: "linkStakingUser",
|
|
144
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
145
|
+
signatureChainId: await getSignatureChainId(config),
|
|
146
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
147
|
+
...params,
|
|
148
|
+
},
|
|
149
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
150
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
151
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
152
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
153
|
+
v: 27,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
return await executeUserSignedAction(config, request, LinkStakingUserTypes, opts?.signal);
|
|
157
|
+
}
|
|
@@ -119,18 +119,21 @@ export async function modify(
|
|
|
119
119
|
params: DeepImmutable<ModifyParameters>,
|
|
120
120
|
opts?: ModifyOptions,
|
|
121
121
|
): Promise<SuccessResponse> {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const request = parser(ModifyRequest)({
|
|
123
|
+
action: {
|
|
124
|
+
type: "modify",
|
|
125
|
+
...params,
|
|
126
|
+
},
|
|
127
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
128
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
129
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
130
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
131
|
+
v: 27,
|
|
132
|
+
},
|
|
133
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
134
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
135
|
+
? config.defaultExpiresAfter
|
|
136
|
+
: await config.defaultExpiresAfter?.(),
|
|
125
137
|
});
|
|
126
|
-
|
|
127
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
128
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
129
|
-
|
|
130
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
131
|
-
? config.defaultExpiresAfter
|
|
132
|
-
: await config.defaultExpiresAfter?.();
|
|
133
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
134
|
-
|
|
135
|
-
return await executeL1Action(config, { action, vaultAddress, expiresAfter }, opts?.signal);
|
|
138
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
136
139
|
}
|
|
@@ -282,28 +282,22 @@ export async function multiSig<
|
|
|
282
282
|
): Promise<T> {
|
|
283
283
|
const { nonce, ...params } = paramsAndNonce;
|
|
284
284
|
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
292
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
293
|
-
|
|
294
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
295
|
-
? config.defaultExpiresAfter
|
|
296
|
-
: await config.defaultExpiresAfter?.();
|
|
297
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
298
|
-
|
|
299
|
-
return await executeMultiSigAction(
|
|
300
|
-
config,
|
|
301
|
-
{
|
|
302
|
-
action,
|
|
303
|
-
vaultAddress,
|
|
304
|
-
expiresAfter,
|
|
305
|
-
nonce: Number(nonce),
|
|
285
|
+
const request = parser(MultiSigRequest)({
|
|
286
|
+
action: {
|
|
287
|
+
type: "multiSig",
|
|
288
|
+
signatureChainId: await getSignatureChainId(config),
|
|
289
|
+
...params,
|
|
306
290
|
},
|
|
307
|
-
|
|
308
|
-
|
|
291
|
+
nonce,
|
|
292
|
+
signature: { // Placeholder; actual signature generated in `executeMultiSigAction`
|
|
293
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
294
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
295
|
+
v: 27,
|
|
296
|
+
},
|
|
297
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
298
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
299
|
+
? config.defaultExpiresAfter
|
|
300
|
+
: await config.defaultExpiresAfter?.(),
|
|
301
|
+
});
|
|
302
|
+
return await executeMultiSigAction(config, request, opts?.signal);
|
|
309
303
|
}
|
|
@@ -84,14 +84,19 @@ export async function noop(
|
|
|
84
84
|
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
85
85
|
opts?: NoopOptions,
|
|
86
86
|
): Promise<SuccessResponse> {
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const request = parser(NoopRequest)({
|
|
88
|
+
action: {
|
|
89
|
+
type: "noop",
|
|
90
|
+
},
|
|
91
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
92
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
93
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
94
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
95
|
+
v: 27,
|
|
96
|
+
},
|
|
97
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
98
|
+
? config.defaultExpiresAfter
|
|
99
|
+
: await config.defaultExpiresAfter?.(),
|
|
89
100
|
});
|
|
90
|
-
|
|
91
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
92
|
-
? config.defaultExpiresAfter
|
|
93
|
-
: await config.defaultExpiresAfter?.();
|
|
94
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
95
|
-
|
|
96
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
101
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
97
102
|
}
|
|
@@ -330,18 +330,21 @@ export async function order(
|
|
|
330
330
|
params: DeepImmutable<OrderParameters>,
|
|
331
331
|
opts?: OrderOptions,
|
|
332
332
|
): Promise<OrderSuccessResponse> {
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
333
|
+
const request = parser(OrderRequest)({
|
|
334
|
+
action: {
|
|
335
|
+
type: "order",
|
|
336
|
+
...params,
|
|
337
|
+
},
|
|
338
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
339
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
340
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
341
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
342
|
+
v: 27,
|
|
343
|
+
},
|
|
344
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
345
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
346
|
+
? config.defaultExpiresAfter
|
|
347
|
+
: await config.defaultExpiresAfter?.(),
|
|
336
348
|
});
|
|
337
|
-
|
|
338
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
339
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
340
|
-
|
|
341
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
342
|
-
? config.defaultExpiresAfter
|
|
343
|
-
: await config.defaultExpiresAfter?.();
|
|
344
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
345
|
-
|
|
346
|
-
return await executeL1Action(config, { action, vaultAddress, expiresAfter }, opts?.signal);
|
|
349
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
347
350
|
}
|
|
@@ -317,15 +317,20 @@ export async function perpDeploy(
|
|
|
317
317
|
params: DeepImmutable<PerpDeployParameters>,
|
|
318
318
|
opts?: PerpDeployOptions,
|
|
319
319
|
): Promise<SuccessResponse> {
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
const request = parser(PerpDeployRequest)({
|
|
321
|
+
action: {
|
|
322
|
+
type: "perpDeploy",
|
|
323
|
+
...params,
|
|
324
|
+
},
|
|
325
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
326
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
327
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
328
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
329
|
+
v: 27,
|
|
330
|
+
},
|
|
331
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
332
|
+
? config.defaultExpiresAfter
|
|
333
|
+
: await config.defaultExpiresAfter?.(),
|
|
323
334
|
});
|
|
324
|
-
|
|
325
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
326
|
-
? config.defaultExpiresAfter
|
|
327
|
-
: await config.defaultExpiresAfter?.();
|
|
328
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
329
|
-
|
|
330
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
335
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
331
336
|
}
|
|
@@ -97,15 +97,20 @@ export async function registerReferrer(
|
|
|
97
97
|
params: DeepImmutable<RegisterReferrerParameters>,
|
|
98
98
|
opts?: RegisterReferrerOptions,
|
|
99
99
|
): Promise<SuccessResponse> {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
const request = parser(RegisterReferrerRequest)({
|
|
101
|
+
action: {
|
|
102
|
+
type: "registerReferrer",
|
|
103
|
+
...params,
|
|
104
|
+
},
|
|
105
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
106
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
107
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
108
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
109
|
+
v: 27,
|
|
110
|
+
},
|
|
111
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
112
|
+
? config.defaultExpiresAfter
|
|
113
|
+
: await config.defaultExpiresAfter?.(),
|
|
103
114
|
});
|
|
104
|
-
|
|
105
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
106
|
-
? config.defaultExpiresAfter
|
|
107
|
-
: await config.defaultExpiresAfter?.();
|
|
108
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
109
|
-
|
|
110
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
115
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
111
116
|
}
|
|
@@ -96,15 +96,20 @@ export async function reserveRequestWeight(
|
|
|
96
96
|
params: DeepImmutable<ReserveRequestWeightParameters>,
|
|
97
97
|
opts?: ReserveRequestWeightOptions,
|
|
98
98
|
): Promise<SuccessResponse> {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const request = parser(ReserveRequestWeightRequest)({
|
|
100
|
+
action: {
|
|
101
|
+
type: "reserveRequestWeight",
|
|
102
|
+
...params,
|
|
103
|
+
},
|
|
104
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
105
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
106
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
107
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
108
|
+
v: 27,
|
|
109
|
+
},
|
|
110
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
111
|
+
? config.defaultExpiresAfter
|
|
112
|
+
: await config.defaultExpiresAfter?.(),
|
|
102
113
|
});
|
|
103
|
-
|
|
104
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
105
|
-
? config.defaultExpiresAfter
|
|
106
|
-
: await config.defaultExpiresAfter?.();
|
|
107
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
108
|
-
|
|
109
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
114
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
110
115
|
}
|
|
@@ -125,18 +125,21 @@ export async function scheduleCancel(
|
|
|
125
125
|
const params = isFirstArgParams ? paramsOrOpts : {};
|
|
126
126
|
const opts = isFirstArgParams ? maybeOpts : paramsOrOpts as ScheduleCancelOptions;
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const request = parser(ScheduleCancelRequest)({
|
|
129
|
+
action: {
|
|
130
|
+
type: "scheduleCancel",
|
|
131
|
+
...params,
|
|
132
|
+
},
|
|
133
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
134
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
135
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
136
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
137
|
+
v: 27,
|
|
138
|
+
},
|
|
139
|
+
vaultAddress: opts?.vaultAddress ?? config.defaultVaultAddress,
|
|
140
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
141
|
+
? config.defaultExpiresAfter
|
|
142
|
+
: await config.defaultExpiresAfter?.(),
|
|
131
143
|
});
|
|
132
|
-
|
|
133
|
-
const vaultAddress_ = opts?.vaultAddress ?? config.defaultVaultAddress;
|
|
134
|
-
const vaultAddress = parser(v.optional(Address))(vaultAddress_);
|
|
135
|
-
|
|
136
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
137
|
-
? config.defaultExpiresAfter
|
|
138
|
-
: await config.defaultExpiresAfter?.();
|
|
139
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
140
|
-
|
|
141
|
-
return await executeL1Action(config, { action, vaultAddress, expiresAfter }, opts?.signal);
|
|
144
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
142
145
|
}
|
|
@@ -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";
|
|
@@ -153,16 +152,20 @@ export async function sendAsset(
|
|
|
153
152
|
params: DeepImmutable<SendAssetParameters>,
|
|
154
153
|
opts?: SendAssetOptions,
|
|
155
154
|
): Promise<SuccessResponse> {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
const request = parser(SendAssetRequest)({
|
|
156
|
+
action: {
|
|
157
|
+
type: "sendAsset",
|
|
158
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
159
|
+
signatureChainId: await getSignatureChainId(config),
|
|
160
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
161
|
+
...params,
|
|
162
|
+
},
|
|
163
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeUserSignedAction` to prevent race conditions
|
|
164
|
+
signature: { // Placeholder; actual signature generated in `executeUserSignedAction`
|
|
165
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
166
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
167
|
+
v: 27,
|
|
168
|
+
},
|
|
162
169
|
});
|
|
163
|
-
return await executeUserSignedAction(
|
|
164
|
-
config,
|
|
165
|
-
{ action, types: SendAssetTypes },
|
|
166
|
-
opts?.signal,
|
|
167
|
-
);
|
|
170
|
+
return await executeUserSignedAction(config, request, SendAssetTypes, opts?.signal);
|
|
168
171
|
}
|
|
@@ -103,15 +103,20 @@ export async function setDisplayName(
|
|
|
103
103
|
params: DeepImmutable<SetDisplayNameParameters>,
|
|
104
104
|
opts?: SetDisplayNameOptions,
|
|
105
105
|
): Promise<SuccessResponse> {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const request = parser(SetDisplayNameRequest)({
|
|
107
|
+
action: {
|
|
108
|
+
type: "setDisplayName",
|
|
109
|
+
...params,
|
|
110
|
+
},
|
|
111
|
+
nonce: 0, // Placeholder; actual nonce generated in `executeL1Action`
|
|
112
|
+
signature: { // Placeholder; actual signature generated in `executeL1Action`
|
|
113
|
+
r: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
114
|
+
s: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
115
|
+
v: 27,
|
|
116
|
+
},
|
|
117
|
+
expiresAfter: typeof config.defaultExpiresAfter === "number"
|
|
118
|
+
? config.defaultExpiresAfter
|
|
119
|
+
: await config.defaultExpiresAfter?.(),
|
|
109
120
|
});
|
|
110
|
-
|
|
111
|
-
const expiresAfter_ = typeof config.defaultExpiresAfter === "number"
|
|
112
|
-
? config.defaultExpiresAfter
|
|
113
|
-
: await config.defaultExpiresAfter?.();
|
|
114
|
-
const expiresAfter = parser(v.optional(UnsignedInteger))(expiresAfter_);
|
|
115
|
-
|
|
116
|
-
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
121
|
+
return await executeL1Action(config, request, opts?.signal);
|
|
117
122
|
}
|