@zofai/zo-sdk 0.2.15 → 0.2.17
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/abstract/BaseAPI.cjs +5 -0
- package/dist/abstract/BaseAPI.cjs.map +1 -1
- package/dist/abstract/BaseAPI.d.cts +2 -1
- package/dist/abstract/BaseAPI.d.cts.map +1 -1
- package/dist/abstract/BaseAPI.d.mts +2 -1
- package/dist/abstract/BaseAPI.d.mts.map +1 -1
- package/dist/abstract/BaseAPI.mjs +5 -0
- package/dist/abstract/BaseAPI.mjs.map +1 -1
- package/dist/consts/deployments-zo-oracle-mainnet.json +4 -4
- package/dist/implementations/SLPAPI.cjs +3 -2
- package/dist/implementations/SLPAPI.cjs.map +1 -1
- package/dist/implementations/SLPAPI.d.cts.map +1 -1
- package/dist/implementations/SLPAPI.d.mts.map +1 -1
- package/dist/implementations/SLPAPI.mjs +3 -2
- package/dist/implementations/SLPAPI.mjs.map +1 -1
- package/dist/implementations/USDZAPI.cjs +107 -5
- package/dist/implementations/USDZAPI.cjs.map +1 -1
- package/dist/implementations/USDZAPI.d.cts +8 -0
- package/dist/implementations/USDZAPI.d.cts.map +1 -1
- package/dist/implementations/USDZAPI.d.mts +8 -0
- package/dist/implementations/USDZAPI.d.mts.map +1 -1
- package/dist/implementations/USDZAPI.mjs +108 -6
- package/dist/implementations/USDZAPI.mjs.map +1 -1
- package/dist/implementations/ZBTCVCAPI.cjs +3 -1
- package/dist/implementations/ZBTCVCAPI.cjs.map +1 -1
- package/dist/implementations/ZBTCVCAPI.d.cts.map +1 -1
- package/dist/implementations/ZBTCVCAPI.d.mts.map +1 -1
- package/dist/implementations/ZBTCVCAPI.mjs +3 -1
- package/dist/implementations/ZBTCVCAPI.mjs.map +1 -1
- package/dist/implementations/ZLPAPI.cjs +3 -2
- package/dist/implementations/ZLPAPI.cjs.map +1 -1
- package/dist/implementations/ZLPAPI.d.cts.map +1 -1
- package/dist/implementations/ZLPAPI.d.mts.map +1 -1
- package/dist/implementations/ZLPAPI.mjs +3 -2
- package/dist/implementations/ZLPAPI.mjs.map +1 -1
- package/dist/interfaces/base.d.cts +1 -1
- package/dist/interfaces/base.d.cts.map +1 -1
- package/dist/interfaces/base.d.mts +1 -1
- package/dist/interfaces/base.d.mts.map +1 -1
- package/dist/interfaces/usdz.d.cts +2 -0
- package/dist/interfaces/usdz.d.cts.map +1 -1
- package/dist/interfaces/usdz.d.mts +2 -0
- package/dist/interfaces/usdz.d.mts.map +1 -1
- package/dist/oraclePro.cjs +4 -7
- package/dist/oraclePro.cjs.map +1 -1
- package/dist/oraclePro.d.cts +0 -2
- package/dist/oraclePro.d.cts.map +1 -1
- package/dist/oraclePro.d.mts +0 -2
- package/dist/oraclePro.d.mts.map +1 -1
- package/dist/oraclePro.mjs +4 -6
- package/dist/oraclePro.mjs.map +1 -1
- package/package.json +1 -1
- package/src/abstract/BaseAPI.ts +11 -0
- package/src/consts/deployments-zo-oracle-mainnet.json +4 -4
- package/src/implementations/SLPAPI.ts +5 -5
- package/src/implementations/USDZAPI.ts +178 -9
- package/src/implementations/ZBTCVCAPI.ts +6 -4
- package/src/implementations/ZLPAPI.ts +6 -5
- package/src/interfaces/base.ts +1 -0
- package/src/interfaces/usdz.ts +45 -0
- package/src/oraclePro.ts +4 -7
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
} from '../interfaces'
|
|
21
21
|
import type { IInitPythProOracleOptions } from '../oracle'
|
|
22
22
|
import type { OracleInputs, OracleInputsAlt } from '../oraclePro'
|
|
23
|
-
import { buildOracleInputsAlt, oracleArgsAlt, oracleArgsStandard
|
|
23
|
+
import { buildOracleInputsAlt, oracleArgsAlt, oracleArgsStandard } from '../oraclePro'
|
|
24
24
|
import type { SuiClient } from '../suiClient'
|
|
25
25
|
import { joinSymbol, parseSymbolKey } from '../utils'
|
|
26
26
|
import { USDZDataAPI } from './USDZDataAPI'
|
|
@@ -2329,7 +2329,6 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2329
2329
|
sender?: string,
|
|
2330
2330
|
): Promise<Transaction> {
|
|
2331
2331
|
let tx = new Transaction()
|
|
2332
|
-
// Handle oracle initialization and coin processing
|
|
2333
2332
|
let suiCoinObject
|
|
2334
2333
|
if (sponsoredTx) {
|
|
2335
2334
|
const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
|
|
@@ -2343,14 +2342,12 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2343
2342
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
2344
2343
|
}
|
|
2345
2344
|
|
|
2346
|
-
|
|
2347
|
-
const [depositObject] = this.processCoinSplitting(
|
|
2345
|
+
const depositObject = await this.resolveSplitCoinObject(
|
|
2348
2346
|
tx,
|
|
2349
2347
|
collateralToken,
|
|
2348
|
+
BigInt(amount),
|
|
2350
2349
|
coinObjects,
|
|
2351
|
-
|
|
2352
|
-
sponsoredTx,
|
|
2353
|
-
suiCoinObject,
|
|
2350
|
+
{ sponsoredTx, suiCoinObject, sender },
|
|
2354
2351
|
)
|
|
2355
2352
|
|
|
2356
2353
|
tx.moveCall({
|
|
@@ -2363,6 +2360,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2363
2360
|
],
|
|
2364
2361
|
arguments: [tx.object(this.consts.zoCore.market), tx.object(pcpId), depositObject],
|
|
2365
2362
|
})
|
|
2363
|
+
|
|
2364
|
+
this.returnUnusedSuiCoin(tx, suiCoinObject, sender)
|
|
2366
2365
|
return tx
|
|
2367
2366
|
}
|
|
2368
2367
|
|
|
@@ -2411,6 +2410,7 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2411
2410
|
],
|
|
2412
2411
|
})
|
|
2413
2412
|
|
|
2413
|
+
this.returnUnusedSuiCoin(tx, suiCoinObject, sender)
|
|
2414
2414
|
return tx
|
|
2415
2415
|
}
|
|
2416
2416
|
|
|
@@ -2678,7 +2678,7 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2678
2678
|
fromDepositObject,
|
|
2679
2679
|
tx_.pure.u64(minAmountOut || 0),
|
|
2680
2680
|
vaultsValuation,
|
|
2681
|
-
...
|
|
2681
|
+
...oracleArgsStandard(oracle),
|
|
2682
2682
|
],
|
|
2683
2683
|
})
|
|
2684
2684
|
return tx_
|
|
@@ -2722,7 +2722,7 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2722
2722
|
fromDepositObject,
|
|
2723
2723
|
tx_.pure.u64(minAmountOut || 0),
|
|
2724
2724
|
vaultsValuation,
|
|
2725
|
-
...
|
|
2725
|
+
...oracleArgsStandard(oracle),
|
|
2726
2726
|
],
|
|
2727
2727
|
})
|
|
2728
2728
|
return outputCoin
|
|
@@ -2905,6 +2905,171 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
2905
2905
|
return tx
|
|
2906
2906
|
}
|
|
2907
2907
|
|
|
2908
|
+
/**
|
|
2909
|
+
* Opens a position with a pre-composed collateral coin using open_position_v3 (Pyth Pro + Stork).
|
|
2910
|
+
*/
|
|
2911
|
+
public async openPositionWithCoinV3(
|
|
2912
|
+
collateralToken: string,
|
|
2913
|
+
indexToken: string,
|
|
2914
|
+
size: bigint,
|
|
2915
|
+
coinObj: TransactionObjectArgument,
|
|
2916
|
+
long: boolean,
|
|
2917
|
+
reserveAmount: bigint,
|
|
2918
|
+
indexPrice: number,
|
|
2919
|
+
collateralPrice: number,
|
|
2920
|
+
pythProUpdateBytes: Uint8Array | number[],
|
|
2921
|
+
isLimitOrder?: boolean,
|
|
2922
|
+
isIocOrder?: boolean,
|
|
2923
|
+
pricesSlippage = 0.003,
|
|
2924
|
+
collateralSlippage = 0.5,
|
|
2925
|
+
relayerFee = BigInt(0.5),
|
|
2926
|
+
referralAddress?: string,
|
|
2927
|
+
sender?: string,
|
|
2928
|
+
tx?: Transaction,
|
|
2929
|
+
sponsoredTx?: boolean,
|
|
2930
|
+
): Promise<Transaction> {
|
|
2931
|
+
if (!tx) {
|
|
2932
|
+
tx = new Transaction()
|
|
2933
|
+
}
|
|
2934
|
+
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
2935
|
+
tx = await this.addReferral(referralAddress, tx)
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
const symbol = joinSymbol(long ? 'long' : 'short', indexToken)
|
|
2939
|
+
const adjustPrice = this.processSlippage(indexPrice, long, isLimitOrder ? 0 : pricesSlippage)
|
|
2940
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage)
|
|
2941
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage)
|
|
2942
|
+
|
|
2943
|
+
let allowTrade = ALLOW_TRADE_MUST_TRADE
|
|
2944
|
+
if (isLimitOrder) {
|
|
2945
|
+
allowTrade = isIocOrder ? ALLOW_TRADE_NO_TRADE : ALLOW_TRADE_CAN_TRADE
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
const { tx: tx_, oracle } = await this.initV3OracleForTokens(
|
|
2949
|
+
[collateralToken, indexToken],
|
|
2950
|
+
tx,
|
|
2951
|
+
pythProUpdateBytes,
|
|
2952
|
+
)
|
|
2953
|
+
tx = tx_
|
|
2954
|
+
|
|
2955
|
+
const [feeObject] = tx.splitCoins(coinObj, [tx.pure.u64(relayerFee)])
|
|
2956
|
+
|
|
2957
|
+
tx.moveCall({
|
|
2958
|
+
target: `${this.consts.zoCore.upgradedPackage}::market::open_position_v3`,
|
|
2959
|
+
typeArguments: this.positionTypeArgs(collateralToken, indexToken, long),
|
|
2960
|
+
arguments: [
|
|
2961
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
2962
|
+
tx.object(this.consts.zoCore.market),
|
|
2963
|
+
tx.object(this.consts.zoCore.symbols[symbol].positionConfig),
|
|
2964
|
+
...oracleArgsStandard(oracle),
|
|
2965
|
+
coinObj,
|
|
2966
|
+
feeObject,
|
|
2967
|
+
tx.pure.u8(allowTrade),
|
|
2968
|
+
tx.pure.u64(size),
|
|
2969
|
+
tx.pure.u64(reserveAmount),
|
|
2970
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
2971
|
+
tx.pure.u256(adjustPrice),
|
|
2972
|
+
tx.pure.u256(indexPriceThreshold),
|
|
2973
|
+
],
|
|
2974
|
+
})
|
|
2975
|
+
|
|
2976
|
+
return tx
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
/**
|
|
2980
|
+
* Opens a position with a pre-composed collateral coin and S Card using open_position_with_scard_v3.
|
|
2981
|
+
*/
|
|
2982
|
+
public async openPositionWithCoinAndSCardV3(
|
|
2983
|
+
collateralToken: string,
|
|
2984
|
+
indexToken: string,
|
|
2985
|
+
size: bigint,
|
|
2986
|
+
coinObj: TransactionObjectArgument,
|
|
2987
|
+
long: boolean,
|
|
2988
|
+
reserveAmount: bigint,
|
|
2989
|
+
indexPrice: number,
|
|
2990
|
+
collateralPrice: number,
|
|
2991
|
+
kioskClient: KioskClient,
|
|
2992
|
+
kioskCap: KioskOwnerCap,
|
|
2993
|
+
scard: string,
|
|
2994
|
+
pythProUpdateBytes: Uint8Array | number[],
|
|
2995
|
+
isLimitOrder?: boolean,
|
|
2996
|
+
isIocOrder?: boolean,
|
|
2997
|
+
pricesSlippage = 0.003,
|
|
2998
|
+
collateralSlippage = 0.5,
|
|
2999
|
+
relayerFee = BigInt(0.5),
|
|
3000
|
+
referralAddress?: string,
|
|
3001
|
+
sender?: string,
|
|
3002
|
+
tx?: Transaction,
|
|
3003
|
+
sponsoredTx?: boolean,
|
|
3004
|
+
): Promise<Transaction> {
|
|
3005
|
+
if (!tx) {
|
|
3006
|
+
tx = new Transaction()
|
|
3007
|
+
}
|
|
3008
|
+
if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
|
|
3009
|
+
tx = await this.addReferral(referralAddress, tx)
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
const symbol = joinSymbol(long ? 'long' : 'short', indexToken)
|
|
3013
|
+
const adjustPrice = this.processSlippage(indexPrice, long, isLimitOrder ? 0 : pricesSlippage)
|
|
3014
|
+
const adjustCollateralPrice = this.processSlippage(collateralPrice, false, collateralSlippage)
|
|
3015
|
+
const indexPriceThreshold = this.processPriceThreshold(indexPrice, pricesSlippage)
|
|
3016
|
+
|
|
3017
|
+
let allowTrade = ALLOW_TRADE_MUST_TRADE
|
|
3018
|
+
if (isLimitOrder) {
|
|
3019
|
+
allowTrade = isIocOrder ? ALLOW_TRADE_NO_TRADE : ALLOW_TRADE_CAN_TRADE
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
const kioskTx = new KioskTransaction({
|
|
3023
|
+
transaction: tx,
|
|
3024
|
+
kioskClient,
|
|
3025
|
+
cap: kioskCap,
|
|
3026
|
+
})
|
|
3027
|
+
|
|
3028
|
+
const [sudoCard, promise] = kioskTx.borrow({
|
|
3029
|
+
itemType: `0xe7e651e4974fe367aa2837712d68081efb299c470242a15e2b9c26ea326159ec::card::SudoCard`,
|
|
3030
|
+
itemId: scard,
|
|
3031
|
+
})
|
|
3032
|
+
|
|
3033
|
+
const { tx: tx_, oracle } = await this.initV3OracleForTokens(
|
|
3034
|
+
[collateralToken, indexToken],
|
|
3035
|
+
tx,
|
|
3036
|
+
pythProUpdateBytes,
|
|
3037
|
+
)
|
|
3038
|
+
tx = tx_
|
|
3039
|
+
|
|
3040
|
+
const [feeObject] = tx.splitCoins(coinObj, [tx.pure.u64(relayerFee)])
|
|
3041
|
+
|
|
3042
|
+
tx.moveCall({
|
|
3043
|
+
target: `${this.consts.zoCore.upgradedPackage}::market::open_position_with_scard_v3`,
|
|
3044
|
+
typeArguments: this.positionTypeArgs(collateralToken, indexToken, long),
|
|
3045
|
+
arguments: [
|
|
3046
|
+
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
3047
|
+
tx.object(this.consts.zoCore.market),
|
|
3048
|
+
tx.object(this.consts.zoCore.symbols[symbol].positionConfig),
|
|
3049
|
+
...oracleArgsStandard(oracle),
|
|
3050
|
+
coinObj,
|
|
3051
|
+
feeObject,
|
|
3052
|
+
tx.pure.u8(allowTrade),
|
|
3053
|
+
tx.pure.u64(size),
|
|
3054
|
+
tx.pure.u64(reserveAmount),
|
|
3055
|
+
tx.pure.u256(adjustCollateralPrice),
|
|
3056
|
+
tx.pure.u256(adjustPrice),
|
|
3057
|
+
tx.pure.u256(indexPriceThreshold),
|
|
3058
|
+
sudoCard,
|
|
3059
|
+
],
|
|
3060
|
+
})
|
|
3061
|
+
|
|
3062
|
+
kioskTx
|
|
3063
|
+
.return({
|
|
3064
|
+
itemType: `0xe7e651e4974fe367aa2837712d68081efb299c470242a15e2b9c26ea326159ec::card::SudoCard`,
|
|
3065
|
+
item: sudoCard,
|
|
3066
|
+
promise,
|
|
3067
|
+
})
|
|
3068
|
+
.finalize()
|
|
3069
|
+
|
|
3070
|
+
return tx
|
|
3071
|
+
}
|
|
3072
|
+
|
|
2908
3073
|
/**
|
|
2909
3074
|
* Decreases a position using decrease_position_v3.
|
|
2910
3075
|
*/
|
|
@@ -3107,6 +3272,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
3107
3272
|
pythProUpdateBytes,
|
|
3108
3273
|
)
|
|
3109
3274
|
|
|
3275
|
+
const symbol = joinSymbol(long ? 'long' : 'short', indexToken)
|
|
3276
|
+
|
|
3110
3277
|
tx_.moveCall({
|
|
3111
3278
|
target: `${this.consts.zoCore.upgradedPackage}::market::redeem_from_position_v2`,
|
|
3112
3279
|
typeArguments: this.redeemTypeArgs(collateralToken, indexToken, long),
|
|
@@ -3114,6 +3281,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
3114
3281
|
tx_.object(SUI_CLOCK_OBJECT_ID),
|
|
3115
3282
|
tx_.object(this.consts.zoCore.market),
|
|
3116
3283
|
tx_.object(pcpId),
|
|
3284
|
+
tx_.object(this.consts.zoCore.vaults[collateralToken].reservingFeeModel),
|
|
3285
|
+
tx_.object(this.consts.zoCore.symbols[symbol].fundingFeeModel),
|
|
3117
3286
|
...oracleArgsStandard(oracle),
|
|
3118
3287
|
tx_.pure.u64(amount),
|
|
3119
3288
|
],
|
|
@@ -1107,13 +1107,12 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
1109
1109
|
// Process coin splitting
|
|
1110
|
-
const
|
|
1110
|
+
const depositObject = await this.resolveSplitCoinObject(
|
|
1111
1111
|
tx,
|
|
1112
1112
|
collateralToken,
|
|
1113
|
+
BigInt(amount),
|
|
1113
1114
|
coinObjects,
|
|
1114
|
-
|
|
1115
|
-
sponsoredTx,
|
|
1116
|
-
suiCoinObject,
|
|
1115
|
+
{ sponsoredTx, suiCoinObject, sender },
|
|
1117
1116
|
)
|
|
1118
1117
|
|
|
1119
1118
|
tx.moveCall({
|
|
@@ -1126,6 +1125,8 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
|
|
|
1126
1125
|
],
|
|
1127
1126
|
arguments: [tx.object(this.consts.zoCore.market), tx.object(pcpId), depositObject],
|
|
1128
1127
|
})
|
|
1128
|
+
|
|
1129
|
+
this.returnUnusedSuiCoin(tx, suiCoinObject, sender)
|
|
1129
1130
|
return tx
|
|
1130
1131
|
}
|
|
1131
1132
|
|
|
@@ -1174,6 +1175,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
|
|
|
1174
1175
|
],
|
|
1175
1176
|
})
|
|
1176
1177
|
|
|
1178
|
+
this.returnUnusedSuiCoin(tx, suiCoinObject, sender)
|
|
1177
1179
|
return tx
|
|
1178
1180
|
}
|
|
1179
1181
|
|
|
@@ -2392,14 +2392,12 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
2392
2392
|
tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
|
|
2393
2393
|
}
|
|
2394
2394
|
|
|
2395
|
-
|
|
2396
|
-
const [depositObject] = this.processCoinSplitting(
|
|
2395
|
+
const depositObject = await this.resolveSplitCoinObject(
|
|
2397
2396
|
tx,
|
|
2398
2397
|
collateralToken,
|
|
2398
|
+
BigInt(amount),
|
|
2399
2399
|
coinObjects,
|
|
2400
|
-
|
|
2401
|
-
sponsoredTx,
|
|
2402
|
-
suiCoinObject,
|
|
2400
|
+
{ sponsoredTx, suiCoinObject, sender },
|
|
2403
2401
|
)
|
|
2404
2402
|
|
|
2405
2403
|
tx.moveCall({
|
|
@@ -2412,6 +2410,8 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
2412
2410
|
],
|
|
2413
2411
|
arguments: [tx.object(this.consts.zoCore.market), tx.object(pcpId), depositObject],
|
|
2414
2412
|
})
|
|
2413
|
+
|
|
2414
|
+
this.returnUnusedSuiCoin(tx, suiCoinObject, sender)
|
|
2415
2415
|
return tx
|
|
2416
2416
|
}
|
|
2417
2417
|
|
|
@@ -2460,6 +2460,7 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
|
|
|
2460
2460
|
],
|
|
2461
2461
|
})
|
|
2462
2462
|
|
|
2463
|
+
this.returnUnusedSuiCoin(tx, suiCoinObject, sender)
|
|
2463
2464
|
return tx
|
|
2464
2465
|
}
|
|
2465
2466
|
|
package/src/interfaces/base.ts
CHANGED
package/src/interfaces/usdz.ts
CHANGED
|
@@ -271,6 +271,51 @@ export interface IUSDZAPI extends IBaseAPI {
|
|
|
271
271
|
sponsoredTx?: boolean,
|
|
272
272
|
) => Promise<Transaction>
|
|
273
273
|
|
|
274
|
+
openPositionWithCoinV3: (
|
|
275
|
+
collateralToken: string,
|
|
276
|
+
indexToken: string,
|
|
277
|
+
size: bigint,
|
|
278
|
+
coinObj: import('@mysten/sui/transactions').TransactionObjectArgument,
|
|
279
|
+
long: boolean,
|
|
280
|
+
reserveAmount: bigint,
|
|
281
|
+
indexPrice: number,
|
|
282
|
+
collateralPrice: number,
|
|
283
|
+
pythProUpdateBytes: Uint8Array | number[],
|
|
284
|
+
isLimitOrder?: boolean,
|
|
285
|
+
isIocOrder?: boolean,
|
|
286
|
+
pricesSlippage?: number,
|
|
287
|
+
collateralSlippage?: number,
|
|
288
|
+
relayerFee?: bigint,
|
|
289
|
+
referralAddress?: string,
|
|
290
|
+
sender?: string,
|
|
291
|
+
tx?: import('@mysten/sui/transactions').Transaction,
|
|
292
|
+
sponsoredTx?: boolean,
|
|
293
|
+
) => Promise<Transaction>
|
|
294
|
+
|
|
295
|
+
openPositionWithCoinAndSCardV3: (
|
|
296
|
+
collateralToken: string,
|
|
297
|
+
indexToken: string,
|
|
298
|
+
size: bigint,
|
|
299
|
+
coinObj: import('@mysten/sui/transactions').TransactionObjectArgument,
|
|
300
|
+
long: boolean,
|
|
301
|
+
reserveAmount: bigint,
|
|
302
|
+
indexPrice: number,
|
|
303
|
+
collateralPrice: number,
|
|
304
|
+
kioskClient: import('@mysten/kiosk').KioskClient,
|
|
305
|
+
kioskCap: import('@mysten/kiosk').KioskOwnerCap,
|
|
306
|
+
scard: string,
|
|
307
|
+
pythProUpdateBytes: Uint8Array | number[],
|
|
308
|
+
isLimitOrder?: boolean,
|
|
309
|
+
isIocOrder?: boolean,
|
|
310
|
+
pricesSlippage?: number,
|
|
311
|
+
collateralSlippage?: number,
|
|
312
|
+
relayerFee?: bigint,
|
|
313
|
+
referralAddress?: string,
|
|
314
|
+
sender?: string,
|
|
315
|
+
tx?: import('@mysten/sui/transactions').Transaction,
|
|
316
|
+
sponsoredTx?: boolean,
|
|
317
|
+
) => Promise<Transaction>
|
|
318
|
+
|
|
274
319
|
decreasePositionV3: (
|
|
275
320
|
pcpId: string,
|
|
276
321
|
collateralToken: string,
|
package/src/oraclePro.ts
CHANGED
|
@@ -203,11 +203,6 @@ export function oracleArgsStandard(oracle: OracleInputs): TransactionObjectArgum
|
|
|
203
203
|
return [oracle.pythProUpdate, oracle.storkState, oracle.oracleRegistry]
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
/** `[pythProUpdate, storkState, oracleRegistry, clock]` — for public fns that take clock after oracle args. */
|
|
207
|
-
export function oracleArgsWithClock(oracle: OracleInputs): TransactionObjectArgument[] {
|
|
208
|
-
return [...oracleArgsStandard(oracle), oracle.clock]
|
|
209
|
-
}
|
|
210
|
-
|
|
211
206
|
export function oracleArgsAlt(oracle: OracleInputsAlt): TransactionObjectArgument[] {
|
|
212
207
|
return [oracle.oracleRegistry, oracle.storkState, oracle.pythProUpdate]
|
|
213
208
|
}
|
|
@@ -259,7 +254,8 @@ export function valuateVaultsV2(params: IValuateVaultsV2Params): TransactionObje
|
|
|
259
254
|
arguments: [
|
|
260
255
|
tx.object(market),
|
|
261
256
|
tx.object(vault.reservingFeeModel),
|
|
262
|
-
...
|
|
257
|
+
...oracleArgsStandard(oracle),
|
|
258
|
+
oracle.clock,
|
|
263
259
|
vaultsValuation,
|
|
264
260
|
],
|
|
265
261
|
})
|
|
@@ -302,7 +298,8 @@ export function valuateSymbolsV2(params: IValuateSymbolsV2Params): TransactionOb
|
|
|
302
298
|
arguments: [
|
|
303
299
|
tx.object(market),
|
|
304
300
|
tx.object(symbol.fundingFeeModel),
|
|
305
|
-
...
|
|
301
|
+
...oracleArgsStandard(oracle),
|
|
302
|
+
oracle.clock,
|
|
306
303
|
symbolsValuation,
|
|
307
304
|
],
|
|
308
305
|
})
|