File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -1776,15 +1776,24 @@ export class DriftClient {
17761776 public async getUpdateUserPerpPositionCustomMarginRatioIx (
17771777 perpMarketIndex : number ,
17781778 marginRatio : number ,
1779- subAccountId = 0
1779+ subAccountId = 0 ,
1780+ overrides ?: {
1781+ userAccountPublicKey ?: PublicKey ;
1782+ authority ?: PublicKey ;
1783+ signingAuthority ?: PublicKey ;
1784+ }
17801785 ) : Promise < TransactionInstruction > {
1781- const userAccountPublicKey = getUserAccountPublicKeySync (
1782- this . program . programId ,
1783- this . authority ,
1784- subAccountId
1785- ) ;
1786+ let userAccountPublicKey = overrides ?. userAccountPublicKey ;
1787+ if ( ! userAccountPublicKey ) {
1788+ userAccountPublicKey = getUserAccountPublicKeySync (
1789+ this . program . programId ,
1790+ overrides ?. authority ?? this . authority ,
1791+ subAccountId
1792+ ) ;
1793+ }
17861794
1787- await this . addUser ( subAccountId , this . authority ) ;
1795+ const signingAuthority =
1796+ overrides ?. signingAuthority ?? this . wallet . publicKey ;
17881797
17891798 const ix = this . program . instruction . updateUserPerpPositionCustomMarginRatio (
17901799 subAccountId ,
@@ -1793,7 +1802,7 @@ export class DriftClient {
17931802 {
17941803 accounts : {
17951804 user : userAccountPublicKey ,
1796- authority : this . wallet . publicKey ,
1805+ authority : signingAuthority ,
17971806 } ,
17981807 }
17991808 ) ;
Original file line number Diff line number Diff line change @@ -672,9 +672,9 @@ export class MockUserMap implements UserMapInterface {
672672 } ) ;
673673 }
674674
675- public async subscribe ( ) : Promise < void > { }
675+ public async subscribe ( ) : Promise < void > { }
676676
677- public async unsubscribe ( ) : Promise < void > { }
677+ public async unsubscribe ( ) : Promise < void > { }
678678
679679 public async addPubkey ( userAccountPublicKey : PublicKey ) : Promise < void > {
680680 const user = new User ( {
@@ -733,7 +733,7 @@ export class MockUserMap implements UserMapInterface {
733733 ) ;
734734 }
735735
736- public async updateWithOrderRecord ( _record : OrderRecord ) : Promise < void > { }
736+ public async updateWithOrderRecord ( _record : OrderRecord ) : Promise < void > { }
737737
738738 public values ( ) : IterableIterator < User > {
739739 return this . userMap . values ( ) ;
You can’t perform that action at this time.
0 commit comments