@dydxprotocol/v4-client-js 1.0.1 → 1.0.3
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/LICENSE +5 -2
- package/__native__/__ios__/v4-native-client.js +16 -16
- package/__tests__/modules/client/Transfers.test.ts +3 -3
- package/__tests__/modules/client/ValidatorPostEndpoints.test.ts +2 -2
- package/build/__tests__/modules/client/Transfers.test.js +2 -2
- package/build/__tests__/modules/client/ValidatorPostEndpoints.test.js +2 -2
- package/build/examples/composite_example.js +2 -2
- package/build/examples/long_term_order_cancel_example.js +2 -2
- package/build/examples/short_term_order_cancel_example.js +2 -2
- package/build/examples/short_term_order_composite_example.js +2 -2
- package/build/examples/test.js +2 -2
- package/build/examples/transfer_example_deposit.js +2 -2
- package/build/examples/transfer_example_send.js +2 -2
- package/build/examples/transfer_example_subaccount_transfer.js +2 -2
- package/build/examples/transfer_example_withdraw.js +2 -2
- package/build/examples/transfer_example_withdraw_other.js +2 -2
- package/build/examples/validator_post_example.js +2 -2
- package/build/src/clients/composite-client.d.ts +13 -13
- package/build/src/clients/composite-client.js +1 -1
- package/build/src/clients/modules/post.d.ts +9 -9
- package/build/src/clients/modules/post.js +1 -1
- package/build/src/clients/native.js +10 -10
- package/build/src/clients/subaccount.d.ts +1 -1
- package/build/src/clients/subaccount.js +4 -4
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +2 -2
- package/examples/composite_example.ts +2 -2
- package/examples/long_term_order_cancel_example.ts +2 -2
- package/examples/short_term_order_cancel_example.ts +2 -2
- package/examples/short_term_order_composite_example.ts +2 -2
- package/examples/test.ts +2 -2
- package/examples/transfer_example_deposit.ts +2 -2
- package/examples/transfer_example_send.ts +2 -2
- package/examples/transfer_example_subaccount_transfer.ts +2 -2
- package/examples/transfer_example_withdraw.ts +2 -2
- package/examples/transfer_example_withdraw_other.ts +2 -2
- package/examples/validator_post_example.ts +2 -2
- package/package.json +1 -1
- package/src/clients/composite-client.ts +15 -15
- package/src/clients/modules/post.ts +9 -9
- package/src/clients/native.ts +10 -10
- package/src/clients/subaccount.ts +1 -1
- package/src/index.ts +1 -1
|
@@ -25,7 +25,7 @@ import protobuf from 'protobufjs';
|
|
|
25
25
|
import { GAS_MULTIPLIER } from '../constants';
|
|
26
26
|
import { UnexpectedClientError } from '../lib/errors';
|
|
27
27
|
import { generateRegistry } from '../lib/registry';
|
|
28
|
-
import {
|
|
28
|
+
import { SubaccountInfo } from '../subaccount';
|
|
29
29
|
import {
|
|
30
30
|
OrderFlags,
|
|
31
31
|
BroadcastMode,
|
|
@@ -343,7 +343,7 @@ export class Post {
|
|
|
343
343
|
// ------ State-Changing Requests ------ //
|
|
344
344
|
|
|
345
345
|
async placeOrder(
|
|
346
|
-
subaccount:
|
|
346
|
+
subaccount: SubaccountInfo,
|
|
347
347
|
clientId: number,
|
|
348
348
|
clobPairId: number,
|
|
349
349
|
side: Order_Side,
|
|
@@ -392,7 +392,7 @@ export class Post {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
async placeOrderObject(
|
|
395
|
-
subaccount:
|
|
395
|
+
subaccount: SubaccountInfo,
|
|
396
396
|
placeOrder: IPlaceOrder,
|
|
397
397
|
broadcastMode?: BroadcastMode,
|
|
398
398
|
): Promise<BroadcastTxAsyncResponse | BroadcastTxSyncResponse | IndexedTx> {
|
|
@@ -416,7 +416,7 @@ export class Post {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
async cancelOrder(
|
|
419
|
-
subaccount:
|
|
419
|
+
subaccount: SubaccountInfo,
|
|
420
420
|
clientId: number,
|
|
421
421
|
orderFlags: OrderFlags,
|
|
422
422
|
clobPairId: number,
|
|
@@ -446,7 +446,7 @@ export class Post {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
async cancelOrderObject(
|
|
449
|
-
subaccount:
|
|
449
|
+
subaccount: SubaccountInfo,
|
|
450
450
|
cancelOrder: ICancelOrder,
|
|
451
451
|
broadcastMode?: BroadcastMode,
|
|
452
452
|
): Promise<BroadcastTxAsyncResponse | BroadcastTxSyncResponse | IndexedTx> {
|
|
@@ -462,7 +462,7 @@ export class Post {
|
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
async transfer(
|
|
465
|
-
subaccount:
|
|
465
|
+
subaccount: SubaccountInfo,
|
|
466
466
|
recipientAddress: string,
|
|
467
467
|
recipientSubaccountNumber: number,
|
|
468
468
|
assetId: number,
|
|
@@ -491,7 +491,7 @@ export class Post {
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
async deposit(
|
|
494
|
-
subaccount:
|
|
494
|
+
subaccount: SubaccountInfo,
|
|
495
495
|
assetId: number,
|
|
496
496
|
quantums: Long,
|
|
497
497
|
broadcastMode?: BroadcastMode,
|
|
@@ -516,7 +516,7 @@ export class Post {
|
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
async withdraw(
|
|
519
|
-
subaccount:
|
|
519
|
+
subaccount: SubaccountInfo,
|
|
520
520
|
assetId: number,
|
|
521
521
|
quantums: Long,
|
|
522
522
|
recipient?: string,
|
|
@@ -543,7 +543,7 @@ export class Post {
|
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
async sendToken(
|
|
546
|
-
subaccount:
|
|
546
|
+
subaccount: SubaccountInfo,
|
|
547
547
|
recipient: string,
|
|
548
548
|
coinDenom: string,
|
|
549
549
|
quantums: string,
|
package/src/clients/native.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from './constants';
|
|
20
20
|
import { FaucetClient } from './faucet-client';
|
|
21
21
|
import LocalWallet from './modules/local-wallet';
|
|
22
|
-
import {
|
|
22
|
+
import { SubaccountInfo } from './subaccount';
|
|
23
23
|
import { OrderFlags } from './types';
|
|
24
24
|
|
|
25
25
|
declare global {
|
|
@@ -252,7 +252,7 @@ export async function placeOrder(
|
|
|
252
252
|
const marketInfo = json.marketInfo as MarketInfo;
|
|
253
253
|
const currentHeight = json.currentHeight as number;
|
|
254
254
|
|
|
255
|
-
const subaccount = new
|
|
255
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
256
256
|
const tx = await client.placeOrder(
|
|
257
257
|
subaccount,
|
|
258
258
|
marketId,
|
|
@@ -314,7 +314,7 @@ export async function cancelOrder(
|
|
|
314
314
|
const goodTilBlock = json.goodTilBlock;
|
|
315
315
|
const goodTilBlockTime = json.goodTilBlockTime;
|
|
316
316
|
|
|
317
|
-
const subaccount = new
|
|
317
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
318
318
|
const tx = await client.cancelRawOrder(
|
|
319
319
|
subaccount,
|
|
320
320
|
clientId,
|
|
@@ -352,7 +352,7 @@ export async function deposit(
|
|
|
352
352
|
throw new UserError('amount is not set');
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
const subaccount = new
|
|
355
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
356
356
|
const tx = await client.depositToSubaccount(
|
|
357
357
|
subaccount,
|
|
358
358
|
amount,
|
|
@@ -386,7 +386,7 @@ export async function withdraw(
|
|
|
386
386
|
throw new UserError('amount is not set');
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
const subaccount = new
|
|
389
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
390
390
|
const tx = await client.withdrawFromSubaccount(
|
|
391
391
|
subaccount,
|
|
392
392
|
amount,
|
|
@@ -454,7 +454,7 @@ export async function withdrawToIBC(
|
|
|
454
454
|
value: json.msg,
|
|
455
455
|
};
|
|
456
456
|
|
|
457
|
-
const subaccount = new
|
|
457
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
458
458
|
const subaccountMsg = client.withdrawFromSubaccountMessage(subaccount, amount);
|
|
459
459
|
|
|
460
460
|
const msgs = [subaccountMsg, ibcMsg];
|
|
@@ -597,7 +597,7 @@ export async function simulateDeposit(
|
|
|
597
597
|
throw new UserError('amount is not set');
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
const subaccount = new
|
|
600
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
601
601
|
const msg: EncodeObject = client.depositToSubaccountMessage(
|
|
602
602
|
subaccount,
|
|
603
603
|
amount,
|
|
@@ -639,7 +639,7 @@ export async function simulateWithdraw(
|
|
|
639
639
|
throw new UserError('amount is not set');
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
const subaccount = new
|
|
642
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
643
643
|
const msg: EncodeObject = client.withdrawFromSubaccountMessage(
|
|
644
644
|
subaccount,
|
|
645
645
|
amount,
|
|
@@ -780,7 +780,7 @@ export async function signPlaceOrder(
|
|
|
780
780
|
throw new UserError('wallet is not set. Call connectWallet() first');
|
|
781
781
|
}
|
|
782
782
|
|
|
783
|
-
const subaccount = new
|
|
783
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
784
784
|
const signed = await client.signPlaceOrder(
|
|
785
785
|
subaccount,
|
|
786
786
|
marketId,
|
|
@@ -819,7 +819,7 @@ export async function signCancelOrder(
|
|
|
819
819
|
throw new UserError('wallet is not set. Call connectWallet() first');
|
|
820
820
|
}
|
|
821
821
|
|
|
822
|
-
const subaccount = new
|
|
822
|
+
const subaccount = new SubaccountInfo(wallet, subaccountNumber);
|
|
823
823
|
const signed = await client.signCancelOrder(
|
|
824
824
|
subaccount,
|
|
825
825
|
clientId,
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * as validation from './lib/validation';
|
|
|
7
7
|
export * as onboarding from './lib/onboarding';
|
|
8
8
|
|
|
9
9
|
export { default as LocalWallet } from './clients/modules/local-wallet';
|
|
10
|
-
export {
|
|
10
|
+
export { SubaccountInfo as SubaccountClient } from './clients/subaccount';
|
|
11
11
|
export { CompositeClient } from './clients/composite-client';
|
|
12
12
|
export { IndexerClient } from './clients/indexer-client';
|
|
13
13
|
export { ValidatorClient } from './clients/validator-client';
|