@suilend/sui-fe 0.3.8 → 0.3.9
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/lib/transactions.d.ts +4 -2
- package/lib/transactions.js +9 -1
- package/package.json +1 -1
package/lib/transactions.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { SuiClient, SuiObjectDataFilter, SuiObjectResponse, SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
1
|
+
import { CoinStruct, SuiClient, SuiObjectDataFilter, SuiObjectResponse, SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
2
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
3
|
import BigNumber from "bignumber.js";
|
|
3
4
|
import { Token } from "./coinMetadata";
|
|
4
5
|
export declare const getTotalGasFee: (res: SuiTransactionBlockResponse) => BigNumber;
|
|
5
6
|
export declare const getBalanceChange: (res: SuiTransactionBlockResponse, address: string, token: Token, multiplier?: -1 | 1) => BigNumber | undefined;
|
|
6
7
|
export declare const getAllOwnedObjects: (suiClient: SuiClient, address: string, filter?: SuiObjectDataFilter) => Promise<SuiObjectResponse[]>;
|
|
7
|
-
export declare const getAllCoins: (suiClient: SuiClient, address: string, coinType: string) => Promise<
|
|
8
|
+
export declare const getAllCoins: (suiClient: SuiClient, address: string, coinType: string) => Promise<CoinStruct[]>;
|
|
8
9
|
export declare const getMostRecentAddressTransaction: (suiClient: SuiClient, address: string, direction: "from" | "to") => Promise<SuiTransactionBlockResponse | undefined>;
|
|
10
|
+
export declare const mergeAllCoins: (coinType: string, transaction: Transaction, allCoins: CoinStruct[]) => CoinStruct;
|
package/lib/transactions.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getMostRecentAddressTransaction = exports.getAllCoins = exports.getAllOwnedObjects = exports.getBalanceChange = exports.getTotalGasFee = void 0;
|
|
15
|
+
exports.mergeAllCoins = exports.getMostRecentAddressTransaction = exports.getAllCoins = exports.getAllOwnedObjects = exports.getBalanceChange = exports.getTotalGasFee = void 0;
|
|
16
16
|
const utils_1 = require("@mysten/sui/utils");
|
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
18
18
|
const coinType_1 = require("./coinType");
|
|
@@ -87,3 +87,11 @@ const getMostRecentAddressTransaction = (suiClient, address, direction) => __awa
|
|
|
87
87
|
return transactions.data[0];
|
|
88
88
|
});
|
|
89
89
|
exports.getMostRecentAddressTransaction = getMostRecentAddressTransaction;
|
|
90
|
+
const mergeAllCoins = (coinType, transaction, allCoins) => {
|
|
91
|
+
const mergeCoin = allCoins[0];
|
|
92
|
+
if (allCoins.length > 1 && !(0, coinType_1.isSui)(coinType)) {
|
|
93
|
+
transaction.mergeCoins(transaction.object(mergeCoin.coinObjectId), allCoins.map((c) => transaction.object(c.coinObjectId)).slice(1));
|
|
94
|
+
}
|
|
95
|
+
return mergeCoin;
|
|
96
|
+
};
|
|
97
|
+
exports.mergeAllCoins = mergeAllCoins;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sui-fe","version":"0.3.
|
|
1
|
+
{"name":"@suilend/sui-fe","version":"0.3.9","private":false,"description":"A collection of TypeScript frontend libraries","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./lib/api":"./lib/api.js","./lib/coin":"./lib/coin.js","./lib/coinMetadata":"./lib/coinMetadata.js","./lib/coinType":"./lib/coinType.js","./lib/constants":"./lib/constants.js","./lib/format":"./lib/format.js","./lib":"./lib/index.js","./lib/indexedDB":"./lib/indexedDB.js","./lib/keypair":"./lib/keypair.js","./lib/ledger":"./lib/ledger.js","./lib/msafe":"./lib/msafe.js","./lib/track":"./lib/track.js","./lib/transactions":"./lib/transactions.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/sui-fe.git"},"bugs":{"url":"https://github.com/suilend/sui-fe/issues"},"dependencies":{"@mysten/wallet-standard":"0.14.7","@pythnetwork/pyth-sui-js":"^2.1.0","bignumber.js":"^9.1.2","blake2b":"^2.1.4","lodash":"^4.17.21","mixpanel-browser":"^2.56.0","next":"^15.0.3","p-limit":"3.1.0"},"devDependencies":{"@tsconfig/recommended":"^1.0.8","@types/blake2b":"^2.1.3","@types/lodash":"^4.17.13","@types/mixpanel-browser":"^2.50.2","@types/node":"^22.9.0","@typescript-eslint/eslint-plugin":"^8.14.0","@typescript-eslint/parser":"^8.14.0","eslint":"^9.14.0","eslint-config-next":"^15.0.3","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.1","prettier":"^3.3.3","ts-node":"^10.9.2","typescript":"^5.6.3"},"peerDependencies":{"@mysten/sui":"1.28.2","date-fns":"^4.1.0"}}
|