@nadohq/client 0.1.0-alpha.3 → 0.1.0-alpha.30
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/dist/apis/base.cjs +3 -6
- package/dist/apis/base.cjs.map +1 -1
- package/dist/apis/base.d.cts +1 -2
- package/dist/apis/base.d.ts +1 -2
- package/dist/apis/base.js +1 -4
- package/dist/apis/base.js.map +1 -1
- package/dist/apis/market/MarketExecuteAPI.cjs +44 -22
- package/dist/apis/market/MarketExecuteAPI.cjs.map +1 -1
- package/dist/apis/market/MarketExecuteAPI.d.cts +14 -11
- package/dist/apis/market/MarketExecuteAPI.d.ts +14 -11
- package/dist/apis/market/MarketExecuteAPI.js +44 -22
- package/dist/apis/market/MarketExecuteAPI.js.map +1 -1
- package/dist/apis/market/MarketQueryAPI.cjs +2 -9
- package/dist/apis/market/MarketQueryAPI.cjs.map +1 -1
- package/dist/apis/market/MarketQueryAPI.d.cts +4 -8
- package/dist/apis/market/MarketQueryAPI.d.ts +4 -8
- package/dist/apis/market/MarketQueryAPI.js +2 -9
- package/dist/apis/market/MarketQueryAPI.js.map +1 -1
- package/dist/apis/market/index.d.cts +2 -2
- package/dist/apis/market/index.d.ts +2 -2
- package/dist/apis/market/types.cjs.map +1 -1
- package/dist/apis/market/types.d.cts +12 -8
- package/dist/apis/market/types.d.ts +12 -8
- package/dist/apis/perp/PerpExecuteAPI.cjs +0 -3
- package/dist/apis/perp/PerpExecuteAPI.cjs.map +1 -1
- package/dist/apis/perp/PerpExecuteAPI.d.cts +1 -2
- package/dist/apis/perp/PerpExecuteAPI.d.ts +1 -2
- package/dist/apis/perp/PerpExecuteAPI.js +0 -3
- package/dist/apis/perp/PerpExecuteAPI.js.map +1 -1
- package/dist/apis/perp/PerpQueryAPI.d.cts +1 -1
- package/dist/apis/perp/PerpQueryAPI.d.ts +1 -1
- package/dist/apis/perp/index.d.cts +1 -1
- package/dist/apis/perp/index.d.ts +1 -1
- package/dist/apis/spot/BaseSpotAPI.cjs +3 -4
- package/dist/apis/spot/BaseSpotAPI.cjs.map +1 -1
- package/dist/apis/spot/BaseSpotAPI.d.cts +1 -2
- package/dist/apis/spot/BaseSpotAPI.d.ts +1 -2
- package/dist/apis/spot/BaseSpotAPI.js +4 -2
- package/dist/apis/spot/BaseSpotAPI.js.map +1 -1
- package/dist/apis/spot/SpotExecuteAPI.cjs +7 -8
- package/dist/apis/spot/SpotExecuteAPI.cjs.map +1 -1
- package/dist/apis/spot/SpotExecuteAPI.d.cts +2 -3
- package/dist/apis/spot/SpotExecuteAPI.d.ts +2 -3
- package/dist/apis/spot/SpotExecuteAPI.js +4 -3
- package/dist/apis/spot/SpotExecuteAPI.js.map +1 -1
- package/dist/apis/spot/SpotQueryAPI.cjs +4 -4
- package/dist/apis/spot/SpotQueryAPI.cjs.map +1 -1
- package/dist/apis/spot/SpotQueryAPI.d.cts +1 -2
- package/dist/apis/spot/SpotQueryAPI.d.ts +1 -2
- package/dist/apis/spot/SpotQueryAPI.js +1 -1
- package/dist/apis/spot/SpotQueryAPI.js.map +1 -1
- package/dist/apis/spot/index.d.cts +2 -3
- package/dist/apis/spot/index.d.ts +2 -3
- package/dist/apis/spot/types.cjs.map +1 -1
- package/dist/apis/spot/types.d.cts +6 -2
- package/dist/apis/spot/types.d.ts +6 -2
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.cts +1 -1
- package/dist/apis/subaccount/SubaccountExecuteAPI.d.ts +1 -1
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs +1 -10
- package/dist/apis/subaccount/SubaccountQueryAPI.cjs.map +1 -1
- package/dist/apis/subaccount/SubaccountQueryAPI.d.cts +3 -10
- package/dist/apis/subaccount/SubaccountQueryAPI.d.ts +3 -10
- package/dist/apis/subaccount/SubaccountQueryAPI.js +1 -12
- package/dist/apis/subaccount/SubaccountQueryAPI.js.map +1 -1
- package/dist/apis/subaccount/index.cjs +3 -4
- package/dist/apis/subaccount/index.cjs.map +1 -1
- package/dist/apis/subaccount/index.d.cts +1 -1
- package/dist/apis/subaccount/index.d.ts +1 -1
- package/dist/apis/subaccount/index.js +4 -2
- package/dist/apis/subaccount/index.js.map +1 -1
- package/dist/apis/subaccount/types.cjs.map +1 -1
- package/dist/apis/subaccount/types.d.cts +1 -1
- package/dist/apis/subaccount/types.d.ts +1 -1
- package/dist/apis/ws/WebSocketExecuteAPI.cjs.map +1 -1
- package/dist/apis/ws/WebSocketExecuteAPI.d.cts +4 -4
- package/dist/apis/ws/WebSocketExecuteAPI.d.ts +4 -4
- package/dist/apis/ws/WebSocketExecuteAPI.js.map +1 -1
- package/dist/apis/ws/WebSocketQueryAPI.d.cts +1 -1
- package/dist/apis/ws/WebSocketQueryAPI.d.ts +1 -1
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.cts +1 -1
- package/dist/apis/ws/WebSocketSubscriptionAPI.d.ts +1 -1
- package/dist/apis/ws/index.d.cts +1 -1
- package/dist/apis/ws/index.d.ts +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -3
- package/dist/client.d.ts +2 -3
- package/dist/client.js.map +1 -1
- package/dist/context.cjs +3 -3
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +4 -4
- package/dist/context.js.map +1 -1
- package/dist/createNadoClient.d.cts +1 -2
- package/dist/createNadoClient.d.ts +1 -2
- package/dist/index.cjs +4 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
- package/src/apis/base.ts +1 -6
- package/src/apis/market/MarketExecuteAPI.ts +50 -32
- package/src/apis/market/MarketQueryAPI.ts +4 -11
- package/src/apis/market/types.ts +15 -11
- package/src/apis/perp/PerpExecuteAPI.ts +1 -6
- package/src/apis/spot/BaseSpotAPI.ts +5 -2
- package/src/apis/spot/SpotExecuteAPI.ts +4 -3
- package/src/apis/spot/SpotQueryAPI.ts +1 -1
- package/src/apis/spot/types.ts +6 -1
- package/src/apis/subaccount/SubaccountQueryAPI.ts +1 -14
- package/src/apis/subaccount/index.ts +4 -2
- package/src/apis/subaccount/types.ts +1 -1
- package/src/apis/ws/WebSocketExecuteAPI.ts +1 -1
- package/src/client.ts +1 -1
- package/src/context.ts +6 -6
- package/src/index.ts +2 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getAllMarkets, GetAllMarketsResponse } from '@nadohq/contracts';
|
|
2
1
|
import {
|
|
2
|
+
GetEngineAllMarketsResponse,
|
|
3
3
|
GetEngineMarketLiquidityParams,
|
|
4
4
|
GetEngineMarketPriceParams,
|
|
5
5
|
GetEngineMarketPricesParams,
|
|
@@ -24,25 +24,18 @@ import { BaseNadoAPI } from '../base';
|
|
|
24
24
|
import { GetTriggerOrdersParams } from './types';
|
|
25
25
|
|
|
26
26
|
export class MarketQueryAPI extends BaseNadoAPI {
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves all market states from the on-chain contracts
|
|
29
|
-
*/
|
|
30
|
-
async getAllMarkets(): Promise<GetAllMarketsResponse> {
|
|
31
|
-
return getAllMarkets(this.context.contracts);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
/**
|
|
35
28
|
* Retrieves all market states from the offchain engine
|
|
36
29
|
*/
|
|
37
|
-
async
|
|
30
|
+
async getAllMarkets(): Promise<GetEngineAllMarketsResponse> {
|
|
38
31
|
return this.context.engineClient.getAllMarkets();
|
|
39
32
|
}
|
|
40
33
|
|
|
41
34
|
/**
|
|
42
35
|
* Get all edge engine markets
|
|
43
36
|
*/
|
|
44
|
-
async
|
|
45
|
-
Record<number,
|
|
37
|
+
async getEdgeAllMarkets(): Promise<
|
|
38
|
+
Record<number, GetEngineAllMarketsResponse>
|
|
46
39
|
> {
|
|
47
40
|
return this.context.engineClient.getEdgeAllMarkets();
|
|
48
41
|
}
|
package/src/apis/market/types.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EngineCancelOrdersParams,
|
|
3
3
|
EngineCancelProductOrdersParams,
|
|
4
|
-
EngineIsolatedOrderParams,
|
|
5
4
|
EngineOrderParams,
|
|
6
|
-
EnginePlaceIsolatedOrderParams,
|
|
7
5
|
EnginePlaceOrderParams,
|
|
8
6
|
} from '@nadohq/engine-client';
|
|
9
7
|
import {
|
|
@@ -14,20 +12,21 @@ import {
|
|
|
14
12
|
} from '@nadohq/trigger-client';
|
|
15
13
|
import { OptionalSignatureParams, OptionalSubaccountOwner } from '../types';
|
|
16
14
|
|
|
17
|
-
type ClientOrderParams<T
|
|
15
|
+
type ClientOrderParams<T extends { order: EngineOrderParams }> = Omit<
|
|
16
|
+
OptionalSignatureParams<T>,
|
|
17
|
+
// Order is overridden to make subaccount owner optional
|
|
18
|
+
| 'order'
|
|
19
|
+
// Verifying address can be derived from product ID
|
|
20
|
+
| 'verifyingAddr'
|
|
21
|
+
> & {
|
|
18
22
|
order: OptionalSubaccountOwner<EngineOrderParams>;
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
export type PlaceOrderParams = ClientOrderParams<EnginePlaceOrderParams>;
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type PlaceIsolatedOrderParams = Omit<
|
|
27
|
-
OptionalSignatureParams<EnginePlaceIsolatedOrderParams>,
|
|
28
|
-
'order'
|
|
29
|
-
> & {
|
|
30
|
-
order: OptionalSubaccountOwner<EngineIsolatedOrderParams>;
|
|
27
|
+
export type PlaceOrdersParams = {
|
|
28
|
+
orders: PlaceOrderParams[];
|
|
29
|
+
cancelOnFailure?: boolean;
|
|
31
30
|
};
|
|
32
31
|
|
|
33
32
|
export type CancelOrdersParams = OptionalSignatureParams<
|
|
@@ -46,6 +45,11 @@ export interface CancelAndPlaceOrderParams {
|
|
|
46
45
|
export type PlaceTriggerOrderParams =
|
|
47
46
|
ClientOrderParams<TriggerPlaceOrderParams>;
|
|
48
47
|
|
|
48
|
+
export interface PlaceTriggerOrdersParams {
|
|
49
|
+
orders: PlaceTriggerOrderParams[];
|
|
50
|
+
cancelOnFailure?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
export type CancelTriggerOrdersParams = OptionalSignatureParams<
|
|
50
54
|
OptionalSubaccountOwner<TriggerCancelOrdersParams>
|
|
51
55
|
>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { SettlePnlParams } from '@nadohq/contracts';
|
|
2
1
|
import { BaseNadoAPI } from '../base';
|
|
3
2
|
|
|
4
|
-
export class PerpExecuteAPI extends BaseNadoAPI {
|
|
5
|
-
settlePnl(_params: SettlePnlParams) {
|
|
6
|
-
throw Error('Not implemented');
|
|
7
|
-
}
|
|
8
|
-
}
|
|
3
|
+
export class PerpExecuteAPI extends BaseNadoAPI {}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
ContractInstance,
|
|
3
|
+
ERC20_ABI,
|
|
4
|
+
getValidatedAddress,
|
|
5
|
+
} from '@nadohq/shared';
|
|
3
6
|
import { getContract } from 'viem';
|
|
4
7
|
import { BaseNadoAPI } from '../base';
|
|
5
8
|
import { ProductIdOrTokenAddress } from './types';
|
|
@@ -3,14 +3,15 @@ import {
|
|
|
3
3
|
depositCollateral,
|
|
4
4
|
DepositCollateralParams,
|
|
5
5
|
isWriteableContract,
|
|
6
|
-
MintMockERC20Params,
|
|
7
6
|
MOCK_ERC20_ABI,
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
toBigInt,
|
|
8
|
+
WalletNotProvidedError,
|
|
9
|
+
} from '@nadohq/shared';
|
|
10
10
|
import { BaseSpotAPI } from './BaseSpotAPI';
|
|
11
11
|
import {
|
|
12
12
|
ApproveAllowanceParams,
|
|
13
13
|
BurnNlpParams,
|
|
14
|
+
MintMockERC20Params,
|
|
14
15
|
MintNlpParams,
|
|
15
16
|
TransferQuoteParams,
|
|
16
17
|
WithdrawCollateralParams,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
GetEngineMaxMintNlpAmountParams,
|
|
3
3
|
GetEngineMaxWithdrawableParams,
|
|
4
4
|
} from '@nadohq/engine-client';
|
|
5
|
-
import { BigDecimal, getValidatedAddress, toBigDecimal } from '@nadohq/
|
|
5
|
+
import { BigDecimal, getValidatedAddress, toBigDecimal } from '@nadohq/shared';
|
|
6
6
|
import { BaseSpotAPI } from './BaseSpotAPI';
|
|
7
7
|
import { GetTokenAllowanceParams, GetTokenWalletBalanceParams } from './types';
|
|
8
8
|
|
package/src/apis/spot/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
EngineTransferQuoteParams,
|
|
5
5
|
EngineWithdrawCollateralParams,
|
|
6
6
|
} from '@nadohq/engine-client';
|
|
7
|
-
import { BigDecimalish } from '@nadohq/
|
|
7
|
+
import { BigDecimalish } from '@nadohq/shared';
|
|
8
8
|
import { OptionalSignatureParams, OptionalSubaccountOwner } from '../types';
|
|
9
9
|
|
|
10
10
|
export type ProductIdOrTokenAddress =
|
|
@@ -42,3 +42,8 @@ export type MintNlpParams = OptionalSignatureParams<
|
|
|
42
42
|
export type BurnNlpParams = OptionalSignatureParams<
|
|
43
43
|
OptionalSubaccountOwner<EngineBurnNlpParams>
|
|
44
44
|
>;
|
|
45
|
+
|
|
46
|
+
export interface MintMockERC20Params {
|
|
47
|
+
productId: number;
|
|
48
|
+
amount: BigDecimalish;
|
|
49
|
+
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSubaccountSummary,
|
|
3
|
-
GetSubaccountSummaryParams,
|
|
4
|
-
} from '@nadohq/contracts';
|
|
5
1
|
import {
|
|
6
2
|
GetEngineEstimatedSubaccountSummaryParams,
|
|
7
3
|
GetEngineIsolatedPositionsParams,
|
|
@@ -15,20 +11,11 @@ import {
|
|
|
15
11
|
import { BaseNadoAPI } from '../base';
|
|
16
12
|
|
|
17
13
|
export class SubaccountQueryAPI extends BaseNadoAPI {
|
|
18
|
-
/**
|
|
19
|
-
* Returns a comprehensive summary for a subaaccount, including its balances and health
|
|
20
|
-
*
|
|
21
|
-
* @see {@link getSubaccountSummary:CONTRACTS | getSubaccountSummary}
|
|
22
|
-
*/
|
|
23
|
-
async getSubaccountSummary(params: GetSubaccountSummaryParams) {
|
|
24
|
-
return getSubaccountSummary(this.paramsWithContracts(params));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
14
|
/**
|
|
28
15
|
* Gets the subaccount state according to the offchain engine
|
|
29
16
|
* @param params
|
|
30
17
|
*/
|
|
31
|
-
async
|
|
18
|
+
async getSubaccountSummary(params: GetEngineSubaccountSummaryParams) {
|
|
32
19
|
return this.context.engineClient.getSubaccountSummary(params);
|
|
33
20
|
}
|
|
34
21
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createDeterministicLinkedSignerPrivateKey,
|
|
3
|
+
WalletNotProvidedError,
|
|
4
|
+
} from '@nadohq/shared';
|
|
3
5
|
import { Mixin } from 'ts-mixer';
|
|
4
6
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
5
7
|
import { SubaccountExecuteAPI } from './SubaccountExecuteAPI';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AccountWithPrivateKey } from '@nadohq/contracts';
|
|
2
1
|
import {
|
|
3
2
|
EngineLinkSignerParams,
|
|
4
3
|
EngineLiquidateSubaccountParams,
|
|
5
4
|
} from '@nadohq/engine-client';
|
|
5
|
+
import { AccountWithPrivateKey } from '@nadohq/shared';
|
|
6
6
|
import { OptionalSignatureParams, OptionalSubaccountOwner } from '../types';
|
|
7
7
|
|
|
8
8
|
export type LinkSignerParams = OptionalSignatureParams<
|
package/src/client.ts
CHANGED
package/src/context.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { ENGINE_CLIENT_ENDPOINTS, EngineClient } from '@nadohq/engine-client';
|
|
2
|
+
import {
|
|
3
|
+
INDEXER_CLIENT_ENDPOINTS,
|
|
4
|
+
IndexerClient,
|
|
5
|
+
} from '@nadohq/indexer-client';
|
|
1
6
|
import {
|
|
2
7
|
ChainEnv,
|
|
3
8
|
NADO_ABIS,
|
|
@@ -6,12 +11,7 @@ import {
|
|
|
6
11
|
NadoContracts,
|
|
7
12
|
NadoDeploymentAddresses,
|
|
8
13
|
WalletClientWithAccount,
|
|
9
|
-
} from '@nadohq/
|
|
10
|
-
import { ENGINE_CLIENT_ENDPOINTS, EngineClient } from '@nadohq/engine-client';
|
|
11
|
-
import {
|
|
12
|
-
INDEXER_CLIENT_ENDPOINTS,
|
|
13
|
-
IndexerClient,
|
|
14
|
-
} from '@nadohq/indexer-client';
|
|
14
|
+
} from '@nadohq/shared';
|
|
15
15
|
import {
|
|
16
16
|
TRIGGER_CLIENT_ENDPOINTS,
|
|
17
17
|
TriggerClient,
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './createNadoClient';
|
|
2
1
|
export * from './client';
|
|
3
2
|
export * from './context';
|
|
3
|
+
export * from './createNadoClient';
|
|
4
4
|
|
|
5
5
|
export * from './apis/market';
|
|
6
6
|
export * from './apis/perp';
|
|
@@ -8,8 +8,7 @@ export * from './apis/spot';
|
|
|
8
8
|
export * from './apis/subaccount';
|
|
9
9
|
|
|
10
10
|
// Subpackage exports
|
|
11
|
-
export * from '@nadohq/utils';
|
|
12
|
-
export * from '@nadohq/contracts';
|
|
13
11
|
export * from '@nadohq/engine-client';
|
|
14
12
|
export * from '@nadohq/indexer-client';
|
|
13
|
+
export * from '@nadohq/shared';
|
|
15
14
|
export * from '@nadohq/trigger-client';
|