@@ -7,13 +7,18 @@ import {
77 MsgDelegate ,
88 MsgUndelegate ,
99} from '@dydxprotocol/v4-proto/src/codegen/cosmos/staking/v1beta1/tx' ;
10- import { MsgAddAuthenticator , MsgRemoveAuthenticator } from '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/accountplus/tx' ;
10+ import {
11+ MsgAddAuthenticator ,
12+ MsgRemoveAuthenticator ,
13+ } from '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/accountplus/tx' ;
1114import { MsgRegisterAffiliate } from '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/affiliates/tx' ;
1215import { ClobPair_Status } from '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/clob_pair' ;
1316import {
17+ LeverageEntry ,
1418 MsgBatchCancel ,
1519 MsgCreateClobPair ,
1620 MsgUpdateClobPair ,
21+ MsgUpdateLeverage ,
1722 OrderBatch ,
1823} from '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/clob/tx' ;
1924import { MsgDelayMessage } from '@dydxprotocol/v4-proto/src/codegen/dydxprotocol/delaymsg/tx' ;
@@ -56,6 +61,7 @@ import {
5661 TYPE_URL_MSG_ADD_AUTHENTICATOR ,
5762 TYPE_URL_MSG_REMOVE_AUTHENTICATOR ,
5863 AuthenticatorType ,
64+ TYPE_URL_MSG_UPDATE_LEVERAGE ,
5965} from '../constants' ;
6066import { DenomConfig , ITwapParameters , IBuilderCodeParameters } from '../types' ;
6167import {
@@ -97,7 +103,7 @@ export class Composer {
97103 conditionalOrderTriggerSubticks : Long = Long . fromInt ( 0 ) ,
98104 twapParameters ?: ITwapParameters ,
99105 builderCodeParameters ?: IBuilderCodeParameters ,
100- orderRouterAddress : string = "" ,
106+ orderRouterAddress : string = '' ,
101107 ) : EncodeObject {
102108 this . validateGoodTilBlockAndTime ( orderFlags , goodTilBlock , goodTilBlockTime ) ;
103109
@@ -252,6 +258,27 @@ export class Composer {
252258 } ;
253259 }
254260
261+ public composeMsgUpdateLeverage (
262+ address : string ,
263+ subaccountNumber : number ,
264+ entries : LeverageEntry [ ] ,
265+ ) : EncodeObject {
266+ const subaccountId : SubaccountId = {
267+ owner : address ,
268+ number : subaccountNumber ,
269+ } ;
270+
271+ const msg : MsgUpdateLeverage = {
272+ subaccountId,
273+ clobPairLeverage : entries ,
274+ } ;
275+
276+ return {
277+ typeUrl : TYPE_URL_MSG_UPDATE_LEVERAGE ,
278+ value : msg ,
279+ } ;
280+ }
281+
255282 // ------------ x/sending ------------
256283 public composeMsgTransfer (
257284 address : string ,
@@ -577,13 +604,13 @@ export class Composer {
577604
578605 const msg : MsgCreateMarketPermissionless = {
579606 ticker,
580- subaccountId
607+ subaccountId,
581608 } ;
582609
583610 return {
584611 typeUrl : TYPE_URL_MSG_CREATE_MARKET_PERMISSIONLESS ,
585612 value : msg ,
586- }
613+ } ;
587614 }
588615
589616 // ----------- x/accountplus --------
@@ -597,27 +624,24 @@ export class Composer {
597624 sender : address ,
598625 authenticatorType,
599626 data,
600- }
627+ } ;
601628
602629 return {
603630 typeUrl : TYPE_URL_MSG_ADD_AUTHENTICATOR ,
604631 value : msg ,
605- }
632+ } ;
606633 }
607634
608- public composeMsgRemoveAuthenticator (
609- address : string ,
610- id : Long ,
611- ) : EncodeObject {
635+ public composeMsgRemoveAuthenticator ( address : string , id : Long ) : EncodeObject {
612636 const msg : MsgRemoveAuthenticator = {
613637 sender : address ,
614638 id,
615- }
639+ } ;
616640
617641 return {
618642 typeUrl : TYPE_URL_MSG_REMOVE_AUTHENTICATOR ,
619643 value : msg ,
620- }
644+ } ;
621645 }
622646
623647 // ------------ util ------------
0 commit comments