@@ -36,7 +36,7 @@ typedef struct {
3636} ApiKeyResponse;
3737
3838typedef struct {
39- uint8_t MarketIndex;
39+ int16_t MarketIndex;
4040 int64_t ClientOrderIndex;
4141 int64_t BaseAmount;
4242 uint32_t Price;
@@ -46,6 +46,9 @@ typedef struct {
4646 uint8_t ReduceOnly;
4747 uint32_t TriggerPrice;
4848 int64_t OrderExpiry;
49+ int64_t IntegratorAccountIndex;
50+ int64_t IntegratorMakerFee;
51+ int64_t IntegratorTakerFee;
4952} CreateOrderTxReq;
5053*/
5154import "C"
@@ -65,6 +68,8 @@ func messageToSign(txInfo txtypes.TxInfo) string {
6568 return typed .GetL1SignatureBody ()
6669 case * txtypes.L2TransferTxInfo :
6770 return typed .GetL1SignatureBody (chainId )
71+ case * txtypes.L2ApproveIntegratorTxInfo :
72+ return typed .GetL1SignatureBody (chainId )
6873 default :
6974 return ""
7075 }
@@ -207,7 +212,7 @@ func SignChangePubKey(cPubKey *C.char, cNonce C.longlong, cApiKeyIndex C.int, cA
207212}
208213
209214//export SignCreateOrder
210- func SignCreateOrder (cMarketIndex C.int , cClientOrderIndex C.longlong , cBaseAmount C.longlong , cPrice C.int , cIsAsk C.int , cOrderType C.int , cTimeInForce C.int , cReduceOnly C.int , cTriggerPrice C.int , cOrderExpiry C.longlong , cNonce C.longlong , cApiKeyIndex C.int , cAccountIndex C.longlong ) (ret C.SignedTxResponse ) {
215+ func SignCreateOrder (cMarketIndex C.int , cClientOrderIndex C.longlong , cBaseAmount C.longlong , cPrice C.int , cIsAsk C.int , cOrderType C.int , cTimeInForce C.int , cReduceOnly C.int , cTriggerPrice C.int , cOrderExpiry C.longlong , cIntegratorAccountIndex C. int , cIntegratorTakerFee C. int , cIntegratorMakerFee C. int , cNonce C.longlong , cApiKeyIndex C.int , cAccountIndex C.longlong ) (ret C.SignedTxResponse ) {
211216 defer func () {
212217 if r := recover (); r != nil {
213218 ret = signedTxResponsePanic (r )
@@ -230,21 +235,28 @@ func SignCreateOrder(cMarketIndex C.int, cClientOrderIndex C.longlong, cBaseAmou
230235 triggerPrice := uint32 (cTriggerPrice )
231236 orderExpiry := int64 (cOrderExpiry )
232237
238+ integratorAccountIndex := int (cIntegratorAccountIndex )
239+ integratorMakerFee := int (cIntegratorMakerFee )
240+ integratorTakerFee := int (cIntegratorTakerFee )
241+
233242 if orderExpiry == - 1 {
234243 orderExpiry = time .Now ().Add (time .Hour * 24 * 28 ).UnixMilli () // 28 days
235244 }
236245
237246 tx := & types.CreateOrderTxReq {
238- MarketIndex : marketIndex ,
239- ClientOrderIndex : clientOrderIndex ,
240- BaseAmount : baseAmount ,
241- Price : price ,
242- IsAsk : isAsk ,
243- Type : orderType ,
244- TimeInForce : timeInForce ,
245- ReduceOnly : reduceOnly ,
246- TriggerPrice : triggerPrice ,
247- OrderExpiry : orderExpiry ,
247+ MarketIndex : marketIndex ,
248+ ClientOrderIndex : clientOrderIndex ,
249+ BaseAmount : baseAmount ,
250+ Price : price ,
251+ IsAsk : isAsk ,
252+ Type : orderType ,
253+ TimeInForce : timeInForce ,
254+ ReduceOnly : reduceOnly ,
255+ TriggerPrice : triggerPrice ,
256+ OrderExpiry : orderExpiry ,
257+ IntegratorAccountIndex : integratorAccountIndex ,
258+ IntegratorTakerFee : integratorTakerFee ,
259+ IntegratorMakerFee : integratorMakerFee ,
248260 }
249261 ops := getTransactOpts (cNonce )
250262
@@ -278,16 +290,19 @@ func SignCreateGroupedOrders(cGroupingType C.uint8_t, cOrders *C.CreateOrderTxRe
278290 }
279291
280292 orders [i ] = & types.CreateOrderTxReq {
281- MarketIndex : int16 (order .MarketIndex ),
282- ClientOrderIndex : int64 (order .ClientOrderIndex ),
283- BaseAmount : int64 (order .BaseAmount ),
284- Price : uint32 (order .Price ),
285- IsAsk : uint8 (order .IsAsk ),
286- Type : uint8 (order .Type ),
287- TimeInForce : uint8 (order .TimeInForce ),
288- ReduceOnly : uint8 (order .ReduceOnly ),
289- TriggerPrice : uint32 (order .TriggerPrice ),
290- OrderExpiry : orderExpiry ,
293+ MarketIndex : int16 (order .MarketIndex ),
294+ ClientOrderIndex : int64 (order .ClientOrderIndex ),
295+ BaseAmount : int64 (order .BaseAmount ),
296+ Price : uint32 (order .Price ),
297+ IsAsk : uint8 (order .IsAsk ),
298+ Type : uint8 (order .Type ),
299+ TimeInForce : uint8 (order .TimeInForce ),
300+ ReduceOnly : uint8 (order .ReduceOnly ),
301+ TriggerPrice : uint32 (order .TriggerPrice ),
302+ OrderExpiry : orderExpiry ,
303+ IntegratorAccountIndex : int (order .IntegratorAccountIndex ),
304+ IntegratorTakerFee : int (order .IntegratorTakerFee ),
305+ IntegratorMakerFee : int (order .IntegratorMakerFee ),
291306 }
292307 }
293308
@@ -401,7 +416,7 @@ func SignCancelAllOrders(cTimeInForce C.int, cTime C.longlong, cNonce C.longlong
401416}
402417
403418//export SignModifyOrder
404- func SignModifyOrder (cMarketIndex C.int , cIndex C.longlong , cBaseAmount C.longlong , cPrice C.longlong , cTriggerPrice C.longlong , cNonce C.longlong , cApiKeyIndex C.int , cAccountIndex C.longlong ) (ret C.SignedTxResponse ) {
419+ func SignModifyOrder (cMarketIndex C.int , cIndex C.longlong , cBaseAmount C.longlong , cPrice C.longlong , cTriggerPrice C.longlong , cIntegratorAccountIndex C. int , cIntegratorTakerFee C. int , cIntegratorMakerFee C. int , cNonce C.longlong , cApiKeyIndex C.int , cAccountIndex C.longlong ) (ret C.SignedTxResponse ) {
405420 defer func () {
406421 if r := recover (); r != nil {
407422 ret = signedTxResponsePanic (r )
@@ -419,12 +434,19 @@ func SignModifyOrder(cMarketIndex C.int, cIndex C.longlong, cBaseAmount C.longlo
419434 price := uint32 (cPrice )
420435 triggerPrice := uint32 (cTriggerPrice )
421436
437+ integratorAccountIndex := int (cIntegratorAccountIndex )
438+ integratorMakerFee := int (cIntegratorMakerFee )
439+ integratorTakerFee := int (cIntegratorTakerFee )
440+
422441 tx := & types.ModifyOrderTxReq {
423- MarketIndex : marketIndex ,
424- Index : index ,
425- BaseAmount : baseAmount ,
426- Price : price ,
427- TriggerPrice : triggerPrice ,
442+ MarketIndex : marketIndex ,
443+ Index : index ,
444+ BaseAmount : baseAmount ,
445+ Price : price ,
446+ TriggerPrice : triggerPrice ,
447+ IntegratorAccountIndex : integratorAccountIndex ,
448+ IntegratorTakerFee : integratorTakerFee ,
449+ IntegratorMakerFee : integratorMakerFee ,
428450 }
429451 ops := getTransactOpts (cNonce )
430452
@@ -738,4 +760,36 @@ func SignUnstakeAssets(cStakingPoolIndex C.longlong, cShareAmount C.longlong, cN
738760 return convertTxInfoToResponse (txInfo , err )
739761}
740762
763+ //export SignApproveIntegrator
764+ func SignApproveIntegrator (cIntegratorIndex C.longlong , cMaxPerpsTakerFee C.uint32_t , cMaxPerpsMakerFee C.uint32_t , cMaxSpotTakerFee C.uint32_t , cMaxSpotMakerFee C.uint32_t , cApprovalExpiry C.longlong , cNonce C.longlong , cApiKeyIndex C.int , cAccountIndex C.longlong ) (ret C.SignedTxResponse ) {
765+ defer func () {
766+ if r := recover (); r != nil {
767+ ret = signedTxResponsePanic (r )
768+ }
769+ }()
770+ c , err := getClient (cApiKeyIndex , cAccountIndex )
771+ if err != nil {
772+ return signedTxResponseErr (err )
773+ }
774+
775+ IntegratorIndex := int64 (cIntegratorIndex )
776+ MaxPerpsMakerFee := uint32 (cMaxPerpsMakerFee )
777+ MaxPerpsTakerFee := uint32 (cMaxPerpsTakerFee )
778+ MaxSpotMakerFee := uint32 (cMaxSpotMakerFee )
779+ MaxSpotTakerFee := uint32 (cMaxSpotTakerFee )
780+ ApprovalExpiry := int64 (cApprovalExpiry )
781+
782+ tx := & types.ApproveIntegratorTxReq {
783+ IntegratorAccountIndex : IntegratorIndex ,
784+ MaxPerpsTakerFee : MaxPerpsTakerFee ,
785+ MaxPerpsMakerFee : MaxPerpsMakerFee ,
786+ MaxSpotTakerFee : MaxSpotTakerFee ,
787+ MaxSpotMakerFee : MaxSpotMakerFee ,
788+ ApprovalExpiry : ApprovalExpiry ,
789+ }
790+ ops := getTransactOpts (cNonce )
791+ txInfo , err := c .GetApproveIntegratorTx (tx , ops )
792+ return convertTxInfoToResponse (txInfo , err )
793+ }
794+
741795func main () {}
0 commit comments