@suilend/sui-fe 0.2.90 → 0.2.92

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/keypair.d.ts CHANGED
@@ -10,7 +10,9 @@ export declare const createKeypair: (account: WalletAccount, signPersonalMessage
10
10
  address: string;
11
11
  privateKey: string;
12
12
  }>;
13
- export declare const checkIfKeypairCanBeUsed: (lastSignatureWithBytes: SignatureWithBytes | undefined, currentFlowDigests: string[], keypair: Ed25519Keypair, suiClient: SuiClient) => Promise<void>;
13
+ export declare const checkIfKeypairCanBeUsed: (lastSignedTransaction: SignatureWithBytes | undefined, currentFlowDigests: string[], keypair: Ed25519Keypair, suiClient: SuiClient) => Promise<{
14
+ lastSignedTransactionIsMostRecentTransaction: boolean | undefined;
15
+ }>;
14
16
  export declare const keypairWaitForTransaction: (digest: string, suiClient: SuiClient) => Promise<SuiTransactionBlockResponse>;
15
17
  export declare const keypairSignExecuteAndWaitForTransaction: (transaction: Transaction, keypair: Ed25519Keypair, suiClient: SuiClient, onSign?: (signedTransaction: SignatureWithBytes) => void, onExecute?: (res: SuiTransactionBlockResponse) => void) => Promise<SuiTransactionBlockResponse>;
16
18
  export type FundKeypairResult = {
package/lib/keypair.js CHANGED
@@ -35,28 +35,33 @@ const createKeypair = (account, signPersonalMessage) => __awaiter(void 0, void 0
35
35
  return { keypair, address, privateKey };
36
36
  });
37
37
  exports.createKeypair = createKeypair;
38
- const checkIfKeypairCanBeUsed = (lastSignatureWithBytes, currentFlowDigests, keypair, suiClient) => __awaiter(void 0, void 0, void 0, function* () {
38
+ const checkIfKeypairCanBeUsed = (lastSignedTransaction, currentFlowDigests, keypair, suiClient) => __awaiter(void 0, void 0, void 0, function* () {
39
39
  var _a, _b;
40
40
  const ownedObjectIds = (yield (0, transactions_2.getAllOwnedObjects)(suiClient, keypair.toSuiAddress())).map((obj) => { var _a; return (_a = obj.data) === null || _a === void 0 ? void 0 : _a.objectId; });
41
41
  console.log("[checkIfKeypairCanBeUsed] ownedObjectIds:", ownedObjectIds);
42
42
  if (ownedObjectIds.length === 0) {
43
43
  // Empty wallet
44
44
  // CONTINUE
45
+ return { lastSignedTransactionIsMostRecentTransaction: undefined };
45
46
  }
46
47
  else {
47
48
  const mostRecentFromAddressTransaction = yield (0, transactions_2.getMostRecentFromAddressTransaction)(suiClient, keypair.toSuiAddress());
48
- console.log("[checkIfKeypairCanBeUsed] mostRecentFromAddressTransaction:", mostRecentFromAddressTransaction, "lastSignatureWithBytes:", lastSignatureWithBytes, "currentFlowDigests:", currentFlowDigests);
49
+ console.log("[checkIfKeypairCanBeUsed] mostRecentFromAddressTransaction:", mostRecentFromAddressTransaction, "lastSignedTransaction:", lastSignedTransaction, "currentFlowDigests:", currentFlowDigests);
49
50
  if (mostRecentFromAddressTransaction === undefined) {
50
51
  // Non-empty wallet with no FROM transactions
51
52
  // CONTINUE
53
+ return { lastSignedTransactionIsMostRecentTransaction: undefined };
52
54
  }
53
55
  else {
56
+ const lastSignedTransactionIsMostRecentTransaction = lastSignedTransaction === undefined
57
+ ? undefined
58
+ : ((_b = (_a = mostRecentFromAddressTransaction.transaction) === null || _a === void 0 ? void 0 : _a.txSignatures) !== null && _b !== void 0 ? _b : []).includes(lastSignedTransaction.signature);
54
59
  // Non-empty wallet with FROM transactions
55
- if ((lastSignatureWithBytes !== undefined &&
56
- ((_b = (_a = mostRecentFromAddressTransaction.transaction) === null || _a === void 0 ? void 0 : _a.txSignatures) !== null && _b !== void 0 ? _b : []).includes(lastSignatureWithBytes.signature)) ||
60
+ if (!!lastSignedTransactionIsMostRecentTransaction ||
57
61
  currentFlowDigests.includes(mostRecentFromAddressTransaction.digest)) {
58
62
  // Retrying current flow
59
63
  // CONTINUE
64
+ return { lastSignedTransactionIsMostRecentTransaction };
60
65
  }
61
66
  else {
62
67
  // Previous flow
@@ -71,6 +76,7 @@ const checkIfKeypairCanBeUsed = (lastSignatureWithBytes, currentFlowDigests, key
71
76
  else {
72
77
  // Previous flow stopped before completion
73
78
  // CONTINUE
79
+ return { lastSignedTransactionIsMostRecentTransaction: undefined };
74
80
  }
75
81
  }
76
82
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe","version":"0.2.90","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.92","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"}}