@suilend/sui-fe 0.2.86 → 0.2.88

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.
@@ -1,5 +1,5 @@
1
1
  import BigNumber from "bignumber.js";
2
- export declare const API_URL = "https://global.suilend.fi";
2
+ export declare const API_URL = "https://d10td5ybgrf39v.cloudfront.net";
3
3
  export declare const TOAST_DURATION_MS: number;
4
4
  export declare const TX_TOAST_DURATION: number;
5
5
  export declare const SUI_GAS_MIN = 1;
package/lib/constants.js CHANGED
@@ -6,7 +6,7 @@ var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.EXPLORERS = exports.ExplorerId = exports.RPCS = exports.RpcId = exports.MS_PER_YEAR = exports.MAX_U64 = exports.SUI_GAS_MIN = exports.TX_TOAST_DURATION = exports.TOAST_DURATION_MS = exports.API_URL = void 0;
8
8
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
- exports.API_URL = "https://global.suilend.fi";
9
+ exports.API_URL = "https://d10td5ybgrf39v.cloudfront.net";
10
10
  exports.TOAST_DURATION_MS = 5 * 1000;
11
11
  exports.TX_TOAST_DURATION = 10 * 1000;
12
12
  exports.SUI_GAS_MIN = 1;
package/lib/keypair.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare const createKeypair: (account: WalletAccount, signPersonalMessage
11
11
  privateKey: string;
12
12
  }>;
13
13
  export declare const checkIfKeypairCanBeUsed: (currentFlowDigests: string[], keypair: Ed25519Keypair, suiClient: SuiClient) => Promise<void>;
14
+ export declare const keypairWaitForTransaction: (digest: string, suiClient: SuiClient) => Promise<SuiTransactionBlockResponse>;
14
15
  export declare const keypairSignExecuteAndWaitForTransaction: (transaction: Transaction, keypair: Ed25519Keypair, suiClient: SuiClient, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>;
15
16
  export type FundKeypairResult = {
16
17
  res: SuiTransactionBlockResponse;
package/lib/keypair.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.returnAllOwnedObjectsAndSuiToUser = exports.fundKeypair = exports.keypairSignExecuteAndWaitForTransaction = exports.checkIfKeypairCanBeUsed = exports.createKeypair = void 0;
15
+ exports.returnAllOwnedObjectsAndSuiToUser = exports.fundKeypair = exports.keypairSignExecuteAndWaitForTransaction = exports.keypairWaitForTransaction = exports.checkIfKeypairCanBeUsed = exports.createKeypair = void 0;
16
16
  const ed25519_1 = require("@mysten/sui/keypairs/ed25519");
17
17
  const transactions_1 = require("@mysten/sui/transactions");
18
18
  const utils_1 = require("@mysten/sui/utils");
@@ -74,8 +74,24 @@ const checkIfKeypairCanBeUsed = (currentFlowDigests, keypair, suiClient) => __aw
74
74
  }
75
75
  });
76
76
  exports.checkIfKeypairCanBeUsed = checkIfKeypairCanBeUsed;
77
- const keypairSignExecuteAndWaitForTransaction = (transaction, keypair, suiClient, onSign, onExecute) => __awaiter(void 0, void 0, void 0, function* () {
77
+ const keypairWaitForTransaction = (digest, suiClient) => __awaiter(void 0, void 0, void 0, function* () {
78
78
  var _a, _b;
79
+ const res = yield suiClient.waitForTransaction({
80
+ digest,
81
+ options: {
82
+ showBalanceChanges: true,
83
+ showEffects: true,
84
+ showEvents: true,
85
+ showObjectChanges: true,
86
+ },
87
+ });
88
+ if (((_a = res.effects) === null || _a === void 0 ? void 0 : _a.status) !== undefined &&
89
+ res.effects.status.status === "failure")
90
+ throw new Error((_b = res.effects.status.error) !== null && _b !== void 0 ? _b : "Transaction failed");
91
+ return res;
92
+ });
93
+ exports.keypairWaitForTransaction = keypairWaitForTransaction;
94
+ const keypairSignExecuteAndWaitForTransaction = (transaction, keypair, suiClient, onSign, onExecute) => __awaiter(void 0, void 0, void 0, function* () {
79
95
  // 1) Sign
80
96
  const builtTransaction = yield transaction.build({
81
97
  client: suiClient,
@@ -89,18 +105,7 @@ const keypairSignExecuteAndWaitForTransaction = (transaction, keypair, suiClient
89
105
  });
90
106
  onExecute === null || onExecute === void 0 ? void 0 : onExecute(res1);
91
107
  // 3) Wait
92
- const res2 = yield suiClient.waitForTransaction({
93
- digest: res1.digest,
94
- options: {
95
- showBalanceChanges: true,
96
- showEffects: true,
97
- showEvents: true,
98
- showObjectChanges: true,
99
- },
100
- });
101
- if (((_a = res2.effects) === null || _a === void 0 ? void 0 : _a.status) !== undefined &&
102
- res2.effects.status.status === "failure")
103
- throw new Error((_b = res2.effects.status.error) !== null && _b !== void 0 ? _b : "Transaction failed");
108
+ const res2 = yield (0, exports.keypairWaitForTransaction)(res1.digest, suiClient);
104
109
  return res2;
105
110
  });
106
111
  exports.keypairSignExecuteAndWaitForTransaction = keypairSignExecuteAndWaitForTransaction;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe","version":"0.2.86","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/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","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/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"}}
1
+ {"name":"@suilend/sui-fe","version":"0.2.88","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/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","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/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"}}