@suilend/sui-fe 0.3.46 → 0.3.48

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/api.js CHANGED
@@ -10,9 +10,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getHistoryPrice = exports.getPrice = void 0;
13
- const date_fns_1 = require("date-fns");
14
13
  const coinType_1 = require("./coinType");
15
14
  const constants_1 = require("./constants");
15
+ // Date helper functions
16
+ const getHours = (date) => date.getHours();
17
+ const getMinutes = (date) => date.getMinutes();
18
+ const getSeconds = (date) => date.getSeconds();
19
+ const setHours = (date, hours) => {
20
+ const result = new Date(date);
21
+ result.setHours(hours);
22
+ return result;
23
+ };
24
+ const setMinutes = (date, minutes) => {
25
+ const result = new Date(date);
26
+ result.setMinutes(minutes);
27
+ return result;
28
+ };
29
+ const setSeconds = (date, seconds) => {
30
+ const result = new Date(date);
31
+ result.setSeconds(seconds);
32
+ return result;
33
+ };
16
34
  const getPrice = (coinType) => __awaiter(void 0, void 0, void 0, function* () {
17
35
  try {
18
36
  const url = `${constants_1.API_URL}/proxy/price?${new URLSearchParams({
@@ -32,13 +50,13 @@ const getPrice = (coinType) => __awaiter(void 0, void 0, void 0, function* () {
32
50
  exports.getPrice = getPrice;
33
51
  const getHistoryPrice = (coinType, interval, timeFromS, timeToS) => __awaiter(void 0, void 0, void 0, function* () {
34
52
  let timeFrom = new Date(timeFromS * 1000);
35
- timeFrom = (0, date_fns_1.setHours)(timeFrom, (0, date_fns_1.getHours)(timeFrom) - ((0, date_fns_1.getHours)(timeFrom) % 3));
36
- timeFrom = (0, date_fns_1.setMinutes)(timeFrom, 0);
37
- timeFrom = (0, date_fns_1.setSeconds)(timeFrom, 0);
53
+ timeFrom = setHours(timeFrom, getHours(timeFrom) - (getHours(timeFrom) % 3));
54
+ timeFrom = setMinutes(timeFrom, 0);
55
+ timeFrom = setSeconds(timeFrom, 0);
38
56
  let timeTo = new Date(timeToS * 1000);
39
- timeTo = (0, date_fns_1.setHours)(timeTo, (0, date_fns_1.getHours)(timeTo) - ((0, date_fns_1.getHours)(timeTo) % 3));
40
- timeTo = (0, date_fns_1.setMinutes)(timeTo, 0);
41
- timeTo = (0, date_fns_1.setSeconds)(timeTo, 0);
57
+ timeTo = setHours(timeTo, getHours(timeTo) - (getHours(timeTo) % 3));
58
+ timeTo = setMinutes(timeTo, 0);
59
+ timeTo = setSeconds(timeTo, 0);
42
60
  const processedTimeFromS = Math.floor(timeFrom.getTime() / 1000);
43
61
  const processedTimeToS = Math.floor(timeTo.getTime() / 1000);
44
62
  try {
package/lib/index.d.ts CHANGED
@@ -8,5 +8,4 @@ export * from "./indexedDB";
8
8
  export * from "./keypair";
9
9
  export * from "./ledger";
10
10
  export * from "./msafe";
11
- export * from "./track";
12
11
  export * from "./transactions";
package/lib/index.js CHANGED
@@ -24,5 +24,4 @@ __exportStar(require("./indexedDB"), exports);
24
24
  __exportStar(require("./keypair"), exports);
25
25
  __exportStar(require("./ledger"), exports);
26
26
  __exportStar(require("./msafe"), exports);
27
- __exportStar(require("./track"), exports);
28
27
  __exportStar(require("./transactions"), exports);
package/lib/keypair.d.ts CHANGED
@@ -15,6 +15,7 @@ export type LastSignedTransaction<T> = {
15
15
  };
16
16
  export declare const checkLastTransactionSignature: <T>(type: T, lastCurrentFlowTransaction: SuiTransactionBlockResponse | undefined, lastSignedTransaction: LastSignedTransaction<T> | undefined, setLastSignedTransaction: (value: LastSignedTransaction<T> | undefined) => void, suiClient: SuiClient, validCallback: (res: SuiTransactionBlockResponse) => Promise<void>, invalidCallback: () => Promise<void>) => Promise<void>;
17
17
  export declare const onSign: <T>(type: T, setLastSignedTransaction: (value: LastSignedTransaction<T> | undefined) => void, index?: number) => (signedTransaction: SignatureWithBytes) => void;
18
+ export declare const KEYPAIR_SEED_MESSAGE = "send:wallet-connect";
18
19
  export declare const createKeypair: (signPersonalMessage: (message: Uint8Array) => Promise<{
19
20
  signature: string;
20
21
  }>) => Promise<{
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.checkIfKeypairCanBeUsed = exports.createKeypair = exports.onSign = exports.checkLastTransactionSignature = exports.keypairSignExecuteAndWaitForTransaction = exports.keypairWaitForTransaction = exports.TransactionStatusError = void 0;
15
+ exports.returnAllOwnedObjectsAndSuiToUser = exports.fundKeypair = exports.checkIfKeypairCanBeUsed = exports.createKeypair = exports.KEYPAIR_SEED_MESSAGE = exports.onSign = exports.checkLastTransactionSignature = exports.keypairSignExecuteAndWaitForTransaction = exports.keypairWaitForTransaction = exports.TransactionStatusError = 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");
@@ -107,9 +107,9 @@ const onSign = (type, setLastSignedTransaction, index) => {
107
107
  };
108
108
  exports.onSign = onSign;
109
109
  // CREATE KEYPAIR
110
- const KEYPAIR_SEED_MESSAGE = "send:wallet-connect";
110
+ exports.KEYPAIR_SEED_MESSAGE = "send:wallet-connect";
111
111
  const createKeypair = (signPersonalMessage) => __awaiter(void 0, void 0, void 0, function* () {
112
- const message = Buffer.from(KEYPAIR_SEED_MESSAGE);
112
+ const message = Buffer.from(exports.KEYPAIR_SEED_MESSAGE);
113
113
  const { signature } = yield signPersonalMessage(message);
114
114
  const signatureBytes = (0, utils_1.fromBase64)(signature);
115
115
  const signatureHex = (0, utils_1.toHex)(signatureBytes);
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe","version":"0.3.46","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.19.2","bignumber.js":"^9.1.2","blake2b":"^2.1.4","lodash":"^4.17.21","mixpanel-browser":"^2.71.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/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.42.0","date-fns":"^4.1.0"}}
1
+ {"name":"@suilend/sui-fe","version":"0.3.48","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/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.19.2","bignumber.js":"^9.1.2","blake2b":"^2.1.4","lodash":"^4.17.21","p-limit":"3.1.0"},"devDependencies":{"@tsconfig/recommended":"^1.0.8","@types/blake2b":"^2.1.3","@types/lodash":"^4.17.13","@types/node":"^22.9.0","@typescript-eslint/eslint-plugin":"^8.14.0","@typescript-eslint/parser":"^8.14.0","eslint":"^9.14.0","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.42.0"}}
package/lib/track.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const track: (eventName: string, properties?: Record<string, string | number>) => void;
2
- export default track;
package/lib/track.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const mixpanel_browser_1 = __importDefault(require("mixpanel-browser"));
7
- const track = (eventName, properties) => {
8
- const projectToken = process.env.NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN;
9
- if (!projectToken)
10
- return;
11
- try {
12
- setTimeout(() => {
13
- mixpanel_browser_1.default.track(eventName, properties);
14
- }, 250);
15
- }
16
- catch (err) {
17
- console.error(err);
18
- }
19
- };
20
- exports.default = track;