@scallop-io/sui-scallop-sdk 0.47.2 → 0.47.3
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/builders/oracle.d.ts +4 -1
- package/dist/index.js +38 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -25
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallop.d.ts +5 -5
- package/dist/types/model.d.ts +4 -3
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +3 -8
- package/src/builders/oracle.ts +8 -2
- package/src/models/scallop.ts +39 -16
- package/src/types/model.ts +7 -3
|
@@ -7,5 +7,8 @@ import type { SupportAssetCoins } from '../types';
|
|
|
7
7
|
* @param builder - The scallop builder.
|
|
8
8
|
* @param txBlock - TxBlock created by SuiKit.
|
|
9
9
|
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
10
|
+
* @param options - The options for update oracles.
|
|
10
11
|
*/
|
|
11
|
-
export declare const updateOracles: (builder: ScallopBuilder, txBlock: SuiKitTxBlock, assetCoinNames?: SupportAssetCoins[]
|
|
12
|
+
export declare const updateOracles: (builder: ScallopBuilder, txBlock: SuiKitTxBlock, assetCoinNames?: SupportAssetCoins[], options?: {
|
|
13
|
+
usePythPullModel: boolean;
|
|
14
|
+
}) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -4805,12 +4805,13 @@ var import_sui_kit5 = require("@scallop-io/sui-kit");
|
|
|
4805
4805
|
// src/builders/oracle.ts
|
|
4806
4806
|
var import_utils12 = require("@mysten/sui.js/utils");
|
|
4807
4807
|
var import_pyth_sui_js2 = require("@pythnetwork/pyth-sui-js");
|
|
4808
|
-
var updateOracles = async (builder, txBlock, assetCoinNames) => {
|
|
4808
|
+
var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePythPullModel: true }) => {
|
|
4809
|
+
const usePythPullModel = builder.params.usePythPullModel ?? options.usePythPullModel;
|
|
4809
4810
|
assetCoinNames = assetCoinNames ?? [
|
|
4810
4811
|
.../* @__PURE__ */ new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS])
|
|
4811
4812
|
];
|
|
4812
4813
|
const rules = builder.isTestnet ? ["pyth"] : ["pyth"];
|
|
4813
|
-
if (rules.includes("pyth")) {
|
|
4814
|
+
if (usePythPullModel && rules.includes("pyth")) {
|
|
4814
4815
|
const pythClient = new import_pyth_sui_js2.SuiPythClient(
|
|
4815
4816
|
builder.suiKit.client(),
|
|
4816
4817
|
builder.address.get("core.oracles.pyth.state"),
|
|
@@ -5717,19 +5718,14 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
5717
5718
|
);
|
|
5718
5719
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
5719
5720
|
const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
|
|
5720
|
-
if (veScaKey && veScaKey !== bindedVeScaKey) {
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
);
|
|
5724
|
-
}
|
|
5725
|
-
if (bindedVeScaKey) {
|
|
5721
|
+
if (veScaKey && veScaKey !== bindedVeScaKey || !bindedVeScaKey) {
|
|
5722
|
+
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
5723
|
+
} else {
|
|
5726
5724
|
txBlock.stakeObligationWithVesca(
|
|
5727
5725
|
obligationArg,
|
|
5728
5726
|
obligationKeyArg,
|
|
5729
5727
|
bindedVeScaKey
|
|
5730
5728
|
);
|
|
5731
|
-
} else {
|
|
5732
|
-
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
5733
5729
|
}
|
|
5734
5730
|
}
|
|
5735
5731
|
},
|
|
@@ -7995,11 +7991,15 @@ var Scallop = class {
|
|
|
7995
7991
|
*
|
|
7996
7992
|
* @return Scallop Builder.
|
|
7997
7993
|
*/
|
|
7998
|
-
async createScallopBuilder() {
|
|
7994
|
+
async createScallopBuilder(params) {
|
|
7999
7995
|
if (!this.address.getAddresses())
|
|
8000
7996
|
await this.address.read();
|
|
8001
|
-
const
|
|
8002
|
-
|
|
7997
|
+
const builderParams = {
|
|
7998
|
+
...this.params,
|
|
7999
|
+
...params
|
|
8000
|
+
};
|
|
8001
|
+
const scallopBuilder = new ScallopBuilder(builderParams, {
|
|
8002
|
+
query: await this.createScallopQuery(builderParams)
|
|
8003
8003
|
});
|
|
8004
8004
|
return scallopBuilder;
|
|
8005
8005
|
}
|
|
@@ -8009,13 +8009,16 @@ var Scallop = class {
|
|
|
8009
8009
|
* @param walletAddress - When user cannot provide a secret key or mnemonic, the scallop client cannot directly derive the address of the transaction the user wants to sign. This argument specifies the wallet address for signing the transaction.
|
|
8010
8010
|
* @return Scallop Client.
|
|
8011
8011
|
*/
|
|
8012
|
-
async createScallopClient(
|
|
8012
|
+
async createScallopClient(params) {
|
|
8013
8013
|
if (!this.address.getAddresses())
|
|
8014
8014
|
await this.address.read();
|
|
8015
|
-
const
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8015
|
+
const clientParams = {
|
|
8016
|
+
...this.params,
|
|
8017
|
+
...params
|
|
8018
|
+
};
|
|
8019
|
+
const scallopClient = new ScallopClient(clientParams, {
|
|
8020
|
+
builder: await this.createScallopBuilder(clientParams)
|
|
8021
|
+
});
|
|
8019
8022
|
return scallopClient;
|
|
8020
8023
|
}
|
|
8021
8024
|
/**
|
|
@@ -8023,11 +8026,15 @@ var Scallop = class {
|
|
|
8023
8026
|
*
|
|
8024
8027
|
* @return Scallop Query.
|
|
8025
8028
|
*/
|
|
8026
|
-
async createScallopQuery() {
|
|
8029
|
+
async createScallopQuery(params) {
|
|
8027
8030
|
if (!this.address.getAddresses())
|
|
8028
8031
|
await this.address.read();
|
|
8029
|
-
const
|
|
8030
|
-
|
|
8032
|
+
const queryParams = {
|
|
8033
|
+
...this.params,
|
|
8034
|
+
...params
|
|
8035
|
+
};
|
|
8036
|
+
const scallopQuery = new ScallopQuery(queryParams, {
|
|
8037
|
+
utils: await this.createScallopUtils(queryParams)
|
|
8031
8038
|
});
|
|
8032
8039
|
return scallopQuery;
|
|
8033
8040
|
}
|
|
@@ -8047,12 +8054,18 @@ var Scallop = class {
|
|
|
8047
8054
|
*
|
|
8048
8055
|
* @return Scallop Utils.
|
|
8049
8056
|
*/
|
|
8050
|
-
async createScallopUtils() {
|
|
8057
|
+
async createScallopUtils(params) {
|
|
8051
8058
|
if (!this.address.getAddresses())
|
|
8052
8059
|
await this.address.read();
|
|
8053
|
-
const scallopUtils = new ScallopUtils(
|
|
8054
|
-
|
|
8055
|
-
|
|
8060
|
+
const scallopUtils = new ScallopUtils(
|
|
8061
|
+
{
|
|
8062
|
+
...this.params,
|
|
8063
|
+
...params
|
|
8064
|
+
},
|
|
8065
|
+
{
|
|
8066
|
+
address: this.address
|
|
8067
|
+
}
|
|
8068
|
+
);
|
|
8056
8069
|
return scallopUtils;
|
|
8057
8070
|
}
|
|
8058
8071
|
};
|