@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
package/dist/index.mjs
CHANGED
|
@@ -4734,12 +4734,13 @@ import {
|
|
|
4734
4734
|
SuiPythClient,
|
|
4735
4735
|
SuiPriceServiceConnection as SuiPriceServiceConnection2
|
|
4736
4736
|
} from "@pythnetwork/pyth-sui-js";
|
|
4737
|
-
var updateOracles = async (builder, txBlock, assetCoinNames) => {
|
|
4737
|
+
var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePythPullModel: true }) => {
|
|
4738
|
+
const usePythPullModel = builder.params.usePythPullModel ?? options.usePythPullModel;
|
|
4738
4739
|
assetCoinNames = assetCoinNames ?? [
|
|
4739
4740
|
.../* @__PURE__ */ new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS])
|
|
4740
4741
|
];
|
|
4741
4742
|
const rules = builder.isTestnet ? ["pyth"] : ["pyth"];
|
|
4742
|
-
if (rules.includes("pyth")) {
|
|
4743
|
+
if (usePythPullModel && rules.includes("pyth")) {
|
|
4743
4744
|
const pythClient = new SuiPythClient(
|
|
4744
4745
|
builder.suiKit.client(),
|
|
4745
4746
|
builder.address.get("core.oracles.pyth.state"),
|
|
@@ -5646,19 +5647,14 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
5646
5647
|
);
|
|
5647
5648
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
5648
5649
|
const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
|
|
5649
|
-
if (veScaKey && veScaKey !== bindedVeScaKey) {
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
);
|
|
5653
|
-
}
|
|
5654
|
-
if (bindedVeScaKey) {
|
|
5650
|
+
if (veScaKey && veScaKey !== bindedVeScaKey || !bindedVeScaKey) {
|
|
5651
|
+
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
5652
|
+
} else {
|
|
5655
5653
|
txBlock.stakeObligationWithVesca(
|
|
5656
5654
|
obligationArg,
|
|
5657
5655
|
obligationKeyArg,
|
|
5658
5656
|
bindedVeScaKey
|
|
5659
5657
|
);
|
|
5660
|
-
} else {
|
|
5661
|
-
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
5662
5658
|
}
|
|
5663
5659
|
}
|
|
5664
5660
|
},
|
|
@@ -7935,11 +7931,15 @@ var Scallop = class {
|
|
|
7935
7931
|
*
|
|
7936
7932
|
* @return Scallop Builder.
|
|
7937
7933
|
*/
|
|
7938
|
-
async createScallopBuilder() {
|
|
7934
|
+
async createScallopBuilder(params) {
|
|
7939
7935
|
if (!this.address.getAddresses())
|
|
7940
7936
|
await this.address.read();
|
|
7941
|
-
const
|
|
7942
|
-
|
|
7937
|
+
const builderParams = {
|
|
7938
|
+
...this.params,
|
|
7939
|
+
...params
|
|
7940
|
+
};
|
|
7941
|
+
const scallopBuilder = new ScallopBuilder(builderParams, {
|
|
7942
|
+
query: await this.createScallopQuery(builderParams)
|
|
7943
7943
|
});
|
|
7944
7944
|
return scallopBuilder;
|
|
7945
7945
|
}
|
|
@@ -7949,13 +7949,16 @@ var Scallop = class {
|
|
|
7949
7949
|
* @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.
|
|
7950
7950
|
* @return Scallop Client.
|
|
7951
7951
|
*/
|
|
7952
|
-
async createScallopClient(
|
|
7952
|
+
async createScallopClient(params) {
|
|
7953
7953
|
if (!this.address.getAddresses())
|
|
7954
7954
|
await this.address.read();
|
|
7955
|
-
const
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7955
|
+
const clientParams = {
|
|
7956
|
+
...this.params,
|
|
7957
|
+
...params
|
|
7958
|
+
};
|
|
7959
|
+
const scallopClient = new ScallopClient(clientParams, {
|
|
7960
|
+
builder: await this.createScallopBuilder(clientParams)
|
|
7961
|
+
});
|
|
7959
7962
|
return scallopClient;
|
|
7960
7963
|
}
|
|
7961
7964
|
/**
|
|
@@ -7963,11 +7966,15 @@ var Scallop = class {
|
|
|
7963
7966
|
*
|
|
7964
7967
|
* @return Scallop Query.
|
|
7965
7968
|
*/
|
|
7966
|
-
async createScallopQuery() {
|
|
7969
|
+
async createScallopQuery(params) {
|
|
7967
7970
|
if (!this.address.getAddresses())
|
|
7968
7971
|
await this.address.read();
|
|
7969
|
-
const
|
|
7970
|
-
|
|
7972
|
+
const queryParams = {
|
|
7973
|
+
...this.params,
|
|
7974
|
+
...params
|
|
7975
|
+
};
|
|
7976
|
+
const scallopQuery = new ScallopQuery(queryParams, {
|
|
7977
|
+
utils: await this.createScallopUtils(queryParams)
|
|
7971
7978
|
});
|
|
7972
7979
|
return scallopQuery;
|
|
7973
7980
|
}
|
|
@@ -7987,12 +7994,18 @@ var Scallop = class {
|
|
|
7987
7994
|
*
|
|
7988
7995
|
* @return Scallop Utils.
|
|
7989
7996
|
*/
|
|
7990
|
-
async createScallopUtils() {
|
|
7997
|
+
async createScallopUtils(params) {
|
|
7991
7998
|
if (!this.address.getAddresses())
|
|
7992
7999
|
await this.address.read();
|
|
7993
|
-
const scallopUtils = new ScallopUtils(
|
|
7994
|
-
|
|
7995
|
-
|
|
8000
|
+
const scallopUtils = new ScallopUtils(
|
|
8001
|
+
{
|
|
8002
|
+
...this.params,
|
|
8003
|
+
...params
|
|
8004
|
+
},
|
|
8005
|
+
{
|
|
8006
|
+
address: this.address
|
|
8007
|
+
}
|
|
8008
|
+
);
|
|
7996
8009
|
return scallopUtils;
|
|
7997
8010
|
}
|
|
7998
8011
|
};
|