Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deposit/withdraw fee setting #26

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions v4-client-js/__native__/__ios__/v4-native-client.js

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions v4-client-js/__tests__/modules/client/Transfers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ describe('Validator Client', () => {
let subaccount: Subaccount;
let client: ValidatorClient;

describe('Transfers', async () => {
describe('Transfers', () => {
beforeEach(async () => {
wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
subaccount = new Subaccount(wallet, 0);
client = await ValidatorClient.connect(Network.staging().validatorConfig);
await sleep(5000); // wait for withdraw to complete
});

it('Withdraw', async () => {
const tx = await client.post.withdraw(
subaccount,
0,
new Long(1_00_000_000),
undefined,
);
console.log('**Withdraw Tx**');
console.log(tx);
});

await sleep(5000); // wait for withdraw to complete

it('Deposit', async () => {
const tx = await client.post.deposit(
subaccount,
Expand All @@ -42,10 +42,7 @@ describe('Validator Client', () => {
);
console.log('**Deposit Tx**');
console.log(tx);
},
);

await sleep(5000); // wait for withdraw to complete
});

it('Transfer', async () => {
const tx = await client.post.transfer(
Expand All @@ -57,7 +54,6 @@ describe('Validator Client', () => {
);
console.log('**Transfer Tx**');
console.log(tx);
},
);
});
});
});
1 change: 0 additions & 1 deletion v4-client-js/examples/transfer_example_withdraw_other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ async function test(): Promise<void> {
0,
amountAfterFee,
TEST_RECIPIENT_ADDRESS,
false,
Method.BroadcastTxCommit,
);
console.log('**Withdraw and Send**');
Expand Down
4 changes: 2 additions & 2 deletions v4-client-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v4-client-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dydxprotocol/v4-client-js",
"version": "0.33.0",
"version": "0.33.1",
"description": "General client library for the new dYdX system (v4 decentralized)",
"main": "build/src/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions v4-client-js/src/clients/composite-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export class CompositeClient {
});
return this.validatorClient.post.send(subaccount.wallet,
() => msgs,
true);
false);
}

/**
Expand Down Expand Up @@ -512,7 +512,7 @@ export class CompositeClient {
return this.send(
subaccount.wallet,
() => msgs,
true);
false);
}

/**
Expand Down
7 changes: 3 additions & 4 deletions v4-client-js/src/clients/modules/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export class Post {
);
resolve([msg]);
});
return this.send(subaccount.wallet, () => msgs, true, undefined, undefined, broadcastMode);
return this.send(subaccount.wallet, () => msgs, false, undefined, undefined, broadcastMode);
}

async deposit(
Expand All @@ -433,15 +433,14 @@ export class Post {
);
resolve([msg]);
});
return this.send(subaccount.wallet, () => msgs, true, undefined, undefined, broadcastMode);
return this.send(subaccount.wallet, () => msgs, false, undefined, undefined, broadcastMode);
}

async withdraw(
subaccount: Subaccount,
assetId: number,
quantums: Long,
recipient?: string,
zeroFee: boolean = true,
broadcastMode?: BroadcastMode,
): Promise<BroadcastTxAsyncResponse | BroadcastTxSyncResponse | IndexedTx> {
const msgs: Promise<EncodeObject[]> = new Promise((resolve) => {
Expand All @@ -454,7 +453,7 @@ export class Post {
);
resolve([msg]);
});
return this.send(subaccount.wallet, () => msgs, zeroFee, undefined, undefined, broadcastMode);
return this.send(subaccount.wallet, () => msgs, false, undefined, undefined, broadcastMode);
}

async sendToken(
Expand Down