@suilend/sui-fe 0.3.9 → 0.3.11
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/coinMetadata.d.ts +1 -0
- package/lib/coinMetadata.js +10 -1
- package/lib/indexedDB.d.ts +1 -0
- package/lib/indexedDB.js +20 -1
- package/lib/keypair.d.ts +1 -1
- package/lib/keypair.js +1 -1
- package/package.json +1 -1
package/lib/coinMetadata.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export type Token = CoinMetadata & {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const getToken: (coinType: string, coinMetadata: CoinMetadata) => Token;
|
|
6
6
|
export declare const getCoinMetadataMap: (uniqueCoinTypes: string[]) => Promise<Record<string, Token>>;
|
|
7
|
+
export declare const removeCoinMetadataFromIndexedDB: (coinTypes: string[]) => Promise<void>;
|
package/lib/coinMetadata.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
var _a;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.getCoinMetadataMap = exports.getToken = void 0;
|
|
16
|
+
exports.removeCoinMetadataFromIndexedDB = exports.getCoinMetadataMap = exports.getToken = void 0;
|
|
17
17
|
const lodash_1 = require("lodash");
|
|
18
18
|
const p_limit_1 = __importDefault(require("p-limit"));
|
|
19
19
|
const coinType_1 = require("./coinType");
|
|
@@ -82,3 +82,12 @@ const getCoinMetadataMap = (uniqueCoinTypes) => __awaiter(void 0, void 0, void 0
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
exports.getCoinMetadataMap = getCoinMetadataMap;
|
|
85
|
+
const removeCoinMetadataFromIndexedDB = (coinTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
try {
|
|
87
|
+
yield (0, indexedDB_1.removeTokensFromIndexedDB)(coinTypes);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
// Silently fail if IndexedDB is not available
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
exports.removeCoinMetadataFromIndexedDB = removeCoinMetadataFromIndexedDB;
|
package/lib/indexedDB.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ import { Token } from "./coinMetadata";
|
|
|
2
2
|
export declare const initDB: () => Promise<IDBDatabase>;
|
|
3
3
|
export declare const getTokenMapByCoinTypeFromIndexedDB: (coinTypes: string[]) => Promise<Record<string, Token>>;
|
|
4
4
|
export declare const setTokenMapToIndexedDB: (tokenMap: Record<string, Token>) => Promise<void>;
|
|
5
|
+
export declare const removeTokensFromIndexedDB: (coinTypes: string[]) => Promise<void>;
|
package/lib/indexedDB.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.setTokenMapToIndexedDB = exports.getTokenMapByCoinTypeFromIndexedDB = exports.initDB = void 0;
|
|
12
|
+
exports.removeTokensFromIndexedDB = exports.setTokenMapToIndexedDB = exports.getTokenMapByCoinTypeFromIndexedDB = exports.initDB = void 0;
|
|
13
13
|
const DB_NAME = "suilend";
|
|
14
14
|
const DB_VERSION = 1;
|
|
15
15
|
const TOKEN_STORE = "token";
|
|
@@ -70,3 +70,22 @@ const setTokenMapToIndexedDB = (tokenMap) => __awaiter(void 0, void 0, void 0, f
|
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
exports.setTokenMapToIndexedDB = setTokenMapToIndexedDB;
|
|
73
|
+
const removeTokensFromIndexedDB = (coinTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
if (coinTypes.length === 0)
|
|
75
|
+
return;
|
|
76
|
+
const db = yield (0, exports.initDB)();
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const transaction = db.transaction(TOKEN_STORE, "readwrite");
|
|
79
|
+
const store = transaction.objectStore(TOKEN_STORE);
|
|
80
|
+
const promises = coinTypes.map((coinType) => new Promise((resolve, reject) => {
|
|
81
|
+
const request = store.delete(coinType);
|
|
82
|
+
request.onsuccess = () => resolve();
|
|
83
|
+
request.onerror = () => reject(request.error);
|
|
84
|
+
}));
|
|
85
|
+
Promise.all(promises)
|
|
86
|
+
.then(() => resolve())
|
|
87
|
+
.catch(reject)
|
|
88
|
+
.finally(() => db.close());
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
exports.removeTokensFromIndexedDB = removeTokensFromIndexedDB;
|
package/lib/keypair.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const fundKeypair: (tokens: (Token & {
|
|
|
31
31
|
amount: BigNumber;
|
|
32
32
|
})[], keypair: Ed25519Keypair, signExecuteAndWaitForTransaction: (transaction: Transaction, options?: {
|
|
33
33
|
auction?: boolean;
|
|
34
|
-
}, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>, // From WalletContext
|
|
34
|
+
}, onSetGasBudget?: (transaction: Transaction) => void, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>, // From WalletContext
|
|
35
35
|
onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<{
|
|
36
36
|
res: SuiTransactionBlockResponse;
|
|
37
37
|
}>;
|
package/lib/keypair.js
CHANGED
|
@@ -197,7 +197,7 @@ onSign, onExecute) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
197
197
|
useGasCoin: (0, coinType_1.isSui)(token.coinType),
|
|
198
198
|
})(fundKeypairTransaction));
|
|
199
199
|
fundKeypairTransaction.transferObjects(coinsWithBalance, keypair.toSuiAddress());
|
|
200
|
-
const res = yield signExecuteAndWaitForTransaction(fundKeypairTransaction, undefined, onSign, onExecute);
|
|
200
|
+
const res = yield signExecuteAndWaitForTransaction(fundKeypairTransaction, undefined, undefined, onSign, onExecute);
|
|
201
201
|
return { res };
|
|
202
202
|
});
|
|
203
203
|
exports.fundKeypair = fundKeypair;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sui-fe","version":"0.3.
|
|
1
|
+
{"name":"@suilend/sui-fe","version":"0.3.11","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"}}
|