@scallop-io/sui-scallop-sdk 0.46.56 → 0.46.57
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/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -7
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopBuilder.d.ts +2 -5
- package/dist/types/builder/index.d.ts +8 -1
- package/dist/utils/query.d.ts +1 -1
- package/package.json +1 -1
- package/src/models/scallopBuilder.ts +13 -7
- package/src/queries/borrowIncentiveQuery.ts +1 -1
- package/src/queries/coreQuery.ts +2 -2
- package/src/types/builder/index.ts +11 -1
- package/src/utils/query.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2667,7 +2667,7 @@ var queryObligation = async ({
|
|
|
2667
2667
|
{ queryTarget, args }
|
|
2668
2668
|
// txBlock
|
|
2669
2669
|
);
|
|
2670
|
-
return queryResult?.events[0]
|
|
2670
|
+
return queryResult?.events[0]?.parsedJson;
|
|
2671
2671
|
};
|
|
2672
2672
|
var getCoinAmounts = async (query, assetCoinNames, ownerAddress) => {
|
|
2673
2673
|
assetCoinNames = assetCoinNames || [...SUPPORT_POOLS];
|
|
@@ -2750,7 +2750,7 @@ var getFlashLoanFees = async (query, assetNames) => {
|
|
|
2750
2750
|
const flashloanFeesTableId = vault.fields.flash_loan_fees.fields.table.fields.id.id;
|
|
2751
2751
|
const balanceSheetDynamicFields = await query.cache.queryGetDynamicFields({
|
|
2752
2752
|
parentId: flashloanFeesTableId,
|
|
2753
|
-
limit:
|
|
2753
|
+
limit: 10
|
|
2754
2754
|
});
|
|
2755
2755
|
const dynamicFieldObjectIds = balanceSheetDynamicFields?.data.filter((field) => {
|
|
2756
2756
|
const assetType = field.name.value.name;
|
|
@@ -3263,7 +3263,7 @@ var queryBorrowIncentiveAccounts = async ({
|
|
|
3263
3263
|
const queryTarget = `${queryPkgId}::incentive_account_query::incentive_account_data`;
|
|
3264
3264
|
const args = [incentiveAccountsId, obligationId];
|
|
3265
3265
|
const queryResult = await utils.cache.queryInspectTxn({ queryTarget, args });
|
|
3266
|
-
const borrowIncentiveAccountsQueryData = queryResult?.events[0]
|
|
3266
|
+
const borrowIncentiveAccountsQueryData = queryResult?.events[0]?.parsedJson;
|
|
3267
3267
|
const borrowIncentiveAccounts = Object.values(
|
|
3268
3268
|
borrowIncentiveAccountsQueryData?.pool_records ?? []
|
|
3269
3269
|
).reduce((accounts, accountData) => {
|
|
@@ -7034,10 +7034,15 @@ var ScallopBuilder = class {
|
|
|
7034
7034
|
* @return Take coin and left coin.
|
|
7035
7035
|
*/
|
|
7036
7036
|
async selectCoin(txBlock, assetCoinName, amount, sender = this.walletAddress) {
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7037
|
+
if (assetCoinName === "sui") {
|
|
7038
|
+
const [takeCoin] = txBlock.splitSUIFromGas([amount]);
|
|
7039
|
+
return { takeCoin };
|
|
7040
|
+
} else {
|
|
7041
|
+
const coinType = this.utils.parseCoinType(assetCoinName);
|
|
7042
|
+
const coins = await this.utils.selectCoins(amount, coinType, sender);
|
|
7043
|
+
const [takeCoin, leftCoin] = txBlock.takeAmountFromCoins(coins, amount);
|
|
7044
|
+
return { takeCoin, leftCoin };
|
|
7045
|
+
}
|
|
7041
7046
|
}
|
|
7042
7047
|
/**
|
|
7043
7048
|
* Specifying the sender's amount of market coins to get coins args from transaction result.
|