@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.js
CHANGED
|
@@ -2741,7 +2741,7 @@ var queryObligation = async ({
|
|
|
2741
2741
|
{ queryTarget, args }
|
|
2742
2742
|
// txBlock
|
|
2743
2743
|
);
|
|
2744
|
-
return queryResult?.events[0]
|
|
2744
|
+
return queryResult?.events[0]?.parsedJson;
|
|
2745
2745
|
};
|
|
2746
2746
|
var getCoinAmounts = async (query, assetCoinNames, ownerAddress) => {
|
|
2747
2747
|
assetCoinNames = assetCoinNames || [...SUPPORT_POOLS];
|
|
@@ -2824,7 +2824,7 @@ var getFlashLoanFees = async (query, assetNames) => {
|
|
|
2824
2824
|
const flashloanFeesTableId = vault.fields.flash_loan_fees.fields.table.fields.id.id;
|
|
2825
2825
|
const balanceSheetDynamicFields = await query.cache.queryGetDynamicFields({
|
|
2826
2826
|
parentId: flashloanFeesTableId,
|
|
2827
|
-
limit:
|
|
2827
|
+
limit: 10
|
|
2828
2828
|
});
|
|
2829
2829
|
const dynamicFieldObjectIds = balanceSheetDynamicFields?.data.filter((field) => {
|
|
2830
2830
|
const assetType = field.name.value.name;
|
|
@@ -3337,7 +3337,7 @@ var queryBorrowIncentiveAccounts = async ({
|
|
|
3337
3337
|
const queryTarget = `${queryPkgId}::incentive_account_query::incentive_account_data`;
|
|
3338
3338
|
const args = [incentiveAccountsId, obligationId];
|
|
3339
3339
|
const queryResult = await utils.cache.queryInspectTxn({ queryTarget, args });
|
|
3340
|
-
const borrowIncentiveAccountsQueryData = queryResult?.events[0]
|
|
3340
|
+
const borrowIncentiveAccountsQueryData = queryResult?.events[0]?.parsedJson;
|
|
3341
3341
|
const borrowIncentiveAccounts = Object.values(
|
|
3342
3342
|
borrowIncentiveAccountsQueryData?.pool_records ?? []
|
|
3343
3343
|
).reduce((accounts, accountData) => {
|
|
@@ -7094,10 +7094,15 @@ var ScallopBuilder = class {
|
|
|
7094
7094
|
* @return Take coin and left coin.
|
|
7095
7095
|
*/
|
|
7096
7096
|
async selectCoin(txBlock, assetCoinName, amount, sender = this.walletAddress) {
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7097
|
+
if (assetCoinName === "sui") {
|
|
7098
|
+
const [takeCoin] = txBlock.splitSUIFromGas([amount]);
|
|
7099
|
+
return { takeCoin };
|
|
7100
|
+
} else {
|
|
7101
|
+
const coinType = this.utils.parseCoinType(assetCoinName);
|
|
7102
|
+
const coins = await this.utils.selectCoins(amount, coinType, sender);
|
|
7103
|
+
const [takeCoin, leftCoin] = txBlock.takeAmountFromCoins(coins, amount);
|
|
7104
|
+
return { takeCoin, leftCoin };
|
|
7105
|
+
}
|
|
7101
7106
|
}
|
|
7102
7107
|
/**
|
|
7103
7108
|
* Specifying the sender's amount of market coins to get coins args from transaction result.
|