Skip to content

Commit 5db315b

Browse files
committed
update driftclient
1 parent a4fe692 commit 5db315b

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

sdk/src/driftClient.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,16 +1384,14 @@ export class DriftClient {
13841384
}
13851385

13861386
public async changeApprovedBuilder(
1387-
authority: PublicKey,
13881387
builder: PublicKey,
1389-
maxFeeBps: number,
1388+
maxFeeTenthBps: number,
13901389
add: boolean,
13911390
txParams?: TxParams
13921391
): Promise<TransactionSignature> {
13931392
const ix = await this.getChangeApprovedBuilderIx(
1394-
authority,
13951393
builder,
1396-
maxFeeBps,
1394+
maxFeeTenthBps,
13971395
add
13981396
);
13991397
const tx = await this.buildTransaction([ix], txParams);
@@ -1402,18 +1400,18 @@ export class DriftClient {
14021400
}
14031401

14041402
public async getChangeApprovedBuilderIx(
1405-
authority: PublicKey,
14061403
builder: PublicKey,
1407-
maxFeeBps: number,
1404+
maxFeeTenthBps: number,
14081405
add: boolean
14091406
): Promise<TransactionInstruction> {
1407+
const authority = this.wallet.publicKey;
14101408
const escrow = getRevenueShareEscrowAccountPublicKey(
14111409
this.program.programId,
14121410
authority
14131411
);
14141412
return this.program.instruction.changeApprovedBuilder(
14151413
builder,
1416-
maxFeeBps,
1414+
maxFeeTenthBps,
14171415
add,
14181416
{
14191417
accounts: {

tests/builderCodes.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ describe('builder codes', () => {
456456

457457
// First add a builder
458458
await userClient.changeApprovedBuilder(
459-
userClient.wallet.publicKey,
460459
builder.publicKey,
461460
maxFeeBps,
462461
true // add
@@ -493,7 +492,6 @@ describe('builder codes', () => {
493492

494493
// update the user fee
495494
await userClient.changeApprovedBuilder(
496-
userClient.wallet.publicKey,
497495
builder.publicKey,
498496
maxFeeBps * 2,
499497
true // update existing builder
@@ -525,7 +523,6 @@ describe('builder codes', () => {
525523

526524
// Now remove the builder
527525
await userClient.changeApprovedBuilder(
528-
userClient.wallet.publicKey,
529526
builder.publicKey,
530527
maxFeeBps,
531528
false // remove
@@ -705,7 +702,6 @@ describe('builder codes', () => {
705702
const builder = builderClient.wallet;
706703
const maxFeeBps = 150 * 10; // 1.5%
707704
await userClient.changeApprovedBuilder(
708-
userClient.wallet.publicKey,
709705
builder.publicKey,
710706
maxFeeBps,
711707
true // update existing builder
@@ -773,7 +769,6 @@ describe('builder codes', () => {
773769
// try to revoke builder with open orders
774770
try {
775771
await userClient.changeApprovedBuilder(
776-
userClient.wallet.publicKey,
777772
builder.publicKey,
778773
0,
779774
false // remove
@@ -992,12 +987,7 @@ describe('builder codes', () => {
992987
it('user can place and cancel with no fill (no fees accrued, escrow unchanged)', async () => {
993988
const builder = builderClient.wallet;
994989
const maxFeeBps = 150 * 10;
995-
await userClient.changeApprovedBuilder(
996-
userClient.wallet.publicKey,
997-
builder.publicKey,
998-
maxFeeBps,
999-
true
1000-
);
990+
await userClient.changeApprovedBuilder(builder.publicKey, maxFeeBps, true);
1001991

1002992
await escrowMap.slowSync();
1003993
const beforeEscrow = (await escrowMap.mustGet(
@@ -1070,12 +1060,7 @@ describe('builder codes', () => {
10701060
it('user can place and fill multiple orders (fees accumulate and settle)', async () => {
10711061
const builder = builderClient.wallet;
10721062
const maxFeeBps = 150 * 10;
1073-
await userClient.changeApprovedBuilder(
1074-
userClient.wallet.publicKey,
1075-
builder.publicKey,
1076-
maxFeeBps,
1077-
true
1078-
);
1063+
await userClient.changeApprovedBuilder(builder.publicKey, maxFeeBps, true);
10791064

10801065
const marketIndex = 0;
10811066
const baseAssetAmount = BASE_PRECISION;
@@ -1244,12 +1229,7 @@ describe('builder codes', () => {
12441229
it('user can place and fill with multiple maker orders', async () => {
12451230
const builder = builderClient.wallet;
12461231
const maxFeeBps = 150 * 10;
1247-
await userClient.changeApprovedBuilder(
1248-
userClient.wallet.publicKey,
1249-
builder.publicKey,
1250-
maxFeeBps,
1251-
true
1252-
);
1232+
await userClient.changeApprovedBuilder(builder.publicKey, maxFeeBps, true);
12531233

12541234
const builderAccountInfoBefore =
12551235
await bankrunContextWrapper.connection.getAccountInfo(

0 commit comments

Comments
 (0)