zo-sdk 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consts/deployments-usdz-mainnet.json +4 -4
- package/dist/implementations/SLPAPI.cjs +544 -0
- package/dist/implementations/SLPAPI.cjs.map +1 -1
- package/dist/implementations/SLPAPI.d.cts +49 -0
- package/dist/implementations/SLPAPI.d.cts.map +1 -1
- package/dist/implementations/SLPAPI.d.mts +49 -0
- package/dist/implementations/SLPAPI.d.mts.map +1 -1
- package/dist/implementations/SLPAPI.mjs +544 -0
- package/dist/implementations/SLPAPI.mjs.map +1 -1
- package/dist/implementations/SLPDataAPI.cjs +48 -9
- package/dist/implementations/SLPDataAPI.cjs.map +1 -1
- package/dist/implementations/SLPDataAPI.d.cts.map +1 -1
- package/dist/implementations/SLPDataAPI.d.mts.map +1 -1
- package/dist/implementations/SLPDataAPI.mjs +49 -10
- package/dist/implementations/SLPDataAPI.mjs.map +1 -1
- package/dist/implementations/USDZAPI.cjs +544 -0
- package/dist/implementations/USDZAPI.cjs.map +1 -1
- package/dist/implementations/USDZAPI.d.cts +49 -0
- package/dist/implementations/USDZAPI.d.cts.map +1 -1
- package/dist/implementations/USDZAPI.d.mts +49 -0
- package/dist/implementations/USDZAPI.d.mts.map +1 -1
- package/dist/implementations/USDZAPI.mjs +544 -0
- package/dist/implementations/USDZAPI.mjs.map +1 -1
- package/dist/implementations/USDZDataAPI.cjs +47 -7
- package/dist/implementations/USDZDataAPI.cjs.map +1 -1
- package/dist/implementations/USDZDataAPI.d.cts.map +1 -1
- package/dist/implementations/USDZDataAPI.d.mts.map +1 -1
- package/dist/implementations/USDZDataAPI.mjs +47 -7
- package/dist/implementations/USDZDataAPI.mjs.map +1 -1
- package/dist/implementations/ZLPAPI.cjs +2 -6
- package/dist/implementations/ZLPAPI.cjs.map +1 -1
- package/dist/implementations/ZLPAPI.d.cts +2 -2
- package/dist/implementations/ZLPAPI.d.cts.map +1 -1
- package/dist/implementations/ZLPAPI.d.mts +2 -2
- package/dist/implementations/ZLPAPI.d.mts.map +1 -1
- package/dist/implementations/ZLPAPI.mjs +2 -6
- package/dist/implementations/ZLPAPI.mjs.map +1 -1
- package/package.json +1 -1
- package/src/consts/deployments-usdz-mainnet.json +4 -4
- package/src/implementations/SLPAPI.ts +884 -26
- package/src/implementations/SLPDataAPI.ts +52 -10
- package/src/implementations/USDZAPI.ts +913 -55
- package/src/implementations/USDZDataAPI.ts +50 -7
- package/src/implementations/ZLPAPI.ts +2 -7
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
},
|
|
87
87
|
"short_metax": {
|
|
88
88
|
"supported_collaterals": ["nusdc"],
|
|
89
|
-
"funding_fee_model": "
|
|
90
|
-
"position_config": "
|
|
89
|
+
"funding_fee_model": "0x4d252e7ad3ac53e448a631b897d7098665fe843252322ab0e4e5279689760498",
|
|
90
|
+
"position_config": "0x309d711110ad08861e761218590007e1d73ebd1db6b816070fdd873b851e8986"
|
|
91
91
|
},
|
|
92
92
|
"long_nvdax": {
|
|
93
93
|
"supported_collaterals": ["nusdc"],
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
},
|
|
97
97
|
"short_nvdax": {
|
|
98
98
|
"supported_collaterals": ["nusdc"],
|
|
99
|
-
"funding_fee_model": "
|
|
100
|
-
"position_config": "
|
|
99
|
+
"funding_fee_model": "0xf340f54a36cea298d8d0b7e0488946a27222e14707ee1101231b7f32515248c4",
|
|
100
|
+
"position_config": "0x0cfc78a47983714743be93c1ae6c06907d0de271c7694af2efb2ac1bc10580d9"
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
},
|
|
@@ -650,6 +650,116 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
650
650
|
});
|
|
651
651
|
return tx;
|
|
652
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* Opens a new position in SLP (V2 - uses v3 contract)
|
|
655
|
+
*/
|
|
656
|
+
async openPositionV2(collateralToken, indexToken, size, collateralAmount, coinObjects, long, reserveAmount, indexPrice, collateralPrice, isLimitOrder, isIocOrder, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), referralAddress, sender, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
657
|
+
let tx = new transactions_1.Transaction();
|
|
658
|
+
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
659
|
+
tx = await this.addReferral(referralAddress, tx);
|
|
660
|
+
}
|
|
661
|
+
const symbol = (0, utils_2.joinSymbol)(long ? 'long' : 'short', indexToken);
|
|
662
|
+
const adjustPrice = this.processSlippage(indexPrice, long, isLimitOrder ? 0 : pricesSlippage);
|
|
663
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
664
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
665
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
666
|
+
if (isLimitOrder) {
|
|
667
|
+
allowTrade = isIocOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
668
|
+
}
|
|
669
|
+
// Handle oracle initialization and coin processing
|
|
670
|
+
let suiCoinObject;
|
|
671
|
+
if (sponsoredTx) {
|
|
672
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
673
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject);
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx);
|
|
677
|
+
}
|
|
678
|
+
// Process coin splitting
|
|
679
|
+
const [depositObject, feeObject] = this.processCoinSplitting(tx, collateralToken, coinObjects, [tx.pure.u64(collateralAmount), tx.pure.u64(relayerFee)], sponsoredTx, suiCoinObject);
|
|
680
|
+
tx.moveCall({
|
|
681
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_v3`,
|
|
682
|
+
typeArguments: [
|
|
683
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
684
|
+
this.consts.coins[collateralToken].module,
|
|
685
|
+
this.consts.coins[indexToken].module,
|
|
686
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
687
|
+
this.consts.coins[collateralToken].module,
|
|
688
|
+
],
|
|
689
|
+
arguments: [
|
|
690
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
691
|
+
tx.object(this.consts.sudoCore.market),
|
|
692
|
+
tx.object(this.consts.sudoCore.symbols[symbol].positionConfig),
|
|
693
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
694
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
695
|
+
depositObject,
|
|
696
|
+
feeObject,
|
|
697
|
+
tx.pure.u8(allowTrade),
|
|
698
|
+
tx.pure.u64(size),
|
|
699
|
+
tx.pure.u64(reserveAmount),
|
|
700
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
701
|
+
tx.pure.u256(adjustPrice),
|
|
702
|
+
tx.pure.u256(indexPriceThreshold),
|
|
703
|
+
],
|
|
704
|
+
});
|
|
705
|
+
return tx;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Opens a new position with Coin in SLP (V2 - uses v3 contract)
|
|
709
|
+
*/
|
|
710
|
+
async openPositionWithCoinV2(collateralToken, indexToken, size, coinObj, long, reserveAmount, indexPrice, collateralPrice, isLimitOrder, isIocOrder, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), referralAddress, sender, tx, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
711
|
+
if (!tx) {
|
|
712
|
+
tx = new transactions_1.Transaction();
|
|
713
|
+
}
|
|
714
|
+
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
715
|
+
tx = await this.addReferral(referralAddress, tx);
|
|
716
|
+
}
|
|
717
|
+
const symbol = (0, utils_2.joinSymbol)(long ? 'long' : 'short', indexToken);
|
|
718
|
+
const adjustPrice = this.processSlippage(indexPrice, long, isLimitOrder ? 0 : pricesSlippage);
|
|
719
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
720
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
721
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
722
|
+
if (isLimitOrder) {
|
|
723
|
+
allowTrade = isIocOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
724
|
+
}
|
|
725
|
+
// Handle oracle initialization and coin processing
|
|
726
|
+
let suiCoinObject;
|
|
727
|
+
if (sponsoredTx) {
|
|
728
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
729
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject);
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx);
|
|
733
|
+
}
|
|
734
|
+
// Process coin splitting
|
|
735
|
+
const [feeObject] = tx.splitCoins(coinObj, [tx.pure.u64(relayerFee)]);
|
|
736
|
+
tx.moveCall({
|
|
737
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_v3`,
|
|
738
|
+
typeArguments: [
|
|
739
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
740
|
+
this.consts.coins[collateralToken].module,
|
|
741
|
+
this.consts.coins[indexToken].module,
|
|
742
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
743
|
+
this.consts.coins[collateralToken].module,
|
|
744
|
+
],
|
|
745
|
+
arguments: [
|
|
746
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
747
|
+
tx.object(this.consts.sudoCore.market),
|
|
748
|
+
tx.object(this.consts.sudoCore.symbols[symbol].positionConfig),
|
|
749
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
750
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
751
|
+
coinObj,
|
|
752
|
+
feeObject,
|
|
753
|
+
tx.pure.u8(allowTrade),
|
|
754
|
+
tx.pure.u64(size),
|
|
755
|
+
tx.pure.u64(reserveAmount),
|
|
756
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
757
|
+
tx.pure.u256(adjustPrice),
|
|
758
|
+
tx.pure.u256(indexPriceThreshold),
|
|
759
|
+
],
|
|
760
|
+
});
|
|
761
|
+
return tx;
|
|
762
|
+
}
|
|
653
763
|
/**
|
|
654
764
|
* Decreases an existing position in SLP using Sudo SDK approach
|
|
655
765
|
*/
|
|
@@ -705,6 +815,61 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
705
815
|
});
|
|
706
816
|
return tx;
|
|
707
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* Decreases an existing position in SLP (V2 - uses v3 contract)
|
|
820
|
+
*/
|
|
821
|
+
async decreasePositionV2(pcpId, collateralToken, indexToken, amount, long, indexPrice, collateralPrice, isTriggerOrder = false, isTakeProfitOrder = true, isIocOrder = false, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), coinObjects, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
822
|
+
if (!coinObjects) {
|
|
823
|
+
throw new Error(`${this.constructor.name}: coinObjects is required`);
|
|
824
|
+
}
|
|
825
|
+
let tx = new transactions_1.Transaction();
|
|
826
|
+
const adjustPrice = this.processSlippage(indexPrice, !long, isTriggerOrder ? 0 : pricesSlippage);
|
|
827
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
828
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
829
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
830
|
+
if (isTriggerOrder) {
|
|
831
|
+
allowTrade = isIocOrder || !isTakeProfitOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
isTakeProfitOrder = true;
|
|
835
|
+
}
|
|
836
|
+
// Handle oracle initialization and coin processing
|
|
837
|
+
let suiCoinObject;
|
|
838
|
+
if (sponsoredTx) {
|
|
839
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
840
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject);
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx);
|
|
844
|
+
}
|
|
845
|
+
// Process coin splitting
|
|
846
|
+
const [feeObject] = this.processCoinSplitting(tx, collateralToken, coinObjects, [tx.pure.u64(relayerFee)], sponsoredTx, suiCoinObject);
|
|
847
|
+
tx.moveCall({
|
|
848
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v3`,
|
|
849
|
+
typeArguments: [
|
|
850
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
851
|
+
this.consts.coins[collateralToken].module,
|
|
852
|
+
this.consts.coins[indexToken].module,
|
|
853
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
854
|
+
this.consts.coins[collateralToken].module,
|
|
855
|
+
],
|
|
856
|
+
arguments: [
|
|
857
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
858
|
+
tx.object(this.consts.sudoCore.market),
|
|
859
|
+
tx.object(pcpId),
|
|
860
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
861
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
862
|
+
feeObject,
|
|
863
|
+
tx.pure.u8(allowTrade),
|
|
864
|
+
tx.pure.bool(isTakeProfitOrder),
|
|
865
|
+
tx.pure.u64(amount),
|
|
866
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
867
|
+
tx.pure.u256(adjustPrice),
|
|
868
|
+
tx.pure.u256(indexPriceThreshold),
|
|
869
|
+
],
|
|
870
|
+
});
|
|
871
|
+
return tx;
|
|
872
|
+
}
|
|
708
873
|
async decreaseMultiPositions(positions, tx, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
709
874
|
if (!tx) {
|
|
710
875
|
tx = new transactions_1.Transaction();
|
|
@@ -761,6 +926,61 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
761
926
|
}
|
|
762
927
|
return tx;
|
|
763
928
|
}
|
|
929
|
+
async decreaseMultiPositionsV2(positions, tx, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
930
|
+
if (!tx) {
|
|
931
|
+
tx = new transactions_1.Transaction();
|
|
932
|
+
}
|
|
933
|
+
// Handle oracle initialization and coin processing
|
|
934
|
+
let suiCoinObject;
|
|
935
|
+
if (sponsoredTx) {
|
|
936
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
937
|
+
tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx, true, suiCoinObject);
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx);
|
|
941
|
+
}
|
|
942
|
+
for (const position of positions) {
|
|
943
|
+
const { pcpId, collateralToken, coinObjects = [], indexToken, amount, long, indexPrice, collateralPrice, isTriggerOrder = false, isTakeProfitOrder = true, isIocOrder = false, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), } = position;
|
|
944
|
+
let innerIsTakeProfitOrder = isTakeProfitOrder;
|
|
945
|
+
const adjustPrice = this.processSlippage(indexPrice, !long, isTriggerOrder ? 0 : pricesSlippage);
|
|
946
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
947
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
948
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
949
|
+
if (isTriggerOrder) {
|
|
950
|
+
allowTrade = isIocOrder || !innerIsTakeProfitOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
951
|
+
}
|
|
952
|
+
else {
|
|
953
|
+
innerIsTakeProfitOrder = true;
|
|
954
|
+
}
|
|
955
|
+
// Process coin splitting
|
|
956
|
+
const [feeObject] = this.processCoinSplitting(tx, collateralToken, coinObjects, [tx.pure.u64(relayerFee)], sponsoredTx, suiCoinObject);
|
|
957
|
+
tx.moveCall({
|
|
958
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v3`,
|
|
959
|
+
typeArguments: [
|
|
960
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
961
|
+
this.consts.coins[collateralToken].module,
|
|
962
|
+
this.consts.coins[indexToken].module,
|
|
963
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
964
|
+
this.consts.coins[collateralToken].module,
|
|
965
|
+
],
|
|
966
|
+
arguments: [
|
|
967
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
968
|
+
tx.object(this.consts.sudoCore.market),
|
|
969
|
+
tx.object(pcpId),
|
|
970
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
971
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
972
|
+
feeObject,
|
|
973
|
+
tx.pure.u8(allowTrade),
|
|
974
|
+
tx.pure.bool(innerIsTakeProfitOrder),
|
|
975
|
+
tx.pure.u64(amount),
|
|
976
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
977
|
+
tx.pure.u256(adjustPrice),
|
|
978
|
+
tx.pure.u256(indexPriceThreshold),
|
|
979
|
+
],
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
return tx;
|
|
983
|
+
}
|
|
764
984
|
async pledgeInPosition(pcpId, collateralToken, indexToken, amount, coinObjects, long, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
765
985
|
let tx = new transactions_1.Transaction();
|
|
766
986
|
// Handle oracle initialization and coin processing
|
|
@@ -831,10 +1051,18 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
831
1051
|
functionName = 'clear_open_position_order_unified';
|
|
832
1052
|
break;
|
|
833
1053
|
}
|
|
1054
|
+
case 'OPEN_MARKET': {
|
|
1055
|
+
functionName = 'clear_open_market_order';
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
834
1058
|
case 'DECREASE_POSITION': {
|
|
835
1059
|
functionName = 'clear_decrease_position_order_unified';
|
|
836
1060
|
break;
|
|
837
1061
|
}
|
|
1062
|
+
case 'DECREASE_MARKET': {
|
|
1063
|
+
functionName = 'clear_decrease_market_order';
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
838
1066
|
default: {
|
|
839
1067
|
throw new Error('invalid order type');
|
|
840
1068
|
}
|
|
@@ -867,10 +1095,18 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
867
1095
|
functionName = 'clear_open_position_order_unified';
|
|
868
1096
|
break;
|
|
869
1097
|
}
|
|
1098
|
+
case 'OPEN_MARKET': {
|
|
1099
|
+
functionName = 'clear_open_market_order';
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
870
1102
|
case 'DECREASE_POSITION': {
|
|
871
1103
|
functionName = 'clear_decrease_position_order_unified';
|
|
872
1104
|
break;
|
|
873
1105
|
}
|
|
1106
|
+
case 'DECREASE_MARKET': {
|
|
1107
|
+
functionName = 'clear_decrease_market_order';
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
874
1110
|
default: {
|
|
875
1111
|
throw new Error('invalid order type');
|
|
876
1112
|
}
|
|
@@ -933,6 +1169,34 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
933
1169
|
],
|
|
934
1170
|
});
|
|
935
1171
|
}
|
|
1172
|
+
clearOpenMarketOrder(orderCapId, collateralToken, indexToken, long, tx, _isV11Order) {
|
|
1173
|
+
const funcName = 'clear_open_market_order';
|
|
1174
|
+
tx.moveCall({
|
|
1175
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::${funcName}`,
|
|
1176
|
+
typeArguments: [
|
|
1177
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
1178
|
+
this.consts.coins[collateralToken].module,
|
|
1179
|
+
this.consts.coins[indexToken].module,
|
|
1180
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
1181
|
+
this.consts.coins[collateralToken].module,
|
|
1182
|
+
],
|
|
1183
|
+
arguments: [tx.object(this.consts.sudoCore.market), tx.object(orderCapId)],
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
clearDecreaseMarketOrder(orderCapId, collateralToken, indexToken, long, tx, _isV11Order) {
|
|
1187
|
+
const funcName = 'clear_decrease_market_order';
|
|
1188
|
+
tx.moveCall({
|
|
1189
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::${funcName}`,
|
|
1190
|
+
typeArguments: [
|
|
1191
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
1192
|
+
this.consts.coins[collateralToken].module,
|
|
1193
|
+
this.consts.coins[indexToken].module,
|
|
1194
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
1195
|
+
this.consts.coins[collateralToken].module,
|
|
1196
|
+
],
|
|
1197
|
+
arguments: [tx.object(this.consts.sudoCore.market), tx.object(orderCapId)],
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
936
1200
|
async openPositionWithSCard(collateralToken, indexToken, size, collateralAmount, coinObjects, long, reserveAmount, indexPrice, collateralPrice, kioskClient, kioskCap, scard, isLimitOrder = false, isIocOrder = false, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), referralAddress, sender, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
937
1201
|
let tx = new transactions_1.Transaction();
|
|
938
1202
|
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
@@ -1071,6 +1335,145 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
1071
1335
|
.finalize();
|
|
1072
1336
|
return tx;
|
|
1073
1337
|
}
|
|
1338
|
+
async openPositionWithSCardV2(collateralToken, indexToken, size, collateralAmount, coinObjects, long, reserveAmount, indexPrice, collateralPrice, kioskClient, kioskCap, scard, isLimitOrder, isIocOrder, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), referralAddress, sender, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
1339
|
+
let tx = new transactions_1.Transaction();
|
|
1340
|
+
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
1341
|
+
tx = await this.addReferral(referralAddress, tx);
|
|
1342
|
+
}
|
|
1343
|
+
const symbol = (0, utils_2.joinSymbol)(long ? 'long' : 'short', indexToken);
|
|
1344
|
+
const adjustPrice = this.processSlippage(indexPrice, long, isLimitOrder ? 0 : pricesSlippage);
|
|
1345
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
1346
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
1347
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
1348
|
+
if (isLimitOrder) {
|
|
1349
|
+
allowTrade = isIocOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
1350
|
+
}
|
|
1351
|
+
const kioskTx = new kiosk_1.KioskTransaction({
|
|
1352
|
+
transaction: tx,
|
|
1353
|
+
kioskClient,
|
|
1354
|
+
cap: kioskCap,
|
|
1355
|
+
});
|
|
1356
|
+
const [sudoCard, promise] = kioskTx.borrow({
|
|
1357
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1358
|
+
itemId: scard,
|
|
1359
|
+
});
|
|
1360
|
+
// Handle oracle initialization and coin processing
|
|
1361
|
+
let suiCoinObject;
|
|
1362
|
+
if (sponsoredTx) {
|
|
1363
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
1364
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject);
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx);
|
|
1368
|
+
}
|
|
1369
|
+
// Process coin splitting
|
|
1370
|
+
const [depositObject, feeObject] = this.processCoinSplitting(tx, collateralToken, coinObjects, [tx.pure.u64(collateralAmount), tx.pure.u64(relayerFee)], sponsoredTx, suiCoinObject);
|
|
1371
|
+
tx.moveCall({
|
|
1372
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_with_scard_v2`,
|
|
1373
|
+
typeArguments: [
|
|
1374
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
1375
|
+
this.consts.coins[collateralToken].module,
|
|
1376
|
+
this.consts.coins[indexToken].module,
|
|
1377
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
1378
|
+
this.consts.coins[collateralToken].module,
|
|
1379
|
+
],
|
|
1380
|
+
arguments: [
|
|
1381
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
1382
|
+
tx.object(this.consts.sudoCore.market),
|
|
1383
|
+
tx.object(this.consts.sudoCore.symbols[symbol].positionConfig),
|
|
1384
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
1385
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
1386
|
+
depositObject,
|
|
1387
|
+
feeObject,
|
|
1388
|
+
tx.pure.u8(allowTrade),
|
|
1389
|
+
tx.pure.u64(size),
|
|
1390
|
+
tx.pure.u64(reserveAmount),
|
|
1391
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
1392
|
+
tx.pure.u256(adjustPrice),
|
|
1393
|
+
tx.pure.u256(indexPriceThreshold),
|
|
1394
|
+
sudoCard,
|
|
1395
|
+
],
|
|
1396
|
+
});
|
|
1397
|
+
kioskTx
|
|
1398
|
+
.return({
|
|
1399
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1400
|
+
item: sudoCard,
|
|
1401
|
+
promise,
|
|
1402
|
+
})
|
|
1403
|
+
.finalize();
|
|
1404
|
+
return tx;
|
|
1405
|
+
}
|
|
1406
|
+
// S Card operations
|
|
1407
|
+
async openPositionWithCoinAndSCardV2(collateralToken, indexToken, size, coinObj, long, reserveAmount, indexPrice, collateralPrice, kioskClient, kioskCap, scard, isLimitOrder, isIocOrder, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), referralAddress, sender, tx, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
1408
|
+
if (!tx) {
|
|
1409
|
+
tx = new transactions_1.Transaction();
|
|
1410
|
+
}
|
|
1411
|
+
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
1412
|
+
tx = await this.addReferral(referralAddress, tx);
|
|
1413
|
+
}
|
|
1414
|
+
const symbol = (0, utils_2.joinSymbol)(long ? 'long' : 'short', indexToken);
|
|
1415
|
+
const adjustPrice = this.processSlippage(indexPrice, long, isLimitOrder ? 0 : pricesSlippage);
|
|
1416
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
1417
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
1418
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
1419
|
+
if (isLimitOrder) {
|
|
1420
|
+
allowTrade = isIocOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
1421
|
+
}
|
|
1422
|
+
const kioskTx = new kiosk_1.KioskTransaction({
|
|
1423
|
+
transaction: tx,
|
|
1424
|
+
kioskClient,
|
|
1425
|
+
cap: kioskCap,
|
|
1426
|
+
});
|
|
1427
|
+
const [sudoCard, promise] = kioskTx.borrow({
|
|
1428
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1429
|
+
itemId: scard,
|
|
1430
|
+
});
|
|
1431
|
+
// Handle oracle initialization and coin processing
|
|
1432
|
+
let suiCoinObject;
|
|
1433
|
+
if (sponsoredTx) {
|
|
1434
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
1435
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject);
|
|
1436
|
+
}
|
|
1437
|
+
else {
|
|
1438
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx);
|
|
1439
|
+
}
|
|
1440
|
+
// Process coin splitting
|
|
1441
|
+
const [feeObject] = tx.splitCoins(coinObj, [tx.pure.u64(relayerFee)]);
|
|
1442
|
+
tx.moveCall({
|
|
1443
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_with_scard_v2`,
|
|
1444
|
+
typeArguments: [
|
|
1445
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
1446
|
+
this.consts.coins[collateralToken].module,
|
|
1447
|
+
this.consts.coins[indexToken].module,
|
|
1448
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
1449
|
+
this.consts.coins[collateralToken].module,
|
|
1450
|
+
],
|
|
1451
|
+
arguments: [
|
|
1452
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
1453
|
+
tx.object(this.consts.sudoCore.market),
|
|
1454
|
+
tx.object(this.consts.sudoCore.symbols[symbol].positionConfig),
|
|
1455
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
1456
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
1457
|
+
coinObj,
|
|
1458
|
+
feeObject,
|
|
1459
|
+
tx.pure.u8(allowTrade),
|
|
1460
|
+
tx.pure.u64(size),
|
|
1461
|
+
tx.pure.u64(reserveAmount),
|
|
1462
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
1463
|
+
tx.pure.u256(adjustPrice),
|
|
1464
|
+
tx.pure.u256(indexPriceThreshold),
|
|
1465
|
+
sudoCard,
|
|
1466
|
+
],
|
|
1467
|
+
});
|
|
1468
|
+
kioskTx
|
|
1469
|
+
.return({
|
|
1470
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1471
|
+
item: sudoCard,
|
|
1472
|
+
promise,
|
|
1473
|
+
})
|
|
1474
|
+
.finalize();
|
|
1475
|
+
return tx;
|
|
1476
|
+
}
|
|
1074
1477
|
async decreasePositionWithSCard(pcpId, collateralToken, indexToken, amount, long, indexPrice, collateralPrice, kioskClient, kioskCap, scard, isTriggerOrder = false, isTakeProfitOrder = true, isIocOrder = false, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), coinObjects, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
1075
1478
|
if (!coinObjects) {
|
|
1076
1479
|
throw new Error(`${this.constructor.name}: coinObjects is required`);
|
|
@@ -1141,6 +1544,75 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
1141
1544
|
.finalize();
|
|
1142
1545
|
return tx;
|
|
1143
1546
|
}
|
|
1547
|
+
async decreasePositionWithSCardV2(pcpId, collateralToken, indexToken, amount, long, indexPrice, collateralPrice, kioskClient, kioskCap, scard, isTriggerOrder = false, isTakeProfitOrder = true, isIocOrder = false, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), coinObjects, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
1548
|
+
if (!coinObjects) {
|
|
1549
|
+
throw new Error(`${this.constructor.name}: coinObjects is required`);
|
|
1550
|
+
}
|
|
1551
|
+
let tx = new transactions_1.Transaction();
|
|
1552
|
+
const kioskTx = new kiosk_1.KioskTransaction({
|
|
1553
|
+
transaction: tx,
|
|
1554
|
+
kioskClient,
|
|
1555
|
+
cap: kioskCap,
|
|
1556
|
+
});
|
|
1557
|
+
const [sudoCard, promise] = kioskTx.borrow({
|
|
1558
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1559
|
+
itemId: scard,
|
|
1560
|
+
});
|
|
1561
|
+
const adjustPrice = this.processSlippage(indexPrice, !long, isTriggerOrder ? 0 : pricesSlippage);
|
|
1562
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
1563
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
1564
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
1565
|
+
if (isTriggerOrder) {
|
|
1566
|
+
allowTrade = isIocOrder || !isTakeProfitOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
isTakeProfitOrder = true;
|
|
1570
|
+
}
|
|
1571
|
+
// Handle oracle initialization and coin processing
|
|
1572
|
+
let suiCoinObject;
|
|
1573
|
+
if (sponsoredTx) {
|
|
1574
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
1575
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject);
|
|
1576
|
+
}
|
|
1577
|
+
else {
|
|
1578
|
+
tx = await this.initOracleTxb([collateralToken, indexToken], tx);
|
|
1579
|
+
}
|
|
1580
|
+
// Process coin splitting
|
|
1581
|
+
const [feeObject] = this.processCoinSplitting(tx, collateralToken, coinObjects, [tx.pure.u64(relayerFee)], sponsoredTx, suiCoinObject);
|
|
1582
|
+
tx.moveCall({
|
|
1583
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_with_scard_v2`,
|
|
1584
|
+
typeArguments: [
|
|
1585
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
1586
|
+
this.consts.coins[collateralToken].module,
|
|
1587
|
+
this.consts.coins[indexToken].module,
|
|
1588
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
1589
|
+
this.consts.coins[collateralToken].module,
|
|
1590
|
+
],
|
|
1591
|
+
arguments: [
|
|
1592
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
1593
|
+
tx.object(this.consts.sudoCore.market),
|
|
1594
|
+
tx.object(pcpId),
|
|
1595
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
1596
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
1597
|
+
feeObject,
|
|
1598
|
+
tx.pure.u8(allowTrade),
|
|
1599
|
+
tx.pure.bool(isTakeProfitOrder),
|
|
1600
|
+
tx.pure.u64(amount),
|
|
1601
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
1602
|
+
tx.pure.u256(adjustPrice),
|
|
1603
|
+
tx.pure.u256(indexPriceThreshold),
|
|
1604
|
+
sudoCard,
|
|
1605
|
+
],
|
|
1606
|
+
});
|
|
1607
|
+
kioskTx
|
|
1608
|
+
.return({
|
|
1609
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1610
|
+
item: sudoCard,
|
|
1611
|
+
promise,
|
|
1612
|
+
})
|
|
1613
|
+
.finalize();
|
|
1614
|
+
return tx;
|
|
1615
|
+
}
|
|
1144
1616
|
async decreaseMultiPositionsWithSCard(positions, kioskClient, kioskCap, scard, tx, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
1145
1617
|
if (!tx) {
|
|
1146
1618
|
tx = new transactions_1.Transaction();
|
|
@@ -1214,6 +1686,78 @@ class SLPAPI extends abstract_1.BaseAPI {
|
|
|
1214
1686
|
.finalize();
|
|
1215
1687
|
return tx;
|
|
1216
1688
|
}
|
|
1689
|
+
async decreaseMultiPositionsWithSCardV2(positions, kioskClient, kioskCap, scard, tx, sponsoredTx, suiCoinObjectsForPythUpdate) {
|
|
1690
|
+
if (!tx) {
|
|
1691
|
+
tx = new transactions_1.Transaction();
|
|
1692
|
+
}
|
|
1693
|
+
// Handle oracle initialization and coin processing
|
|
1694
|
+
let suiCoinObject;
|
|
1695
|
+
if (sponsoredTx) {
|
|
1696
|
+
suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true);
|
|
1697
|
+
tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx, true, suiCoinObject);
|
|
1698
|
+
}
|
|
1699
|
+
else {
|
|
1700
|
+
tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx);
|
|
1701
|
+
}
|
|
1702
|
+
const kioskTx = new kiosk_1.KioskTransaction({
|
|
1703
|
+
transaction: tx,
|
|
1704
|
+
kioskClient,
|
|
1705
|
+
cap: kioskCap,
|
|
1706
|
+
});
|
|
1707
|
+
const [sudoCard, promise] = kioskTx.borrow({
|
|
1708
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1709
|
+
itemId: scard,
|
|
1710
|
+
});
|
|
1711
|
+
for (const position of positions) {
|
|
1712
|
+
const { pcpId, collateralToken, indexToken, amount, long, indexPrice, collateralPrice, isTriggerOrder = false, isTakeProfitOrder = true, isIocOrder = false, pricesSlippage = 0.003, collateralSlippage = 0.5, relayerFee = BigInt(0.5), coinObjects = [], } = position;
|
|
1713
|
+
let innerIsTakeProfitOrder = isTakeProfitOrder;
|
|
1714
|
+
const adjustPrice = this.processSlippage(indexPrice, !long, isTriggerOrder ? 0 : pricesSlippage);
|
|
1715
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage);
|
|
1716
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage);
|
|
1717
|
+
let allowTrade = consts_1.ALLOW_TRADE_MUST_TRADE;
|
|
1718
|
+
if (isTriggerOrder) {
|
|
1719
|
+
allowTrade = isIocOrder || !innerIsTakeProfitOrder ? consts_1.ALLOW_TRADE_NO_TRADE : consts_1.ALLOW_TRADE_CAN_TRADE;
|
|
1720
|
+
}
|
|
1721
|
+
else {
|
|
1722
|
+
innerIsTakeProfitOrder = true;
|
|
1723
|
+
}
|
|
1724
|
+
// Process coin splitting
|
|
1725
|
+
const [feeObject] = this.processCoinSplitting(tx, collateralToken, coinObjects, [tx.pure.u64(relayerFee)], sponsoredTx, suiCoinObject);
|
|
1726
|
+
tx.moveCall({
|
|
1727
|
+
target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_with_scard_v2`,
|
|
1728
|
+
typeArguments: [
|
|
1729
|
+
`${this.consts.sudoCore.package}::slp::SLP`,
|
|
1730
|
+
this.consts.coins[collateralToken].module,
|
|
1731
|
+
this.consts.coins[indexToken].module,
|
|
1732
|
+
`${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
|
|
1733
|
+
this.consts.coins[collateralToken].module,
|
|
1734
|
+
],
|
|
1735
|
+
arguments: [
|
|
1736
|
+
tx.object(utils_1.SUI_CLOCK_OBJECT_ID),
|
|
1737
|
+
tx.object(this.consts.sudoCore.market),
|
|
1738
|
+
tx.object(pcpId),
|
|
1739
|
+
tx.object(this.consts.pythFeeder.feeder[collateralToken]),
|
|
1740
|
+
tx.object(this.consts.pythFeeder.feeder[indexToken]),
|
|
1741
|
+
feeObject,
|
|
1742
|
+
tx.pure.u8(allowTrade),
|
|
1743
|
+
tx.pure.bool(innerIsTakeProfitOrder),
|
|
1744
|
+
tx.pure.u64(amount),
|
|
1745
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
1746
|
+
tx.pure.u256(adjustPrice),
|
|
1747
|
+
tx.pure.u256(indexPriceThreshold),
|
|
1748
|
+
sudoCard,
|
|
1749
|
+
],
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
kioskTx
|
|
1753
|
+
.return({
|
|
1754
|
+
itemType: `${this.consts.sudoNft.package}::card::SudoCard`,
|
|
1755
|
+
item: sudoCard,
|
|
1756
|
+
promise,
|
|
1757
|
+
})
|
|
1758
|
+
.finalize();
|
|
1759
|
+
return tx;
|
|
1760
|
+
}
|
|
1217
1761
|
addReferral(referrer, tx) {
|
|
1218
1762
|
if (!tx) {
|
|
1219
1763
|
tx = new transactions_1.Transaction();
|