@nadohq/client 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/apis/base.cjs +66 -0
- package/dist/apis/base.cjs.map +1 -0
- package/dist/apis/base.d.cts +23 -0
- package/dist/apis/base.d.ts +23 -0
- package/dist/apis/base.js +41 -0
- package/dist/apis/base.js.map +1 -0
- package/dist/apis/market/MarketExecuteAPI.cjs +169 -0
- package/dist/apis/market/MarketExecuteAPI.cjs.map +1 -0
- package/dist/apis/market/MarketExecuteAPI.d.cts +57 -0
- package/dist/apis/market/MarketExecuteAPI.d.ts +57 -0
- package/dist/apis/market/MarketExecuteAPI.js +144 -0
- package/dist/apis/market/MarketExecuteAPI.js.map +1 -0
- package/dist/apis/market/MarketQueryAPI.cjs +191 -0
- package/dist/apis/market/MarketQueryAPI.cjs.map +1 -0
- package/dist/apis/market/MarketQueryAPI.d.cts +127 -0
- package/dist/apis/market/MarketQueryAPI.d.ts +127 -0
- package/dist/apis/market/MarketQueryAPI.js +166 -0
- package/dist/apis/market/MarketQueryAPI.js.map +1 -0
- package/dist/apis/market/index.cjs +38 -0
- package/dist/apis/market/index.cjs.map +1 -0
- package/dist/apis/market/index.d.cts +18 -0
- package/dist/apis/market/index.d.ts +18 -0
- package/dist/apis/market/index.js +11 -0
- package/dist/apis/market/index.js.map +1 -0
- package/dist/apis/market/types.cjs +19 -0
- package/dist/apis/market/types.cjs.map +1 -0
- package/dist/apis/market/types.d.cts +26 -0
- package/dist/apis/market/types.d.ts +26 -0
- package/dist/apis/market/types.js +1 -0
- package/dist/apis/market/types.js.map +1 -0
- package/dist/apis/perp/PerpExecuteAPI.cjs +36 -0
- package/dist/apis/perp/PerpExecuteAPI.cjs.map +1 -0
- package/dist/apis/perp/PerpExecuteAPI.d.cts +13 -0
- package/dist/apis/perp/PerpExecuteAPI.d.ts +13 -0
- package/dist/apis/perp/PerpExecuteAPI.js +11 -0
- package/dist/apis/perp/PerpExecuteAPI.js.map +1 -0
- package/dist/apis/perp/PerpQueryAPI.cjs +47 -0
- package/dist/apis/perp/PerpQueryAPI.cjs.map +1 -0
- package/dist/apis/perp/PerpQueryAPI.d.cts +23 -0
- package/dist/apis/perp/PerpQueryAPI.d.ts +23 -0
- package/dist/apis/perp/PerpQueryAPI.js +22 -0
- package/dist/apis/perp/PerpQueryAPI.js.map +1 -0
- package/dist/apis/perp/index.cjs +35 -0
- package/dist/apis/perp/index.cjs.map +1 -0
- package/dist/apis/perp/index.d.cts +16 -0
- package/dist/apis/perp/index.d.ts +16 -0
- package/dist/apis/perp/index.js +10 -0
- package/dist/apis/perp/index.js.map +1 -0
- package/dist/apis/spot/BaseSpotAPI.cjs +55 -0
- package/dist/apis/spot/BaseSpotAPI.cjs.map +1 -0
- package/dist/apis/spot/BaseSpotAPI.d.cts +19 -0
- package/dist/apis/spot/BaseSpotAPI.d.ts +19 -0
- package/dist/apis/spot/BaseSpotAPI.js +30 -0
- package/dist/apis/spot/BaseSpotAPI.js.map +1 -0
- package/dist/apis/spot/SpotExecuteAPI.cjs +108 -0
- package/dist/apis/spot/SpotExecuteAPI.cjs.map +1 -0
- package/dist/apis/spot/SpotExecuteAPI.d.cts +28 -0
- package/dist/apis/spot/SpotExecuteAPI.d.ts +28 -0
- package/dist/apis/spot/SpotExecuteAPI.js +88 -0
- package/dist/apis/spot/SpotExecuteAPI.js.map +1 -0
- package/dist/apis/spot/SpotQueryAPI.cjs +74 -0
- package/dist/apis/spot/SpotQueryAPI.cjs.map +1 -0
- package/dist/apis/spot/SpotQueryAPI.d.cts +35 -0
- package/dist/apis/spot/SpotQueryAPI.d.ts +35 -0
- package/dist/apis/spot/SpotQueryAPI.js +49 -0
- package/dist/apis/spot/SpotQueryAPI.js.map +1 -0
- package/dist/apis/spot/index.cjs +38 -0
- package/dist/apis/spot/index.cjs.map +1 -0
- package/dist/apis/spot/index.d.cts +23 -0
- package/dist/apis/spot/index.d.ts +23 -0
- package/dist/apis/spot/index.js +11 -0
- package/dist/apis/spot/index.js.map +1 -0
- package/dist/apis/spot/types.cjs +19 -0
- package/dist/apis/spot/types.cjs.map +1 -0
- package/dist/apis/spot/types.d.cts +23 -0
- package/dist/apis/spot/types.d.ts +23 -0
- package/dist/apis/spot/types.js +1 -0
- package/dist/apis/spot/types.js.map +1 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.cjs +59 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.cjs.map +1 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.cts +26 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.ts +26 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.js +34 -0
- package/dist/apis/subaccount/SubaccountExecuteAPI.js.map +1 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs +84 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs.map +1 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.d.cts +51 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.d.ts +51 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.js +61 -0
- package/dist/apis/subaccount/SubaccountQueryAPI.js.map +1 -0
- package/dist/apis/subaccount/index.cjs +68 -0
- package/dist/apis/subaccount/index.cjs.map +1 -0
- package/dist/apis/subaccount/index.d.cts +27 -0
- package/dist/apis/subaccount/index.d.ts +27 -0
- package/dist/apis/subaccount/index.js +41 -0
- package/dist/apis/subaccount/index.js.map +1 -0
- package/dist/apis/subaccount/types.cjs +19 -0
- package/dist/apis/subaccount/types.cjs.map +1 -0
- package/dist/apis/subaccount/types.d.cts +9 -0
- package/dist/apis/subaccount/types.d.ts +9 -0
- package/dist/apis/subaccount/types.js +1 -0
- package/dist/apis/subaccount/types.js.map +1 -0
- package/dist/apis/types.cjs +19 -0
- package/dist/apis/types.cjs.map +1 -0
- package/dist/apis/types.d.cts +9 -0
- package/dist/apis/types.d.ts +9 -0
- package/dist/apis/types.js +1 -0
- package/dist/apis/types.js.map +1 -0
- package/dist/apis/ws/WebSocketExecuteAPI.cjs +73 -0
- package/dist/apis/ws/WebSocketExecuteAPI.cjs.map +1 -0
- package/dist/apis/ws/WebSocketExecuteAPI.d.cts +48 -0
- package/dist/apis/ws/WebSocketExecuteAPI.d.ts +48 -0
- package/dist/apis/ws/WebSocketExecuteAPI.js +48 -0
- package/dist/apis/ws/WebSocketExecuteAPI.js.map +1 -0
- package/dist/apis/ws/WebSocketQueryAPI.cjs +42 -0
- package/dist/apis/ws/WebSocketQueryAPI.cjs.map +1 -0
- package/dist/apis/ws/WebSocketQueryAPI.d.cts +23 -0
- package/dist/apis/ws/WebSocketQueryAPI.d.ts +23 -0
- package/dist/apis/ws/WebSocketQueryAPI.js +17 -0
- package/dist/apis/ws/WebSocketQueryAPI.js.map +1 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.cjs +61 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.cjs.map +1 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.cts +37 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.ts +37 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.js +36 -0
- package/dist/apis/ws/WebSocketSubscriptionAPI.js.map +1 -0
- package/dist/apis/ws/index.cjs +42 -0
- package/dist/apis/ws/index.cjs.map +1 -0
- package/dist/apis/ws/index.d.cts +22 -0
- package/dist/apis/ws/index.d.ts +22 -0
- package/dist/apis/ws/index.js +17 -0
- package/dist/apis/ws/index.js.map +1 -0
- package/dist/client.cjs +79 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +57 -0
- package/dist/client.d.ts +57 -0
- package/dist/client.js +54 -0
- package/dist/client.js.map +1 -0
- package/dist/context.cjs +125 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +42 -0
- package/dist/context.d.ts +42 -0
- package/dist/context.js +109 -0
- package/dist/context.js.map +1 -0
- package/dist/createNadoClient.cjs +35 -0
- package/dist/createNadoClient.cjs.map +1 -0
- package/dist/createNadoClient.d.cts +42 -0
- package/dist/createNadoClient.d.ts +42 -0
- package/dist/createNadoClient.js +12 -0
- package/dist/createNadoClient.js.map +1 -0
- package/dist/index.cjs +47 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
- package/src/apis/base.ts +52 -0
- package/src/apis/market/MarketExecuteAPI.ts +169 -0
- package/src/apis/market/MarketQueryAPI.ts +214 -0
- package/src/apis/market/index.ts +7 -0
- package/src/apis/market/types.ts +58 -0
- package/src/apis/perp/PerpExecuteAPI.ts +8 -0
- package/src/apis/perp/PerpQueryAPI.ts +25 -0
- package/src/apis/perp/index.ts +5 -0
- package/src/apis/spot/BaseSpotAPI.ts +30 -0
- package/src/apis/spot/SpotExecuteAPI.ts +102 -0
- package/src/apis/spot/SpotQueryAPI.ts +53 -0
- package/src/apis/spot/index.ts +10 -0
- package/src/apis/spot/types.ts +44 -0
- package/src/apis/subaccount/SubaccountExecuteAPI.ts +32 -0
- package/src/apis/subaccount/SubaccountQueryAPI.ts +78 -0
- package/src/apis/subaccount/index.ts +44 -0
- package/src/apis/subaccount/types.ts +16 -0
- package/src/apis/types.ts +11 -0
- package/src/apis/ws/WebSocketExecuteAPI.ts +70 -0
- package/src/apis/ws/WebSocketQueryAPI.ts +25 -0
- package/src/apis/ws/WebSocketSubscriptionAPI.ts +62 -0
- package/src/apis/ws/index.ts +21 -0
- package/src/client.ts +67 -0
- package/src/context.ts +165 -0
- package/src/createNadoClient.ts +20 -0
- package/src/index.ts +15 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/apis/spot/SpotExecuteAPI.ts
|
|
21
|
+
var SpotExecuteAPI_exports = {};
|
|
22
|
+
__export(SpotExecuteAPI_exports, {
|
|
23
|
+
SpotExecuteAPI: () => SpotExecuteAPI
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(SpotExecuteAPI_exports);
|
|
26
|
+
var import_contracts = require("@nadohq/contracts");
|
|
27
|
+
var import_utils = require("@nadohq/utils");
|
|
28
|
+
var import_BaseSpotAPI = require("./BaseSpotAPI.cjs");
|
|
29
|
+
var SpotExecuteAPI = class extends import_BaseSpotAPI.BaseSpotAPI {
|
|
30
|
+
async deposit(params) {
|
|
31
|
+
return (0, import_contracts.depositCollateral)({
|
|
32
|
+
endpoint: this.context.contracts.endpoint,
|
|
33
|
+
subaccountName: params.subaccountName,
|
|
34
|
+
productId: params.productId,
|
|
35
|
+
amount: params.amount,
|
|
36
|
+
referralCode: params.referralCode
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async withdraw(params) {
|
|
40
|
+
return this.context.engineClient.withdrawCollateral({
|
|
41
|
+
...params,
|
|
42
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
43
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
44
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async approveAllowance(params) {
|
|
48
|
+
const tokenContract = await this.getTokenContractForProduct(params);
|
|
49
|
+
if (!(0, import_contracts.isWriteableContract)(tokenContract)) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
"Token contract does not permit writes. Is a wallet client provided?"
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return (0, import_contracts.approveDepositAllowance)({
|
|
55
|
+
amount: params.amount,
|
|
56
|
+
endpoint: this.context.contracts.endpoint,
|
|
57
|
+
tokenContract
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Transfers quote between subaccounts under the same wallet.
|
|
62
|
+
*
|
|
63
|
+
* @param params
|
|
64
|
+
*/
|
|
65
|
+
async transferQuote(params) {
|
|
66
|
+
return this.context.engineClient.transferQuote({
|
|
67
|
+
...params,
|
|
68
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
69
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),
|
|
70
|
+
chainId: this.getWalletClientChainIdIfNeeded(params)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async mintVlp(params) {
|
|
74
|
+
return this.context.engineClient.mintVlp({
|
|
75
|
+
...params,
|
|
76
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
77
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
78
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async burnVlp(params) {
|
|
82
|
+
return this.context.engineClient.burnVlp({
|
|
83
|
+
...params,
|
|
84
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
85
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
86
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async _mintMockERC20(params) {
|
|
90
|
+
if (!this.context.walletClient) {
|
|
91
|
+
throw new import_utils.WalletNotProvidedError();
|
|
92
|
+
}
|
|
93
|
+
const config = await this.context.contracts.spotEngine.read.getConfig([
|
|
94
|
+
params.productId
|
|
95
|
+
]);
|
|
96
|
+
return this.context.walletClient.writeContract({
|
|
97
|
+
abi: import_contracts.MOCK_ERC20_ABI,
|
|
98
|
+
address: config.token,
|
|
99
|
+
functionName: "mint",
|
|
100
|
+
args: [this.getWalletClientAddress(), (0, import_utils.toBigInt)(params.amount)]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
SpotExecuteAPI
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=SpotExecuteAPI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/SpotExecuteAPI.ts"],"sourcesContent":["import {\n approveDepositAllowance,\n depositCollateral,\n DepositCollateralParams,\n isWriteableContract,\n MintMockERC20Params,\n MOCK_ERC20_ABI,\n} from '@nadohq/contracts';\nimport { toBigInt, WalletNotProvidedError } from '@nadohq/utils';\nimport { BaseSpotAPI } from './BaseSpotAPI';\nimport {\n ApproveAllowanceParams,\n BurnVlpParams,\n MintVlpParams,\n TransferQuoteParams,\n WithdrawCollateralParams,\n} from './types';\n\nexport class SpotExecuteAPI extends BaseSpotAPI {\n async deposit(params: DepositCollateralParams) {\n return depositCollateral({\n endpoint: this.context.contracts.endpoint,\n subaccountName: params.subaccountName,\n productId: params.productId,\n amount: params.amount,\n referralCode: params.referralCode,\n });\n }\n\n async withdraw(params: WithdrawCollateralParams) {\n return this.context.engineClient.withdrawCollateral({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n async approveAllowance(params: ApproveAllowanceParams) {\n const tokenContract = await this.getTokenContractForProduct(params);\n if (!isWriteableContract(tokenContract)) {\n throw new Error(\n 'Token contract does not permit writes. Is a wallet client provided?',\n );\n }\n\n return approveDepositAllowance({\n amount: params.amount,\n endpoint: this.context.contracts.endpoint,\n tokenContract,\n });\n }\n\n /**\n * Transfers quote between subaccounts under the same wallet.\n *\n * @param params\n */\n async transferQuote(params: TransferQuoteParams) {\n return this.context.engineClient.transferQuote({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n });\n }\n\n async mintVlp(params: MintVlpParams) {\n return this.context.engineClient.mintVlp({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n async burnVlp(params: BurnVlpParams) {\n return this.context.engineClient.burnVlp({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n async _mintMockERC20(params: MintMockERC20Params) {\n if (!this.context.walletClient) {\n throw new WalletNotProvidedError();\n }\n\n const config = await this.context.contracts.spotEngine.read.getConfig([\n params.productId,\n ]);\n\n return this.context.walletClient.writeContract({\n abi: MOCK_ERC20_ABI,\n address: config.token,\n functionName: 'mint',\n args: [this.getWalletClientAddress(), toBigInt(params.amount)],\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAOO;AACP,mBAAiD;AACjD,yBAA4B;AASrB,IAAM,iBAAN,cAA6B,+BAAY;AAAA,EAC9C,MAAM,QAAQ,QAAiC;AAC7C,eAAO,oCAAkB;AAAA,MACvB,UAAU,KAAK,QAAQ,UAAU;AAAA,MACjC,gBAAgB,OAAO;AAAA,MACvB,WAAW,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,MACf,cAAc,OAAO;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,SAAS,QAAkC;AAC/C,WAAO,KAAK,QAAQ,aAAa,mBAAmB;AAAA,MAClD,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,iBAAiB,QAAgC;AACrD,UAAM,gBAAgB,MAAM,KAAK,2BAA2B,MAAM;AAClE,QAAI,KAAC,sCAAoB,aAAa,GAAG;AACvC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,eAAO,0CAAwB;AAAA,MAC7B,QAAQ,OAAO;AAAA,MACf,UAAU,KAAK,QAAQ,UAAU;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,QAA6B;AAC/C,WAAO,KAAK,QAAQ,aAAa,cAAc;AAAA,MAC7C,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,MAC/D,SAAS,KAAK,+BAA+B,MAAM;AAAA,IACrD,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACnC,WAAO,KAAK,QAAQ,aAAa,QAAQ;AAAA,MACvC,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACnC,WAAO,KAAK,QAAQ,aAAa,QAAQ;AAAA,MACvC,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,eAAe,QAA6B;AAChD,QAAI,CAAC,KAAK,QAAQ,cAAc;AAC9B,YAAM,IAAI,oCAAuB;AAAA,IACnC;AAEA,UAAM,SAAS,MAAM,KAAK,QAAQ,UAAU,WAAW,KAAK,UAAU;AAAA,MACpE,OAAO;AAAA,IACT,CAAC;AAED,WAAO,KAAK,QAAQ,aAAa,cAAc;AAAA,MAC7C,KAAK;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,cAAc;AAAA,MACd,MAAM,CAAC,KAAK,uBAAuB,OAAG,uBAAS,OAAO,MAAM,CAAC;AAAA,IAC/D,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as _nadohq_engine_client from '@nadohq/engine-client';
|
|
2
|
+
import { DepositCollateralParams, MintMockERC20Params } from '@nadohq/contracts';
|
|
3
|
+
import { BaseSpotAPI } from './BaseSpotAPI.cjs';
|
|
4
|
+
import { WithdrawCollateralParams, ApproveAllowanceParams, TransferQuoteParams, MintVlpParams, BurnVlpParams } from './types.cjs';
|
|
5
|
+
import '../base.cjs';
|
|
6
|
+
import '../../context.cjs';
|
|
7
|
+
import '@nadohq/indexer-client';
|
|
8
|
+
import '@nadohq/trigger-client';
|
|
9
|
+
import 'viem';
|
|
10
|
+
import '@nadohq/utils';
|
|
11
|
+
import '../types.cjs';
|
|
12
|
+
|
|
13
|
+
declare class SpotExecuteAPI extends BaseSpotAPI {
|
|
14
|
+
deposit(params: DepositCollateralParams): Promise<`0x${string}`>;
|
|
15
|
+
withdraw(params: WithdrawCollateralParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"withdraw_collateral">>;
|
|
16
|
+
approveAllowance(params: ApproveAllowanceParams): Promise<`0x${string}`>;
|
|
17
|
+
/**
|
|
18
|
+
* Transfers quote between subaccounts under the same wallet.
|
|
19
|
+
*
|
|
20
|
+
* @param params
|
|
21
|
+
*/
|
|
22
|
+
transferQuote(params: TransferQuoteParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"transfer_quote">>;
|
|
23
|
+
mintVlp(params: MintVlpParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"mint_vlp">>;
|
|
24
|
+
burnVlp(params: BurnVlpParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"burn_vlp">>;
|
|
25
|
+
_mintMockERC20(params: MintMockERC20Params): Promise<`0x${string}`>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { SpotExecuteAPI };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as _nadohq_engine_client from '@nadohq/engine-client';
|
|
2
|
+
import { DepositCollateralParams, MintMockERC20Params } from '@nadohq/contracts';
|
|
3
|
+
import { BaseSpotAPI } from './BaseSpotAPI.js';
|
|
4
|
+
import { WithdrawCollateralParams, ApproveAllowanceParams, TransferQuoteParams, MintVlpParams, BurnVlpParams } from './types.js';
|
|
5
|
+
import '../base.js';
|
|
6
|
+
import '../../context.js';
|
|
7
|
+
import '@nadohq/indexer-client';
|
|
8
|
+
import '@nadohq/trigger-client';
|
|
9
|
+
import 'viem';
|
|
10
|
+
import '@nadohq/utils';
|
|
11
|
+
import '../types.js';
|
|
12
|
+
|
|
13
|
+
declare class SpotExecuteAPI extends BaseSpotAPI {
|
|
14
|
+
deposit(params: DepositCollateralParams): Promise<`0x${string}`>;
|
|
15
|
+
withdraw(params: WithdrawCollateralParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"withdraw_collateral">>;
|
|
16
|
+
approveAllowance(params: ApproveAllowanceParams): Promise<`0x${string}`>;
|
|
17
|
+
/**
|
|
18
|
+
* Transfers quote between subaccounts under the same wallet.
|
|
19
|
+
*
|
|
20
|
+
* @param params
|
|
21
|
+
*/
|
|
22
|
+
transferQuote(params: TransferQuoteParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"transfer_quote">>;
|
|
23
|
+
mintVlp(params: MintVlpParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"mint_vlp">>;
|
|
24
|
+
burnVlp(params: BurnVlpParams): Promise<_nadohq_engine_client.EngineServerExecuteSuccessResult<"burn_vlp">>;
|
|
25
|
+
_mintMockERC20(params: MintMockERC20Params): Promise<`0x${string}`>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { SpotExecuteAPI };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// src/apis/spot/SpotExecuteAPI.ts
|
|
2
|
+
import {
|
|
3
|
+
approveDepositAllowance,
|
|
4
|
+
depositCollateral,
|
|
5
|
+
isWriteableContract,
|
|
6
|
+
MOCK_ERC20_ABI
|
|
7
|
+
} from "@nadohq/contracts";
|
|
8
|
+
import { toBigInt, WalletNotProvidedError } from "@nadohq/utils";
|
|
9
|
+
import { BaseSpotAPI } from "./BaseSpotAPI.js";
|
|
10
|
+
var SpotExecuteAPI = class extends BaseSpotAPI {
|
|
11
|
+
async deposit(params) {
|
|
12
|
+
return depositCollateral({
|
|
13
|
+
endpoint: this.context.contracts.endpoint,
|
|
14
|
+
subaccountName: params.subaccountName,
|
|
15
|
+
productId: params.productId,
|
|
16
|
+
amount: params.amount,
|
|
17
|
+
referralCode: params.referralCode
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async withdraw(params) {
|
|
21
|
+
return this.context.engineClient.withdrawCollateral({
|
|
22
|
+
...params,
|
|
23
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
24
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
25
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async approveAllowance(params) {
|
|
29
|
+
const tokenContract = await this.getTokenContractForProduct(params);
|
|
30
|
+
if (!isWriteableContract(tokenContract)) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
"Token contract does not permit writes. Is a wallet client provided?"
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return approveDepositAllowance({
|
|
36
|
+
amount: params.amount,
|
|
37
|
+
endpoint: this.context.contracts.endpoint,
|
|
38
|
+
tokenContract
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Transfers quote between subaccounts under the same wallet.
|
|
43
|
+
*
|
|
44
|
+
* @param params
|
|
45
|
+
*/
|
|
46
|
+
async transferQuote(params) {
|
|
47
|
+
return this.context.engineClient.transferQuote({
|
|
48
|
+
...params,
|
|
49
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
50
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),
|
|
51
|
+
chainId: this.getWalletClientChainIdIfNeeded(params)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async mintVlp(params) {
|
|
55
|
+
return this.context.engineClient.mintVlp({
|
|
56
|
+
...params,
|
|
57
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
58
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
59
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async burnVlp(params) {
|
|
63
|
+
return this.context.engineClient.burnVlp({
|
|
64
|
+
...params,
|
|
65
|
+
subaccountOwner: this.getSubaccountOwnerIfNeeded(params),
|
|
66
|
+
chainId: this.getWalletClientChainIdIfNeeded(params),
|
|
67
|
+
verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress()
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async _mintMockERC20(params) {
|
|
71
|
+
if (!this.context.walletClient) {
|
|
72
|
+
throw new WalletNotProvidedError();
|
|
73
|
+
}
|
|
74
|
+
const config = await this.context.contracts.spotEngine.read.getConfig([
|
|
75
|
+
params.productId
|
|
76
|
+
]);
|
|
77
|
+
return this.context.walletClient.writeContract({
|
|
78
|
+
abi: MOCK_ERC20_ABI,
|
|
79
|
+
address: config.token,
|
|
80
|
+
functionName: "mint",
|
|
81
|
+
args: [this.getWalletClientAddress(), toBigInt(params.amount)]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
SpotExecuteAPI
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=SpotExecuteAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/SpotExecuteAPI.ts"],"sourcesContent":["import {\n approveDepositAllowance,\n depositCollateral,\n DepositCollateralParams,\n isWriteableContract,\n MintMockERC20Params,\n MOCK_ERC20_ABI,\n} from '@nadohq/contracts';\nimport { toBigInt, WalletNotProvidedError } from '@nadohq/utils';\nimport { BaseSpotAPI } from './BaseSpotAPI';\nimport {\n ApproveAllowanceParams,\n BurnVlpParams,\n MintVlpParams,\n TransferQuoteParams,\n WithdrawCollateralParams,\n} from './types';\n\nexport class SpotExecuteAPI extends BaseSpotAPI {\n async deposit(params: DepositCollateralParams) {\n return depositCollateral({\n endpoint: this.context.contracts.endpoint,\n subaccountName: params.subaccountName,\n productId: params.productId,\n amount: params.amount,\n referralCode: params.referralCode,\n });\n }\n\n async withdraw(params: WithdrawCollateralParams) {\n return this.context.engineClient.withdrawCollateral({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n async approveAllowance(params: ApproveAllowanceParams) {\n const tokenContract = await this.getTokenContractForProduct(params);\n if (!isWriteableContract(tokenContract)) {\n throw new Error(\n 'Token contract does not permit writes. Is a wallet client provided?',\n );\n }\n\n return approveDepositAllowance({\n amount: params.amount,\n endpoint: this.context.contracts.endpoint,\n tokenContract,\n });\n }\n\n /**\n * Transfers quote between subaccounts under the same wallet.\n *\n * @param params\n */\n async transferQuote(params: TransferQuoteParams) {\n return this.context.engineClient.transferQuote({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n });\n }\n\n async mintVlp(params: MintVlpParams) {\n return this.context.engineClient.mintVlp({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n async burnVlp(params: BurnVlpParams) {\n return this.context.engineClient.burnVlp({\n ...params,\n subaccountOwner: this.getSubaccountOwnerIfNeeded(params),\n chainId: this.getWalletClientChainIdIfNeeded(params),\n verifyingAddr: params.verifyingAddr ?? this.getEndpointAddress(),\n });\n }\n\n async _mintMockERC20(params: MintMockERC20Params) {\n if (!this.context.walletClient) {\n throw new WalletNotProvidedError();\n }\n\n const config = await this.context.contracts.spotEngine.read.getConfig([\n params.productId,\n ]);\n\n return this.context.walletClient.writeContract({\n abi: MOCK_ERC20_ABI,\n address: config.token,\n functionName: 'mint',\n args: [this.getWalletClientAddress(), toBigInt(params.amount)],\n });\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,UAAU,8BAA8B;AACjD,SAAS,mBAAmB;AASrB,IAAM,iBAAN,cAA6B,YAAY;AAAA,EAC9C,MAAM,QAAQ,QAAiC;AAC7C,WAAO,kBAAkB;AAAA,MACvB,UAAU,KAAK,QAAQ,UAAU;AAAA,MACjC,gBAAgB,OAAO;AAAA,MACvB,WAAW,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,MACf,cAAc,OAAO;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,SAAS,QAAkC;AAC/C,WAAO,KAAK,QAAQ,aAAa,mBAAmB;AAAA,MAClD,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,iBAAiB,QAAgC;AACrD,UAAM,gBAAgB,MAAM,KAAK,2BAA2B,MAAM;AAClE,QAAI,CAAC,oBAAoB,aAAa,GAAG;AACvC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,WAAO,wBAAwB;AAAA,MAC7B,QAAQ,OAAO;AAAA,MACf,UAAU,KAAK,QAAQ,UAAU;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,QAA6B;AAC/C,WAAO,KAAK,QAAQ,aAAa,cAAc;AAAA,MAC7C,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,MAC/D,SAAS,KAAK,+BAA+B,MAAM;AAAA,IACrD,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACnC,WAAO,KAAK,QAAQ,aAAa,QAAQ;AAAA,MACvC,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACnC,WAAO,KAAK,QAAQ,aAAa,QAAQ;AAAA,MACvC,GAAG;AAAA,MACH,iBAAiB,KAAK,2BAA2B,MAAM;AAAA,MACvD,SAAS,KAAK,+BAA+B,MAAM;AAAA,MACnD,eAAe,OAAO,iBAAiB,KAAK,mBAAmB;AAAA,IACjE,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,eAAe,QAA6B;AAChD,QAAI,CAAC,KAAK,QAAQ,cAAc;AAC9B,YAAM,IAAI,uBAAuB;AAAA,IACnC;AAEA,UAAM,SAAS,MAAM,KAAK,QAAQ,UAAU,WAAW,KAAK,UAAU;AAAA,MACpE,OAAO;AAAA,IACT,CAAC;AAED,WAAO,KAAK,QAAQ,aAAa,cAAc;AAAA,MAC7C,KAAK;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,cAAc;AAAA,MACd,MAAM,CAAC,KAAK,uBAAuB,GAAG,SAAS,OAAO,MAAM,CAAC;AAAA,IAC/D,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/apis/spot/SpotQueryAPI.ts
|
|
21
|
+
var SpotQueryAPI_exports = {};
|
|
22
|
+
__export(SpotQueryAPI_exports, {
|
|
23
|
+
SpotQueryAPI: () => SpotQueryAPI
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(SpotQueryAPI_exports);
|
|
26
|
+
var import_utils = require("@nadohq/utils");
|
|
27
|
+
var import_BaseSpotAPI = require("./BaseSpotAPI.cjs");
|
|
28
|
+
var SpotQueryAPI = class extends import_BaseSpotAPI.BaseSpotAPI {
|
|
29
|
+
/**
|
|
30
|
+
* Gets the estimated max withdrawable amount for a product
|
|
31
|
+
* @param params
|
|
32
|
+
*/
|
|
33
|
+
async getMaxWithdrawable(params) {
|
|
34
|
+
return this.context.engineClient.getMaxWithdrawable(params);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Queries engine to determine maximum quote amount for minting VLP.
|
|
38
|
+
*
|
|
39
|
+
* @param params
|
|
40
|
+
*/
|
|
41
|
+
async getMaxMintVlpAmount(params) {
|
|
42
|
+
return this.context.engineClient.getMaxMintVlpAmount(params);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Helper to get current token balance in the user's wallet (i.e. not in a Nado subaccount)
|
|
46
|
+
*/
|
|
47
|
+
async getTokenWalletBalance({
|
|
48
|
+
address,
|
|
49
|
+
...rest
|
|
50
|
+
}) {
|
|
51
|
+
const token = await this.getTokenContractForProduct(rest);
|
|
52
|
+
return token.read.balanceOf([(0, import_utils.getValidatedAddress)(address)]);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Helper to get current token allowance
|
|
56
|
+
*/
|
|
57
|
+
async getTokenAllowance({
|
|
58
|
+
address,
|
|
59
|
+
...rest
|
|
60
|
+
}) {
|
|
61
|
+
const token = await this.getTokenContractForProduct(rest);
|
|
62
|
+
return (0, import_utils.toBigDecimal)(
|
|
63
|
+
await token.read.allowance([
|
|
64
|
+
(0, import_utils.getValidatedAddress)(address),
|
|
65
|
+
this.getEndpointAddress()
|
|
66
|
+
])
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
SpotQueryAPI
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=SpotQueryAPI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/SpotQueryAPI.ts"],"sourcesContent":["import {\n GetEngineMaxMintVlpAmountParams,\n GetEngineMaxWithdrawableParams,\n} from '@nadohq/engine-client';\nimport { BigDecimal, getValidatedAddress, toBigDecimal } from '@nadohq/utils';\nimport { BaseSpotAPI } from './BaseSpotAPI';\nimport { GetTokenAllowanceParams, GetTokenWalletBalanceParams } from './types';\n\nexport class SpotQueryAPI extends BaseSpotAPI {\n /**\n * Gets the estimated max withdrawable amount for a product\n * @param params\n */\n async getMaxWithdrawable(params: GetEngineMaxWithdrawableParams) {\n return this.context.engineClient.getMaxWithdrawable(params);\n }\n\n /**\n * Queries engine to determine maximum quote amount for minting VLP.\n *\n * @param params\n */\n async getMaxMintVlpAmount(params: GetEngineMaxMintVlpAmountParams) {\n return this.context.engineClient.getMaxMintVlpAmount(params);\n }\n\n /**\n * Helper to get current token balance in the user's wallet (i.e. not in a Nado subaccount)\n */\n async getTokenWalletBalance({\n address,\n ...rest\n }: GetTokenWalletBalanceParams): Promise<bigint> {\n const token = await this.getTokenContractForProduct(rest);\n return token.read.balanceOf([getValidatedAddress(address)]);\n }\n\n /**\n * Helper to get current token allowance\n */\n async getTokenAllowance({\n address,\n ...rest\n }: GetTokenAllowanceParams): Promise<BigDecimal> {\n const token = await this.getTokenContractForProduct(rest);\n return toBigDecimal(\n await token.read.allowance([\n getValidatedAddress(address),\n this.getEndpointAddress(),\n ]),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA8D;AAC9D,yBAA4B;AAGrB,IAAM,eAAN,cAA2B,+BAAY;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,MAAM,mBAAmB,QAAwC;AAC/D,WAAO,KAAK,QAAQ,aAAa,mBAAmB,MAAM;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBAAoB,QAAyC;AACjE,WAAO,KAAK,QAAQ,aAAa,oBAAoB,MAAM;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,sBAAsB;AAAA,IAC1B;AAAA,IACA,GAAG;AAAA,EACL,GAAiD;AAC/C,UAAM,QAAQ,MAAM,KAAK,2BAA2B,IAAI;AACxD,WAAO,MAAM,KAAK,UAAU,KAAC,kCAAoB,OAAO,CAAC,CAAC;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAkB;AAAA,IACtB;AAAA,IACA,GAAG;AAAA,EACL,GAAiD;AAC/C,UAAM,QAAQ,MAAM,KAAK,2BAA2B,IAAI;AACxD,eAAO;AAAA,MACL,MAAM,MAAM,KAAK,UAAU;AAAA,YACzB,kCAAoB,OAAO;AAAA,QAC3B,KAAK,mBAAmB;AAAA,MAC1B,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GetEngineMaxWithdrawableParams, GetEngineMaxMintVlpAmountParams } from '@nadohq/engine-client';
|
|
2
|
+
import { BigDecimal } from '@nadohq/utils';
|
|
3
|
+
import { BaseSpotAPI } from './BaseSpotAPI.cjs';
|
|
4
|
+
import { GetTokenWalletBalanceParams, GetTokenAllowanceParams } from './types.cjs';
|
|
5
|
+
import '@nadohq/contracts';
|
|
6
|
+
import '../base.cjs';
|
|
7
|
+
import '../../context.cjs';
|
|
8
|
+
import '@nadohq/indexer-client';
|
|
9
|
+
import '@nadohq/trigger-client';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import '../types.cjs';
|
|
12
|
+
|
|
13
|
+
declare class SpotQueryAPI extends BaseSpotAPI {
|
|
14
|
+
/**
|
|
15
|
+
* Gets the estimated max withdrawable amount for a product
|
|
16
|
+
* @param params
|
|
17
|
+
*/
|
|
18
|
+
getMaxWithdrawable(params: GetEngineMaxWithdrawableParams): Promise<BigDecimal>;
|
|
19
|
+
/**
|
|
20
|
+
* Queries engine to determine maximum quote amount for minting VLP.
|
|
21
|
+
*
|
|
22
|
+
* @param params
|
|
23
|
+
*/
|
|
24
|
+
getMaxMintVlpAmount(params: GetEngineMaxMintVlpAmountParams): Promise<BigDecimal>;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to get current token balance in the user's wallet (i.e. not in a Nado subaccount)
|
|
27
|
+
*/
|
|
28
|
+
getTokenWalletBalance({ address, ...rest }: GetTokenWalletBalanceParams): Promise<bigint>;
|
|
29
|
+
/**
|
|
30
|
+
* Helper to get current token allowance
|
|
31
|
+
*/
|
|
32
|
+
getTokenAllowance({ address, ...rest }: GetTokenAllowanceParams): Promise<BigDecimal>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { SpotQueryAPI };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GetEngineMaxWithdrawableParams, GetEngineMaxMintVlpAmountParams } from '@nadohq/engine-client';
|
|
2
|
+
import { BigDecimal } from '@nadohq/utils';
|
|
3
|
+
import { BaseSpotAPI } from './BaseSpotAPI.js';
|
|
4
|
+
import { GetTokenWalletBalanceParams, GetTokenAllowanceParams } from './types.js';
|
|
5
|
+
import '@nadohq/contracts';
|
|
6
|
+
import '../base.js';
|
|
7
|
+
import '../../context.js';
|
|
8
|
+
import '@nadohq/indexer-client';
|
|
9
|
+
import '@nadohq/trigger-client';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import '../types.js';
|
|
12
|
+
|
|
13
|
+
declare class SpotQueryAPI extends BaseSpotAPI {
|
|
14
|
+
/**
|
|
15
|
+
* Gets the estimated max withdrawable amount for a product
|
|
16
|
+
* @param params
|
|
17
|
+
*/
|
|
18
|
+
getMaxWithdrawable(params: GetEngineMaxWithdrawableParams): Promise<BigDecimal>;
|
|
19
|
+
/**
|
|
20
|
+
* Queries engine to determine maximum quote amount for minting VLP.
|
|
21
|
+
*
|
|
22
|
+
* @param params
|
|
23
|
+
*/
|
|
24
|
+
getMaxMintVlpAmount(params: GetEngineMaxMintVlpAmountParams): Promise<BigDecimal>;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to get current token balance in the user's wallet (i.e. not in a Nado subaccount)
|
|
27
|
+
*/
|
|
28
|
+
getTokenWalletBalance({ address, ...rest }: GetTokenWalletBalanceParams): Promise<bigint>;
|
|
29
|
+
/**
|
|
30
|
+
* Helper to get current token allowance
|
|
31
|
+
*/
|
|
32
|
+
getTokenAllowance({ address, ...rest }: GetTokenAllowanceParams): Promise<BigDecimal>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { SpotQueryAPI };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/apis/spot/SpotQueryAPI.ts
|
|
2
|
+
import { getValidatedAddress, toBigDecimal } from "@nadohq/utils";
|
|
3
|
+
import { BaseSpotAPI } from "./BaseSpotAPI.js";
|
|
4
|
+
var SpotQueryAPI = class extends BaseSpotAPI {
|
|
5
|
+
/**
|
|
6
|
+
* Gets the estimated max withdrawable amount for a product
|
|
7
|
+
* @param params
|
|
8
|
+
*/
|
|
9
|
+
async getMaxWithdrawable(params) {
|
|
10
|
+
return this.context.engineClient.getMaxWithdrawable(params);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Queries engine to determine maximum quote amount for minting VLP.
|
|
14
|
+
*
|
|
15
|
+
* @param params
|
|
16
|
+
*/
|
|
17
|
+
async getMaxMintVlpAmount(params) {
|
|
18
|
+
return this.context.engineClient.getMaxMintVlpAmount(params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Helper to get current token balance in the user's wallet (i.e. not in a Nado subaccount)
|
|
22
|
+
*/
|
|
23
|
+
async getTokenWalletBalance({
|
|
24
|
+
address,
|
|
25
|
+
...rest
|
|
26
|
+
}) {
|
|
27
|
+
const token = await this.getTokenContractForProduct(rest);
|
|
28
|
+
return token.read.balanceOf([getValidatedAddress(address)]);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Helper to get current token allowance
|
|
32
|
+
*/
|
|
33
|
+
async getTokenAllowance({
|
|
34
|
+
address,
|
|
35
|
+
...rest
|
|
36
|
+
}) {
|
|
37
|
+
const token = await this.getTokenContractForProduct(rest);
|
|
38
|
+
return toBigDecimal(
|
|
39
|
+
await token.read.allowance([
|
|
40
|
+
getValidatedAddress(address),
|
|
41
|
+
this.getEndpointAddress()
|
|
42
|
+
])
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
SpotQueryAPI
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=SpotQueryAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/SpotQueryAPI.ts"],"sourcesContent":["import {\n GetEngineMaxMintVlpAmountParams,\n GetEngineMaxWithdrawableParams,\n} from '@nadohq/engine-client';\nimport { BigDecimal, getValidatedAddress, toBigDecimal } from '@nadohq/utils';\nimport { BaseSpotAPI } from './BaseSpotAPI';\nimport { GetTokenAllowanceParams, GetTokenWalletBalanceParams } from './types';\n\nexport class SpotQueryAPI extends BaseSpotAPI {\n /**\n * Gets the estimated max withdrawable amount for a product\n * @param params\n */\n async getMaxWithdrawable(params: GetEngineMaxWithdrawableParams) {\n return this.context.engineClient.getMaxWithdrawable(params);\n }\n\n /**\n * Queries engine to determine maximum quote amount for minting VLP.\n *\n * @param params\n */\n async getMaxMintVlpAmount(params: GetEngineMaxMintVlpAmountParams) {\n return this.context.engineClient.getMaxMintVlpAmount(params);\n }\n\n /**\n * Helper to get current token balance in the user's wallet (i.e. not in a Nado subaccount)\n */\n async getTokenWalletBalance({\n address,\n ...rest\n }: GetTokenWalletBalanceParams): Promise<bigint> {\n const token = await this.getTokenContractForProduct(rest);\n return token.read.balanceOf([getValidatedAddress(address)]);\n }\n\n /**\n * Helper to get current token allowance\n */\n async getTokenAllowance({\n address,\n ...rest\n }: GetTokenAllowanceParams): Promise<BigDecimal> {\n const token = await this.getTokenContractForProduct(rest);\n return toBigDecimal(\n await token.read.allowance([\n getValidatedAddress(address),\n this.getEndpointAddress(),\n ]),\n );\n }\n}\n"],"mappings":";AAIA,SAAqB,qBAAqB,oBAAoB;AAC9D,SAAS,mBAAmB;AAGrB,IAAM,eAAN,cAA2B,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,MAAM,mBAAmB,QAAwC;AAC/D,WAAO,KAAK,QAAQ,aAAa,mBAAmB,MAAM;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,oBAAoB,QAAyC;AACjE,WAAO,KAAK,QAAQ,aAAa,oBAAoB,MAAM;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,sBAAsB;AAAA,IAC1B;AAAA,IACA,GAAG;AAAA,EACL,GAAiD;AAC/C,UAAM,QAAQ,MAAM,KAAK,2BAA2B,IAAI;AACxD,WAAO,MAAM,KAAK,UAAU,CAAC,oBAAoB,OAAO,CAAC,CAAC;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAkB;AAAA,IACtB;AAAA,IACA,GAAG;AAAA,EACL,GAAiD;AAC/C,UAAM,QAAQ,MAAM,KAAK,2BAA2B,IAAI;AACxD,WAAO;AAAA,MACL,MAAM,MAAM,KAAK,UAAU;AAAA,QACzB,oBAAoB,OAAO;AAAA,QAC3B,KAAK,mBAAmB;AAAA,MAC1B,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/apis/spot/index.ts
|
|
22
|
+
var spot_exports = {};
|
|
23
|
+
__export(spot_exports, {
|
|
24
|
+
SpotAPI: () => SpotAPI
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(spot_exports);
|
|
27
|
+
var import_ts_mixer = require("ts-mixer");
|
|
28
|
+
var import_SpotExecuteAPI = require("./SpotExecuteAPI.cjs");
|
|
29
|
+
var import_SpotQueryAPI = require("./SpotQueryAPI.cjs");
|
|
30
|
+
__reExport(spot_exports, require("./types.cjs"), module.exports);
|
|
31
|
+
var SpotAPI = class extends (0, import_ts_mixer.Mixin)(import_SpotExecuteAPI.SpotExecuteAPI, import_SpotQueryAPI.SpotQueryAPI) {
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
SpotAPI,
|
|
36
|
+
...require("./types.cjs")
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/index.ts"],"sourcesContent":["import { Mixin } from 'ts-mixer';\nimport { SpotExecuteAPI } from './SpotExecuteAPI';\nimport { SpotQueryAPI } from './SpotQueryAPI';\n\n/**\n * Combined Spot trading API providing both execution and query functionality\n */\nexport class SpotAPI extends Mixin(SpotExecuteAPI, SpotQueryAPI) {}\n\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsB;AACtB,4BAA+B;AAC/B,0BAA6B;AAO7B,yBAAc,wBATd;AAOO,IAAM,UAAN,kBAAsB,uBAAM,sCAAgB,gCAAY,EAAE;AAAC;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as ts_mixer_dist_types_types from 'ts-mixer/dist/types/types';
|
|
2
|
+
import { SpotExecuteAPI } from './SpotExecuteAPI.cjs';
|
|
3
|
+
import { SpotQueryAPI } from './SpotQueryAPI.cjs';
|
|
4
|
+
export { ApproveAllowanceParams, BurnVlpParams, GetTokenAllowanceParams, GetTokenWalletBalanceParams, MintVlpParams, ProductIdOrTokenAddress, TransferQuoteParams, WithdrawCollateralParams } from './types.cjs';
|
|
5
|
+
import '@nadohq/engine-client';
|
|
6
|
+
import '@nadohq/contracts';
|
|
7
|
+
import './BaseSpotAPI.cjs';
|
|
8
|
+
import '../base.cjs';
|
|
9
|
+
import '../../context.cjs';
|
|
10
|
+
import '@nadohq/indexer-client';
|
|
11
|
+
import '@nadohq/trigger-client';
|
|
12
|
+
import 'viem';
|
|
13
|
+
import '@nadohq/utils';
|
|
14
|
+
import '../types.cjs';
|
|
15
|
+
|
|
16
|
+
declare const SpotAPI_base: ts_mixer_dist_types_types.Class<any[], SpotExecuteAPI & SpotQueryAPI, typeof SpotExecuteAPI & typeof SpotQueryAPI>;
|
|
17
|
+
/**
|
|
18
|
+
* Combined Spot trading API providing both execution and query functionality
|
|
19
|
+
*/
|
|
20
|
+
declare class SpotAPI extends SpotAPI_base {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { SpotAPI };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as ts_mixer_dist_types_types from 'ts-mixer/dist/types/types';
|
|
2
|
+
import { SpotExecuteAPI } from './SpotExecuteAPI.js';
|
|
3
|
+
import { SpotQueryAPI } from './SpotQueryAPI.js';
|
|
4
|
+
export { ApproveAllowanceParams, BurnVlpParams, GetTokenAllowanceParams, GetTokenWalletBalanceParams, MintVlpParams, ProductIdOrTokenAddress, TransferQuoteParams, WithdrawCollateralParams } from './types.js';
|
|
5
|
+
import '@nadohq/engine-client';
|
|
6
|
+
import '@nadohq/contracts';
|
|
7
|
+
import './BaseSpotAPI.js';
|
|
8
|
+
import '../base.js';
|
|
9
|
+
import '../../context.js';
|
|
10
|
+
import '@nadohq/indexer-client';
|
|
11
|
+
import '@nadohq/trigger-client';
|
|
12
|
+
import 'viem';
|
|
13
|
+
import '@nadohq/utils';
|
|
14
|
+
import '../types.js';
|
|
15
|
+
|
|
16
|
+
declare const SpotAPI_base: ts_mixer_dist_types_types.Class<any[], SpotExecuteAPI & SpotQueryAPI, typeof SpotExecuteAPI & typeof SpotQueryAPI>;
|
|
17
|
+
/**
|
|
18
|
+
* Combined Spot trading API providing both execution and query functionality
|
|
19
|
+
*/
|
|
20
|
+
declare class SpotAPI extends SpotAPI_base {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { SpotAPI };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/apis/spot/index.ts
|
|
2
|
+
import { Mixin } from "ts-mixer";
|
|
3
|
+
import { SpotExecuteAPI } from "./SpotExecuteAPI.js";
|
|
4
|
+
import { SpotQueryAPI } from "./SpotQueryAPI.js";
|
|
5
|
+
export * from "./types.js";
|
|
6
|
+
var SpotAPI = class extends Mixin(SpotExecuteAPI, SpotQueryAPI) {
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
SpotAPI
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/index.ts"],"sourcesContent":["import { Mixin } from 'ts-mixer';\nimport { SpotExecuteAPI } from './SpotExecuteAPI';\nimport { SpotQueryAPI } from './SpotQueryAPI';\n\n/**\n * Combined Spot trading API providing both execution and query functionality\n */\nexport class SpotAPI extends Mixin(SpotExecuteAPI, SpotQueryAPI) {}\n\nexport * from './types';\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAO7B,cAAc;AAFP,IAAM,UAAN,cAAsB,MAAM,gBAAgB,YAAY,EAAE;AAAC;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/apis/spot/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
19
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/apis/spot/types.ts"],"sourcesContent":["import {\n EngineBurnVlpParams,\n EngineMintVlpParams,\n EngineTransferQuoteParams,\n EngineWithdrawCollateralParams,\n} from '@nadohq/engine-client';\nimport { BigDecimalish } from '@nadohq/utils';\nimport { OptionalSignatureParams, OptionalSubaccountOwner } from '../types';\n\nexport type ProductIdOrTokenAddress =\n | {\n productId: number;\n }\n | {\n tokenAddress: string;\n };\n\ntype TokenQueryParams = {\n address: string;\n} & ProductIdOrTokenAddress;\n\nexport type ApproveAllowanceParams = ProductIdOrTokenAddress & {\n amount: BigDecimalish;\n};\n\nexport type GetTokenWalletBalanceParams = TokenQueryParams;\n\nexport type GetTokenAllowanceParams = TokenQueryParams;\n\nexport type WithdrawCollateralParams = OptionalSignatureParams<\n OptionalSubaccountOwner<EngineWithdrawCollateralParams>\n>;\n\nexport type TransferQuoteParams = OptionalSignatureParams<\n OptionalSubaccountOwner<EngineTransferQuoteParams>\n>;\n\nexport type MintVlpParams = OptionalSignatureParams<\n OptionalSubaccountOwner<EngineMintVlpParams>\n>;\n\nexport type BurnVlpParams = OptionalSignatureParams<\n OptionalSubaccountOwner<EngineBurnVlpParams>\n>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EngineWithdrawCollateralParams, EngineTransferQuoteParams, EngineMintVlpParams, EngineBurnVlpParams } from '@nadohq/engine-client';
|
|
2
|
+
import { BigDecimalish } from '@nadohq/utils';
|
|
3
|
+
import { OptionalSignatureParams, OptionalSubaccountOwner } from '../types.cjs';
|
|
4
|
+
|
|
5
|
+
type ProductIdOrTokenAddress = {
|
|
6
|
+
productId: number;
|
|
7
|
+
} | {
|
|
8
|
+
tokenAddress: string;
|
|
9
|
+
};
|
|
10
|
+
type TokenQueryParams = {
|
|
11
|
+
address: string;
|
|
12
|
+
} & ProductIdOrTokenAddress;
|
|
13
|
+
type ApproveAllowanceParams = ProductIdOrTokenAddress & {
|
|
14
|
+
amount: BigDecimalish;
|
|
15
|
+
};
|
|
16
|
+
type GetTokenWalletBalanceParams = TokenQueryParams;
|
|
17
|
+
type GetTokenAllowanceParams = TokenQueryParams;
|
|
18
|
+
type WithdrawCollateralParams = OptionalSignatureParams<OptionalSubaccountOwner<EngineWithdrawCollateralParams>>;
|
|
19
|
+
type TransferQuoteParams = OptionalSignatureParams<OptionalSubaccountOwner<EngineTransferQuoteParams>>;
|
|
20
|
+
type MintVlpParams = OptionalSignatureParams<OptionalSubaccountOwner<EngineMintVlpParams>>;
|
|
21
|
+
type BurnVlpParams = OptionalSignatureParams<OptionalSubaccountOwner<EngineBurnVlpParams>>;
|
|
22
|
+
|
|
23
|
+
export type { ApproveAllowanceParams, BurnVlpParams, GetTokenAllowanceParams, GetTokenWalletBalanceParams, MintVlpParams, ProductIdOrTokenAddress, TransferQuoteParams, WithdrawCollateralParams };
|