@ton/appkit
Advanced tools
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { StakingProviderMetadata, Network } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProviderMetadataOptions = { | ||
| network?: Network; | ||
| providerId?: string; | ||
| }; | ||
| export type GetStakingProviderMetadataReturnType = StakingProviderMetadata; | ||
| /** | ||
| * Get staking provider static metadata | ||
| */ | ||
| export declare const getStakingProviderMetadata: (appKit: AppKit, options?: GetStakingProviderMetadataOptions) => GetStakingProviderMetadataReturnType; | ||
| //# sourceMappingURL=get-staking-provider-metadata.d.ts.map |
| {"version":3,"file":"get-staking-provider-metadata.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-provider-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,iCAAiC,GAAG;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,uBAAuB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACnC,QAAQ,MAAM,EACd,UAAS,iCAAsC,KAChD,oCAKF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getStakingProviderMetadata = void 0; | ||
| const utils_1 = require("../../utils"); | ||
| /** | ||
| * Get staking provider static metadata | ||
| */ | ||
| const getStakingProviderMetadata = (appKit, options = {}) => { | ||
| return appKit.stakingManager.getStakingProviderMetadata((0, utils_1.resolveNetwork)(appKit, options.network), options.providerId); | ||
| }; | ||
| exports.getStakingProviderMetadata = getStakingProviderMetadata; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { StakingProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProviderOptions = { | ||
| /** | ||
| * Provider ID to get. If not provided, returns default provider. | ||
| */ | ||
| id?: string; | ||
| }; | ||
| export type GetStakingProviderReturnType = StakingProviderInterface; | ||
| /** | ||
| * Get staking provider instance | ||
| */ | ||
| export declare const getStakingProvider: (appKit: AppKit, options?: GetStakingProviderOptions) => GetStakingProviderReturnType; | ||
| //# sourceMappingURL=get-staking-provider.d.ts.map |
| {"version":3,"file":"get-staking-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,yBAAyB,GAAG;IACpC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC3B,QAAQ,MAAM,EACd,UAAS,yBAA8B,KACxC,4BAEF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getStakingProvider = void 0; | ||
| /** | ||
| * Get staking provider instance | ||
| */ | ||
| const getStakingProvider = (appKit, options = {}) => { | ||
| return appKit.stakingManager.getProvider(options.id); | ||
| }; | ||
| exports.getStakingProvider = getStakingProvider; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface SetDefaultStakingProviderParameters { | ||
| providerId: string; | ||
| } | ||
| export type SetDefaultStakingProviderReturnType = void; | ||
| /** | ||
| * Set the default staking provider. | ||
| * Subsequent quote and stake-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export declare const setDefaultStakingProvider: (appKit: AppKit, parameters: SetDefaultStakingProviderParameters) => SetDefaultStakingProviderReturnType; | ||
| //# sourceMappingURL=set-default-staking-provider.d.ts.map |
| {"version":3,"file":"set-default-staking-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/set-default-staking-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,mCAAmC;IAChD,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,mCAAmC,GAAG,IAAI,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAClC,QAAQ,MAAM,EACd,YAAY,mCAAmC,KAChD,mCAEF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.setDefaultStakingProvider = void 0; | ||
| /** | ||
| * Set the default staking provider. | ||
| * Subsequent quote and stake-transaction calls will use this provider when none is specified. | ||
| */ | ||
| const setDefaultStakingProvider = (appKit, parameters) => { | ||
| appKit.stakingManager.setDefaultProvider(parameters.providerId); | ||
| }; | ||
| exports.setDefaultStakingProvider = setDefaultStakingProvider; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface WatchStakingProvidersParameters { | ||
| onChange: () => void; | ||
| } | ||
| export type WatchStakingProvidersReturnType = () => void; | ||
| /** | ||
| * Watch for staking providers registration and default provider changes | ||
| */ | ||
| export declare const watchStakingProviders: (appKit: AppKit, parameters: WatchStakingProvidersParameters) => WatchStakingProvidersReturnType; | ||
| //# sourceMappingURL=watch-staking-providers.d.ts.map |
| {"version":3,"file":"watch-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/watch-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,+BAA+B;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,+BAA+B,GAAG,MAAM,IAAI,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAC9B,QAAQ,MAAM,EACd,YAAY,+BAA+B,KAC5C,+BAgBF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.watchStakingProviders = void 0; | ||
| /** | ||
| * Watch for staking providers registration and default provider changes | ||
| */ | ||
| const watchStakingProviders = (appKit, parameters) => { | ||
| const { onChange } = parameters; | ||
| const onEvent = (event) => { | ||
| if (event.payload.type === 'staking') { | ||
| onChange(); | ||
| } | ||
| }; | ||
| const unsubscribeRegistered = appKit.emitter.on('provider:registered', onEvent); | ||
| const unsubscribeDefaultChanged = appKit.emitter.on('provider:default-changed', onEvent); | ||
| return () => { | ||
| unsubscribeRegistered(); | ||
| unsubscribeDefaultChanged(); | ||
| }; | ||
| }; | ||
| exports.watchStakingProviders = watchStakingProviders; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { SwapProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface GetSwapProviderOptions { | ||
| id?: string; | ||
| } | ||
| export type GetSwapProviderReturnType = SwapProviderInterface; | ||
| export declare const getSwapProvider: (appKit: AppKit, options?: GetSwapProviderOptions) => GetSwapProviderReturnType; | ||
| //# sourceMappingURL=get-swap-provider.d.ts.map |
| {"version":3,"file":"get-swap-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAE9D,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,UAAS,sBAA2B,KAAG,yBAEtF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getSwapProvider = void 0; | ||
| const getSwapProvider = (appKit, options = {}) => { | ||
| return appKit.swapManager.getProvider(options.id); | ||
| }; | ||
| exports.getSwapProvider = getSwapProvider; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { SwapProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetSwapProvidersReturnType = SwapProviderInterface[]; | ||
| /** | ||
| * Get all registered swap providers. | ||
| */ | ||
| export declare const getSwapProviders: (appKit: AppKit) => GetSwapProvidersReturnType; | ||
| //# sourceMappingURL=get-swap-providers.d.ts.map |
| {"version":3,"file":"get-swap-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,EAAE,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,0BAEjD,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getSwapProviders = void 0; | ||
| /** | ||
| * Get all registered swap providers. | ||
| */ | ||
| const getSwapProviders = (appKit) => { | ||
| return appKit.swapManager.getProviders(); | ||
| }; | ||
| exports.getSwapProviders = getSwapProviders; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface SetDefaultSwapProviderParameters { | ||
| providerId: string; | ||
| } | ||
| export type SetDefaultSwapProviderReturnType = void; | ||
| /** | ||
| * Set the default swap provider. | ||
| * Subsequent quote and swap-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export declare const setDefaultSwapProvider: (appKit: AppKit, parameters: SetDefaultSwapProviderParameters) => SetDefaultSwapProviderReturnType; | ||
| //# sourceMappingURL=set-default-swap-provider.d.ts.map |
| {"version":3,"file":"set-default-swap-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/set-default-swap-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,gCAAgC;IAC7C,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAC/B,QAAQ,MAAM,EACd,YAAY,gCAAgC,KAC7C,gCAEF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.setDefaultSwapProvider = void 0; | ||
| /** | ||
| * Set the default swap provider. | ||
| * Subsequent quote and swap-transaction calls will use this provider when none is specified. | ||
| */ | ||
| const setDefaultSwapProvider = (appKit, parameters) => { | ||
| appKit.swapManager.setDefaultProvider(parameters.providerId); | ||
| }; | ||
| exports.setDefaultSwapProvider = setDefaultSwapProvider; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface WatchSwapProvidersParameters { | ||
| onChange: () => void; | ||
| } | ||
| export type WatchSwapProvidersReturnType = () => void; | ||
| /** | ||
| * Watch for new swap providers registration | ||
| */ | ||
| export declare const watchSwapProviders: (appKit: AppKit, parameters: WatchSwapProvidersParameters) => WatchSwapProvidersReturnType; | ||
| //# sourceMappingURL=watch-swap-providers.d.ts.map |
| {"version":3,"file":"watch-swap-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/watch-swap-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,4BAA4B;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,4BAA4B,GAAG,MAAM,IAAI,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC3B,QAAQ,MAAM,EACd,YAAY,4BAA4B,KACzC,4BAeF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.watchSwapProviders = void 0; | ||
| /** | ||
| * Watch for new swap providers registration | ||
| */ | ||
| const watchSwapProviders = (appKit, parameters) => { | ||
| const { onChange } = parameters; | ||
| const unsubscribeRegistered = appKit.emitter.on('provider:registered', (event) => { | ||
| if (event.payload.type === 'swap') | ||
| onChange(); | ||
| }); | ||
| const unsubscribeDefaultChanged = appKit.emitter.on('provider:default-changed', (event) => { | ||
| if (event.payload.type === 'swap') | ||
| onChange(); | ||
| }); | ||
| return () => { | ||
| unsubscribeRegistered(); | ||
| unsubscribeDefaultChanged(); | ||
| }; | ||
| }; | ||
| exports.watchSwapProviders = watchSwapProviders; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKitCache } from '../types/app-kit-cache'; | ||
| export declare class LruAppKitCache implements AppKitCache { | ||
| private readonly cache; | ||
| constructor(options?: { | ||
| max?: number; | ||
| ttl?: number; | ||
| }); | ||
| get<T = unknown>(key: string): Promise<T | undefined>; | ||
| set(key: string, value: unknown): Promise<void>; | ||
| remove(key: string): Promise<void>; | ||
| clear(): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=lru-app-kit-cache.d.ts.map |
| {"version":3,"file":"lru-app-kit-cache.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/adapters/lru-app-kit-cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,qBAAa,cAAe,YAAW,WAAW;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;gBAEjD,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE;IAO9C,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIrD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.LruAppKitCache = void 0; | ||
| const lru_cache_1 = require("lru-cache"); | ||
| class LruAppKitCache { | ||
| constructor(options) { | ||
| this.cache = new lru_cache_1.LRUCache({ | ||
| max: options?.max ?? 1000, | ||
| ttl: options?.ttl ?? 1000 * 60 * 10, | ||
| }); | ||
| } | ||
| async get(key) { | ||
| return this.cache.get(key)?.value; | ||
| } | ||
| async set(key, value) { | ||
| this.cache.set(key, { value }); | ||
| } | ||
| async remove(key) { | ||
| this.cache.delete(key); | ||
| } | ||
| async clear() { | ||
| this.cache.clear(); | ||
| } | ||
| } | ||
| exports.LruAppKitCache = LruAppKitCache; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=lru-app-kit-cache.test.d.ts.map |
| {"version":3,"file":"lru-app-kit-cache.test.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/adapters/lru-app-kit-cache.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const lru_app_kit_cache_1 = require("./lru-app-kit-cache"); | ||
| (0, vitest_1.describe)('LruAppKitCache', () => { | ||
| (0, vitest_1.it)('should return undefined for a missing key', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| (0, vitest_1.expect)(await cache.get('missing')).toBeUndefined(); | ||
| }); | ||
| (0, vitest_1.it)('should store and retrieve a value', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| await cache.set('key', 'value'); | ||
| (0, vitest_1.expect)(await cache.get('key')).toBe('value'); | ||
| }); | ||
| (0, vitest_1.it)('should store and retrieve null', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| await cache.set('key', null); | ||
| (0, vitest_1.expect)(await cache.get('key')).toBeNull(); | ||
| }); | ||
| (0, vitest_1.it)('should store and retrieve an object', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| const obj = { address: 'EQabc', name: 'Test', decimals: 6 }; | ||
| await cache.set('key', obj); | ||
| (0, vitest_1.expect)(await cache.get('key')).toEqual(obj); | ||
| }); | ||
| (0, vitest_1.it)('should overwrite an existing value', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| await cache.set('key', 'first'); | ||
| await cache.set('key', 'second'); | ||
| (0, vitest_1.expect)(await cache.get('key')).toBe('second'); | ||
| }); | ||
| (0, vitest_1.it)('should remove a key', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| await cache.set('key', 'value'); | ||
| await cache.remove('key'); | ||
| (0, vitest_1.expect)(await cache.get('key')).toBeUndefined(); | ||
| }); | ||
| (0, vitest_1.it)('should clear all keys', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache(); | ||
| await cache.set('a', 1); | ||
| await cache.set('b', 2); | ||
| await cache.clear(); | ||
| (0, vitest_1.expect)(await cache.get('a')).toBeUndefined(); | ||
| (0, vitest_1.expect)(await cache.get('b')).toBeUndefined(); | ||
| }); | ||
| (0, vitest_1.it)('should evict entries when max is exceeded', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache({ max: 2 }); | ||
| await cache.set('a', 1); | ||
| await cache.set('b', 2); | ||
| await cache.set('c', 3); | ||
| (0, vitest_1.expect)(await cache.get('a')).toBeUndefined(); | ||
| (0, vitest_1.expect)(await cache.get('b')).toBe(2); | ||
| (0, vitest_1.expect)(await cache.get('c')).toBe(3); | ||
| }); | ||
| (0, vitest_1.it)('should expire entries after ttl', async () => { | ||
| const cache = new lru_app_kit_cache_1.LruAppKitCache({ ttl: 10 }); | ||
| await cache.set('key', 'value'); | ||
| await new Promise((resolve) => setTimeout(resolve, 20)); | ||
| (0, vitest_1.expect)(await cache.get('key')).toBeUndefined(); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export { LruAppKitCache } from './adapters/lru-app-kit-cache'; | ||
| export { getCacheKey } from './utils/get-cache-key'; | ||
| export type { AppKitCache } from './types/app-kit-cache'; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getCacheKey = exports.LruAppKitCache = void 0; | ||
| var lru_app_kit_cache_1 = require("./adapters/lru-app-kit-cache"); | ||
| Object.defineProperty(exports, "LruAppKitCache", { enumerable: true, get: function () { return lru_app_kit_cache_1.LruAppKitCache; } }); | ||
| var get_cache_key_1 = require("./utils/get-cache-key"); | ||
| Object.defineProperty(exports, "getCacheKey", { enumerable: true, get: function () { return get_cache_key_1.getCacheKey; } }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export interface AppKitCache { | ||
| get<T = unknown>(key: string): Promise<T | undefined>; | ||
| set(key: string, value: unknown): Promise<void>; | ||
| remove(key: string): Promise<void>; | ||
| clear(): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=app-kit-cache.d.ts.map |
| {"version":3,"file":"app-kit-cache.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/types/app-kit-cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACtD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const getCacheKey: (prefix: string) => (...params: string[]) => string; | ||
| //# sourceMappingURL=get-cache-key.d.ts.map |
| {"version":3,"file":"get-cache-key.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/utils/get-cache-key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,WAAW,GACnB,QAAQ,MAAM,MACd,GAAG,QAAQ,MAAM,EAAE,KAAG,MACY,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getCacheKey = void 0; | ||
| const getCacheKey = (prefix) => (...params) => `${prefix}:${params.join(':')}`; | ||
| exports.getCacheKey = getCacheKey; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=get-cache-key.test.d.ts.map |
| {"version":3,"file":"get-cache-key.test.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/utils/get-cache-key.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const get_cache_key_1 = require("./get-cache-key"); | ||
| (0, vitest_1.describe)('getCacheKey', () => { | ||
| (0, vitest_1.it)('should build a key with a single param', () => { | ||
| const key = (0, get_cache_key_1.getCacheKey)('jetton-info'); | ||
| (0, vitest_1.expect)(key('EQabc')).toBe('jetton-info:EQabc'); | ||
| }); | ||
| (0, vitest_1.it)('should build a key with multiple params', () => { | ||
| const key = (0, get_cache_key_1.getCacheKey)('jetton-info'); | ||
| (0, vitest_1.expect)(key('mainnet', 'EQabc')).toBe('jetton-info:mainnet:EQabc'); | ||
| }); | ||
| (0, vitest_1.it)('should build a key with no params', () => { | ||
| const key = (0, get_cache_key_1.getCacheKey)('jetton-info'); | ||
| (0, vitest_1.expect)(key()).toBe('jetton-info:'); | ||
| }); | ||
| (0, vitest_1.it)('should scope keys independently per prefix', () => { | ||
| const infoKey = (0, get_cache_key_1.getCacheKey)('jetton-info'); | ||
| const walletKey = (0, get_cache_key_1.getCacheKey)('jetton-wallet'); | ||
| (0, vitest_1.expect)(infoKey('EQabc')).not.toBe(walletKey('EQabc')); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { UserFriendlyAddress } from '../../types/primitives'; | ||
| export declare const isValidAddress: (address: unknown) => address is string; | ||
| export declare const isFriendlyTonAddress: (address: unknown) => address is UserFriendlyAddress; | ||
| //# sourceMappingURL=is-valid-address.d.ts.map |
| {"version":3,"file":"is-valid-address.d.ts","sourceRoot":"","sources":["../../../../src/utils/address/is-valid-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,MAY5D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,mBAYlE,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.isFriendlyTonAddress = exports.isValidAddress = void 0; | ||
| const core_1 = require("@ton/core"); | ||
| const is_string_1 = require("../predicate/is-string"); | ||
| const isValidAddress = (address) => { | ||
| if (typeof address !== 'string') { | ||
| return false; | ||
| } | ||
| try { | ||
| core_1.Address.parse(address); | ||
| } | ||
| catch (_) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| exports.isValidAddress = isValidAddress; | ||
| const isFriendlyTonAddress = (address) => { | ||
| if (!(0, is_string_1.isString)(address)) { | ||
| return false; | ||
| } | ||
| try { | ||
| core_1.Address.parseFriendly(address); | ||
| } | ||
| catch (_) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| exports.isFriendlyTonAddress = isFriendlyTonAddress; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| export declare const toBounceableAddress: (address?: Address | string | null) => string; | ||
| export declare const tryToBounceableAddress: (address?: Address | string | null) => string | undefined; | ||
| //# sourceMappingURL=to-bounceble-address.d.ts.map |
| {"version":3,"file":"to-bounceble-address.d.ts","sourceRoot":"","sources":["../../../../src/utils/address/to-bounceble-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,mBAAmB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAcvE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,SAMnF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.tryToBounceableAddress = exports.toBounceableAddress = void 0; | ||
| const core_1 = require("@ton/core"); | ||
| const get_error_message_1 = require("../errors/get-error-message"); | ||
| const toBounceableAddress = (address) => { | ||
| if (!address) { | ||
| throw new Error(`Address is empty`); | ||
| } | ||
| if (address instanceof core_1.Address) { | ||
| return address.toString({ bounceable: true }); | ||
| } | ||
| try { | ||
| return core_1.Address.parse(address).toString({ bounceable: true }); | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Can not convert to bounceble address from "${address}". Error: ${(0, get_error_message_1.getErrorMessage)(e)}`); | ||
| } | ||
| }; | ||
| exports.toBounceableAddress = toBounceableAddress; | ||
| const tryToBounceableAddress = (address) => { | ||
| try { | ||
| return (0, exports.toBounceableAddress)(address); | ||
| } | ||
| catch { | ||
| return undefined; | ||
| } | ||
| }; | ||
| exports.tryToBounceableAddress = tryToBounceableAddress; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| export declare const toNonBounceableAddress: (address?: Address | string | null) => string; | ||
| export declare const tryToNonBounceableAddress: (address?: Address | string | null) => string | undefined; | ||
| //# sourceMappingURL=to-non-bounceble-address.d.ts.map |
| {"version":3,"file":"to-non-bounceble-address.d.ts","sourceRoot":"","sources":["../../../../src/utils/address/to-non-bounceble-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,sBAAsB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAc1E,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,SAMtF,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.tryToNonBounceableAddress = exports.toNonBounceableAddress = void 0; | ||
| const core_1 = require("@ton/core"); | ||
| const get_error_message_1 = require("../errors/get-error-message"); | ||
| const toNonBounceableAddress = (address) => { | ||
| if (!address) { | ||
| throw new Error(`Address is empty`); | ||
| } | ||
| if (address instanceof core_1.Address) { | ||
| return address.toString({ bounceable: false }); | ||
| } | ||
| try { | ||
| return core_1.Address.parse(address).toString({ bounceable: false }); | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Can not convert to non-bounceable address from "${address}". Error: ${(0, get_error_message_1.getErrorMessage)(e)}`); | ||
| } | ||
| }; | ||
| exports.toNonBounceableAddress = toNonBounceableAddress; | ||
| const tryToNonBounceableAddress = (address) => { | ||
| try { | ||
| return (0, exports.toNonBounceableAddress)(address); | ||
| } | ||
| catch { | ||
| return undefined; | ||
| } | ||
| }; | ||
| exports.tryToNonBounceableAddress = tryToNonBounceableAddress; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Calculates the fiat value of a token amount. | ||
| * Returns null when rate is unavailable or amount is zero/invalid. | ||
| */ | ||
| export declare function calcFiatValue(amount: string, rate: string | undefined): string; | ||
| //# sourceMappingURL=calc-fiat-value.d.ts.map |
| {"version":3,"file":"calc-fiat-value.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/calc-fiat-value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK9E"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.calcFiatValue = calcFiatValue; | ||
| /** | ||
| * Calculates the fiat value of a token amount. | ||
| * Returns null when rate is unavailable or amount is zero/invalid. | ||
| */ | ||
| function calcFiatValue(amount, rate) { | ||
| if (!rate) | ||
| return '0'; | ||
| const num = parseFloat(amount); | ||
| if (!num || num <= 0) | ||
| return '0'; | ||
| return Number((num * parseFloat(rate)).toFixed(10)).toString(); | ||
| } |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=calc-fiat-value.test.d.ts.map |
| {"version":3,"file":"calc-fiat-value.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/calc-fiat-value.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const calc_fiat_value_1 = require("./calc-fiat-value"); | ||
| (0, vitest_1.describe)('calcFiatValue', () => { | ||
| (0, vitest_1.it)('should return 0 when rate is undefined', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('100', undefined)).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should return 0 when rate is 0', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('100', '0')).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should return 0 when amount is 0', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('0', '1.5')).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should return 0 when amount is negative', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('-10', '1.5')).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should return 0 when amount is not a valid number', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('abc', '1.5')).toBe('0'); | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('', '1.5')).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should calculate fiat value without rounding', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('100', '1.5')).toBe('150'); | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('1', '0.001')).toBe('0.001'); | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('3', '1.005')).toBe('3.015'); | ||
| }); | ||
| (0, vitest_1.it)('should handle decimal amounts without rounding', () => { | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('0.5', '2')).toBe('1'); | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('1.23456', '100')).toBe('123.456'); | ||
| (0, vitest_1.expect)((0, calc_fiat_value_1.calcFiatValue)('2.996876', '1')).toBe('2.996876'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const formatLargeValue: (amount: string, decimals?: number, minimumFractionDigits?: number) => string; | ||
| //# sourceMappingURL=format-large-value.d.ts.map |
| {"version":3,"file":"format-large-value.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/format-large-value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,WAAU,MAAU,EAAE,wBAAuB,MAAU,KAAG,MAkC1G,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.formatLargeValue = void 0; | ||
| const formatLargeValue = (amount, decimals = 2, minimumFractionDigits = 0) => { | ||
| const cleanAmount = amount.toString().replace(/\s/g, ''); | ||
| const intPart = cleanAmount.split('.')[0] || '0'; | ||
| // value > 100 000 000 000 000 => 100 T | ||
| if (intPart.length > 12) { | ||
| const value = Number(intPart.slice(0, -10)) / 100; | ||
| return `${value.toLocaleString('en-US')}T`; | ||
| } | ||
| // value > 100 000 000 000 => 100 B | ||
| if (intPart.length > 9) { | ||
| const value = Number(intPart.slice(0, -7)) / 100; | ||
| return `${value.toLocaleString('en-US')}B`; | ||
| } | ||
| // value > 10 000 000 => 10 M | ||
| if (intPart.length > 6) { | ||
| const value = Number(intPart.slice(0, -4)) / 100; | ||
| return `${value.toLocaleString('en-US')}M`; | ||
| } | ||
| const value = parseFloat(cleanAmount); | ||
| if (isNaN(value)) { | ||
| return '0'; | ||
| } | ||
| const factor = Math.pow(10, decimals); | ||
| const truncated = Math.floor(value * factor) / factor; | ||
| return truncated.toLocaleString('en-US', { | ||
| minimumFractionDigits, | ||
| maximumFractionDigits: decimals, | ||
| }); | ||
| }; | ||
| exports.formatLargeValue = formatLargeValue; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=format-large-value.test.d.ts.map |
| {"version":3,"file":"format-large-value.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/format-large-value.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const format_large_value_1 = require("./format-large-value"); | ||
| (0, vitest_1.describe)('formatLargeValue', () => { | ||
| (0, vitest_1.it)('should format trillion values', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1000000000000')).toBe('1T'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1230000000000')).toBe('1.23T'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('12345678901234')).toBe('12.34T'); | ||
| }); | ||
| (0, vitest_1.it)('should format billion values', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1000000000')).toBe('1B'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1230000000')).toBe('1.23B'); | ||
| }); | ||
| (0, vitest_1.it)('should format million values', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1000000')).toBe('1M'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1230000')).toBe('1.23M'); | ||
| }); | ||
| (0, vitest_1.it)('should format smaller values using toLocaleString', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1234.56')).toBe('1,234.56'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('100')).toBe('100'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('0')).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should handle spaces and formatting', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1 000 000')).toBe('1M'); | ||
| }); | ||
| (0, vitest_1.it)('should respect decimals for small values', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1234.5678', 4)).toBe('1,234.5678'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('1234.5678', 2)).toBe('1,234.56'); | ||
| }); | ||
| (0, vitest_1.it)('should round down (floor) fractional values', () => { | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('2.996848', 2)).toBe('2.99'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('2.996848', 6)).toBe('2.996848'); | ||
| (0, vitest_1.expect)((0, format_large_value_1.formatLargeValue)('0.9999', 2)).toBe('0.99'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const truncateDecimals: (value: string | number, maxDecimals: number) => string; | ||
| //# sourceMappingURL=truncate-decimals.d.ts.map |
| {"version":3,"file":"truncate-decimals.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/truncate-decimals.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,GAAG,MAAM,EAAE,aAAa,MAAM,KAAG,MAkB9E,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.truncateDecimals = void 0; | ||
| /** | ||
| * Converts a number to a plain decimal string, expanding scientific notation | ||
| * like "1.23e-9" into "0.00000000123". | ||
| */ | ||
| const toPlainDecimalString = (num) => { | ||
| const str = num.toString(); | ||
| if (!str.includes('e') && !str.includes('E')) | ||
| return str; | ||
| const [base = '0', exponent = '0'] = str.split(/[eE]/); | ||
| const exp = Number(exponent); | ||
| const isNegative = base.startsWith('-'); | ||
| const absBase = isNegative ? base.slice(1) : base; | ||
| const [intPart, decPart = ''] = absBase.split('.'); | ||
| let result; | ||
| if (exp < 0) { | ||
| result = '0.' + '0'.repeat(Math.abs(exp) - 1) + intPart + decPart; | ||
| } | ||
| else { | ||
| const addZeros = exp - decPart.length; | ||
| if (addZeros >= 0) { | ||
| result = intPart + decPart + '0'.repeat(addZeros); | ||
| } | ||
| else { | ||
| result = intPart + decPart.slice(0, exp) + '.' + decPart.slice(exp); | ||
| } | ||
| } | ||
| return isNegative ? '-' + result : result; | ||
| }; | ||
| const truncateDecimals = (value, maxDecimals) => { | ||
| let strValue; | ||
| if (typeof value === 'number') { | ||
| strValue = toPlainDecimalString(value); | ||
| } | ||
| else if (value.includes('e') || value.includes('E')) { | ||
| const num = Number(value); | ||
| if (Number.isNaN(num)) | ||
| return value; | ||
| strValue = toPlainDecimalString(num); | ||
| } | ||
| else { | ||
| strValue = value; | ||
| } | ||
| const dotIndex = strValue.indexOf('.'); | ||
| if (dotIndex === -1) | ||
| return strValue; | ||
| const result = strValue.slice(0, dotIndex + 1 + maxDecimals); | ||
| return result.endsWith('.') ? result.slice(0, -1) : result; | ||
| }; | ||
| exports.truncateDecimals = truncateDecimals; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=truncate-decimals.test.d.ts.map |
| {"version":3,"file":"truncate-decimals.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/truncate-decimals.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const truncate_decimals_1 = require("./truncate-decimals"); | ||
| (0, vitest_1.describe)('truncateDecimals', () => { | ||
| (0, vitest_1.it)('should return integers unchanged', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('123', 2)).toBe('123'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('0', 5)).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('should truncate decimals exceeding maxDecimals', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.23456', 2)).toBe('1.23'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.23456', 4)).toBe('1.2345'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('0.123456789', 9)).toBe('0.123456789'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('0.1234567890', 9)).toBe('0.123456789'); | ||
| }); | ||
| (0, vitest_1.it)('should return value unchanged when decimals are within limit', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.23', 5)).toBe('1.23'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.2', 2)).toBe('1.2'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('5.0', 1)).toBe('5.0'); | ||
| }); | ||
| (0, vitest_1.it)('should handle maxDecimals of 0', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.999', 0)).toBe('1'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('42.1', 0)).toBe('42'); | ||
| }); | ||
| (0, vitest_1.it)('should strip trailing dot', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.', 3)).toBe('1'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.', 0)).toBe('1'); | ||
| }); | ||
| (0, vitest_1.it)('should handle empty string', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('', 2)).toBe(''); | ||
| }); | ||
| (0, vitest_1.it)('should handle number input', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(1.23456, 2)).toBe('1.23'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(42, 3)).toBe('42'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(0.1, 5)).toBe('0.1'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(3.14159, 0)).toBe('3'); | ||
| }); | ||
| (0, vitest_1.it)('should handle scientific notation strings', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.095492908209088e-9', 9)).toBe('0.000000001'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('5e-7', 9)).toBe('0.0000005'); | ||
| }); | ||
| (0, vitest_1.it)('should handle numbers that produce scientific notation', () => { | ||
| const tiny = 0.000000001 * 1.095492908209088; // 1.095492908209088e-9 | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(tiny, 9)).toBe('0.000000001'); | ||
| }); | ||
| (0, vitest_1.it)('should handle negative numbers and negative scientific notation', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('-1.23456', 2)).toBe('-1.23'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('-5e-7', 9)).toBe('-0.0000005'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(-0.0000005, 9)).toBe('-0.0000005'); | ||
| }); | ||
| (0, vitest_1.it)('should handle scientific notation with positive exponents', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.2345e2', 2)).toBe('123.45'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1.2345e+2', 0)).toBe('123'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('5.2e9', 0)).toBe('5200000000'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('-1.23e+9', 0)).toBe('-1230000000'); | ||
| }); | ||
| (0, vitest_1.it)('should handle extreme scientific exponents', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1e-100', 100)).toBe('0.' + '0'.repeat(99) + '1'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('1e21', 0)).toBe('1000000000000000000000'); | ||
| }); | ||
| (0, vitest_1.it)('should handle NaN and Infinity', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(NaN, 2)).toBe('NaN'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(Infinity, 2)).toBe('Infinity'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(-Infinity, 2)).toBe('-Infinity'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('NaN', 2)).toBe('NaN'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)('Infinity', 2)).toBe('Infinity'); | ||
| }); | ||
| (0, vitest_1.it)('should handle native numbers with e (scientific notation)', () => { | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(1e-10, 10)).toBe('0.0000000001'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(1.23e-8, 10)).toBe('0.0000000123'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(-5.43e-7, 9)).toBe('-0.000000543'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(5.2e9, 0)).toBe('5200000000'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(-1.23e9, 0)).toBe('-1230000000'); | ||
| (0, vitest_1.expect)((0, truncate_decimals_1.truncateDecimals)(1e21, 0)).toBe('1000000000000000000000'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Default TON reserve subtracted from balance when computing the max spendable amount | ||
| * for a native TON operation — leaves room for network fees. 0.1 TON. | ||
| */ | ||
| export declare const DEFAULT_TON_FEE_RESERVE_NANOS = 100000000n; | ||
| export interface CalcMaxSpendableParams { | ||
| /** User's balance of `token`, as a decimal string. */ | ||
| balance: string; | ||
| /** The token the user is going to spend. */ | ||
| token: { | ||
| address: string; | ||
| decimals: number; | ||
| }; | ||
| /** | ||
| * TON reserve (in nanos) subtracted from balance when the token is native TON. | ||
| * Ignored for jettons. Defaults to {@link DEFAULT_TON_FEE_RESERVE_NANOS}. | ||
| */ | ||
| feeReserveNanos?: bigint; | ||
| } | ||
| /** | ||
| * Compute the max spendable amount a user can place into an input when they click MAX. | ||
| * For native TON — subtracts a fixed reserve so the user still has room for network fees. | ||
| * For jettons — returns the full balance (gas is paid from TON separately). | ||
| */ | ||
| export declare const calcMaxSpendable: ({ balance, token, feeReserveNanos, }: CalcMaxSpendableParams) => string; | ||
| //# sourceMappingURL=calc-max-spendable.d.ts.map |
| {"version":3,"file":"calc-max-spendable.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/calc-max-spendable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,eAAO,MAAM,6BAA6B,aAAe,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACnC,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,sCAI9B,sBAAsB,KAAG,MAM3B,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.calcMaxSpendable = exports.DEFAULT_TON_FEE_RESERVE_NANOS = void 0; | ||
| const walletkit_1 = require("@ton/walletkit"); | ||
| /** | ||
| * Default TON reserve subtracted from balance when computing the max spendable amount | ||
| * for a native TON operation — leaves room for network fees. 0.1 TON. | ||
| */ | ||
| exports.DEFAULT_TON_FEE_RESERVE_NANOS = 100000000n; | ||
| /** | ||
| * Compute the max spendable amount a user can place into an input when they click MAX. | ||
| * For native TON — subtracts a fixed reserve so the user still has room for network fees. | ||
| * For jettons — returns the full balance (gas is paid from TON separately). | ||
| */ | ||
| const calcMaxSpendable = ({ balance, token, feeReserveNanos = exports.DEFAULT_TON_FEE_RESERVE_NANOS, }) => { | ||
| if (token.address !== 'ton') | ||
| return balance; | ||
| const balanceNanos = (0, walletkit_1.parseUnits)(balance, token.decimals); | ||
| const reducedNanos = balanceNanos > feeReserveNanos ? balanceNanos - feeReserveNanos : 0n; | ||
| return (0, walletkit_1.formatUnits)(reducedNanos, token.decimals); | ||
| }; | ||
| exports.calcMaxSpendable = calcMaxSpendable; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=calc-max-spendable.test.d.ts.map |
| {"version":3,"file":"calc-max-spendable.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/calc-max-spendable.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const calc_max_spendable_1 = require("./calc-max-spendable"); | ||
| const TON = { address: 'ton', decimals: 9 }; | ||
| const JETTON = { address: 'EQA_jetton', decimals: 6 }; | ||
| (0, vitest_1.describe)('calcMaxSpendable', () => { | ||
| (0, vitest_1.it)('returns balance minus the TON fee reserve for native TON', () => { | ||
| // 1 TON balance, default reserve 0.1 TON → 0.9 TON spendable. | ||
| (0, vitest_1.expect)((0, calc_max_spendable_1.calcMaxSpendable)({ balance: '1', token: TON })).toBe('0.9'); | ||
| }); | ||
| (0, vitest_1.it)('returns the full balance for a jetton (no reserve)', () => { | ||
| (0, vitest_1.expect)((0, calc_max_spendable_1.calcMaxSpendable)({ balance: '100', token: JETTON })).toBe('100'); | ||
| }); | ||
| (0, vitest_1.it)('clamps to zero when balance is below the reserve', () => { | ||
| (0, vitest_1.expect)((0, calc_max_spendable_1.calcMaxSpendable)({ balance: '0.05', token: TON })).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('clamps to zero when balance equals the reserve', () => { | ||
| (0, vitest_1.expect)((0, calc_max_spendable_1.calcMaxSpendable)({ balance: '0.1', token: TON })).toBe('0'); | ||
| }); | ||
| (0, vitest_1.it)('respects a custom feeReserveNanos', () => { | ||
| // 1 TON balance, 0.5 TON reserve → 0.5 TON spendable. | ||
| (0, vitest_1.expect)((0, calc_max_spendable_1.calcMaxSpendable)({ balance: '1', token: TON, feeReserveNanos: 500000000n })).toBe('0.5'); | ||
| }); | ||
| (0, vitest_1.it)('ignores feeReserveNanos for jettons', () => { | ||
| (0, vitest_1.expect)((0, calc_max_spendable_1.calcMaxSpendable)({ balance: '100', token: JETTON, feeReserveNanos: 999999999999n })).toBe('100'); | ||
| }); | ||
| (0, vitest_1.it)('exports a sane default reserve', () => { | ||
| (0, vitest_1.expect)(calc_max_spendable_1.DEFAULT_TON_FEE_RESERVE_NANOS).toBe(100000000n); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** Default extra TON buffer added on top of built transaction outflow when checking balance before sending. */ | ||
| export declare const DEFAULT_GAS_BUFFER_NANOS = 100000000n; | ||
| /** | ||
| * Default extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Covers quote/gas drift between the current built tx and the one that will actually be sent | ||
| * after the amount changes. 0.02 TON. | ||
| */ | ||
| export declare const DEFAULT_SAFETY_MARGIN_NANOS = 20000000n; | ||
| export type TonShortfall = { | ||
| mode: 'reduce'; | ||
| requiredNanos: bigint; | ||
| suggestedFromAmount: string; | ||
| } | { | ||
| mode: 'topup'; | ||
| requiredNanos: bigint; | ||
| suggestedFromAmount: ''; | ||
| }; | ||
| export interface GetTonShortfallParams { | ||
| /** Messages of the built transaction. Each `amount` is the TON value in nanos attached to the message. */ | ||
| messages: Array<{ | ||
| amount: string; | ||
| }>; | ||
| /** User's current TON balance as a decimal string (same format `formatUnits(balance, 9)` returns). */ | ||
| tonBalance: string | undefined; | ||
| /** The outgoing token — `{ address: 'ton' }` when the user spends TON, otherwise a jetton. */ | ||
| fromToken: { | ||
| address: string; | ||
| }; | ||
| /** Amount the user intends to spend in `fromToken` units, as a decimal string. */ | ||
| fromAmount: string; | ||
| /** | ||
| * Extra TON headroom on top of built-tx outflow when checking balance before sending. | ||
| * Defaults to {@link DEFAULT_GAS_BUFFER_NANOS}. | ||
| */ | ||
| gasBufferNanos?: bigint; | ||
| /** | ||
| * Extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Defaults to {@link DEFAULT_SAFETY_MARGIN_NANOS}. | ||
| */ | ||
| safetyMarginNanos?: bigint; | ||
| } | ||
| /** | ||
| * Check whether the user's TON balance covers the built transaction. | ||
| * - Returns `null` if the balance is sufficient. | ||
| * - Returns `{ mode: 'reduce', ... }` with a smaller suggested `fromAmount` when `fromToken` is TON | ||
| * and the balance is enough to cover at least gas (user can fix it by reducing the amount). | ||
| * - Returns `{ mode: 'topup', ... }` when `fromToken` is a jetton (reducing jetton amount won't free up TON gas), | ||
| * or when `fromToken` is TON but the balance can't even cover gas (reducing won't help — user must top up). | ||
| */ | ||
| export declare const getTonShortfall: ({ messages, tonBalance, fromToken, fromAmount, gasBufferNanos, safetyMarginNanos, }: GetTonShortfallParams) => TonShortfall | undefined; | ||
| //# sourceMappingURL=get-ton-shortfall.d.ts.map |
| {"version":3,"file":"get-ton-shortfall.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/get-ton-shortfall.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,+GAA+G;AAC/G,eAAO,MAAM,wBAAwB,aAAe,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,YAAc,CAAC;AAEvD,MAAM,MAAM,YAAY,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,EAAE,CAAA;CAAE,CAAC;AAExE,MAAM,WAAW,qBAAqB;IAClC,0GAA0G;IAC1G,QAAQ,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpC,sGAAsG;IACtG,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,8FAA8F;IAC9F,SAAS,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,qFAO7B,qBAAqB,KAAG,YAAY,GAAG,SAqBzC,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getTonShortfall = exports.DEFAULT_SAFETY_MARGIN_NANOS = exports.DEFAULT_GAS_BUFFER_NANOS = void 0; | ||
| const walletkit_1 = require("@ton/walletkit"); | ||
| /** Default extra TON buffer added on top of built transaction outflow when checking balance before sending. */ | ||
| exports.DEFAULT_GAS_BUFFER_NANOS = 100000000n; | ||
| /** | ||
| * Default extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Covers quote/gas drift between the current built tx and the one that will actually be sent | ||
| * after the amount changes. 0.02 TON. | ||
| */ | ||
| exports.DEFAULT_SAFETY_MARGIN_NANOS = 20000000n; | ||
| /** | ||
| * Check whether the user's TON balance covers the built transaction. | ||
| * - Returns `null` if the balance is sufficient. | ||
| * - Returns `{ mode: 'reduce', ... }` with a smaller suggested `fromAmount` when `fromToken` is TON | ||
| * and the balance is enough to cover at least gas (user can fix it by reducing the amount). | ||
| * - Returns `{ mode: 'topup', ... }` when `fromToken` is a jetton (reducing jetton amount won't free up TON gas), | ||
| * or when `fromToken` is TON but the balance can't even cover gas (reducing won't help — user must top up). | ||
| */ | ||
| const getTonShortfall = ({ messages, tonBalance, fromToken, fromAmount, gasBufferNanos = exports.DEFAULT_GAS_BUFFER_NANOS, safetyMarginNanos = exports.DEFAULT_SAFETY_MARGIN_NANOS, }) => { | ||
| const totalOutNanos = messages.reduce((acc, m) => acc + BigInt(m.amount), 0n); | ||
| const requiredNanos = totalOutNanos + gasBufferNanos; | ||
| const tonBalanceNanos = tonBalance ? (0, walletkit_1.parseUnits)(tonBalance, 9) : 0n; | ||
| if (tonBalanceNanos >= requiredNanos) | ||
| return; | ||
| if (fromToken.address === 'ton') { | ||
| const gasOnlyNanos = totalOutNanos - (0, walletkit_1.parseUnits)(fromAmount, 9); | ||
| const nonSwapReservedNanos = gasOnlyNanos + gasBufferNanos + safetyMarginNanos; | ||
| // Balance can't cover even gas for a minimal outgoing tx — reducing the amount won't help. | ||
| if (tonBalanceNanos <= nonSwapReservedNanos) { | ||
| return { mode: 'topup', requiredNanos, suggestedFromAmount: '' }; | ||
| } | ||
| const suggestedFromAmount = (0, walletkit_1.formatUnits)(tonBalanceNanos - nonSwapReservedNanos, 9); | ||
| return { mode: 'reduce', requiredNanos, suggestedFromAmount }; | ||
| } | ||
| return { mode: 'topup', requiredNanos, suggestedFromAmount: '' }; | ||
| }; | ||
| exports.getTonShortfall = getTonShortfall; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=get-ton-shortfall.test.d.ts.map |
| {"version":3,"file":"get-ton-shortfall.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/get-ton-shortfall.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const get_ton_shortfall_1 = require("./get-ton-shortfall"); | ||
| const TON = { address: 'ton' }; | ||
| const JETTON = { address: 'EQA_jetton_address' }; | ||
| // Helper — convert a decimal string of TON to nanos as a string (for message amounts). | ||
| const toNanos = (ton) => BigInt(Math.round(Number(ton) * 1e9)).toString(); | ||
| (0, vitest_1.describe)('getTonShortfall', () => { | ||
| (0, vitest_1.it)('returns undefined when TON balance covers the built transaction', () => { | ||
| // Swap 1 TON, total tx outflow 1.3 TON (1 TON swap + 0.3 TON attached gas), balance 2 TON. | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '2', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| (0, vitest_1.expect)(result).toBeUndefined(); | ||
| }); | ||
| (0, vitest_1.it)('returns topup when fromToken is a jetton and TON balance is below outflow + buffer', () => { | ||
| // Jetton swap, tx needs 0.05 TON for gas, user has 0 TON. | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('0.05') }], | ||
| tonBalance: '0', | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| (0, vitest_1.expect)(result).toEqual({ | ||
| mode: 'topup', | ||
| requiredNanos: 50000000n + get_ton_shortfall_1.DEFAULT_GAS_BUFFER_NANOS, | ||
| suggestedFromAmount: '', | ||
| }); | ||
| }); | ||
| (0, vitest_1.it)('returns reduce for TON-from when balance covers gas but not full amount', () => { | ||
| // User wants 1 TON swap, total outflow 1.3 TON, has 1 TON. Gas only = 0.3 TON. | ||
| // Balance (1) > nonSwapReserved (0.3 gas + 0.1 buffer + 0.02 safety = 0.42) → reduce mode. | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| (0, vitest_1.expect)(result?.mode).toBe('reduce'); | ||
| if (result?.mode !== 'reduce') | ||
| return; | ||
| // Suggested = 1 - 0.42 = 0.58 | ||
| (0, vitest_1.expect)(result.suggestedFromAmount).toBe('0.58'); | ||
| (0, vitest_1.expect)(result.requiredNanos).toBe(1300000000n + get_ton_shortfall_1.DEFAULT_GAS_BUFFER_NANOS); | ||
| }); | ||
| (0, vitest_1.it)('returns topup for TON-from when balance cannot cover even gas (reducing would not help)', () => { | ||
| // User wants 1 TON swap, total outflow 1.3 TON → gas = 0.3 TON. Balance 0.2 TON. | ||
| // nonSwapReserved = 0.3 + 0.1 buffer + 0.02 safety = 0.42 TON → balance (0.2) <= 0.42 → topup. | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '0.2', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| (0, vitest_1.expect)(result).toEqual({ | ||
| mode: 'topup', | ||
| requiredNanos: 1300000000n + get_ton_shortfall_1.DEFAULT_GAS_BUFFER_NANOS, | ||
| suggestedFromAmount: '', | ||
| }); | ||
| }); | ||
| (0, vitest_1.it)('treats an undefined tonBalance as zero', () => { | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('0.05') }], | ||
| tonBalance: undefined, | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| (0, vitest_1.expect)(result?.mode).toBe('topup'); | ||
| }); | ||
| (0, vitest_1.it)('sums amounts across multiple messages', () => { | ||
| // Two messages attaching 0.6 TON each → totalOut = 1.2 TON. Balance 1 TON → shortfall. | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('0.6') }, { amount: toNanos('0.6') }], | ||
| tonBalance: '1', | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| (0, vitest_1.expect)(result?.mode).toBe('topup'); | ||
| (0, vitest_1.expect)(result?.requiredNanos).toBe(1200000000n + get_ton_shortfall_1.DEFAULT_GAS_BUFFER_NANOS); | ||
| }); | ||
| (0, vitest_1.it)('respects a custom gasBufferNanos', () => { | ||
| const baseParams = { | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1.3', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }; | ||
| // With the default buffer (0.1 TON), balance 1.3 is insufficient (needs 1.4). | ||
| (0, vitest_1.expect)((0, get_ton_shortfall_1.getTonShortfall)(baseParams)?.mode).toBe('reduce'); | ||
| // With a zero buffer, 1.3 TON balance covers the 1.3 TON outflow exactly. | ||
| (0, vitest_1.expect)((0, get_ton_shortfall_1.getTonShortfall)({ ...baseParams, gasBufferNanos: 0n })).toBeUndefined(); | ||
| }); | ||
| (0, vitest_1.it)('respects a custom safetyMarginNanos in the reduce branch', () => { | ||
| // Default margin: suggested = balance - gas - buffer - 0.02 = 1 - 0.3 - 0.1 - 0.02 = 0.58 | ||
| // Zero margin: suggested = balance - gas - buffer = 1 - 0.3 - 0.1 = 0.6 | ||
| const baseParams = { | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }; | ||
| const withDefault = (0, get_ton_shortfall_1.getTonShortfall)(baseParams); | ||
| (0, vitest_1.expect)(withDefault?.mode === 'reduce' ? withDefault.suggestedFromAmount : null).toBe('0.58'); | ||
| const withZero = (0, get_ton_shortfall_1.getTonShortfall)({ ...baseParams, safetyMarginNanos: 0n }); | ||
| (0, vitest_1.expect)(withZero?.mode === 'reduce' ? withZero.suggestedFromAmount : null).toBe('0.6'); | ||
| }); | ||
| (0, vitest_1.it)('flips from reduce to topup when a large custom safetyMarginNanos eats the balance', () => { | ||
| // Balance 1 TON, gas 0.3 TON, buffer 0.1 TON. With a 1 TON safety margin, nonSwapReserved becomes 1.4 TON → topup. | ||
| const result = (0, get_ton_shortfall_1.getTonShortfall)({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| safetyMarginNanos: 1000000000n, | ||
| }); | ||
| (0, vitest_1.expect)(result?.mode).toBe('topup'); | ||
| }); | ||
| (0, vitest_1.it)('exports sane default constants', () => { | ||
| (0, vitest_1.expect)(get_ton_shortfall_1.DEFAULT_GAS_BUFFER_NANOS).toBe(100000000n); | ||
| (0, vitest_1.expect)(get_ton_shortfall_1.DEFAULT_SAFETY_MARGIN_NANOS).toBe(20000000n); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export interface DebounceOptions { | ||
| /** | ||
| * An optional AbortSignal to cancel the debounced function. | ||
| */ | ||
| signal?: AbortSignal; | ||
| /** | ||
| * An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both. | ||
| * If `edges` include "leading", the function will be invoked at the start of the delay period. | ||
| * If `edges` include "trailing", the function will be invoked at the end of the delay period. | ||
| * If both "leading" and "trailing" are included, the function will be invoked at both the start and end of the delay period. | ||
| * @default ["trailing"] | ||
| */ | ||
| edges?: Array<'leading' | 'trailing'>; | ||
| } | ||
| export interface DebouncedFunction<F extends (...args: unknown[]) => void> { | ||
| (...args: Parameters<F>): void; | ||
| /** | ||
| * Schedules the execution of the debounced function after the specified debounced delay. | ||
| * This method resets any existing timer, ensuring that the function is only invoked | ||
| * after the delay has elapsed since the last call to the debounced function. | ||
| * It is typically called internally whenever the debounced function is invoked. | ||
| * | ||
| * @returns {void} | ||
| */ | ||
| schedule: () => void; | ||
| /** | ||
| * Cancels any pending execution of the debounced function. | ||
| * This method clears the active timer and resets any stored context or arguments. | ||
| */ | ||
| cancel: () => void; | ||
| /** | ||
| * Immediately invokes the debounced function if there is a pending execution. | ||
| * This method executes the function right away if there is a pending execution. | ||
| */ | ||
| flush: () => void; | ||
| } | ||
| /** | ||
| * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds | ||
| * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` | ||
| * method to cancel any pending execution. | ||
| * | ||
| * @template F - The type of function. | ||
| * @param {F} func - The function to debounce. | ||
| * @param {number} debounceMs - The number of milliseconds to delay. | ||
| * @param {DebounceOptions} options - The options object | ||
| * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. | ||
| * @returns A new debounced function with a `cancel` method. | ||
| * | ||
| * @example | ||
| * const debouncedFunction = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000); | ||
| * | ||
| * // Will log 'Function executed' after 1 second if not called again in that time | ||
| * debouncedFunction(); | ||
| * | ||
| * // Will not log anything as the previous call is canceled | ||
| * debouncedFunction.cancel(); | ||
| * | ||
| * // With AbortSignal | ||
| * const controller = new AbortController(); | ||
| * const signal = controller.signal; | ||
| * const debouncedWithSignal = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000, { signal }); | ||
| * | ||
| * debouncedWithSignal(); | ||
| * | ||
| * // Will cancel the debounced function call | ||
| * controller.abort(); | ||
| */ | ||
| export declare const debounce: <F extends (...args: unknown[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions) => DebouncedFunction<F>; | ||
| //# sourceMappingURL=debounce.d.ts.map |
| {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../src/utils/functions/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI;IACrE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EAC3D,MAAM,CAAC,EACP,YAAY,MAAM,EAClB,oBAAmB,eAAoB,KACxC,iBAAiB,CAAC,CAAC,CA+ErB,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.debounce = void 0; | ||
| /** | ||
| * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds | ||
| * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` | ||
| * method to cancel any pending execution. | ||
| * | ||
| * @template F - The type of function. | ||
| * @param {F} func - The function to debounce. | ||
| * @param {number} debounceMs - The number of milliseconds to delay. | ||
| * @param {DebounceOptions} options - The options object | ||
| * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. | ||
| * @returns A new debounced function with a `cancel` method. | ||
| * | ||
| * @example | ||
| * const debouncedFunction = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000); | ||
| * | ||
| * // Will log 'Function executed' after 1 second if not called again in that time | ||
| * debouncedFunction(); | ||
| * | ||
| * // Will not log anything as the previous call is canceled | ||
| * debouncedFunction.cancel(); | ||
| * | ||
| * // With AbortSignal | ||
| * const controller = new AbortController(); | ||
| * const signal = controller.signal; | ||
| * const debouncedWithSignal = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000, { signal }); | ||
| * | ||
| * debouncedWithSignal(); | ||
| * | ||
| * // Will cancel the debounced function call | ||
| * controller.abort(); | ||
| */ | ||
| const debounce = (func, debounceMs, { signal, edges } = {}) => { | ||
| let pendingThis = undefined; | ||
| let pendingArgs = null; | ||
| const leading = edges != null && edges.includes('leading'); | ||
| const trailing = edges == null || edges.includes('trailing'); | ||
| const invoke = () => { | ||
| if (pendingArgs !== null) { | ||
| func.apply(pendingThis, pendingArgs); | ||
| pendingThis = undefined; | ||
| pendingArgs = null; | ||
| } | ||
| }; | ||
| const onTimerEnd = () => { | ||
| if (trailing) { | ||
| invoke(); | ||
| } | ||
| cancel(); | ||
| }; | ||
| let timeoutId = null; | ||
| const schedule = () => { | ||
| if (timeoutId != null) { | ||
| clearTimeout(timeoutId); | ||
| } | ||
| timeoutId = setTimeout(() => { | ||
| timeoutId = null; | ||
| onTimerEnd(); | ||
| }, debounceMs); | ||
| }; | ||
| const cancelTimer = () => { | ||
| if (timeoutId !== null) { | ||
| clearTimeout(timeoutId); | ||
| timeoutId = null; | ||
| } | ||
| }; | ||
| const cancel = () => { | ||
| cancelTimer(); | ||
| pendingThis = undefined; | ||
| pendingArgs = null; | ||
| }; | ||
| const flush = () => { | ||
| invoke(); | ||
| }; | ||
| const debounced = function (...args) { | ||
| if (signal?.aborted) { | ||
| return; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-this-alias | ||
| pendingThis = this; | ||
| pendingArgs = args; | ||
| const isFirstCall = timeoutId == null; | ||
| schedule(); | ||
| if (leading && isFirstCall) { | ||
| invoke(); | ||
| } | ||
| }; | ||
| debounced.schedule = schedule; | ||
| debounced.cancel = cancel; | ||
| debounced.flush = flush; | ||
| signal?.addEventListener('abort', cancel, { once: true }); | ||
| return debounced; | ||
| }; | ||
| exports.debounce = debounce; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=jetton-info.test.d.ts.map |
| {"version":3,"file":"jetton-info.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/jetton/jetton-info.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const vitest_1 = require("vitest"); | ||
| const jetton_info_1 = require("./jetton-info"); | ||
| (0, vitest_1.describe)('isJettonInfo', () => { | ||
| (0, vitest_1.it)('should return true for a valid JettonInfo object', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ | ||
| address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
| name: 'Tether USD', | ||
| symbol: 'USDT', | ||
| description: 'Tether USD stablecoin', | ||
| })).toBe(true); | ||
| }); | ||
| (0, vitest_1.it)('should return true when optional fields are present', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ | ||
| address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
| name: 'Tether USD', | ||
| symbol: 'USDT', | ||
| description: 'Tether USD stablecoin', | ||
| decimals: 6, | ||
| image: 'https://example.com/image.png', | ||
| uri: 'https://example.com/meta.json', | ||
| })).toBe(true); | ||
| }); | ||
| (0, vitest_1.it)('should return false for null', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)(null)).toBe(false); | ||
| }); | ||
| (0, vitest_1.it)('should return false for primitives', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)('string')).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)(42)).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)(true)).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)(undefined)).toBe(false); | ||
| }); | ||
| (0, vitest_1.it)('should return false when required string fields are missing', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ name: 'Test', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ address: 'EQ...', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ address: 'EQ...', name: 'Test', description: 'desc' })).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ address: 'EQ...', name: 'Test', symbol: 'TST' })).toBe(false); | ||
| }); | ||
| (0, vitest_1.it)('should return false when required fields are not strings', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ address: 1, name: 'Test', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({ address: 'EQ...', name: null, symbol: 'TST', description: 'desc' })).toBe(false); | ||
| }); | ||
| (0, vitest_1.it)('should return false for an empty object', () => { | ||
| (0, vitest_1.expect)((0, jetton_info_1.isJettonInfo)({})).toBe(false); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const isNumber: (value: unknown) => value is number; | ||
| //# sourceMappingURL=is-number.d.ts.map |
| {"version":3,"file":"is-number.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-number.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAUlD,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.isNumber = void 0; | ||
| const isNumber = (value) => { | ||
| if (typeof value !== 'number') { | ||
| return false; | ||
| } | ||
| if (Number.isNaN(value)) { | ||
| return false; | ||
| } | ||
| return Number.isFinite(value); | ||
| }; | ||
| exports.isNumber = isNumber; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { StakingProviderMetadata, Network } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProviderMetadataOptions = { | ||
| network?: Network; | ||
| providerId?: string; | ||
| }; | ||
| export type GetStakingProviderMetadataReturnType = StakingProviderMetadata; | ||
| /** | ||
| * Get staking provider static metadata | ||
| */ | ||
| export declare const getStakingProviderMetadata: (appKit: AppKit, options?: GetStakingProviderMetadataOptions) => GetStakingProviderMetadataReturnType; | ||
| //# sourceMappingURL=get-staking-provider-metadata.d.ts.map |
| {"version":3,"file":"get-staking-provider-metadata.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-provider-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,iCAAiC,GAAG;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,uBAAuB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACnC,QAAQ,MAAM,EACd,UAAS,iCAAsC,KAChD,oCAKF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { resolveNetwork } from '../../utils'; | ||
| /** | ||
| * Get staking provider static metadata | ||
| */ | ||
| export const getStakingProviderMetadata = (appKit, options = {}) => { | ||
| return appKit.stakingManager.getStakingProviderMetadata(resolveNetwork(appKit, options.network), options.providerId); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { StakingProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProviderOptions = { | ||
| /** | ||
| * Provider ID to get. If not provided, returns default provider. | ||
| */ | ||
| id?: string; | ||
| }; | ||
| export type GetStakingProviderReturnType = StakingProviderInterface; | ||
| /** | ||
| * Get staking provider instance | ||
| */ | ||
| export declare const getStakingProvider: (appKit: AppKit, options?: GetStakingProviderOptions) => GetStakingProviderReturnType; | ||
| //# sourceMappingURL=get-staking-provider.d.ts.map |
| {"version":3,"file":"get-staking-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,yBAAyB,GAAG;IACpC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC3B,QAAQ,MAAM,EACd,UAAS,yBAA8B,KACxC,4BAEF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Get staking provider instance | ||
| */ | ||
| export const getStakingProvider = (appKit, options = {}) => { | ||
| return appKit.stakingManager.getProvider(options.id); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface SetDefaultStakingProviderParameters { | ||
| providerId: string; | ||
| } | ||
| export type SetDefaultStakingProviderReturnType = void; | ||
| /** | ||
| * Set the default staking provider. | ||
| * Subsequent quote and stake-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export declare const setDefaultStakingProvider: (appKit: AppKit, parameters: SetDefaultStakingProviderParameters) => SetDefaultStakingProviderReturnType; | ||
| //# sourceMappingURL=set-default-staking-provider.d.ts.map |
| {"version":3,"file":"set-default-staking-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/set-default-staking-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,mCAAmC;IAChD,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,mCAAmC,GAAG,IAAI,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAClC,QAAQ,MAAM,EACd,YAAY,mCAAmC,KAChD,mCAEF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Set the default staking provider. | ||
| * Subsequent quote and stake-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export const setDefaultStakingProvider = (appKit, parameters) => { | ||
| appKit.stakingManager.setDefaultProvider(parameters.providerId); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface WatchStakingProvidersParameters { | ||
| onChange: () => void; | ||
| } | ||
| export type WatchStakingProvidersReturnType = () => void; | ||
| /** | ||
| * Watch for staking providers registration and default provider changes | ||
| */ | ||
| export declare const watchStakingProviders: (appKit: AppKit, parameters: WatchStakingProvidersParameters) => WatchStakingProvidersReturnType; | ||
| //# sourceMappingURL=watch-staking-providers.d.ts.map |
| {"version":3,"file":"watch-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/watch-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,+BAA+B;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,+BAA+B,GAAG,MAAM,IAAI,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAC9B,QAAQ,MAAM,EACd,YAAY,+BAA+B,KAC5C,+BAgBF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Watch for staking providers registration and default provider changes | ||
| */ | ||
| export const watchStakingProviders = (appKit, parameters) => { | ||
| const { onChange } = parameters; | ||
| const onEvent = (event) => { | ||
| if (event.payload.type === 'staking') { | ||
| onChange(); | ||
| } | ||
| }; | ||
| const unsubscribeRegistered = appKit.emitter.on('provider:registered', onEvent); | ||
| const unsubscribeDefaultChanged = appKit.emitter.on('provider:default-changed', onEvent); | ||
| return () => { | ||
| unsubscribeRegistered(); | ||
| unsubscribeDefaultChanged(); | ||
| }; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { SwapProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface GetSwapProviderOptions { | ||
| id?: string; | ||
| } | ||
| export type GetSwapProviderReturnType = SwapProviderInterface; | ||
| export declare const getSwapProvider: (appKit: AppKit, options?: GetSwapProviderOptions) => GetSwapProviderReturnType; | ||
| //# sourceMappingURL=get-swap-provider.d.ts.map |
| {"version":3,"file":"get-swap-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAE9D,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,UAAS,sBAA2B,KAAG,yBAEtF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const getSwapProvider = (appKit, options = {}) => { | ||
| return appKit.swapManager.getProvider(options.id); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { SwapProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetSwapProvidersReturnType = SwapProviderInterface[]; | ||
| /** | ||
| * Get all registered swap providers. | ||
| */ | ||
| export declare const getSwapProviders: (appKit: AppKit) => GetSwapProvidersReturnType; | ||
| //# sourceMappingURL=get-swap-providers.d.ts.map |
| {"version":3,"file":"get-swap-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,EAAE,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,0BAEjD,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Get all registered swap providers. | ||
| */ | ||
| export const getSwapProviders = (appKit) => { | ||
| return appKit.swapManager.getProviders(); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface SetDefaultSwapProviderParameters { | ||
| providerId: string; | ||
| } | ||
| export type SetDefaultSwapProviderReturnType = void; | ||
| /** | ||
| * Set the default swap provider. | ||
| * Subsequent quote and swap-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export declare const setDefaultSwapProvider: (appKit: AppKit, parameters: SetDefaultSwapProviderParameters) => SetDefaultSwapProviderReturnType; | ||
| //# sourceMappingURL=set-default-swap-provider.d.ts.map |
| {"version":3,"file":"set-default-swap-provider.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/set-default-swap-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,gCAAgC;IAC7C,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAC/B,QAAQ,MAAM,EACd,YAAY,gCAAgC,KAC7C,gCAEF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Set the default swap provider. | ||
| * Subsequent quote and swap-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export const setDefaultSwapProvider = (appKit, parameters) => { | ||
| appKit.swapManager.setDefaultProvider(parameters.providerId); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface WatchSwapProvidersParameters { | ||
| onChange: () => void; | ||
| } | ||
| export type WatchSwapProvidersReturnType = () => void; | ||
| /** | ||
| * Watch for new swap providers registration | ||
| */ | ||
| export declare const watchSwapProviders: (appKit: AppKit, parameters: WatchSwapProvidersParameters) => WatchSwapProvidersReturnType; | ||
| //# sourceMappingURL=watch-swap-providers.d.ts.map |
| {"version":3,"file":"watch-swap-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/watch-swap-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,4BAA4B;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,4BAA4B,GAAG,MAAM,IAAI,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC3B,QAAQ,MAAM,EACd,YAAY,4BAA4B,KACzC,4BAeF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Watch for new swap providers registration | ||
| */ | ||
| export const watchSwapProviders = (appKit, parameters) => { | ||
| const { onChange } = parameters; | ||
| const unsubscribeRegistered = appKit.emitter.on('provider:registered', (event) => { | ||
| if (event.payload.type === 'swap') | ||
| onChange(); | ||
| }); | ||
| const unsubscribeDefaultChanged = appKit.emitter.on('provider:default-changed', (event) => { | ||
| if (event.payload.type === 'swap') | ||
| onChange(); | ||
| }); | ||
| return () => { | ||
| unsubscribeRegistered(); | ||
| unsubscribeDefaultChanged(); | ||
| }; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKitCache } from '../types/app-kit-cache'; | ||
| export declare class LruAppKitCache implements AppKitCache { | ||
| private readonly cache; | ||
| constructor(options?: { | ||
| max?: number; | ||
| ttl?: number; | ||
| }); | ||
| get<T = unknown>(key: string): Promise<T | undefined>; | ||
| set(key: string, value: unknown): Promise<void>; | ||
| remove(key: string): Promise<void>; | ||
| clear(): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=lru-app-kit-cache.d.ts.map |
| {"version":3,"file":"lru-app-kit-cache.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/adapters/lru-app-kit-cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,qBAAa,cAAe,YAAW,WAAW;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;gBAEjD,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE;IAO9C,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIrD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { LRUCache } from 'lru-cache'; | ||
| export class LruAppKitCache { | ||
| constructor(options) { | ||
| this.cache = new LRUCache({ | ||
| max: options?.max ?? 1000, | ||
| ttl: options?.ttl ?? 1000 * 60 * 10, | ||
| }); | ||
| } | ||
| async get(key) { | ||
| return this.cache.get(key)?.value; | ||
| } | ||
| async set(key, value) { | ||
| this.cache.set(key, { value }); | ||
| } | ||
| async remove(key) { | ||
| this.cache.delete(key); | ||
| } | ||
| async clear() { | ||
| this.cache.clear(); | ||
| } | ||
| } |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=lru-app-kit-cache.test.d.ts.map |
| {"version":3,"file":"lru-app-kit-cache.test.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/adapters/lru-app-kit-cache.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { LruAppKitCache } from './lru-app-kit-cache'; | ||
| describe('LruAppKitCache', () => { | ||
| it('should return undefined for a missing key', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| expect(await cache.get('missing')).toBeUndefined(); | ||
| }); | ||
| it('should store and retrieve a value', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', 'value'); | ||
| expect(await cache.get('key')).toBe('value'); | ||
| }); | ||
| it('should store and retrieve null', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', null); | ||
| expect(await cache.get('key')).toBeNull(); | ||
| }); | ||
| it('should store and retrieve an object', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| const obj = { address: 'EQabc', name: 'Test', decimals: 6 }; | ||
| await cache.set('key', obj); | ||
| expect(await cache.get('key')).toEqual(obj); | ||
| }); | ||
| it('should overwrite an existing value', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', 'first'); | ||
| await cache.set('key', 'second'); | ||
| expect(await cache.get('key')).toBe('second'); | ||
| }); | ||
| it('should remove a key', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', 'value'); | ||
| await cache.remove('key'); | ||
| expect(await cache.get('key')).toBeUndefined(); | ||
| }); | ||
| it('should clear all keys', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('a', 1); | ||
| await cache.set('b', 2); | ||
| await cache.clear(); | ||
| expect(await cache.get('a')).toBeUndefined(); | ||
| expect(await cache.get('b')).toBeUndefined(); | ||
| }); | ||
| it('should evict entries when max is exceeded', async () => { | ||
| const cache = new LruAppKitCache({ max: 2 }); | ||
| await cache.set('a', 1); | ||
| await cache.set('b', 2); | ||
| await cache.set('c', 3); | ||
| expect(await cache.get('a')).toBeUndefined(); | ||
| expect(await cache.get('b')).toBe(2); | ||
| expect(await cache.get('c')).toBe(3); | ||
| }); | ||
| it('should expire entries after ttl', async () => { | ||
| const cache = new LruAppKitCache({ ttl: 10 }); | ||
| await cache.set('key', 'value'); | ||
| await new Promise((resolve) => setTimeout(resolve, 20)); | ||
| expect(await cache.get('key')).toBeUndefined(); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export { LruAppKitCache } from './adapters/lru-app-kit-cache'; | ||
| export { getCacheKey } from './utils/get-cache-key'; | ||
| export type { AppKitCache } from './types/app-kit-cache'; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export { LruAppKitCache } from './adapters/lru-app-kit-cache'; | ||
| export { getCacheKey } from './utils/get-cache-key'; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export interface AppKitCache { | ||
| get<T = unknown>(key: string): Promise<T | undefined>; | ||
| set(key: string, value: unknown): Promise<void>; | ||
| remove(key: string): Promise<void>; | ||
| clear(): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=app-kit-cache.d.ts.map |
| {"version":3,"file":"app-kit-cache.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/types/app-kit-cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACtD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const getCacheKey: (prefix: string) => (...params: string[]) => string; | ||
| //# sourceMappingURL=get-cache-key.d.ts.map |
| {"version":3,"file":"get-cache-key.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/utils/get-cache-key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,WAAW,GACnB,QAAQ,MAAM,MACd,GAAG,QAAQ,MAAM,EAAE,KAAG,MACY,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const getCacheKey = (prefix) => (...params) => `${prefix}:${params.join(':')}`; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=get-cache-key.test.d.ts.map |
| {"version":3,"file":"get-cache-key.test.d.ts","sourceRoot":"","sources":["../../../../../src/core/cache/utils/get-cache-key.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { getCacheKey } from './get-cache-key'; | ||
| describe('getCacheKey', () => { | ||
| it('should build a key with a single param', () => { | ||
| const key = getCacheKey('jetton-info'); | ||
| expect(key('EQabc')).toBe('jetton-info:EQabc'); | ||
| }); | ||
| it('should build a key with multiple params', () => { | ||
| const key = getCacheKey('jetton-info'); | ||
| expect(key('mainnet', 'EQabc')).toBe('jetton-info:mainnet:EQabc'); | ||
| }); | ||
| it('should build a key with no params', () => { | ||
| const key = getCacheKey('jetton-info'); | ||
| expect(key()).toBe('jetton-info:'); | ||
| }); | ||
| it('should scope keys independently per prefix', () => { | ||
| const infoKey = getCacheKey('jetton-info'); | ||
| const walletKey = getCacheKey('jetton-wallet'); | ||
| expect(infoKey('EQabc')).not.toBe(walletKey('EQabc')); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { UserFriendlyAddress } from '../../types/primitives'; | ||
| export declare const isValidAddress: (address: unknown) => address is string; | ||
| export declare const isFriendlyTonAddress: (address: unknown) => address is UserFriendlyAddress; | ||
| //# sourceMappingURL=is-valid-address.d.ts.map |
| {"version":3,"file":"is-valid-address.d.ts","sourceRoot":"","sources":["../../../../src/utils/address/is-valid-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,MAY5D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,mBAYlE,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| import { isString } from '../predicate/is-string'; | ||
| export const isValidAddress = (address) => { | ||
| if (typeof address !== 'string') { | ||
| return false; | ||
| } | ||
| try { | ||
| Address.parse(address); | ||
| } | ||
| catch (_) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| export const isFriendlyTonAddress = (address) => { | ||
| if (!isString(address)) { | ||
| return false; | ||
| } | ||
| try { | ||
| Address.parseFriendly(address); | ||
| } | ||
| catch (_) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| export declare const toBounceableAddress: (address?: Address | string | null) => string; | ||
| export declare const tryToBounceableAddress: (address?: Address | string | null) => string | undefined; | ||
| //# sourceMappingURL=to-bounceble-address.d.ts.map |
| {"version":3,"file":"to-bounceble-address.d.ts","sourceRoot":"","sources":["../../../../src/utils/address/to-bounceble-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,mBAAmB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAcvE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,SAMnF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| import { getErrorMessage } from '../errors/get-error-message'; | ||
| export const toBounceableAddress = (address) => { | ||
| if (!address) { | ||
| throw new Error(`Address is empty`); | ||
| } | ||
| if (address instanceof Address) { | ||
| return address.toString({ bounceable: true }); | ||
| } | ||
| try { | ||
| return Address.parse(address).toString({ bounceable: true }); | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Can not convert to bounceble address from "${address}". Error: ${getErrorMessage(e)}`); | ||
| } | ||
| }; | ||
| export const tryToBounceableAddress = (address) => { | ||
| try { | ||
| return toBounceableAddress(address); | ||
| } | ||
| catch { | ||
| return undefined; | ||
| } | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| export declare const toNonBounceableAddress: (address?: Address | string | null) => string; | ||
| export declare const tryToNonBounceableAddress: (address?: Address | string | null) => string | undefined; | ||
| //# sourceMappingURL=to-non-bounceble-address.d.ts.map |
| {"version":3,"file":"to-non-bounceble-address.d.ts","sourceRoot":"","sources":["../../../../src/utils/address/to-non-bounceble-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,sBAAsB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAc1E,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,UAAU,OAAO,GAAG,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,SAMtF,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| import { getErrorMessage } from '../errors/get-error-message'; | ||
| export const toNonBounceableAddress = (address) => { | ||
| if (!address) { | ||
| throw new Error(`Address is empty`); | ||
| } | ||
| if (address instanceof Address) { | ||
| return address.toString({ bounceable: false }); | ||
| } | ||
| try { | ||
| return Address.parse(address).toString({ bounceable: false }); | ||
| } | ||
| catch (e) { | ||
| throw new Error(`Can not convert to non-bounceable address from "${address}". Error: ${getErrorMessage(e)}`); | ||
| } | ||
| }; | ||
| export const tryToNonBounceableAddress = (address) => { | ||
| try { | ||
| return toNonBounceableAddress(address); | ||
| } | ||
| catch { | ||
| return undefined; | ||
| } | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Calculates the fiat value of a token amount. | ||
| * Returns null when rate is unavailable or amount is zero/invalid. | ||
| */ | ||
| export declare function calcFiatValue(amount: string, rate: string | undefined): string; | ||
| //# sourceMappingURL=calc-fiat-value.d.ts.map |
| {"version":3,"file":"calc-fiat-value.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/calc-fiat-value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK9E"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Calculates the fiat value of a token amount. | ||
| * Returns null when rate is unavailable or amount is zero/invalid. | ||
| */ | ||
| export function calcFiatValue(amount, rate) { | ||
| if (!rate) | ||
| return '0'; | ||
| const num = parseFloat(amount); | ||
| if (!num || num <= 0) | ||
| return '0'; | ||
| return Number((num * parseFloat(rate)).toFixed(10)).toString(); | ||
| } |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=calc-fiat-value.test.d.ts.map |
| {"version":3,"file":"calc-fiat-value.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/calc-fiat-value.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { calcFiatValue } from './calc-fiat-value'; | ||
| describe('calcFiatValue', () => { | ||
| it('should return 0 when rate is undefined', () => { | ||
| expect(calcFiatValue('100', undefined)).toBe('0'); | ||
| }); | ||
| it('should return 0 when rate is 0', () => { | ||
| expect(calcFiatValue('100', '0')).toBe('0'); | ||
| }); | ||
| it('should return 0 when amount is 0', () => { | ||
| expect(calcFiatValue('0', '1.5')).toBe('0'); | ||
| }); | ||
| it('should return 0 when amount is negative', () => { | ||
| expect(calcFiatValue('-10', '1.5')).toBe('0'); | ||
| }); | ||
| it('should return 0 when amount is not a valid number', () => { | ||
| expect(calcFiatValue('abc', '1.5')).toBe('0'); | ||
| expect(calcFiatValue('', '1.5')).toBe('0'); | ||
| }); | ||
| it('should calculate fiat value without rounding', () => { | ||
| expect(calcFiatValue('100', '1.5')).toBe('150'); | ||
| expect(calcFiatValue('1', '0.001')).toBe('0.001'); | ||
| expect(calcFiatValue('3', '1.005')).toBe('3.015'); | ||
| }); | ||
| it('should handle decimal amounts without rounding', () => { | ||
| expect(calcFiatValue('0.5', '2')).toBe('1'); | ||
| expect(calcFiatValue('1.23456', '100')).toBe('123.456'); | ||
| expect(calcFiatValue('2.996876', '1')).toBe('2.996876'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const formatLargeValue: (amount: string, decimals?: number, minimumFractionDigits?: number) => string; | ||
| //# sourceMappingURL=format-large-value.d.ts.map |
| {"version":3,"file":"format-large-value.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/format-large-value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,WAAU,MAAU,EAAE,wBAAuB,MAAU,KAAG,MAkC1G,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const formatLargeValue = (amount, decimals = 2, minimumFractionDigits = 0) => { | ||
| const cleanAmount = amount.toString().replace(/\s/g, ''); | ||
| const intPart = cleanAmount.split('.')[0] || '0'; | ||
| // value > 100 000 000 000 000 => 100 T | ||
| if (intPart.length > 12) { | ||
| const value = Number(intPart.slice(0, -10)) / 100; | ||
| return `${value.toLocaleString('en-US')}T`; | ||
| } | ||
| // value > 100 000 000 000 => 100 B | ||
| if (intPart.length > 9) { | ||
| const value = Number(intPart.slice(0, -7)) / 100; | ||
| return `${value.toLocaleString('en-US')}B`; | ||
| } | ||
| // value > 10 000 000 => 10 M | ||
| if (intPart.length > 6) { | ||
| const value = Number(intPart.slice(0, -4)) / 100; | ||
| return `${value.toLocaleString('en-US')}M`; | ||
| } | ||
| const value = parseFloat(cleanAmount); | ||
| if (isNaN(value)) { | ||
| return '0'; | ||
| } | ||
| const factor = Math.pow(10, decimals); | ||
| const truncated = Math.floor(value * factor) / factor; | ||
| return truncated.toLocaleString('en-US', { | ||
| minimumFractionDigits, | ||
| maximumFractionDigits: decimals, | ||
| }); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=format-large-value.test.d.ts.map |
| {"version":3,"file":"format-large-value.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/format-large-value.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { formatLargeValue } from './format-large-value'; | ||
| describe('formatLargeValue', () => { | ||
| it('should format trillion values', () => { | ||
| expect(formatLargeValue('1000000000000')).toBe('1T'); | ||
| expect(formatLargeValue('1230000000000')).toBe('1.23T'); | ||
| expect(formatLargeValue('12345678901234')).toBe('12.34T'); | ||
| }); | ||
| it('should format billion values', () => { | ||
| expect(formatLargeValue('1000000000')).toBe('1B'); | ||
| expect(formatLargeValue('1230000000')).toBe('1.23B'); | ||
| }); | ||
| it('should format million values', () => { | ||
| expect(formatLargeValue('1000000')).toBe('1M'); | ||
| expect(formatLargeValue('1230000')).toBe('1.23M'); | ||
| }); | ||
| it('should format smaller values using toLocaleString', () => { | ||
| expect(formatLargeValue('1234.56')).toBe('1,234.56'); | ||
| expect(formatLargeValue('100')).toBe('100'); | ||
| expect(formatLargeValue('0')).toBe('0'); | ||
| }); | ||
| it('should handle spaces and formatting', () => { | ||
| expect(formatLargeValue('1 000 000')).toBe('1M'); | ||
| }); | ||
| it('should respect decimals for small values', () => { | ||
| expect(formatLargeValue('1234.5678', 4)).toBe('1,234.5678'); | ||
| expect(formatLargeValue('1234.5678', 2)).toBe('1,234.56'); | ||
| }); | ||
| it('should round down (floor) fractional values', () => { | ||
| expect(formatLargeValue('2.996848', 2)).toBe('2.99'); | ||
| expect(formatLargeValue('2.996848', 6)).toBe('2.996848'); | ||
| expect(formatLargeValue('0.9999', 2)).toBe('0.99'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const truncateDecimals: (value: string | number, maxDecimals: number) => string; | ||
| //# sourceMappingURL=truncate-decimals.d.ts.map |
| {"version":3,"file":"truncate-decimals.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/truncate-decimals.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,GAAG,MAAM,EAAE,aAAa,MAAM,KAAG,MAkB9E,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Converts a number to a plain decimal string, expanding scientific notation | ||
| * like "1.23e-9" into "0.00000000123". | ||
| */ | ||
| const toPlainDecimalString = (num) => { | ||
| const str = num.toString(); | ||
| if (!str.includes('e') && !str.includes('E')) | ||
| return str; | ||
| const [base = '0', exponent = '0'] = str.split(/[eE]/); | ||
| const exp = Number(exponent); | ||
| const isNegative = base.startsWith('-'); | ||
| const absBase = isNegative ? base.slice(1) : base; | ||
| const [intPart, decPart = ''] = absBase.split('.'); | ||
| let result; | ||
| if (exp < 0) { | ||
| result = '0.' + '0'.repeat(Math.abs(exp) - 1) + intPart + decPart; | ||
| } | ||
| else { | ||
| const addZeros = exp - decPart.length; | ||
| if (addZeros >= 0) { | ||
| result = intPart + decPart + '0'.repeat(addZeros); | ||
| } | ||
| else { | ||
| result = intPart + decPart.slice(0, exp) + '.' + decPart.slice(exp); | ||
| } | ||
| } | ||
| return isNegative ? '-' + result : result; | ||
| }; | ||
| export const truncateDecimals = (value, maxDecimals) => { | ||
| let strValue; | ||
| if (typeof value === 'number') { | ||
| strValue = toPlainDecimalString(value); | ||
| } | ||
| else if (value.includes('e') || value.includes('E')) { | ||
| const num = Number(value); | ||
| if (Number.isNaN(num)) | ||
| return value; | ||
| strValue = toPlainDecimalString(num); | ||
| } | ||
| else { | ||
| strValue = value; | ||
| } | ||
| const dotIndex = strValue.indexOf('.'); | ||
| if (dotIndex === -1) | ||
| return strValue; | ||
| const result = strValue.slice(0, dotIndex + 1 + maxDecimals); | ||
| return result.endsWith('.') ? result.slice(0, -1) : result; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=truncate-decimals.test.d.ts.map |
| {"version":3,"file":"truncate-decimals.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/amount/truncate-decimals.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { truncateDecimals } from './truncate-decimals'; | ||
| describe('truncateDecimals', () => { | ||
| it('should return integers unchanged', () => { | ||
| expect(truncateDecimals('123', 2)).toBe('123'); | ||
| expect(truncateDecimals('0', 5)).toBe('0'); | ||
| }); | ||
| it('should truncate decimals exceeding maxDecimals', () => { | ||
| expect(truncateDecimals('1.23456', 2)).toBe('1.23'); | ||
| expect(truncateDecimals('1.23456', 4)).toBe('1.2345'); | ||
| expect(truncateDecimals('0.123456789', 9)).toBe('0.123456789'); | ||
| expect(truncateDecimals('0.1234567890', 9)).toBe('0.123456789'); | ||
| }); | ||
| it('should return value unchanged when decimals are within limit', () => { | ||
| expect(truncateDecimals('1.23', 5)).toBe('1.23'); | ||
| expect(truncateDecimals('1.2', 2)).toBe('1.2'); | ||
| expect(truncateDecimals('5.0', 1)).toBe('5.0'); | ||
| }); | ||
| it('should handle maxDecimals of 0', () => { | ||
| expect(truncateDecimals('1.999', 0)).toBe('1'); | ||
| expect(truncateDecimals('42.1', 0)).toBe('42'); | ||
| }); | ||
| it('should strip trailing dot', () => { | ||
| expect(truncateDecimals('1.', 3)).toBe('1'); | ||
| expect(truncateDecimals('1.', 0)).toBe('1'); | ||
| }); | ||
| it('should handle empty string', () => { | ||
| expect(truncateDecimals('', 2)).toBe(''); | ||
| }); | ||
| it('should handle number input', () => { | ||
| expect(truncateDecimals(1.23456, 2)).toBe('1.23'); | ||
| expect(truncateDecimals(42, 3)).toBe('42'); | ||
| expect(truncateDecimals(0.1, 5)).toBe('0.1'); | ||
| expect(truncateDecimals(3.14159, 0)).toBe('3'); | ||
| }); | ||
| it('should handle scientific notation strings', () => { | ||
| expect(truncateDecimals('1.095492908209088e-9', 9)).toBe('0.000000001'); | ||
| expect(truncateDecimals('5e-7', 9)).toBe('0.0000005'); | ||
| }); | ||
| it('should handle numbers that produce scientific notation', () => { | ||
| const tiny = 0.000000001 * 1.095492908209088; // 1.095492908209088e-9 | ||
| expect(truncateDecimals(tiny, 9)).toBe('0.000000001'); | ||
| }); | ||
| it('should handle negative numbers and negative scientific notation', () => { | ||
| expect(truncateDecimals('-1.23456', 2)).toBe('-1.23'); | ||
| expect(truncateDecimals('-5e-7', 9)).toBe('-0.0000005'); | ||
| expect(truncateDecimals(-0.0000005, 9)).toBe('-0.0000005'); | ||
| }); | ||
| it('should handle scientific notation with positive exponents', () => { | ||
| expect(truncateDecimals('1.2345e2', 2)).toBe('123.45'); | ||
| expect(truncateDecimals('1.2345e+2', 0)).toBe('123'); | ||
| expect(truncateDecimals('5.2e9', 0)).toBe('5200000000'); | ||
| expect(truncateDecimals('-1.23e+9', 0)).toBe('-1230000000'); | ||
| }); | ||
| it('should handle extreme scientific exponents', () => { | ||
| expect(truncateDecimals('1e-100', 100)).toBe('0.' + '0'.repeat(99) + '1'); | ||
| expect(truncateDecimals('1e21', 0)).toBe('1000000000000000000000'); | ||
| }); | ||
| it('should handle NaN and Infinity', () => { | ||
| expect(truncateDecimals(NaN, 2)).toBe('NaN'); | ||
| expect(truncateDecimals(Infinity, 2)).toBe('Infinity'); | ||
| expect(truncateDecimals(-Infinity, 2)).toBe('-Infinity'); | ||
| expect(truncateDecimals('NaN', 2)).toBe('NaN'); | ||
| expect(truncateDecimals('Infinity', 2)).toBe('Infinity'); | ||
| }); | ||
| it('should handle native numbers with e (scientific notation)', () => { | ||
| expect(truncateDecimals(1e-10, 10)).toBe('0.0000000001'); | ||
| expect(truncateDecimals(1.23e-8, 10)).toBe('0.0000000123'); | ||
| expect(truncateDecimals(-5.43e-7, 9)).toBe('-0.000000543'); | ||
| expect(truncateDecimals(5.2e9, 0)).toBe('5200000000'); | ||
| expect(truncateDecimals(-1.23e9, 0)).toBe('-1230000000'); | ||
| expect(truncateDecimals(1e21, 0)).toBe('1000000000000000000000'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Default TON reserve subtracted from balance when computing the max spendable amount | ||
| * for a native TON operation — leaves room for network fees. 0.1 TON. | ||
| */ | ||
| export declare const DEFAULT_TON_FEE_RESERVE_NANOS = 100000000n; | ||
| export interface CalcMaxSpendableParams { | ||
| /** User's balance of `token`, as a decimal string. */ | ||
| balance: string; | ||
| /** The token the user is going to spend. */ | ||
| token: { | ||
| address: string; | ||
| decimals: number; | ||
| }; | ||
| /** | ||
| * TON reserve (in nanos) subtracted from balance when the token is native TON. | ||
| * Ignored for jettons. Defaults to {@link DEFAULT_TON_FEE_RESERVE_NANOS}. | ||
| */ | ||
| feeReserveNanos?: bigint; | ||
| } | ||
| /** | ||
| * Compute the max spendable amount a user can place into an input when they click MAX. | ||
| * For native TON — subtracts a fixed reserve so the user still has room for network fees. | ||
| * For jettons — returns the full balance (gas is paid from TON separately). | ||
| */ | ||
| export declare const calcMaxSpendable: ({ balance, token, feeReserveNanos, }: CalcMaxSpendableParams) => string; | ||
| //# sourceMappingURL=calc-max-spendable.d.ts.map |
| {"version":3,"file":"calc-max-spendable.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/calc-max-spendable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,eAAO,MAAM,6BAA6B,aAAe,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACnC,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,sCAI9B,sBAAsB,KAAG,MAM3B,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { formatUnits, parseUnits } from '@ton/walletkit'; | ||
| /** | ||
| * Default TON reserve subtracted from balance when computing the max spendable amount | ||
| * for a native TON operation — leaves room for network fees. 0.1 TON. | ||
| */ | ||
| export const DEFAULT_TON_FEE_RESERVE_NANOS = 100000000n; | ||
| /** | ||
| * Compute the max spendable amount a user can place into an input when they click MAX. | ||
| * For native TON — subtracts a fixed reserve so the user still has room for network fees. | ||
| * For jettons — returns the full balance (gas is paid from TON separately). | ||
| */ | ||
| export const calcMaxSpendable = ({ balance, token, feeReserveNanos = DEFAULT_TON_FEE_RESERVE_NANOS, }) => { | ||
| if (token.address !== 'ton') | ||
| return balance; | ||
| const balanceNanos = parseUnits(balance, token.decimals); | ||
| const reducedNanos = balanceNanos > feeReserveNanos ? balanceNanos - feeReserveNanos : 0n; | ||
| return formatUnits(reducedNanos, token.decimals); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=calc-max-spendable.test.d.ts.map |
| {"version":3,"file":"calc-max-spendable.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/calc-max-spendable.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { calcMaxSpendable, DEFAULT_TON_FEE_RESERVE_NANOS } from './calc-max-spendable'; | ||
| const TON = { address: 'ton', decimals: 9 }; | ||
| const JETTON = { address: 'EQA_jetton', decimals: 6 }; | ||
| describe('calcMaxSpendable', () => { | ||
| it('returns balance minus the TON fee reserve for native TON', () => { | ||
| // 1 TON balance, default reserve 0.1 TON → 0.9 TON spendable. | ||
| expect(calcMaxSpendable({ balance: '1', token: TON })).toBe('0.9'); | ||
| }); | ||
| it('returns the full balance for a jetton (no reserve)', () => { | ||
| expect(calcMaxSpendable({ balance: '100', token: JETTON })).toBe('100'); | ||
| }); | ||
| it('clamps to zero when balance is below the reserve', () => { | ||
| expect(calcMaxSpendable({ balance: '0.05', token: TON })).toBe('0'); | ||
| }); | ||
| it('clamps to zero when balance equals the reserve', () => { | ||
| expect(calcMaxSpendable({ balance: '0.1', token: TON })).toBe('0'); | ||
| }); | ||
| it('respects a custom feeReserveNanos', () => { | ||
| // 1 TON balance, 0.5 TON reserve → 0.5 TON spendable. | ||
| expect(calcMaxSpendable({ balance: '1', token: TON, feeReserveNanos: 500000000n })).toBe('0.5'); | ||
| }); | ||
| it('ignores feeReserveNanos for jettons', () => { | ||
| expect(calcMaxSpendable({ balance: '100', token: JETTON, feeReserveNanos: 999999999999n })).toBe('100'); | ||
| }); | ||
| it('exports a sane default reserve', () => { | ||
| expect(DEFAULT_TON_FEE_RESERVE_NANOS).toBe(100000000n); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** Default extra TON buffer added on top of built transaction outflow when checking balance before sending. */ | ||
| export declare const DEFAULT_GAS_BUFFER_NANOS = 100000000n; | ||
| /** | ||
| * Default extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Covers quote/gas drift between the current built tx and the one that will actually be sent | ||
| * after the amount changes. 0.02 TON. | ||
| */ | ||
| export declare const DEFAULT_SAFETY_MARGIN_NANOS = 20000000n; | ||
| export type TonShortfall = { | ||
| mode: 'reduce'; | ||
| requiredNanos: bigint; | ||
| suggestedFromAmount: string; | ||
| } | { | ||
| mode: 'topup'; | ||
| requiredNanos: bigint; | ||
| suggestedFromAmount: ''; | ||
| }; | ||
| export interface GetTonShortfallParams { | ||
| /** Messages of the built transaction. Each `amount` is the TON value in nanos attached to the message. */ | ||
| messages: Array<{ | ||
| amount: string; | ||
| }>; | ||
| /** User's current TON balance as a decimal string (same format `formatUnits(balance, 9)` returns). */ | ||
| tonBalance: string | undefined; | ||
| /** The outgoing token — `{ address: 'ton' }` when the user spends TON, otherwise a jetton. */ | ||
| fromToken: { | ||
| address: string; | ||
| }; | ||
| /** Amount the user intends to spend in `fromToken` units, as a decimal string. */ | ||
| fromAmount: string; | ||
| /** | ||
| * Extra TON headroom on top of built-tx outflow when checking balance before sending. | ||
| * Defaults to {@link DEFAULT_GAS_BUFFER_NANOS}. | ||
| */ | ||
| gasBufferNanos?: bigint; | ||
| /** | ||
| * Extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Defaults to {@link DEFAULT_SAFETY_MARGIN_NANOS}. | ||
| */ | ||
| safetyMarginNanos?: bigint; | ||
| } | ||
| /** | ||
| * Check whether the user's TON balance covers the built transaction. | ||
| * - Returns `null` if the balance is sufficient. | ||
| * - Returns `{ mode: 'reduce', ... }` with a smaller suggested `fromAmount` when `fromToken` is TON | ||
| * and the balance is enough to cover at least gas (user can fix it by reducing the amount). | ||
| * - Returns `{ mode: 'topup', ... }` when `fromToken` is a jetton (reducing jetton amount won't free up TON gas), | ||
| * or when `fromToken` is TON but the balance can't even cover gas (reducing won't help — user must top up). | ||
| */ | ||
| export declare const getTonShortfall: ({ messages, tonBalance, fromToken, fromAmount, gasBufferNanos, safetyMarginNanos, }: GetTonShortfallParams) => TonShortfall | undefined; | ||
| //# sourceMappingURL=get-ton-shortfall.d.ts.map |
| {"version":3,"file":"get-ton-shortfall.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/get-ton-shortfall.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,+GAA+G;AAC/G,eAAO,MAAM,wBAAwB,aAAe,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,YAAc,CAAC;AAEvD,MAAM,MAAM,YAAY,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,EAAE,CAAA;CAAE,CAAC;AAExE,MAAM,WAAW,qBAAqB;IAClC,0GAA0G;IAC1G,QAAQ,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpC,sGAAsG;IACtG,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,8FAA8F;IAC9F,SAAS,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,qFAO7B,qBAAqB,KAAG,YAAY,GAAG,SAqBzC,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { formatUnits, parseUnits } from '@ton/walletkit'; | ||
| /** Default extra TON buffer added on top of built transaction outflow when checking balance before sending. */ | ||
| export const DEFAULT_GAS_BUFFER_NANOS = 100000000n; | ||
| /** | ||
| * Default extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Covers quote/gas drift between the current built tx and the one that will actually be sent | ||
| * after the amount changes. 0.02 TON. | ||
| */ | ||
| export const DEFAULT_SAFETY_MARGIN_NANOS = 20000000n; | ||
| /** | ||
| * Check whether the user's TON balance covers the built transaction. | ||
| * - Returns `null` if the balance is sufficient. | ||
| * - Returns `{ mode: 'reduce', ... }` with a smaller suggested `fromAmount` when `fromToken` is TON | ||
| * and the balance is enough to cover at least gas (user can fix it by reducing the amount). | ||
| * - Returns `{ mode: 'topup', ... }` when `fromToken` is a jetton (reducing jetton amount won't free up TON gas), | ||
| * or when `fromToken` is TON but the balance can't even cover gas (reducing won't help — user must top up). | ||
| */ | ||
| export const getTonShortfall = ({ messages, tonBalance, fromToken, fromAmount, gasBufferNanos = DEFAULT_GAS_BUFFER_NANOS, safetyMarginNanos = DEFAULT_SAFETY_MARGIN_NANOS, }) => { | ||
| const totalOutNanos = messages.reduce((acc, m) => acc + BigInt(m.amount), 0n); | ||
| const requiredNanos = totalOutNanos + gasBufferNanos; | ||
| const tonBalanceNanos = tonBalance ? parseUnits(tonBalance, 9) : 0n; | ||
| if (tonBalanceNanos >= requiredNanos) | ||
| return; | ||
| if (fromToken.address === 'ton') { | ||
| const gasOnlyNanos = totalOutNanos - parseUnits(fromAmount, 9); | ||
| const nonSwapReservedNanos = gasOnlyNanos + gasBufferNanos + safetyMarginNanos; | ||
| // Balance can't cover even gas for a minimal outgoing tx — reducing the amount won't help. | ||
| if (tonBalanceNanos <= nonSwapReservedNanos) { | ||
| return { mode: 'topup', requiredNanos, suggestedFromAmount: '' }; | ||
| } | ||
| const suggestedFromAmount = formatUnits(tonBalanceNanos - nonSwapReservedNanos, 9); | ||
| return { mode: 'reduce', requiredNanos, suggestedFromAmount }; | ||
| } | ||
| return { mode: 'topup', requiredNanos, suggestedFromAmount: '' }; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=get-ton-shortfall.test.d.ts.map |
| {"version":3,"file":"get-ton-shortfall.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/balance/get-ton-shortfall.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { DEFAULT_GAS_BUFFER_NANOS, DEFAULT_SAFETY_MARGIN_NANOS, getTonShortfall } from './get-ton-shortfall'; | ||
| const TON = { address: 'ton' }; | ||
| const JETTON = { address: 'EQA_jetton_address' }; | ||
| // Helper — convert a decimal string of TON to nanos as a string (for message amounts). | ||
| const toNanos = (ton) => BigInt(Math.round(Number(ton) * 1e9)).toString(); | ||
| describe('getTonShortfall', () => { | ||
| it('returns undefined when TON balance covers the built transaction', () => { | ||
| // Swap 1 TON, total tx outflow 1.3 TON (1 TON swap + 0.3 TON attached gas), balance 2 TON. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '2', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| expect(result).toBeUndefined(); | ||
| }); | ||
| it('returns topup when fromToken is a jetton and TON balance is below outflow + buffer', () => { | ||
| // Jetton swap, tx needs 0.05 TON for gas, user has 0 TON. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('0.05') }], | ||
| tonBalance: '0', | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| expect(result).toEqual({ | ||
| mode: 'topup', | ||
| requiredNanos: 50000000n + DEFAULT_GAS_BUFFER_NANOS, | ||
| suggestedFromAmount: '', | ||
| }); | ||
| }); | ||
| it('returns reduce for TON-from when balance covers gas but not full amount', () => { | ||
| // User wants 1 TON swap, total outflow 1.3 TON, has 1 TON. Gas only = 0.3 TON. | ||
| // Balance (1) > nonSwapReserved (0.3 gas + 0.1 buffer + 0.02 safety = 0.42) → reduce mode. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| expect(result?.mode).toBe('reduce'); | ||
| if (result?.mode !== 'reduce') | ||
| return; | ||
| // Suggested = 1 - 0.42 = 0.58 | ||
| expect(result.suggestedFromAmount).toBe('0.58'); | ||
| expect(result.requiredNanos).toBe(1300000000n + DEFAULT_GAS_BUFFER_NANOS); | ||
| }); | ||
| it('returns topup for TON-from when balance cannot cover even gas (reducing would not help)', () => { | ||
| // User wants 1 TON swap, total outflow 1.3 TON → gas = 0.3 TON. Balance 0.2 TON. | ||
| // nonSwapReserved = 0.3 + 0.1 buffer + 0.02 safety = 0.42 TON → balance (0.2) <= 0.42 → topup. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '0.2', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| expect(result).toEqual({ | ||
| mode: 'topup', | ||
| requiredNanos: 1300000000n + DEFAULT_GAS_BUFFER_NANOS, | ||
| suggestedFromAmount: '', | ||
| }); | ||
| }); | ||
| it('treats an undefined tonBalance as zero', () => { | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('0.05') }], | ||
| tonBalance: undefined, | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| expect(result?.mode).toBe('topup'); | ||
| }); | ||
| it('sums amounts across multiple messages', () => { | ||
| // Two messages attaching 0.6 TON each → totalOut = 1.2 TON. Balance 1 TON → shortfall. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('0.6') }, { amount: toNanos('0.6') }], | ||
| tonBalance: '1', | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| expect(result?.mode).toBe('topup'); | ||
| expect(result?.requiredNanos).toBe(1200000000n + DEFAULT_GAS_BUFFER_NANOS); | ||
| }); | ||
| it('respects a custom gasBufferNanos', () => { | ||
| const baseParams = { | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1.3', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }; | ||
| // With the default buffer (0.1 TON), balance 1.3 is insufficient (needs 1.4). | ||
| expect(getTonShortfall(baseParams)?.mode).toBe('reduce'); | ||
| // With a zero buffer, 1.3 TON balance covers the 1.3 TON outflow exactly. | ||
| expect(getTonShortfall({ ...baseParams, gasBufferNanos: 0n })).toBeUndefined(); | ||
| }); | ||
| it('respects a custom safetyMarginNanos in the reduce branch', () => { | ||
| // Default margin: suggested = balance - gas - buffer - 0.02 = 1 - 0.3 - 0.1 - 0.02 = 0.58 | ||
| // Zero margin: suggested = balance - gas - buffer = 1 - 0.3 - 0.1 = 0.6 | ||
| const baseParams = { | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }; | ||
| const withDefault = getTonShortfall(baseParams); | ||
| expect(withDefault?.mode === 'reduce' ? withDefault.suggestedFromAmount : null).toBe('0.58'); | ||
| const withZero = getTonShortfall({ ...baseParams, safetyMarginNanos: 0n }); | ||
| expect(withZero?.mode === 'reduce' ? withZero.suggestedFromAmount : null).toBe('0.6'); | ||
| }); | ||
| it('flips from reduce to topup when a large custom safetyMarginNanos eats the balance', () => { | ||
| // Balance 1 TON, gas 0.3 TON, buffer 0.1 TON. With a 1 TON safety margin, nonSwapReserved becomes 1.4 TON → topup. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| safetyMarginNanos: 1000000000n, | ||
| }); | ||
| expect(result?.mode).toBe('topup'); | ||
| }); | ||
| it('exports sane default constants', () => { | ||
| expect(DEFAULT_GAS_BUFFER_NANOS).toBe(100000000n); | ||
| expect(DEFAULT_SAFETY_MARGIN_NANOS).toBe(20000000n); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export interface DebounceOptions { | ||
| /** | ||
| * An optional AbortSignal to cancel the debounced function. | ||
| */ | ||
| signal?: AbortSignal; | ||
| /** | ||
| * An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both. | ||
| * If `edges` include "leading", the function will be invoked at the start of the delay period. | ||
| * If `edges` include "trailing", the function will be invoked at the end of the delay period. | ||
| * If both "leading" and "trailing" are included, the function will be invoked at both the start and end of the delay period. | ||
| * @default ["trailing"] | ||
| */ | ||
| edges?: Array<'leading' | 'trailing'>; | ||
| } | ||
| export interface DebouncedFunction<F extends (...args: unknown[]) => void> { | ||
| (...args: Parameters<F>): void; | ||
| /** | ||
| * Schedules the execution of the debounced function after the specified debounced delay. | ||
| * This method resets any existing timer, ensuring that the function is only invoked | ||
| * after the delay has elapsed since the last call to the debounced function. | ||
| * It is typically called internally whenever the debounced function is invoked. | ||
| * | ||
| * @returns {void} | ||
| */ | ||
| schedule: () => void; | ||
| /** | ||
| * Cancels any pending execution of the debounced function. | ||
| * This method clears the active timer and resets any stored context or arguments. | ||
| */ | ||
| cancel: () => void; | ||
| /** | ||
| * Immediately invokes the debounced function if there is a pending execution. | ||
| * This method executes the function right away if there is a pending execution. | ||
| */ | ||
| flush: () => void; | ||
| } | ||
| /** | ||
| * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds | ||
| * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` | ||
| * method to cancel any pending execution. | ||
| * | ||
| * @template F - The type of function. | ||
| * @param {F} func - The function to debounce. | ||
| * @param {number} debounceMs - The number of milliseconds to delay. | ||
| * @param {DebounceOptions} options - The options object | ||
| * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. | ||
| * @returns A new debounced function with a `cancel` method. | ||
| * | ||
| * @example | ||
| * const debouncedFunction = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000); | ||
| * | ||
| * // Will log 'Function executed' after 1 second if not called again in that time | ||
| * debouncedFunction(); | ||
| * | ||
| * // Will not log anything as the previous call is canceled | ||
| * debouncedFunction.cancel(); | ||
| * | ||
| * // With AbortSignal | ||
| * const controller = new AbortController(); | ||
| * const signal = controller.signal; | ||
| * const debouncedWithSignal = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000, { signal }); | ||
| * | ||
| * debouncedWithSignal(); | ||
| * | ||
| * // Will cancel the debounced function call | ||
| * controller.abort(); | ||
| */ | ||
| export declare const debounce: <F extends (...args: unknown[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions) => DebouncedFunction<F>; | ||
| //# sourceMappingURL=debounce.d.ts.map |
| {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../src/utils/functions/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI;IACrE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE/B;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EAC3D,MAAM,CAAC,EACP,YAAY,MAAM,EAClB,oBAAmB,eAAoB,KACxC,iBAAiB,CAAC,CAAC,CA+ErB,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds | ||
| * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` | ||
| * method to cancel any pending execution. | ||
| * | ||
| * @template F - The type of function. | ||
| * @param {F} func - The function to debounce. | ||
| * @param {number} debounceMs - The number of milliseconds to delay. | ||
| * @param {DebounceOptions} options - The options object | ||
| * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. | ||
| * @returns A new debounced function with a `cancel` method. | ||
| * | ||
| * @example | ||
| * const debouncedFunction = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000); | ||
| * | ||
| * // Will log 'Function executed' after 1 second if not called again in that time | ||
| * debouncedFunction(); | ||
| * | ||
| * // Will not log anything as the previous call is canceled | ||
| * debouncedFunction.cancel(); | ||
| * | ||
| * // With AbortSignal | ||
| * const controller = new AbortController(); | ||
| * const signal = controller.signal; | ||
| * const debouncedWithSignal = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000, { signal }); | ||
| * | ||
| * debouncedWithSignal(); | ||
| * | ||
| * // Will cancel the debounced function call | ||
| * controller.abort(); | ||
| */ | ||
| export const debounce = (func, debounceMs, { signal, edges } = {}) => { | ||
| let pendingThis = undefined; | ||
| let pendingArgs = null; | ||
| const leading = edges != null && edges.includes('leading'); | ||
| const trailing = edges == null || edges.includes('trailing'); | ||
| const invoke = () => { | ||
| if (pendingArgs !== null) { | ||
| func.apply(pendingThis, pendingArgs); | ||
| pendingThis = undefined; | ||
| pendingArgs = null; | ||
| } | ||
| }; | ||
| const onTimerEnd = () => { | ||
| if (trailing) { | ||
| invoke(); | ||
| } | ||
| cancel(); | ||
| }; | ||
| let timeoutId = null; | ||
| const schedule = () => { | ||
| if (timeoutId != null) { | ||
| clearTimeout(timeoutId); | ||
| } | ||
| timeoutId = setTimeout(() => { | ||
| timeoutId = null; | ||
| onTimerEnd(); | ||
| }, debounceMs); | ||
| }; | ||
| const cancelTimer = () => { | ||
| if (timeoutId !== null) { | ||
| clearTimeout(timeoutId); | ||
| timeoutId = null; | ||
| } | ||
| }; | ||
| const cancel = () => { | ||
| cancelTimer(); | ||
| pendingThis = undefined; | ||
| pendingArgs = null; | ||
| }; | ||
| const flush = () => { | ||
| invoke(); | ||
| }; | ||
| const debounced = function (...args) { | ||
| if (signal?.aborted) { | ||
| return; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-this-alias | ||
| pendingThis = this; | ||
| pendingArgs = args; | ||
| const isFirstCall = timeoutId == null; | ||
| schedule(); | ||
| if (leading && isFirstCall) { | ||
| invoke(); | ||
| } | ||
| }; | ||
| debounced.schedule = schedule; | ||
| debounced.cancel = cancel; | ||
| debounced.flush = flush; | ||
| signal?.addEventListener('abort', cancel, { once: true }); | ||
| return debounced; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=jetton-info.test.d.ts.map |
| {"version":3,"file":"jetton-info.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/jetton/jetton-info.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { isJettonInfo } from './jetton-info'; | ||
| describe('isJettonInfo', () => { | ||
| it('should return true for a valid JettonInfo object', () => { | ||
| expect(isJettonInfo({ | ||
| address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
| name: 'Tether USD', | ||
| symbol: 'USDT', | ||
| description: 'Tether USD stablecoin', | ||
| })).toBe(true); | ||
| }); | ||
| it('should return true when optional fields are present', () => { | ||
| expect(isJettonInfo({ | ||
| address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
| name: 'Tether USD', | ||
| symbol: 'USDT', | ||
| description: 'Tether USD stablecoin', | ||
| decimals: 6, | ||
| image: 'https://example.com/image.png', | ||
| uri: 'https://example.com/meta.json', | ||
| })).toBe(true); | ||
| }); | ||
| it('should return false for null', () => { | ||
| expect(isJettonInfo(null)).toBe(false); | ||
| }); | ||
| it('should return false for primitives', () => { | ||
| expect(isJettonInfo('string')).toBe(false); | ||
| expect(isJettonInfo(42)).toBe(false); | ||
| expect(isJettonInfo(true)).toBe(false); | ||
| expect(isJettonInfo(undefined)).toBe(false); | ||
| }); | ||
| it('should return false when required string fields are missing', () => { | ||
| expect(isJettonInfo({ name: 'Test', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', name: 'Test', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', name: 'Test', symbol: 'TST' })).toBe(false); | ||
| }); | ||
| it('should return false when required fields are not strings', () => { | ||
| expect(isJettonInfo({ address: 1, name: 'Test', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', name: null, symbol: 'TST', description: 'desc' })).toBe(false); | ||
| }); | ||
| it('should return false for an empty object', () => { | ||
| expect(isJettonInfo({})).toBe(false); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export declare const isNumber: (value: unknown) => value is number; | ||
| //# sourceMappingURL=is-number.d.ts.map |
| {"version":3,"file":"is-number.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-number.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAUlD,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const isNumber = (value) => { | ||
| if (typeof value !== 'number') { | ||
| return false; | ||
| } | ||
| if (Number.isNaN(value)) { | ||
| return false; | ||
| } | ||
| return Number.isFinite(value); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { StakingProviderMetadata, Network } from '@ton/walletkit'; | ||
| import { resolveNetwork } from '../../utils'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProviderMetadataOptions = { | ||
| network?: Network; | ||
| providerId?: string; | ||
| }; | ||
| export type GetStakingProviderMetadataReturnType = StakingProviderMetadata; | ||
| /** | ||
| * Get staking provider static metadata | ||
| */ | ||
| export const getStakingProviderMetadata = ( | ||
| appKit: AppKit, | ||
| options: GetStakingProviderMetadataOptions = {}, | ||
| ): GetStakingProviderMetadataReturnType => { | ||
| return appKit.stakingManager.getStakingProviderMetadata( | ||
| resolveNetwork(appKit, options.network), | ||
| options.providerId, | ||
| ); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { StakingProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProviderOptions = { | ||
| /** | ||
| * Provider ID to get. If not provided, returns default provider. | ||
| */ | ||
| id?: string; | ||
| }; | ||
| export type GetStakingProviderReturnType = StakingProviderInterface; | ||
| /** | ||
| * Get staking provider instance | ||
| */ | ||
| export const getStakingProvider = ( | ||
| appKit: AppKit, | ||
| options: GetStakingProviderOptions = {}, | ||
| ): GetStakingProviderReturnType => { | ||
| return appKit.stakingManager.getProvider(options.id); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface SetDefaultStakingProviderParameters { | ||
| providerId: string; | ||
| } | ||
| export type SetDefaultStakingProviderReturnType = void; | ||
| /** | ||
| * Set the default staking provider. | ||
| * Subsequent quote and stake-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export const setDefaultStakingProvider = ( | ||
| appKit: AppKit, | ||
| parameters: SetDefaultStakingProviderParameters, | ||
| ): SetDefaultStakingProviderReturnType => { | ||
| appKit.stakingManager.setDefaultProvider(parameters.providerId); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface WatchStakingProvidersParameters { | ||
| onChange: () => void; | ||
| } | ||
| export type WatchStakingProvidersReturnType = () => void; | ||
| /** | ||
| * Watch for staking providers registration and default provider changes | ||
| */ | ||
| export const watchStakingProviders = ( | ||
| appKit: AppKit, | ||
| parameters: WatchStakingProvidersParameters, | ||
| ): WatchStakingProvidersReturnType => { | ||
| const { onChange } = parameters; | ||
| const onEvent = (event: { payload: { type: string } }) => { | ||
| if (event.payload.type === 'staking') { | ||
| onChange(); | ||
| } | ||
| }; | ||
| const unsubscribeRegistered = appKit.emitter.on('provider:registered', onEvent); | ||
| const unsubscribeDefaultChanged = appKit.emitter.on('provider:default-changed', onEvent); | ||
| return () => { | ||
| unsubscribeRegistered(); | ||
| unsubscribeDefaultChanged(); | ||
| }; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { SwapProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface GetSwapProviderOptions { | ||
| id?: string; | ||
| } | ||
| export type GetSwapProviderReturnType = SwapProviderInterface; | ||
| export const getSwapProvider = (appKit: AppKit, options: GetSwapProviderOptions = {}): GetSwapProviderReturnType => { | ||
| return appKit.swapManager.getProvider(options.id); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { SwapProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetSwapProvidersReturnType = SwapProviderInterface[]; | ||
| /** | ||
| * Get all registered swap providers. | ||
| */ | ||
| export const getSwapProviders = (appKit: AppKit): GetSwapProvidersReturnType => { | ||
| return appKit.swapManager.getProviders(); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface SetDefaultSwapProviderParameters { | ||
| providerId: string; | ||
| } | ||
| export type SetDefaultSwapProviderReturnType = void; | ||
| /** | ||
| * Set the default swap provider. | ||
| * Subsequent quote and swap-transaction calls will use this provider when none is specified. | ||
| */ | ||
| export const setDefaultSwapProvider = ( | ||
| appKit: AppKit, | ||
| parameters: SetDefaultSwapProviderParameters, | ||
| ): SetDefaultSwapProviderReturnType => { | ||
| appKit.swapManager.setDefaultProvider(parameters.providerId); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export interface WatchSwapProvidersParameters { | ||
| onChange: () => void; | ||
| } | ||
| export type WatchSwapProvidersReturnType = () => void; | ||
| /** | ||
| * Watch for new swap providers registration | ||
| */ | ||
| export const watchSwapProviders = ( | ||
| appKit: AppKit, | ||
| parameters: WatchSwapProvidersParameters, | ||
| ): WatchSwapProvidersReturnType => { | ||
| const { onChange } = parameters; | ||
| const unsubscribeRegistered = appKit.emitter.on('provider:registered', (event) => { | ||
| if (event.payload.type === 'swap') onChange(); | ||
| }); | ||
| const unsubscribeDefaultChanged = appKit.emitter.on('provider:default-changed', (event) => { | ||
| if (event.payload.type === 'swap') onChange(); | ||
| }); | ||
| return () => { | ||
| unsubscribeRegistered(); | ||
| unsubscribeDefaultChanged(); | ||
| }; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { LruAppKitCache } from './lru-app-kit-cache'; | ||
| describe('LruAppKitCache', () => { | ||
| it('should return undefined for a missing key', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| expect(await cache.get('missing')).toBeUndefined(); | ||
| }); | ||
| it('should store and retrieve a value', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', 'value'); | ||
| expect(await cache.get('key')).toBe('value'); | ||
| }); | ||
| it('should store and retrieve null', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', null); | ||
| expect(await cache.get('key')).toBeNull(); | ||
| }); | ||
| it('should store and retrieve an object', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| const obj = { address: 'EQabc', name: 'Test', decimals: 6 }; | ||
| await cache.set('key', obj); | ||
| expect(await cache.get('key')).toEqual(obj); | ||
| }); | ||
| it('should overwrite an existing value', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', 'first'); | ||
| await cache.set('key', 'second'); | ||
| expect(await cache.get('key')).toBe('second'); | ||
| }); | ||
| it('should remove a key', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('key', 'value'); | ||
| await cache.remove('key'); | ||
| expect(await cache.get('key')).toBeUndefined(); | ||
| }); | ||
| it('should clear all keys', async () => { | ||
| const cache = new LruAppKitCache(); | ||
| await cache.set('a', 1); | ||
| await cache.set('b', 2); | ||
| await cache.clear(); | ||
| expect(await cache.get('a')).toBeUndefined(); | ||
| expect(await cache.get('b')).toBeUndefined(); | ||
| }); | ||
| it('should evict entries when max is exceeded', async () => { | ||
| const cache = new LruAppKitCache({ max: 2 }); | ||
| await cache.set('a', 1); | ||
| await cache.set('b', 2); | ||
| await cache.set('c', 3); | ||
| expect(await cache.get('a')).toBeUndefined(); | ||
| expect(await cache.get('b')).toBe(2); | ||
| expect(await cache.get('c')).toBe(3); | ||
| }); | ||
| it('should expire entries after ttl', async () => { | ||
| const cache = new LruAppKitCache({ ttl: 10 }); | ||
| await cache.set('key', 'value'); | ||
| await new Promise((resolve) => setTimeout(resolve, 20)); | ||
| expect(await cache.get('key')).toBeUndefined(); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { LRUCache } from 'lru-cache'; | ||
| import type { AppKitCache } from '../types/app-kit-cache'; | ||
| export class LruAppKitCache implements AppKitCache { | ||
| private readonly cache: LRUCache<string, { value: unknown }>; | ||
| constructor(options?: { max?: number; ttl?: number }) { | ||
| this.cache = new LRUCache({ | ||
| max: options?.max ?? 1000, | ||
| ttl: options?.ttl ?? 1000 * 60 * 10, | ||
| }); | ||
| } | ||
| async get<T = unknown>(key: string): Promise<T | undefined> { | ||
| return this.cache.get(key)?.value as T | undefined; | ||
| } | ||
| async set(key: string, value: unknown): Promise<void> { | ||
| this.cache.set(key, { value }); | ||
| } | ||
| async remove(key: string): Promise<void> { | ||
| this.cache.delete(key); | ||
| } | ||
| async clear(): Promise<void> { | ||
| this.cache.clear(); | ||
| } | ||
| } |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export { LruAppKitCache } from './adapters/lru-app-kit-cache'; | ||
| export { getCacheKey } from './utils/get-cache-key'; | ||
| export type { AppKitCache } from './types/app-kit-cache'; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export interface AppKitCache { | ||
| get<T = unknown>(key: string): Promise<T | undefined>; | ||
| set(key: string, value: unknown): Promise<void>; | ||
| remove(key: string): Promise<void>; | ||
| clear(): Promise<void>; | ||
| } |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { getCacheKey } from './get-cache-key'; | ||
| describe('getCacheKey', () => { | ||
| it('should build a key with a single param', () => { | ||
| const key = getCacheKey('jetton-info'); | ||
| expect(key('EQabc')).toBe('jetton-info:EQabc'); | ||
| }); | ||
| it('should build a key with multiple params', () => { | ||
| const key = getCacheKey('jetton-info'); | ||
| expect(key('mainnet', 'EQabc')).toBe('jetton-info:mainnet:EQabc'); | ||
| }); | ||
| it('should build a key with no params', () => { | ||
| const key = getCacheKey('jetton-info'); | ||
| expect(key()).toBe('jetton-info:'); | ||
| }); | ||
| it('should scope keys independently per prefix', () => { | ||
| const infoKey = getCacheKey('jetton-info'); | ||
| const walletKey = getCacheKey('jetton-wallet'); | ||
| expect(infoKey('EQabc')).not.toBe(walletKey('EQabc')); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const getCacheKey = | ||
| (prefix: string) => | ||
| (...params: string[]): string => | ||
| `${prefix}:${params.join(':')}`; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| import type { UserFriendlyAddress } from '../../types/primitives'; | ||
| import { isString } from '../predicate/is-string'; | ||
| export const isValidAddress = (address: unknown): address is string => { | ||
| if (typeof address !== 'string') { | ||
| return false; | ||
| } | ||
| try { | ||
| Address.parse(address); | ||
| } catch (_) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| export const isFriendlyTonAddress = (address: unknown): address is UserFriendlyAddress => { | ||
| if (!isString(address)) { | ||
| return false; | ||
| } | ||
| try { | ||
| Address.parseFriendly(address); | ||
| } catch (_) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| import { getErrorMessage } from '../errors/get-error-message'; | ||
| export const toBounceableAddress = (address?: Address | string | null): string => { | ||
| if (!address) { | ||
| throw new Error(`Address is empty`); | ||
| } | ||
| if (address instanceof Address) { | ||
| return address.toString({ bounceable: true }); | ||
| } | ||
| try { | ||
| return Address.parse(address).toString({ bounceable: true }); | ||
| } catch (e) { | ||
| throw new Error(`Can not convert to bounceble address from "${address}". Error: ${getErrorMessage(e)}`); | ||
| } | ||
| }; | ||
| export const tryToBounceableAddress = (address?: Address | string | null): string | undefined => { | ||
| try { | ||
| return toBounceableAddress(address); | ||
| } catch { | ||
| return undefined; | ||
| } | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { Address } from '@ton/core'; | ||
| import { getErrorMessage } from '../errors/get-error-message'; | ||
| export const toNonBounceableAddress = (address?: Address | string | null): string => { | ||
| if (!address) { | ||
| throw new Error(`Address is empty`); | ||
| } | ||
| if (address instanceof Address) { | ||
| return address.toString({ bounceable: false }); | ||
| } | ||
| try { | ||
| return Address.parse(address).toString({ bounceable: false }); | ||
| } catch (e) { | ||
| throw new Error(`Can not convert to non-bounceable address from "${address}". Error: ${getErrorMessage(e)}`); | ||
| } | ||
| }; | ||
| export const tryToNonBounceableAddress = (address?: Address | string | null): string | undefined => { | ||
| try { | ||
| return toNonBounceableAddress(address); | ||
| } catch { | ||
| return undefined; | ||
| } | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { calcFiatValue } from './calc-fiat-value'; | ||
| describe('calcFiatValue', () => { | ||
| it('should return 0 when rate is undefined', () => { | ||
| expect(calcFiatValue('100', undefined)).toBe('0'); | ||
| }); | ||
| it('should return 0 when rate is 0', () => { | ||
| expect(calcFiatValue('100', '0')).toBe('0'); | ||
| }); | ||
| it('should return 0 when amount is 0', () => { | ||
| expect(calcFiatValue('0', '1.5')).toBe('0'); | ||
| }); | ||
| it('should return 0 when amount is negative', () => { | ||
| expect(calcFiatValue('-10', '1.5')).toBe('0'); | ||
| }); | ||
| it('should return 0 when amount is not a valid number', () => { | ||
| expect(calcFiatValue('abc', '1.5')).toBe('0'); | ||
| expect(calcFiatValue('', '1.5')).toBe('0'); | ||
| }); | ||
| it('should calculate fiat value without rounding', () => { | ||
| expect(calcFiatValue('100', '1.5')).toBe('150'); | ||
| expect(calcFiatValue('1', '0.001')).toBe('0.001'); | ||
| expect(calcFiatValue('3', '1.005')).toBe('3.015'); | ||
| }); | ||
| it('should handle decimal amounts without rounding', () => { | ||
| expect(calcFiatValue('0.5', '2')).toBe('1'); | ||
| expect(calcFiatValue('1.23456', '100')).toBe('123.456'); | ||
| expect(calcFiatValue('2.996876', '1')).toBe('2.996876'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Calculates the fiat value of a token amount. | ||
| * Returns null when rate is unavailable or amount is zero/invalid. | ||
| */ | ||
| export function calcFiatValue(amount: string, rate: string | undefined): string { | ||
| if (!rate) return '0'; | ||
| const num = parseFloat(amount); | ||
| if (!num || num <= 0) return '0'; | ||
| return Number((num * parseFloat(rate)).toFixed(10)).toString(); | ||
| } |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { formatLargeValue } from './format-large-value'; | ||
| describe('formatLargeValue', () => { | ||
| it('should format trillion values', () => { | ||
| expect(formatLargeValue('1000000000000')).toBe('1T'); | ||
| expect(formatLargeValue('1230000000000')).toBe('1.23T'); | ||
| expect(formatLargeValue('12345678901234')).toBe('12.34T'); | ||
| }); | ||
| it('should format billion values', () => { | ||
| expect(formatLargeValue('1000000000')).toBe('1B'); | ||
| expect(formatLargeValue('1230000000')).toBe('1.23B'); | ||
| }); | ||
| it('should format million values', () => { | ||
| expect(formatLargeValue('1000000')).toBe('1M'); | ||
| expect(formatLargeValue('1230000')).toBe('1.23M'); | ||
| }); | ||
| it('should format smaller values using toLocaleString', () => { | ||
| expect(formatLargeValue('1234.56')).toBe('1,234.56'); | ||
| expect(formatLargeValue('100')).toBe('100'); | ||
| expect(formatLargeValue('0')).toBe('0'); | ||
| }); | ||
| it('should handle spaces and formatting', () => { | ||
| expect(formatLargeValue('1 000 000')).toBe('1M'); | ||
| }); | ||
| it('should respect decimals for small values', () => { | ||
| expect(formatLargeValue('1234.5678', 4)).toBe('1,234.5678'); | ||
| expect(formatLargeValue('1234.5678', 2)).toBe('1,234.56'); | ||
| }); | ||
| it('should round down (floor) fractional values', () => { | ||
| expect(formatLargeValue('2.996848', 2)).toBe('2.99'); | ||
| expect(formatLargeValue('2.996848', 6)).toBe('2.996848'); | ||
| expect(formatLargeValue('0.9999', 2)).toBe('0.99'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const formatLargeValue = (amount: string, decimals: number = 2, minimumFractionDigits: number = 0): string => { | ||
| const cleanAmount = amount.toString().replace(/\s/g, ''); | ||
| const intPart = cleanAmount.split('.')[0] || '0'; | ||
| // value > 100 000 000 000 000 => 100 T | ||
| if (intPart.length > 12) { | ||
| const value = Number(intPart.slice(0, -10)) / 100; | ||
| return `${value.toLocaleString('en-US')}T`; | ||
| } | ||
| // value > 100 000 000 000 => 100 B | ||
| if (intPart.length > 9) { | ||
| const value = Number(intPart.slice(0, -7)) / 100; | ||
| return `${value.toLocaleString('en-US')}B`; | ||
| } | ||
| // value > 10 000 000 => 10 M | ||
| if (intPart.length > 6) { | ||
| const value = Number(intPart.slice(0, -4)) / 100; | ||
| return `${value.toLocaleString('en-US')}M`; | ||
| } | ||
| const value = parseFloat(cleanAmount); | ||
| if (isNaN(value)) { | ||
| return '0'; | ||
| } | ||
| const factor = Math.pow(10, decimals); | ||
| const truncated = Math.floor(value * factor) / factor; | ||
| return truncated.toLocaleString('en-US', { | ||
| minimumFractionDigits, | ||
| maximumFractionDigits: decimals, | ||
| }); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { truncateDecimals } from './truncate-decimals'; | ||
| describe('truncateDecimals', () => { | ||
| it('should return integers unchanged', () => { | ||
| expect(truncateDecimals('123', 2)).toBe('123'); | ||
| expect(truncateDecimals('0', 5)).toBe('0'); | ||
| }); | ||
| it('should truncate decimals exceeding maxDecimals', () => { | ||
| expect(truncateDecimals('1.23456', 2)).toBe('1.23'); | ||
| expect(truncateDecimals('1.23456', 4)).toBe('1.2345'); | ||
| expect(truncateDecimals('0.123456789', 9)).toBe('0.123456789'); | ||
| expect(truncateDecimals('0.1234567890', 9)).toBe('0.123456789'); | ||
| }); | ||
| it('should return value unchanged when decimals are within limit', () => { | ||
| expect(truncateDecimals('1.23', 5)).toBe('1.23'); | ||
| expect(truncateDecimals('1.2', 2)).toBe('1.2'); | ||
| expect(truncateDecimals('5.0', 1)).toBe('5.0'); | ||
| }); | ||
| it('should handle maxDecimals of 0', () => { | ||
| expect(truncateDecimals('1.999', 0)).toBe('1'); | ||
| expect(truncateDecimals('42.1', 0)).toBe('42'); | ||
| }); | ||
| it('should strip trailing dot', () => { | ||
| expect(truncateDecimals('1.', 3)).toBe('1'); | ||
| expect(truncateDecimals('1.', 0)).toBe('1'); | ||
| }); | ||
| it('should handle empty string', () => { | ||
| expect(truncateDecimals('', 2)).toBe(''); | ||
| }); | ||
| it('should handle number input', () => { | ||
| expect(truncateDecimals(1.23456, 2)).toBe('1.23'); | ||
| expect(truncateDecimals(42, 3)).toBe('42'); | ||
| expect(truncateDecimals(0.1, 5)).toBe('0.1'); | ||
| expect(truncateDecimals(3.14159, 0)).toBe('3'); | ||
| }); | ||
| it('should handle scientific notation strings', () => { | ||
| expect(truncateDecimals('1.095492908209088e-9', 9)).toBe('0.000000001'); | ||
| expect(truncateDecimals('5e-7', 9)).toBe('0.0000005'); | ||
| }); | ||
| it('should handle numbers that produce scientific notation', () => { | ||
| const tiny = 0.000000001 * 1.095492908209088; // 1.095492908209088e-9 | ||
| expect(truncateDecimals(tiny, 9)).toBe('0.000000001'); | ||
| }); | ||
| it('should handle negative numbers and negative scientific notation', () => { | ||
| expect(truncateDecimals('-1.23456', 2)).toBe('-1.23'); | ||
| expect(truncateDecimals('-5e-7', 9)).toBe('-0.0000005'); | ||
| expect(truncateDecimals(-0.0000005, 9)).toBe('-0.0000005'); | ||
| }); | ||
| it('should handle scientific notation with positive exponents', () => { | ||
| expect(truncateDecimals('1.2345e2', 2)).toBe('123.45'); | ||
| expect(truncateDecimals('1.2345e+2', 0)).toBe('123'); | ||
| expect(truncateDecimals('5.2e9', 0)).toBe('5200000000'); | ||
| expect(truncateDecimals('-1.23e+9', 0)).toBe('-1230000000'); | ||
| }); | ||
| it('should handle extreme scientific exponents', () => { | ||
| expect(truncateDecimals('1e-100', 100)).toBe('0.' + '0'.repeat(99) + '1'); | ||
| expect(truncateDecimals('1e21', 0)).toBe('1000000000000000000000'); | ||
| }); | ||
| it('should handle NaN and Infinity', () => { | ||
| expect(truncateDecimals(NaN, 2)).toBe('NaN'); | ||
| expect(truncateDecimals(Infinity, 2)).toBe('Infinity'); | ||
| expect(truncateDecimals(-Infinity, 2)).toBe('-Infinity'); | ||
| expect(truncateDecimals('NaN', 2)).toBe('NaN'); | ||
| expect(truncateDecimals('Infinity', 2)).toBe('Infinity'); | ||
| }); | ||
| it('should handle native numbers with e (scientific notation)', () => { | ||
| expect(truncateDecimals(1e-10, 10)).toBe('0.0000000001'); | ||
| expect(truncateDecimals(1.23e-8, 10)).toBe('0.0000000123'); | ||
| expect(truncateDecimals(-5.43e-7, 9)).toBe('-0.000000543'); | ||
| expect(truncateDecimals(5.2e9, 0)).toBe('5200000000'); | ||
| expect(truncateDecimals(-1.23e9, 0)).toBe('-1230000000'); | ||
| expect(truncateDecimals(1e21, 0)).toBe('1000000000000000000000'); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| /** | ||
| * Converts a number to a plain decimal string, expanding scientific notation | ||
| * like "1.23e-9" into "0.00000000123". | ||
| */ | ||
| const toPlainDecimalString = (num: number): string => { | ||
| const str = num.toString(); | ||
| if (!str.includes('e') && !str.includes('E')) return str; | ||
| const [base = '0', exponent = '0'] = str.split(/[eE]/); | ||
| const exp = Number(exponent); | ||
| const isNegative = base.startsWith('-'); | ||
| const absBase = isNegative ? base.slice(1) : base; | ||
| const [intPart, decPart = ''] = absBase.split('.'); | ||
| let result: string; | ||
| if (exp < 0) { | ||
| result = '0.' + '0'.repeat(Math.abs(exp) - 1) + intPart + decPart; | ||
| } else { | ||
| const addZeros = exp - decPart.length; | ||
| if (addZeros >= 0) { | ||
| result = intPart + decPart + '0'.repeat(addZeros); | ||
| } else { | ||
| result = intPart + decPart.slice(0, exp) + '.' + decPart.slice(exp); | ||
| } | ||
| } | ||
| return isNegative ? '-' + result : result; | ||
| }; | ||
| export const truncateDecimals = (value: string | number, maxDecimals: number): string => { | ||
| let strValue: string; | ||
| if (typeof value === 'number') { | ||
| strValue = toPlainDecimalString(value); | ||
| } else if (value.includes('e') || value.includes('E')) { | ||
| const num = Number(value); | ||
| if (Number.isNaN(num)) return value; | ||
| strValue = toPlainDecimalString(num); | ||
| } else { | ||
| strValue = value; | ||
| } | ||
| const dotIndex = strValue.indexOf('.'); | ||
| if (dotIndex === -1) return strValue; | ||
| const result = strValue.slice(0, dotIndex + 1 + maxDecimals); | ||
| return result.endsWith('.') ? result.slice(0, -1) : result; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { calcMaxSpendable, DEFAULT_TON_FEE_RESERVE_NANOS } from './calc-max-spendable'; | ||
| const TON = { address: 'ton', decimals: 9 }; | ||
| const JETTON = { address: 'EQA_jetton', decimals: 6 }; | ||
| describe('calcMaxSpendable', () => { | ||
| it('returns balance minus the TON fee reserve for native TON', () => { | ||
| // 1 TON balance, default reserve 0.1 TON → 0.9 TON spendable. | ||
| expect(calcMaxSpendable({ balance: '1', token: TON })).toBe('0.9'); | ||
| }); | ||
| it('returns the full balance for a jetton (no reserve)', () => { | ||
| expect(calcMaxSpendable({ balance: '100', token: JETTON })).toBe('100'); | ||
| }); | ||
| it('clamps to zero when balance is below the reserve', () => { | ||
| expect(calcMaxSpendable({ balance: '0.05', token: TON })).toBe('0'); | ||
| }); | ||
| it('clamps to zero when balance equals the reserve', () => { | ||
| expect(calcMaxSpendable({ balance: '0.1', token: TON })).toBe('0'); | ||
| }); | ||
| it('respects a custom feeReserveNanos', () => { | ||
| // 1 TON balance, 0.5 TON reserve → 0.5 TON spendable. | ||
| expect(calcMaxSpendable({ balance: '1', token: TON, feeReserveNanos: 500_000_000n })).toBe('0.5'); | ||
| }); | ||
| it('ignores feeReserveNanos for jettons', () => { | ||
| expect(calcMaxSpendable({ balance: '100', token: JETTON, feeReserveNanos: 999_999_999_999n })).toBe('100'); | ||
| }); | ||
| it('exports a sane default reserve', () => { | ||
| expect(DEFAULT_TON_FEE_RESERVE_NANOS).toBe(100_000_000n); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { formatUnits, parseUnits } from '@ton/walletkit'; | ||
| /** | ||
| * Default TON reserve subtracted from balance when computing the max spendable amount | ||
| * for a native TON operation — leaves room for network fees. 0.1 TON. | ||
| */ | ||
| export const DEFAULT_TON_FEE_RESERVE_NANOS = 100_000_000n; | ||
| export interface CalcMaxSpendableParams { | ||
| /** User's balance of `token`, as a decimal string. */ | ||
| balance: string; | ||
| /** The token the user is going to spend. */ | ||
| token: { address: string; decimals: number }; | ||
| /** | ||
| * TON reserve (in nanos) subtracted from balance when the token is native TON. | ||
| * Ignored for jettons. Defaults to {@link DEFAULT_TON_FEE_RESERVE_NANOS}. | ||
| */ | ||
| feeReserveNanos?: bigint; | ||
| } | ||
| /** | ||
| * Compute the max spendable amount a user can place into an input when they click MAX. | ||
| * For native TON — subtracts a fixed reserve so the user still has room for network fees. | ||
| * For jettons — returns the full balance (gas is paid from TON separately). | ||
| */ | ||
| export const calcMaxSpendable = ({ | ||
| balance, | ||
| token, | ||
| feeReserveNanos = DEFAULT_TON_FEE_RESERVE_NANOS, | ||
| }: CalcMaxSpendableParams): string => { | ||
| if (token.address !== 'ton') return balance; | ||
| const balanceNanos = parseUnits(balance, token.decimals); | ||
| const reducedNanos = balanceNanos > feeReserveNanos ? balanceNanos - feeReserveNanos : 0n; | ||
| return formatUnits(reducedNanos, token.decimals); | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { DEFAULT_GAS_BUFFER_NANOS, DEFAULT_SAFETY_MARGIN_NANOS, getTonShortfall } from './get-ton-shortfall'; | ||
| const TON = { address: 'ton' }; | ||
| const JETTON = { address: 'EQA_jetton_address' }; | ||
| // Helper — convert a decimal string of TON to nanos as a string (for message amounts). | ||
| const toNanos = (ton: string): string => BigInt(Math.round(Number(ton) * 1e9)).toString(); | ||
| describe('getTonShortfall', () => { | ||
| it('returns undefined when TON balance covers the built transaction', () => { | ||
| // Swap 1 TON, total tx outflow 1.3 TON (1 TON swap + 0.3 TON attached gas), balance 2 TON. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '2', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| expect(result).toBeUndefined(); | ||
| }); | ||
| it('returns topup when fromToken is a jetton and TON balance is below outflow + buffer', () => { | ||
| // Jetton swap, tx needs 0.05 TON for gas, user has 0 TON. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('0.05') }], | ||
| tonBalance: '0', | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| expect(result).toEqual({ | ||
| mode: 'topup', | ||
| requiredNanos: 50_000_000n + DEFAULT_GAS_BUFFER_NANOS, | ||
| suggestedFromAmount: '', | ||
| }); | ||
| }); | ||
| it('returns reduce for TON-from when balance covers gas but not full amount', () => { | ||
| // User wants 1 TON swap, total outflow 1.3 TON, has 1 TON. Gas only = 0.3 TON. | ||
| // Balance (1) > nonSwapReserved (0.3 gas + 0.1 buffer + 0.02 safety = 0.42) → reduce mode. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| expect(result?.mode).toBe('reduce'); | ||
| if (result?.mode !== 'reduce') return; | ||
| // Suggested = 1 - 0.42 = 0.58 | ||
| expect(result.suggestedFromAmount).toBe('0.58'); | ||
| expect(result.requiredNanos).toBe(1_300_000_000n + DEFAULT_GAS_BUFFER_NANOS); | ||
| }); | ||
| it('returns topup for TON-from when balance cannot cover even gas (reducing would not help)', () => { | ||
| // User wants 1 TON swap, total outflow 1.3 TON → gas = 0.3 TON. Balance 0.2 TON. | ||
| // nonSwapReserved = 0.3 + 0.1 buffer + 0.02 safety = 0.42 TON → balance (0.2) <= 0.42 → topup. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '0.2', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }); | ||
| expect(result).toEqual({ | ||
| mode: 'topup', | ||
| requiredNanos: 1_300_000_000n + DEFAULT_GAS_BUFFER_NANOS, | ||
| suggestedFromAmount: '', | ||
| }); | ||
| }); | ||
| it('treats an undefined tonBalance as zero', () => { | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('0.05') }], | ||
| tonBalance: undefined, | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| expect(result?.mode).toBe('topup'); | ||
| }); | ||
| it('sums amounts across multiple messages', () => { | ||
| // Two messages attaching 0.6 TON each → totalOut = 1.2 TON. Balance 1 TON → shortfall. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('0.6') }, { amount: toNanos('0.6') }], | ||
| tonBalance: '1', | ||
| fromToken: JETTON, | ||
| fromAmount: '100', | ||
| }); | ||
| expect(result?.mode).toBe('topup'); | ||
| expect(result?.requiredNanos).toBe(1_200_000_000n + DEFAULT_GAS_BUFFER_NANOS); | ||
| }); | ||
| it('respects a custom gasBufferNanos', () => { | ||
| const baseParams = { | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1.3', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }; | ||
| // With the default buffer (0.1 TON), balance 1.3 is insufficient (needs 1.4). | ||
| expect(getTonShortfall(baseParams)?.mode).toBe('reduce'); | ||
| // With a zero buffer, 1.3 TON balance covers the 1.3 TON outflow exactly. | ||
| expect(getTonShortfall({ ...baseParams, gasBufferNanos: 0n })).toBeUndefined(); | ||
| }); | ||
| it('respects a custom safetyMarginNanos in the reduce branch', () => { | ||
| // Default margin: suggested = balance - gas - buffer - 0.02 = 1 - 0.3 - 0.1 - 0.02 = 0.58 | ||
| // Zero margin: suggested = balance - gas - buffer = 1 - 0.3 - 0.1 = 0.6 | ||
| const baseParams = { | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| }; | ||
| const withDefault = getTonShortfall(baseParams); | ||
| expect(withDefault?.mode === 'reduce' ? withDefault.suggestedFromAmount : null).toBe('0.58'); | ||
| const withZero = getTonShortfall({ ...baseParams, safetyMarginNanos: 0n }); | ||
| expect(withZero?.mode === 'reduce' ? withZero.suggestedFromAmount : null).toBe('0.6'); | ||
| }); | ||
| it('flips from reduce to topup when a large custom safetyMarginNanos eats the balance', () => { | ||
| // Balance 1 TON, gas 0.3 TON, buffer 0.1 TON. With a 1 TON safety margin, nonSwapReserved becomes 1.4 TON → topup. | ||
| const result = getTonShortfall({ | ||
| messages: [{ amount: toNanos('1.3') }], | ||
| tonBalance: '1', | ||
| fromToken: TON, | ||
| fromAmount: '1', | ||
| safetyMarginNanos: 1_000_000_000n, | ||
| }); | ||
| expect(result?.mode).toBe('topup'); | ||
| }); | ||
| it('exports sane default constants', () => { | ||
| expect(DEFAULT_GAS_BUFFER_NANOS).toBe(100_000_000n); | ||
| expect(DEFAULT_SAFETY_MARGIN_NANOS).toBe(20_000_000n); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { formatUnits, parseUnits } from '@ton/walletkit'; | ||
| /** Default extra TON buffer added on top of built transaction outflow when checking balance before sending. */ | ||
| export const DEFAULT_GAS_BUFFER_NANOS = 100_000_000n; | ||
| /** | ||
| * Default extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Covers quote/gas drift between the current built tx and the one that will actually be sent | ||
| * after the amount changes. 0.02 TON. | ||
| */ | ||
| export const DEFAULT_SAFETY_MARGIN_NANOS = 20_000_000n; | ||
| export type TonShortfall = | ||
| | { mode: 'reduce'; requiredNanos: bigint; suggestedFromAmount: string } | ||
| | { mode: 'topup'; requiredNanos: bigint; suggestedFromAmount: '' }; | ||
| export interface GetTonShortfallParams { | ||
| /** Messages of the built transaction. Each `amount` is the TON value in nanos attached to the message. */ | ||
| messages: Array<{ amount: string }>; | ||
| /** User's current TON balance as a decimal string (same format `formatUnits(balance, 9)` returns). */ | ||
| tonBalance: string | undefined; | ||
| /** The outgoing token — `{ address: 'ton' }` when the user spends TON, otherwise a jetton. */ | ||
| fromToken: { address: string }; | ||
| /** Amount the user intends to spend in `fromToken` units, as a decimal string. */ | ||
| fromAmount: string; | ||
| /** | ||
| * Extra TON headroom on top of built-tx outflow when checking balance before sending. | ||
| * Defaults to {@link DEFAULT_GAS_BUFFER_NANOS}. | ||
| */ | ||
| gasBufferNanos?: bigint; | ||
| /** | ||
| * Extra headroom baked into the suggested reduced amount, on top of the gas buffer. | ||
| * Defaults to {@link DEFAULT_SAFETY_MARGIN_NANOS}. | ||
| */ | ||
| safetyMarginNanos?: bigint; | ||
| } | ||
| /** | ||
| * Check whether the user's TON balance covers the built transaction. | ||
| * - Returns `null` if the balance is sufficient. | ||
| * - Returns `{ mode: 'reduce', ... }` with a smaller suggested `fromAmount` when `fromToken` is TON | ||
| * and the balance is enough to cover at least gas (user can fix it by reducing the amount). | ||
| * - Returns `{ mode: 'topup', ... }` when `fromToken` is a jetton (reducing jetton amount won't free up TON gas), | ||
| * or when `fromToken` is TON but the balance can't even cover gas (reducing won't help — user must top up). | ||
| */ | ||
| export const getTonShortfall = ({ | ||
| messages, | ||
| tonBalance, | ||
| fromToken, | ||
| fromAmount, | ||
| gasBufferNanos = DEFAULT_GAS_BUFFER_NANOS, | ||
| safetyMarginNanos = DEFAULT_SAFETY_MARGIN_NANOS, | ||
| }: GetTonShortfallParams): TonShortfall | undefined => { | ||
| const totalOutNanos = messages.reduce((acc, m) => acc + BigInt(m.amount), 0n); | ||
| const requiredNanos = totalOutNanos + gasBufferNanos; | ||
| const tonBalanceNanos = tonBalance ? parseUnits(tonBalance, 9) : 0n; | ||
| if (tonBalanceNanos >= requiredNanos) return; | ||
| if (fromToken.address === 'ton') { | ||
| const gasOnlyNanos = totalOutNanos - parseUnits(fromAmount, 9); | ||
| const nonSwapReservedNanos = gasOnlyNanos + gasBufferNanos + safetyMarginNanos; | ||
| // Balance can't cover even gas for a minimal outgoing tx — reducing the amount won't help. | ||
| if (tonBalanceNanos <= nonSwapReservedNanos) { | ||
| return { mode: 'topup', requiredNanos, suggestedFromAmount: '' }; | ||
| } | ||
| const suggestedFromAmount = formatUnits(tonBalanceNanos - nonSwapReservedNanos, 9); | ||
| return { mode: 'reduce', requiredNanos, suggestedFromAmount }; | ||
| } | ||
| return { mode: 'topup', requiredNanos, suggestedFromAmount: '' }; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export interface DebounceOptions { | ||
| /** | ||
| * An optional AbortSignal to cancel the debounced function. | ||
| */ | ||
| signal?: AbortSignal; | ||
| /** | ||
| * An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both. | ||
| * If `edges` include "leading", the function will be invoked at the start of the delay period. | ||
| * If `edges` include "trailing", the function will be invoked at the end of the delay period. | ||
| * If both "leading" and "trailing" are included, the function will be invoked at both the start and end of the delay period. | ||
| * @default ["trailing"] | ||
| */ | ||
| edges?: Array<'leading' | 'trailing'>; | ||
| } | ||
| export interface DebouncedFunction<F extends (...args: unknown[]) => void> { | ||
| (...args: Parameters<F>): void; | ||
| /** | ||
| * Schedules the execution of the debounced function after the specified debounced delay. | ||
| * This method resets any existing timer, ensuring that the function is only invoked | ||
| * after the delay has elapsed since the last call to the debounced function. | ||
| * It is typically called internally whenever the debounced function is invoked. | ||
| * | ||
| * @returns {void} | ||
| */ | ||
| schedule: () => void; | ||
| /** | ||
| * Cancels any pending execution of the debounced function. | ||
| * This method clears the active timer and resets any stored context or arguments. | ||
| */ | ||
| cancel: () => void; | ||
| /** | ||
| * Immediately invokes the debounced function if there is a pending execution. | ||
| * This method executes the function right away if there is a pending execution. | ||
| */ | ||
| flush: () => void; | ||
| } | ||
| /** | ||
| * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds | ||
| * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` | ||
| * method to cancel any pending execution. | ||
| * | ||
| * @template F - The type of function. | ||
| * @param {F} func - The function to debounce. | ||
| * @param {number} debounceMs - The number of milliseconds to delay. | ||
| * @param {DebounceOptions} options - The options object | ||
| * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. | ||
| * @returns A new debounced function with a `cancel` method. | ||
| * | ||
| * @example | ||
| * const debouncedFunction = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000); | ||
| * | ||
| * // Will log 'Function executed' after 1 second if not called again in that time | ||
| * debouncedFunction(); | ||
| * | ||
| * // Will not log anything as the previous call is canceled | ||
| * debouncedFunction.cancel(); | ||
| * | ||
| * // With AbortSignal | ||
| * const controller = new AbortController(); | ||
| * const signal = controller.signal; | ||
| * const debouncedWithSignal = debounce(() => { | ||
| * console.log('Function executed'); | ||
| * }, 1000, { signal }); | ||
| * | ||
| * debouncedWithSignal(); | ||
| * | ||
| * // Will cancel the debounced function call | ||
| * controller.abort(); | ||
| */ | ||
| export const debounce = <F extends (...args: unknown[]) => void>( | ||
| func: F, | ||
| debounceMs: number, | ||
| { signal, edges }: DebounceOptions = {}, | ||
| ): DebouncedFunction<F> => { | ||
| let pendingThis: unknown = undefined; | ||
| let pendingArgs: Parameters<F> | null = null; | ||
| const leading = edges != null && edges.includes('leading'); | ||
| const trailing = edges == null || edges.includes('trailing'); | ||
| const invoke = () => { | ||
| if (pendingArgs !== null) { | ||
| func.apply(pendingThis, pendingArgs); | ||
| pendingThis = undefined; | ||
| pendingArgs = null; | ||
| } | ||
| }; | ||
| const onTimerEnd = () => { | ||
| if (trailing) { | ||
| invoke(); | ||
| } | ||
| cancel(); | ||
| }; | ||
| let timeoutId: ReturnType<typeof setTimeout> | null = null; | ||
| const schedule = () => { | ||
| if (timeoutId != null) { | ||
| clearTimeout(timeoutId); | ||
| } | ||
| timeoutId = setTimeout(() => { | ||
| timeoutId = null; | ||
| onTimerEnd(); | ||
| }, debounceMs); | ||
| }; | ||
| const cancelTimer = () => { | ||
| if (timeoutId !== null) { | ||
| clearTimeout(timeoutId); | ||
| timeoutId = null; | ||
| } | ||
| }; | ||
| const cancel = () => { | ||
| cancelTimer(); | ||
| pendingThis = undefined; | ||
| pendingArgs = null; | ||
| }; | ||
| const flush = () => { | ||
| invoke(); | ||
| }; | ||
| const debounced = function (this: unknown, ...args: Parameters<F>) { | ||
| if (signal?.aborted) { | ||
| return; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-this-alias | ||
| pendingThis = this; | ||
| pendingArgs = args; | ||
| const isFirstCall = timeoutId == null; | ||
| schedule(); | ||
| if (leading && isFirstCall) { | ||
| invoke(); | ||
| } | ||
| }; | ||
| debounced.schedule = schedule; | ||
| debounced.cancel = cancel; | ||
| debounced.flush = flush; | ||
| signal?.addEventListener('abort', cancel, { once: true }); | ||
| return debounced; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { isJettonInfo } from './jetton-info'; | ||
| describe('isJettonInfo', () => { | ||
| it('should return true for a valid JettonInfo object', () => { | ||
| expect( | ||
| isJettonInfo({ | ||
| address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
| name: 'Tether USD', | ||
| symbol: 'USDT', | ||
| description: 'Tether USD stablecoin', | ||
| }), | ||
| ).toBe(true); | ||
| }); | ||
| it('should return true when optional fields are present', () => { | ||
| expect( | ||
| isJettonInfo({ | ||
| address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
| name: 'Tether USD', | ||
| symbol: 'USDT', | ||
| description: 'Tether USD stablecoin', | ||
| decimals: 6, | ||
| image: 'https://example.com/image.png', | ||
| uri: 'https://example.com/meta.json', | ||
| }), | ||
| ).toBe(true); | ||
| }); | ||
| it('should return false for null', () => { | ||
| expect(isJettonInfo(null)).toBe(false); | ||
| }); | ||
| it('should return false for primitives', () => { | ||
| expect(isJettonInfo('string')).toBe(false); | ||
| expect(isJettonInfo(42)).toBe(false); | ||
| expect(isJettonInfo(true)).toBe(false); | ||
| expect(isJettonInfo(undefined)).toBe(false); | ||
| }); | ||
| it('should return false when required string fields are missing', () => { | ||
| expect(isJettonInfo({ name: 'Test', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', name: 'Test', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', name: 'Test', symbol: 'TST' })).toBe(false); | ||
| }); | ||
| it('should return false when required fields are not strings', () => { | ||
| expect(isJettonInfo({ address: 1, name: 'Test', symbol: 'TST', description: 'desc' })).toBe(false); | ||
| expect(isJettonInfo({ address: 'EQ...', name: null, symbol: 'TST', description: 'desc' })).toBe(false); | ||
| }); | ||
| it('should return false for an empty object', () => { | ||
| expect(isJettonInfo({})).toBe(false); | ||
| }); | ||
| }); |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| export const isNumber = (value: unknown): value is number => { | ||
| if (typeof value !== 'number') { | ||
| return false; | ||
| } | ||
| if (Number.isNaN(value)) { | ||
| return false; | ||
| } | ||
| return Number.isFinite(value); | ||
| }; |
| > @ton/appkit@0.0.5-alpha.3 build /home/runner/work/kit/kit/packages/appkit | ||
| > @ton/appkit@1.0.0-alpha.0 build /home/runner/work/kit/kit/packages/appkit | ||
| > pnpm build:clean && pnpm build:cjs && pnpm build:esm | ||
| > @ton/appkit@0.0.5-alpha.3 build:clean /home/runner/work/kit/kit/packages/appkit | ||
| > @ton/appkit@1.0.0-alpha.0 build:clean /home/runner/work/kit/kit/packages/appkit | ||
| > git clean -xdf dist | ||
| > @ton/appkit@0.0.5-alpha.3 build:cjs /home/runner/work/kit/kit/packages/appkit | ||
| > @ton/appkit@1.0.0-alpha.0 build:cjs /home/runner/work/kit/kit/packages/appkit | ||
| > tsc -p tsconfig.cjs.json | ||
| > @ton/appkit@0.0.5-alpha.3 build:esm /home/runner/work/kit/kit/packages/appkit | ||
| > @ton/appkit@1.0.0-alpha.0 build:esm /home/runner/work/kit/kit/packages/appkit | ||
| > tsc -p tsconfig.json | ||
+132
-0
| # @ton/appkit | ||
| ## 1.0.0-alpha.0 | ||
| ### Major Changes | ||
| - AppKit V1 | ||
| ### Minor Changes | ||
| - 70efd43: Add LRU cache to `getJettonInfo` and `getJettonWalletAddress`, and make `jettonDecimals` optional in `useJettonBalanceByAddress`. | ||
| `@ton/appkit` now ships with a built-in LRU cache (10-minute TTL, 1000 entries) used to avoid redundant API calls in `getJettonInfo` and `getJettonWalletAddress`. A custom cache can be provided via the new `cache` option in `AppKitConfig`. The `AppKitCache` interface and `LruAppKitCache` class are exported for custom implementations. | ||
| `jettonDecimals` is now optional in `useJettonBalanceByAddress` and `getJettonBalanceByAddressQueryOptions` — when omitted, decimals are resolved automatically from `getJettonInfo` (using the cache). | ||
| `@ton/walletkit`: `lru-cache` dependency pinned to the workspace catalog version. | ||
| - c1f5243: **Staking widget and provider API** | ||
| Breaking changes in `@ton/walletkit`: | ||
| - `getSupportedUnstakeModes()` removed from `StakingProviderInterface` and `StakingProvider`; replaced by `getStakingProviderMetadata(network?)` which returns full static metadata (including unstake modes) | ||
| - `getSupportedNetworks()` added as abstract method to `StakingProvider` — existing custom subclasses must implement it | ||
| - `DefiManagerError` renamed to `DefiError` | ||
| - `lstExchangeRate` renamed to `exchangeRate` in `StakingProviderInfo` | ||
| - `StakingProviderMetadata` shape changed: flat token fields replaced with `stakeToken: StakingTokenInfo` and optional `receiveToken?: StakingTokenInfo` | ||
| Breaking changes in `@ton/appkit`: | ||
| - `getStakingProviders()` return type changed from `string[]` to `StakingProviderInterface[]` | ||
| New in `@ton/walletkit`: | ||
| - Added `StakingTokenInfo` type (exported) | ||
| - `contractAddress` is now optional in `StakingProviderMetadata` (for custodial providers) | ||
| - Added `isReversed` to `StakingQuoteParams` for reversed unstake quotes | ||
| - `TonStakersStakingProvider` accepts `metadataOverride` in config; constructor deep-merges overrides with defaults | ||
| - `BaseProvider` moved from `interfaces` to `models/core` and re-exported | ||
| - Added `TokenAddress` type (`'ton' | UserFriendlyAddress`) | ||
| - `StakingErrorCode` now exported | ||
| - `DefiError.UNSUPPORTED_NETWORK` error code added | ||
| - `StakingManager`, `StakingProvider`, `StakingError` are now value exports (not only type exports) | ||
| New in `@ton/appkit`: | ||
| - Added actions: `getStakingProvider`, `getStakingProviderMetadata`, `watchStakingProviders` | ||
| - Added utilities: `truncateDecimals`, `calcMaxSpendable` | ||
| - `StakingProviderMetadata` and `StakingTokenInfo` now exported from `@ton/appkit` | ||
| New in `@ton/appkit-react`: | ||
| - Added `StakingWidget` — full stake/unstake UI with reversed quotes, balance display, and unstake mode selector | ||
| - New components: `StakingWidgetProvider`, `StakingWidgetUi`, `StakingInfo`, `StakingBalanceBlock`, `SelectUnstakeMode` | ||
| - New hooks: `useStakingProvider`, `useStakingProviders`, `useStakingProviderInfo`, `useStakingProviderMetadata`, `useStakingQuote`, `useBuildStakeTransaction`, `useStakedBalance` | ||
| - Added English localizations for all staking UI strings | ||
| - c1f5243: **Swap widget and provider API** | ||
| Breaking changes in `@ton/walletkit`: | ||
| - `DefiManagerError` renamed to `DefiError`; update any `catch (e instanceof DefiManagerError)` or direct import | ||
| - `SwapFee` type removed; `fee` field removed from `SwapQuote` | ||
| - `getSupportedNetworks()` and `getMetadata()` added as abstract methods to `SwapProvider` — existing custom provider subclasses must implement them | ||
| New in `@ton/walletkit`: | ||
| - Added `SwapProviderMetadata` and `SwapProviderMetadataOverride` types | ||
| - `getMetadata()` on `SwapProviderInterface` returns static display info (name, logo, URL) | ||
| - `getSupportedNetworks()` on `SwapProviderInterface` returns supported networks | ||
| - `DeDustSwapProvider` and `OmnistonSwapProvider` expose metadata; both accept `metadataOverride` in config | ||
| - `getProviders()` replaces `getRegisteredProviders()` — returns `SwapProviderInterface[]` instead of `string[]` | ||
| - `removeProvider()` added to `DefiManagerAPI` | ||
| - Re-registering a provider with an existing id now replaces it instead of throwing | ||
| - `DefiError.UNSUPPORTED_NETWORK` error code added | ||
| - `SwapError`, `SwapManager`, `SwapProvider` are now value exports (not only type exports) | ||
| - Providers emit `provider:registered` and `provider:default-changed` events on `AppKit`'s event emitter | ||
| New in `@ton/appkit`: | ||
| - Added actions: `getSwapProvider`, `getSwapProviders`, `watchSwapProviders`, `setDefaultSwapProvider` | ||
| - `getSwapQuote` now resolves the active network automatically when `network` is omitted | ||
| - Added utilities: `calcFiatValue`, `formatLargeValue`, `debounce`, `calcMaxSpendable`, `getTonShortfall` | ||
| New in `@ton/appkit-react`: | ||
| - Added `SwapWidget` — full-featured swap UI with token selection, amount input, slippage settings, provider picker, and top-up flow | ||
| - New components: `SwapField`, `SwapFlipButton`, `SwapInfo`, `SwapSettingsButton`, `SwapSettingsModal`, `SwapTokenSelectModal`, `SwapWidgetProvider`, `SwapWidgetUi` | ||
| - New hooks: `useSwapProvider`, `useSwapProviders`, `useSwapQuote`, `useBuildSwapTransaction` | ||
| - Added generic `LowBalanceModal` component (shared with staking widget) | ||
| - New utility hooks: `useDebounceCallback`, `useDebounceValue`, `useUnmount` | ||
| - New shared components: `Input`, `Modal`, `Dialog`, `Skeleton`, `Tabs`, `InfoBlock`, `Collapsible`, `CenteredAmountInput`, `AmountPresets`, `TokenSelectModal`, `Logo`, `AmountReversed` | ||
| - Added `AppKitUIToken` type for CSS custom property tokens | ||
| - `useAppKit`, `useAppKitTheme`, `useI18n` moved to `features/settings` (still re-exported from the package root — no import path change needed) | ||
| - `CircleIcon` renamed to `Logo` with an extended API; replace `<CircleIcon src=... />` with `<Logo src=... />` | ||
| - Added English localizations for all swap UI strings | ||
| ### Patch Changes | ||
| - fd7e89f: Added support for new TonConnect features: SignMessage, StructeredItems, EmbeddedRequests | ||
| - 5b75f27: - `@ton/appkit`: | ||
| - added `getSwapProvider` and `watchSwapProviders` actions | ||
| - added swap-related events and types to `AppKit` core | ||
| - added `calcFiatValue` and `formatLargeValue` amount utilities | ||
| - added `debounce` utility function | ||
| - `@ton/walletkit`: | ||
| - added `SwapProviderMetadata` interface | ||
| - added `getMetadata()` method to `SwapProvider` | ||
| - added metadata support to `DeDustSwapProvider` and `OmnistonSwapProvider` | ||
| - `@ton/appkit-react`: | ||
| - added `SwapWidget` and related UI components (`SwapField`, `SwapSettings`, `TokenSelector`, etc.) | ||
| - added `SwapWidgetProvider` for swap state management | ||
| - added hooks for swap: `useSwapProvider`, `useSwapQuote`, `useBuildSwapTransaction` | ||
| - added `useDebounceCallback`, `useDebounceValue`, and `useUnmount` utility hooks | ||
| - added English localizations for swap features | ||
| - 50c5bf3: - `@ton/walletkit`: | ||
| - refactored `StakingProviderMetadata`: flat token fields replaced with `stakeToken: StakingTokenInfo` object and optional `receiveToken?: StakingTokenInfo` group to support both liquid and custodial staking providers | ||
| - made `contractAddress` optional in `StakingProviderMetadata` for custodial providers without on-chain contracts | ||
| - renamed `lstExchangeRate` to `exchangeRate` in `StakingProviderInfo` | ||
| - added `StakingTokenInfo` type export | ||
| - added `isReversed` parameter to `StakingQuoteParams` for reversed unstake quotes | ||
| - added deep-merge support for metadata overrides in `TonStakersStakingProvider` constructor | ||
| - added `getStakingProvider` and `watchStakingProviders` to `DefiManager` | ||
| - `@ton/appkit`: | ||
| - added `getStakingProviderMetadata`, `getStakingProvider`, and `watchStakingProviders` actions | ||
| - added `truncateDecimals` and `formatLargeValue` amount utilities | ||
| - exported `StakingTokenInfo` type | ||
| - `@ton/appkit-react`: | ||
| - added `StakingWidget` with full stake/unstake UI, balance display, reversed quotes, and unstake mode selector | ||
| - updated base design tokens to TonConnect colors | ||
| - added staking hooks and i18n translations | ||
| - c67bb0e: Added emulation support to the TonAPI client and introduced provider-agnostic emulation domain models under `api/models/emulation` (`EmulationResult`, `EmulationResponse`, `EmulationTransaction`, `EmulationMessage`, `EmulationAction`, `EmulationTraceNode`, `EmulationAddressBookEntry`). `ApiClient.fetchEmulation` now returns `EmulationResult` instead of the toncenter-specific `ToncenterEmulationResult`, so callers get the same shape regardless of backend. Reorganized toncenter raw types under `clients/toncenter/types/*` (NFTs, jettons, DNS, metadata, raw emulation), moved the `ApiClient` interface to `api/interfaces`, removed legacy emulation parsing utilities (`utils/toncenterEmulation`, message/jetton parser handlers), and migrated optional NFT and DNS results from `null` to `undefined` across walletkit, appkit, and mcp. | ||
| - Updated dependencies [db5c23b] | ||
| - Updated dependencies [70efd43] | ||
| - Updated dependencies [fd7e89f] | ||
| - Updated dependencies [db5c23b] | ||
| - Updated dependencies [5b75f27] | ||
| - Updated dependencies [50c5bf3] | ||
| - Updated dependencies [c1f5243] | ||
| - Updated dependencies [c1f5243] | ||
| - Updated dependencies [c67bb0e] | ||
| - @ton/walletkit@1.0.0-alpha.4 | ||
| ## 0.0.5-alpha.3 | ||
@@ -4,0 +136,0 @@ |
@@ -46,6 +46,13 @@ /** | ||
| export { getSwapManager, type GetSwapManagerReturnType } from './swap/get-swap-manager'; | ||
| export { getSwapProvider, type GetSwapProviderOptions, type GetSwapProviderReturnType } from './swap/get-swap-provider'; | ||
| export { getSwapProviders, type GetSwapProvidersReturnType } from './swap/get-swap-providers'; | ||
| export { setDefaultSwapProvider, type SetDefaultSwapProviderParameters, type SetDefaultSwapProviderReturnType, } from './swap/set-default-swap-provider'; | ||
| export { getSwapQuote, type GetSwapQuoteOptions, type GetSwapQuoteReturnType } from './swap/get-swap-quote'; | ||
| export { watchSwapProviders, type WatchSwapProvidersParameters, type WatchSwapProvidersReturnType, } from './swap/watch-swap-providers'; | ||
| export { buildSwapTransaction, type BuildSwapTransactionOptions, type BuildSwapTransactionReturnType, } from './swap/build-swap-transaction'; | ||
| export { getStakingManager, type GetStakingManagerReturnType } from './staking/get-staking-manager'; | ||
| export { getStakingProviders, type GetStakingProvidersReturnType } from './staking/get-staking-providers'; | ||
| export { getStakingProvider, type GetStakingProviderOptions, type GetStakingProviderReturnType, } from './staking/get-staking-provider'; | ||
| export { setDefaultStakingProvider, type SetDefaultStakingProviderParameters, type SetDefaultStakingProviderReturnType, } from './staking/set-default-staking-provider'; | ||
| export { watchStakingProviders, type WatchStakingProvidersParameters, type WatchStakingProvidersReturnType, } from './staking/watch-staking-providers'; | ||
| export { getStakingQuote, type GetStakingQuoteOptions, type GetStakingQuoteReturnType, } from './staking/get-staking-quote'; | ||
@@ -55,2 +62,3 @@ export { buildStakeTransaction, type BuildStakeTransactionOptions, type BuildStakeTransactionReturnType, } from './staking/build-stake-transaction'; | ||
| export { getStakingProviderInfo, type GetStakingProviderInfoOptions, type GetStakingProviderInfoReturnType, } from './staking/get-staking-provider-info'; | ||
| export { getStakingProviderMetadata, type GetStakingProviderMetadataOptions, type GetStakingProviderMetadataReturnType, } from './staking/get-staking-provider-metadata'; | ||
| export { sendTransaction, type SendTransactionParameters, type SendTransactionReturnType, } from './transaction/send-transaction'; | ||
@@ -57,0 +65,0 @@ export { transferTon, type TransferTonParameters, type TransferTonReturnType } from './transaction/transfer-ton'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACH,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,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B,EACpC,KAAK,+BAA+B,GACvC,MAAM,mCAAmC,CAAC"} |
@@ -10,4 +10,4 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.watchTransactionsByAddress = exports.getTransactionStatus = exports.transferTon = exports.sendTransaction = exports.getStakingProviderInfo = exports.getStakedBalance = exports.buildStakeTransaction = exports.getStakingQuote = exports.getStakingProviders = exports.getStakingManager = exports.buildSwapTransaction = exports.getSwapQuote = exports.getSwapManager = exports.signCell = exports.signBinary = exports.signText = exports.registerProvider = exports.transferNft = exports.getNft = exports.getNfts = exports.getNftsByAddress = exports.hasStreamingProvider = exports.watchDefaultNetwork = exports.setDefaultNetwork = exports.getDefaultNetwork = exports.getBlockNumber = exports.watchNetworks = exports.getApiClient = exports.getNetwork = exports.getNetworks = exports.transferJetton = exports.createTransferJettonTransaction = exports.watchJettons = exports.getJettons = exports.watchJettonsByAddress = exports.getJettonsByAddress = exports.getJettonBalance = exports.getJettonWalletAddress = exports.getJettonInfo = exports.watchConnectorById = exports.getConnectorById = exports.watchConnectors = exports.getConnectors = exports.disconnect = exports.connect = exports.addConnector = exports.watchBalance = exports.getBalance = exports.watchBalanceByAddress = exports.getBalanceByAddress = void 0; | ||
| exports.watchConnectedWallets = exports.watchSelectedWallet = exports.setSelectedWalletId = exports.getSelectedWallet = exports.getConnectedWallets = exports.createTransferTonTransaction = exports.createTransferNftTransaction = exports.watchTransactions = void 0; | ||
| exports.getStakingQuote = exports.watchStakingProviders = exports.setDefaultStakingProvider = exports.getStakingProvider = exports.getStakingProviders = exports.getStakingManager = exports.buildSwapTransaction = exports.watchSwapProviders = exports.getSwapQuote = exports.setDefaultSwapProvider = exports.getSwapProviders = exports.getSwapProvider = exports.getSwapManager = exports.signCell = exports.signBinary = exports.signText = exports.registerProvider = exports.transferNft = exports.getNft = exports.getNfts = exports.getNftsByAddress = exports.hasStreamingProvider = exports.watchDefaultNetwork = exports.setDefaultNetwork = exports.getDefaultNetwork = exports.getBlockNumber = exports.watchNetworks = exports.getApiClient = exports.getNetwork = exports.getNetworks = exports.transferJetton = exports.createTransferJettonTransaction = exports.watchJettons = exports.getJettons = exports.watchJettonsByAddress = exports.getJettonsByAddress = exports.getJettonBalance = exports.getJettonWalletAddress = exports.getJettonInfo = exports.watchConnectorById = exports.getConnectorById = exports.watchConnectors = exports.getConnectors = exports.disconnect = exports.connect = exports.addConnector = exports.watchBalance = exports.getBalance = exports.watchBalanceByAddress = exports.getBalanceByAddress = void 0; | ||
| exports.watchConnectedWallets = exports.watchSelectedWallet = exports.setSelectedWalletId = exports.getSelectedWallet = exports.getConnectedWallets = exports.createTransferTonTransaction = exports.createTransferNftTransaction = exports.watchTransactions = exports.watchTransactionsByAddress = exports.getTransactionStatus = exports.transferTon = exports.sendTransaction = exports.getStakingProviderMetadata = exports.getStakingProviderInfo = exports.getStakedBalance = exports.buildStakeTransaction = void 0; | ||
| // Balances | ||
@@ -97,4 +97,12 @@ var get_balance_by_address_1 = require("./balances/get-balance-by-address"); | ||
| Object.defineProperty(exports, "getSwapManager", { enumerable: true, get: function () { return get_swap_manager_1.getSwapManager; } }); | ||
| var get_swap_provider_1 = require("./swap/get-swap-provider"); | ||
| Object.defineProperty(exports, "getSwapProvider", { enumerable: true, get: function () { return get_swap_provider_1.getSwapProvider; } }); | ||
| var get_swap_providers_1 = require("./swap/get-swap-providers"); | ||
| Object.defineProperty(exports, "getSwapProviders", { enumerable: true, get: function () { return get_swap_providers_1.getSwapProviders; } }); | ||
| var set_default_swap_provider_1 = require("./swap/set-default-swap-provider"); | ||
| Object.defineProperty(exports, "setDefaultSwapProvider", { enumerable: true, get: function () { return set_default_swap_provider_1.setDefaultSwapProvider; } }); | ||
| var get_swap_quote_1 = require("./swap/get-swap-quote"); | ||
| Object.defineProperty(exports, "getSwapQuote", { enumerable: true, get: function () { return get_swap_quote_1.getSwapQuote; } }); | ||
| var watch_swap_providers_1 = require("./swap/watch-swap-providers"); | ||
| Object.defineProperty(exports, "watchSwapProviders", { enumerable: true, get: function () { return watch_swap_providers_1.watchSwapProviders; } }); | ||
| var build_swap_transaction_1 = require("./swap/build-swap-transaction"); | ||
@@ -107,2 +115,8 @@ Object.defineProperty(exports, "buildSwapTransaction", { enumerable: true, get: function () { return build_swap_transaction_1.buildSwapTransaction; } }); | ||
| Object.defineProperty(exports, "getStakingProviders", { enumerable: true, get: function () { return get_staking_providers_1.getStakingProviders; } }); | ||
| var get_staking_provider_1 = require("./staking/get-staking-provider"); | ||
| Object.defineProperty(exports, "getStakingProvider", { enumerable: true, get: function () { return get_staking_provider_1.getStakingProvider; } }); | ||
| var set_default_staking_provider_1 = require("./staking/set-default-staking-provider"); | ||
| Object.defineProperty(exports, "setDefaultStakingProvider", { enumerable: true, get: function () { return set_default_staking_provider_1.setDefaultStakingProvider; } }); | ||
| var watch_staking_providers_1 = require("./staking/watch-staking-providers"); | ||
| Object.defineProperty(exports, "watchStakingProviders", { enumerable: true, get: function () { return watch_staking_providers_1.watchStakingProviders; } }); | ||
| var get_staking_quote_1 = require("./staking/get-staking-quote"); | ||
@@ -116,2 +130,4 @@ Object.defineProperty(exports, "getStakingQuote", { enumerable: true, get: function () { return get_staking_quote_1.getStakingQuote; } }); | ||
| Object.defineProperty(exports, "getStakingProviderInfo", { enumerable: true, get: function () { return get_staking_provider_info_1.getStakingProviderInfo; } }); | ||
| var get_staking_provider_metadata_1 = require("./staking/get-staking-provider-metadata"); | ||
| Object.defineProperty(exports, "getStakingProviderMetadata", { enumerable: true, get: function () { return get_staking_provider_metadata_1.getStakingProviderMetadata; } }); | ||
| // Transactions | ||
@@ -118,0 +134,0 @@ var send_transaction_1 = require("./transaction/send-transaction"); |
@@ -14,3 +14,3 @@ /** | ||
| amount: string; | ||
| jettonDecimals: number; | ||
| jettonDecimals?: number; | ||
| comment?: string; | ||
@@ -17,0 +17,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"create-transfer-jetton-transaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/create-transfer-jetton-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,MAAM,WAAW,yCAAyC;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,yCAAyC,GAAG,kBAAkB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,+BAA+B,GACxC,QAAQ,MAAM,EACd,YAAY,yCAAyC,KACtD,OAAO,CAAC,yCAAyC,CA8BnD,CAAC"} | ||
| {"version":3,"file":"create-transfer-jetton-transaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/create-transfer-jetton-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAKjD,MAAM,WAAW,yCAAyC;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,yCAAyC,GAAG,kBAAkB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,+BAA+B,GACxC,QAAQ,MAAM,EACd,YAAY,yCAAyC,KACtD,OAAO,CAAC,yCAAyC,CA4CnD,CAAC"} |
@@ -13,2 +13,4 @@ "use strict"; | ||
| const get_selected_wallet_1 = require("../wallets/get-selected-wallet"); | ||
| const get_jetton_info_1 = require("./get-jetton-info"); | ||
| const utils_1 = require("../../utils"); | ||
| /** | ||
@@ -24,10 +26,20 @@ * Create a Jetton transfer transaction request | ||
| // Get client from network manager | ||
| const client = appKit.networkManager.getClient(wallet.getNetwork()); | ||
| const network = wallet.getNetwork(); | ||
| const client = appKit.networkManager.getClient(network); | ||
| // Get jetton wallet address | ||
| const jettonWalletAddress = await (0, walletkit_1.getJettonWalletAddressFromClient)(client, jettonAddress, wallet.getAddress()); | ||
| const ownerAddress = wallet.getAddress(); | ||
| const jettonWalletAddress = await (0, walletkit_1.getJettonWalletAddressFromClient)(client, jettonAddress, ownerAddress); | ||
| let decimals = jettonDecimals; | ||
| if (!(0, utils_1.isNumber)(decimals)) { | ||
| const jettonInfo = await (0, get_jetton_info_1.getJettonInfo)(appKit, { address: jettonAddress, network }); | ||
| if (!(0, utils_1.isNumber)(jettonInfo?.decimals)) { | ||
| throw new Error(`Jetton decimals not found for address ${jettonAddress}`); | ||
| } | ||
| decimals = jettonInfo.decimals; | ||
| } | ||
| // Create jetton transfer payload | ||
| const jettonPayload = (0, walletkit_1.createJettonTransferPayload)({ | ||
| amount: (0, walletkit_1.parseUnits)(amount, jettonDecimals), | ||
| amount: (0, walletkit_1.parseUnits)(amount, decimals), | ||
| destination: recipientAddress, | ||
| responseDestination: wallet.getAddress(), | ||
| responseDestination: ownerAddress, | ||
| comment, | ||
@@ -40,5 +52,5 @@ }); | ||
| payload: jettonPayload, | ||
| fromAddress: wallet.getAddress(), | ||
| fromAddress: ownerAddress, | ||
| }); | ||
| }; | ||
| exports.createTransferJettonTransaction = createTransferJettonTransaction; |
@@ -14,3 +14,3 @@ /** | ||
| ownerAddress: UserFriendlyAddress; | ||
| jettonDecimals: number; | ||
| jettonDecimals?: number; | ||
| network?: Network; | ||
@@ -17,0 +17,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-balance.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-balance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACpC,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC;AAErD,eAAO,MAAM,gBAAgB,GACzB,QAAQ,MAAM,EACd,SAAS,uBAAuB,KACjC,OAAO,CAAC,0BAA0B,CAapC,CAAC"} | ||
| {"version":3,"file":"get-jetton-balance.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-balance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACpC,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC;AAErD,eAAO,MAAM,gBAAgB,GACzB,QAAQ,MAAM,EACd,SAAS,uBAAuB,KACjC,OAAO,CAAC,0BAA0B,CAmBpC,CAAC"} |
@@ -13,6 +13,7 @@ "use strict"; | ||
| const get_jetton_wallet_address_1 = require("./get-jetton-wallet-address"); | ||
| const resolve_network_1 = require("../../utils/network/resolve-network"); | ||
| const get_jetton_info_1 = require("./get-jetton-info"); | ||
| const utils_1 = require("../../utils"); | ||
| const getJettonBalance = async (appKit, options) => { | ||
| const { jettonAddress, ownerAddress, jettonDecimals, network } = options; | ||
| const client = appKit.networkManager.getClient((0, resolve_network_1.resolveNetwork)(appKit, network)); | ||
| const client = appKit.networkManager.getClient((0, utils_1.resolveNetwork)(appKit, network)); | ||
| const jettonWalletAddress = await (0, get_jetton_wallet_address_1.getJettonWalletAddress)(appKit, { | ||
@@ -24,4 +25,8 @@ jettonAddress, | ||
| const balance = await (0, walletkit_1.getJettonBalanceFromClient)(client, jettonWalletAddress); | ||
| return (0, walletkit_1.formatUnits)(balance, jettonDecimals); | ||
| if ((0, utils_1.isNumber)(jettonDecimals)) { | ||
| return (0, walletkit_1.formatUnits)(balance, jettonDecimals); | ||
| } | ||
| const jettonInfo = await (0, get_jetton_info_1.getJettonInfo)(appKit, { address: jettonAddress, network }); | ||
| return (0, walletkit_1.formatUnits)(balance, jettonInfo?.decimals ?? 0); | ||
| }; | ||
| exports.getJettonBalance = getJettonBalance; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,IAAI,CAAC;AAExD,eAAO,MAAM,aAAa,GACtB,QAAQ,MAAM,EACd,SAAS,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,CAgDjC,CAAC"} | ||
| {"version":3,"file":"get-jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,IAAI,CAAC;AAIxD,eAAO,MAAM,aAAa,GACtB,QAAQ,MAAM,EACd,SAAS,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,CAyDjC,CAAC"} |
@@ -11,8 +11,15 @@ "use strict"; | ||
| exports.getJettonInfo = void 0; | ||
| const resolve_network_1 = require("../../utils/network/resolve-network"); | ||
| const utils_1 = require("../../utils"); | ||
| const cache_1 = require("../../core/cache"); | ||
| const getJettonInfoCacheKey = (0, cache_1.getCacheKey)('jetton-info'); | ||
| const getJettonInfo = async (appKit, options) => { | ||
| const { address, network } = options; | ||
| const client = appKit.networkManager.getClient((0, resolve_network_1.resolveNetwork)(appKit, network)); | ||
| const address = (0, utils_1.toBounceableAddress)(options.address); | ||
| const network = (0, utils_1.resolveNetwork)(appKit, options.network); | ||
| const cacheKey = getJettonInfoCacheKey(address, network.chainId); | ||
| const cached = await appKit.cache.get(cacheKey); | ||
| if (cached && (0, utils_1.isJettonInfo)(cached)) | ||
| return cached; | ||
| const client = appKit.networkManager.getClient(network); | ||
| const response = await client.jettonsByAddress({ | ||
| address: address, | ||
| address, | ||
| offset: 0, | ||
@@ -39,5 +46,5 @@ limit: 1, | ||
| } | ||
| return { | ||
| const result = { | ||
| address, | ||
| decimals, | ||
| address: jetton.jetton, | ||
| name: tokenInfo?.name ?? '', | ||
@@ -49,3 +56,5 @@ symbol: tokenInfo?.symbol ?? '', | ||
| }; | ||
| await appKit.cache.set(cacheKey, result); | ||
| return result; | ||
| }; | ||
| exports.getJettonInfo = getJettonInfo; |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| import type { UserFriendlyAddress } from '@ton/walletkit'; | ||
| import type { UserFriendlyAddress } from '../../types/primitives'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
@@ -11,0 +11,0 @@ import type { Network } from '../../types/network'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,6BAA6B;IAC1C,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEnE,eAAO,MAAM,sBAAsB,GAC/B,QAAQ,MAAM,EACd,SAAS,6BAA6B,KACvC,OAAO,CAAC,gCAAgC,CAM1C,CAAC"} | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,WAAW,6BAA6B;IAC1C,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAInE,eAAO,MAAM,sBAAsB,GAC/B,QAAQ,MAAM,EACd,SAAS,6BAA6B,KACvC,OAAO,CAAC,gCAAgC,CAiB1C,CAAC"} |
@@ -12,8 +12,19 @@ "use strict"; | ||
| const walletkit_1 = require("@ton/walletkit"); | ||
| const resolve_network_1 = require("../../utils/network/resolve-network"); | ||
| const cache_1 = require("../../core/cache"); | ||
| const utils_1 = require("../../utils"); | ||
| const getJettonWalletCacheKey = (0, cache_1.getCacheKey)('jetton-wallet-address'); | ||
| const getJettonWalletAddress = async (appKit, options) => { | ||
| const { jettonAddress, ownerAddress, network } = options; | ||
| const client = appKit.networkManager.getClient((0, resolve_network_1.resolveNetwork)(appKit, network)); | ||
| return (0, walletkit_1.getJettonWalletAddressFromClient)(client, jettonAddress, ownerAddress); | ||
| const ownerAddress = (0, utils_1.toBounceableAddress)(options.ownerAddress); | ||
| const jettonAddress = (0, utils_1.toBounceableAddress)(options.jettonAddress); | ||
| const network = (0, utils_1.resolveNetwork)(appKit, options.network); | ||
| const cacheKey = getJettonWalletCacheKey(network.chainId, ownerAddress, jettonAddress); | ||
| const cached = await appKit.cache.get(cacheKey); | ||
| if (cached && (0, utils_1.isFriendlyTonAddress)(cached)) { | ||
| return cached; | ||
| } | ||
| const client = appKit.networkManager.getClient(network); | ||
| const jettonWalletAddress = await (0, walletkit_1.getJettonWalletAddressFromClient)(client, jettonAddress, ownerAddress); | ||
| await appKit.cache.set(cacheKey, jettonWalletAddress); | ||
| return jettonWalletAddress; | ||
| }; | ||
| exports.getJettonWalletAddress = getJettonWalletAddress; |
@@ -16,4 +16,4 @@ /** | ||
| } | ||
| export type GetNftReturnType = NFT | null; | ||
| export type GetNftReturnType = NFT | undefined; | ||
| export declare const getNft: (appKit: AppKit, options: GetNftOptions) => Promise<GetNftReturnType>; | ||
| //# sourceMappingURL=get-nft.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-nft.d.ts","sourceRoot":"","sources":["../../../../src/actions/nft/get-nft.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;AAE1C,eAAO,MAAM,MAAM,GAAU,QAAQ,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,gBAAgB,CAO7F,CAAC"} | ||
| {"version":3,"file":"get-nft.d.ts","sourceRoot":"","sources":["../../../../src/actions/nft/get-nft.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,SAAS,CAAC;AAE/C,eAAO,MAAM,MAAM,GAAU,QAAQ,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,gBAAgB,CAO7F,CAAC"} |
@@ -8,8 +8,9 @@ /** | ||
| */ | ||
| import type { StakingProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProvidersReturnType = string[]; | ||
| export type GetStakingProvidersReturnType = StakingProviderInterface[]; | ||
| /** | ||
| * Get available staking provider IDs | ||
| * Get all registered staking providers. | ||
| */ | ||
| export declare const getStakingProviders: (appKit: AppKit) => GetStakingProvidersReturnType; | ||
| //# sourceMappingURL=get-staking-providers.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,6BAA6B,GAAG,MAAM,EAAE,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,6BAEpD,CAAC"} | ||
| {"version":3,"file":"get-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,EAAE,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,6BAEpD,CAAC"} |
@@ -12,7 +12,7 @@ "use strict"; | ||
| /** | ||
| * Get available staking provider IDs | ||
| * Get all registered staking providers. | ||
| */ | ||
| const getStakingProviders = (appKit) => { | ||
| return appKit.stakingManager.getRegisteredProviders(); | ||
| return appKit.stakingManager.getProviders(); | ||
| }; | ||
| exports.getStakingProviders = getStakingProviders; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-swap-quote.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,GAAG,OAAO,EAC1C,QAAQ,MAAM,EACd,SAAS,mBAAmB,CAAC,CAAC,CAAC,KAChC,sBAEF,CAAC"} | ||
| {"version":3,"file":"get-swap-quote.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,GAAG,OAAO,EAC1C,QAAQ,MAAM,EACd,SAAS,mBAAmB,CAAC,CAAC,CAAC,KAChC,sBAOF,CAAC"} |
@@ -11,2 +11,3 @@ "use strict"; | ||
| exports.getSwapQuote = void 0; | ||
| const utils_1 = require("../../utils"); | ||
| /** | ||
@@ -16,4 +17,8 @@ * Get swap quote | ||
| const getSwapQuote = async (appKit, options) => { | ||
| return appKit.swapManager.getQuote(options, options.providerId); | ||
| const optionsWithNetwork = { | ||
| ...options, | ||
| network: (0, utils_1.resolveNetwork)(appKit, options.network), | ||
| }; | ||
| return appKit.swapManager.getQuote(optionsWithNetwork, options.providerId); | ||
| }; | ||
| exports.getSwapQuote = getSwapQuote; |
@@ -17,3 +17,3 @@ "use strict"; | ||
| const createTonConnectConnector = (config) => { | ||
| return (0, connector_1.createConnector)(({ eventEmitter, networkManager, ssr }) => { | ||
| return (0, connector_1.createConnector)(({ eventEmitter, networkManager }) => { | ||
| let originalTonConnectUI = null; | ||
@@ -26,3 +26,3 @@ let unsubscribeTonConnect = null; | ||
| } | ||
| if (ssr && typeof window === 'undefined') { | ||
| if (typeof window === 'undefined') { | ||
| return null; | ||
@@ -29,0 +29,0 @@ } |
@@ -29,8 +29,2 @@ /** | ||
| }; | ||
| /** | ||
| * Plugin events | ||
| */ | ||
| export declare const PLUGIN_EVENTS: { | ||
| readonly REGISTERED: "plugin:registered"; | ||
| }; | ||
| //# sourceMappingURL=events.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/constants/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;;CAEhB,CAAC"} | ||
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/constants/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;;;CAGlB,CAAC"} |
@@ -10,3 +10,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.PLUGIN_EVENTS = exports.NETWORKS_EVENTS = exports.WALLETS_EVENTS = exports.CONNECTOR_EVENTS = void 0; | ||
| exports.NETWORKS_EVENTS = exports.WALLETS_EVENTS = exports.CONNECTOR_EVENTS = void 0; | ||
| /** | ||
@@ -33,7 +33,1 @@ * Connector events | ||
| }; | ||
| /** | ||
| * Plugin events | ||
| */ | ||
| exports.PLUGIN_EVENTS = { | ||
| REGISTERED: 'plugin:registered', | ||
| }; |
@@ -9,5 +9,5 @@ /** | ||
| export { AppKit } from './services/app-kit'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
| export type { AppKitConfig } from './types/config'; | ||
| export type { AppKitEmitter, AppKitEvents, WalletConnectedPayload, WalletDisconnectedPayload, PluginRegisteredPayload, DefaultNetworkChangedPayload, } from './types/events'; | ||
| export type { AppKitEmitter, AppKitEvents, WalletConnectedPayload, WalletDisconnectedPayload, DefaultNetworkChangedPayload, } from './types/events'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/app-kit/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEtG,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACR,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,GAC/B,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/app-kit/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEvF,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACR,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,GAC/B,MAAM,gBAAgB,CAAC"} |
@@ -10,3 +10,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.NETWORKS_EVENTS = exports.PLUGIN_EVENTS = exports.WALLETS_EVENTS = exports.CONNECTOR_EVENTS = exports.AppKit = void 0; | ||
| exports.NETWORKS_EVENTS = exports.WALLETS_EVENTS = exports.CONNECTOR_EVENTS = exports.AppKit = void 0; | ||
| var app_kit_1 = require("./services/app-kit"); | ||
@@ -17,3 +17,2 @@ Object.defineProperty(exports, "AppKit", { enumerable: true, get: function () { return app_kit_1.AppKit; } }); | ||
| Object.defineProperty(exports, "WALLETS_EVENTS", { enumerable: true, get: function () { return events_1.WALLETS_EVENTS; } }); | ||
| Object.defineProperty(exports, "PLUGIN_EVENTS", { enumerable: true, get: function () { return events_1.PLUGIN_EVENTS; } }); | ||
| Object.defineProperty(exports, "NETWORKS_EVENTS", { enumerable: true, get: function () { return events_1.NETWORKS_EVENTS; } }); |
@@ -10,2 +10,3 @@ /** | ||
| import type { ProviderInput } from '@ton/walletkit'; | ||
| import type { AppKitConfig } from '../types/config'; | ||
| import { StakingManager } from '../../../staking'; | ||
@@ -16,3 +17,3 @@ import type { Connector, ConnectorFactoryContext, ConnectorInput } from '../../../types/connector'; | ||
| import { AppKitNetworkManager } from '../../network'; | ||
| import type { AppKitConfig } from '../types/config'; | ||
| import type { AppKitCache } from '../../cache'; | ||
| /** | ||
@@ -31,2 +32,3 @@ * Central hub for wallet management. | ||
| readonly config: AppKitConfig; | ||
| readonly cache: AppKitCache; | ||
| constructor(config: AppKitConfig); | ||
@@ -33,0 +35,0 @@ createFactoryContext(): ConnectorFactoryContext; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"app-kit.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/services/app-kit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAmD,MAAM,gBAAgB,CAAC;AAErG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGnG,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,MAAM;IACf,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,CAAM;IACtC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAExC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,EAAE,gBAAg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AAc,CAAC;IAExC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;gBAEhB,MAAM,EAAE,YAAY;IAiChC,oBAAoB,IAAI,uBAAuB;IAI/C;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,IAAI;IAgB/C;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAU3C;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAc5C;;OAEG;IACH,OAAO,CAAC,2BAA2B;CAWtC"} |
@@ -12,8 +12,9 @@ "use strict"; | ||
| const walletkit_1 = require("@ton/walletkit"); | ||
| const events_1 = require("../constants/events"); | ||
| const staking_1 = require("../../../staking"); | ||
| const emitter_1 = require("../../emitter"); | ||
| const events_1 = require("../constants/events"); | ||
| const wallets_manager_1 = require("../../wallets-manager"); | ||
| const network_1 = require("../../network"); | ||
| const network_2 = require("../../../types/network"); | ||
| const cache_1 = require("../../cache"); | ||
| /** | ||
@@ -27,2 +28,3 @@ * Central hub for wallet management. | ||
| this.config = config; | ||
| this.cache = config.cache ?? new cache_1.LruAppKitCache(); | ||
| this.emitter = new emitter_1.EventEmitter(); | ||
@@ -52,3 +54,3 @@ this.emitter.on(events_1.CONNECTOR_EVENTS.CONNECTED, this.updateWalletsFromConnectors.bind(this)); | ||
| createFactoryContext() { | ||
| return { eventEmitter: this.emitter, networkManager: this.networkManager, ssr: this.config?.ssr }; | ||
| return { eventEmitter: this.emitter, networkManager: this.networkManager }; | ||
| } | ||
@@ -55,0 +57,0 @@ /** |
@@ -9,2 +9,3 @@ /** | ||
| import type { NetworkAdapters, ProviderInput } from '@ton/walletkit'; | ||
| import type { AppKitCache } from '../../cache'; | ||
| import type { ConnectorInput } from '../../../types/connector'; | ||
@@ -36,6 +37,7 @@ import type { Network } from '../../../types/network'; | ||
| /** | ||
| * Enable server-side rendering support | ||
| * Custom cache implementation. | ||
| * Defaults to an LRU cache with a 10-minute TTL and a maximum of 1000 entries. | ||
| */ | ||
| ssr?: boolean; | ||
| cache?: AppKitCache; | ||
| } | ||
| //# sourceMappingURL=config.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAE9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB"} | ||
| {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAE9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB"} |
@@ -8,5 +8,5 @@ /** | ||
| */ | ||
| import type { Network } from '../../../types/network'; | ||
| import type { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from '../constants/events'; | ||
| import type { SharedKitEvents } from '../../emitter'; | ||
| import type { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from '../constants/events'; | ||
| import type { Network } from '../../../types/network'; | ||
| import type { EventEmitter } from '../../emitter'; | ||
@@ -21,6 +21,2 @@ import type { WalletInterface } from '../../../types/wallet'; | ||
| } | ||
| export interface PluginRegisteredPayload { | ||
| pluginId: string; | ||
| pluginType: string; | ||
| } | ||
| export interface DefaultNetworkChangedPayload { | ||
@@ -40,5 +36,4 @@ network: Network | undefined; | ||
| [NETWORKS_EVENTS.DEFAULT_CHANGED]: DefaultNetworkChangedPayload; | ||
| [PLUGIN_EVENTS.REGISTERED]: PluginRegisteredPayload; | ||
| } & SharedKitEvents; | ||
| export type AppKitEmitter = EventEmitter<AppKitEvents>; | ||
| //# sourceMappingURL=events.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/types/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,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,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACtC,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IACzC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG;IAEvB,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACrD,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,yBAAyB,CAAC;IAG3D,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;IACzD,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAGhE,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,4BAA4B,CAAC;CACnE,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC"} |
@@ -27,2 +27,3 @@ /** | ||
| export * from './core/app-kit'; | ||
| export * from './core/cache'; | ||
| export * from './core/emitter'; | ||
@@ -29,0 +30,0 @@ export * from './core/network'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src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BAAiB,CAAC;AAGhC,cAAc,SAAS,CAAC"} |
@@ -44,2 +44,3 @@ "use strict"; | ||
| __exportStar(require("./core/app-kit"), exports); | ||
| __exportStar(require("./core/cache"), exports); | ||
| __exportStar(require("./core/emitter"), exports); | ||
@@ -46,0 +47,0 @@ __exportStar(require("./core/network"), exports); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/balances/get-balance-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,OAAO,CACtF,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAExG,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,iBAAgB,8BAA8B,CAAC,UAAU,CAAM,KAChE,+BAA+B,CAAC,UAAU,CAe5C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B,GACpC,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,2BAEF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC5B,aAAa,WAAW,EACxB,sBAAsB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3D,QAAQ,aAAa,SAYxB,CAAC"} | ||
| {"version":3,"file":"get-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/balances/get-balance-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,OAAO,CACtF,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAExG,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,iBAAgB,8BAA8B,CAAC,UAAU,CAAM,KAChE,+BAA+B,CAAC,UAAU,CAmB5C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B,GACpC,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,2BAEF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC5B,aAAa,WAAW,EACxB,sBAAsB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3D,QAAQ,aAAa,SAexB,CAAC"} |
@@ -15,3 +15,7 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: (0, utils_1.tryToBounceableAddress)(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -39,4 +43,7 @@ ...options.query, | ||
| const handleBalanceUpdate = (queryClient, { address, network }, update) => { | ||
| const queryKey = (0, exports.getBalanceByAddressQueryKey)({ | ||
| address: (0, utils_1.tryToBounceableAddress)(address) ?? address, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = (0, exports.getBalanceByAddressQueryKey)({ address, network }); | ||
| queryClient.setQueryData(queryKey, update.balance); | ||
@@ -46,3 +53,2 @@ (0, utils_1.sleep)(5000).then(() => queryClient.invalidateQueries({ queryKey })); | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = (0, exports.getBalanceByAddressQueryKey)({ address, network }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
@@ -49,0 +55,0 @@ } |
@@ -25,3 +25,2 @@ /** | ||
| export { buildSwapTransactionMutationOptions, type BuildSwapTransactionMutationConfig, type BuildSwapTransactionMutationOptions, type BuildSwapTransactionData, type BuildSwapTransactionErrorType, type BuildSwapTransactionMutate, type BuildSwapTransactionMutateAsync, type BuildSwapTransactionVariables, } from './swap/build-swap-transaction'; | ||
| export { getStakingProvidersQueryOptions, type GetStakingProvidersData, type GetStakingProvidersErrorType, type GetStakingProvidersQueryConfig, } from './staking/get-staking-providers'; | ||
| export { getStakingQuoteQueryOptions, type GetStakingQuoteQueryConfig, type GetStakingQuoteQueryOptions, type GetStakingQuoteData, type GetStakingQuoteErrorType, type GetStakingQuoteQueryFnData, type GetStakingQuoteQueryKey, } from './staking/get-staking-quote'; | ||
@@ -28,0 +27,0 @@ export { getStakedBalanceQueryOptions, type GetStakedBalanceQueryConfig, type GetStakedBalanceData, type GetStakedBalanceErrorType, } from './staking/get-staked-balance'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/queries/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACH,+BAA+B,EAC/B,mBAAmB,EACnB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,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/B,KAAK,+BAA+B,GACvC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,oCAAoC,EACpC,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,GACtC,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACH,0BAA0B,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACxC,MAAM,sCAAsC,CAAC"} |
@@ -10,3 +10,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getTransactionStatusQueryOptions = exports.sendTransactionMutationOptions = exports.transferTonMutationOptions = exports.buildStakeTransactionMutationOptions = exports.getStakingProviderInfoQueryOptions = exports.getStakedBalanceQueryOptions = exports.getStakingQuoteQueryOptions = exports.getStakingProvidersQueryOptions = exports.buildSwapTransactionMutationOptions = exports.getSwapQuoteQueryOptions = exports.signCellMutationOptions = exports.signBinaryMutationOptions = exports.signTextMutationOptions = exports.transferNftMutationOptions = exports.getNftQueryOptions = exports.getNFTsQueryOptions = exports.getBlockNumberQueryOptions = exports.transferJettonMutationOptions = exports.handleJettonsUpdate = exports.getJettonsByAddressQueryOptions = exports.handleJettonBalanceUpdate = exports.getJettonBalanceByAddressQueryOptions = exports.getJettonWalletAddressQueryOptions = exports.getJettonInfoQueryOptions = exports.disconnectMutationOptions = exports.connectMutationOptions = exports.handleBalanceUpdate = exports.getBalanceByAddressQueryOptions = void 0; | ||
| exports.getTransactionStatusQueryOptions = exports.sendTransactionMutationOptions = exports.transferTonMutationOptions = exports.buildStakeTransactionMutationOptions = exports.getStakingProviderInfoQueryOptions = exports.getStakedBalanceQueryOptions = exports.getStakingQuoteQueryOptions = exports.buildSwapTransactionMutationOptions = exports.getSwapQuoteQueryOptions = exports.signCellMutationOptions = exports.signBinaryMutationOptions = exports.signTextMutationOptions = exports.transferNftMutationOptions = exports.getNftQueryOptions = exports.getNFTsQueryOptions = exports.getBlockNumberQueryOptions = exports.transferJettonMutationOptions = exports.handleJettonsUpdate = exports.getJettonsByAddressQueryOptions = exports.handleJettonBalanceUpdate = exports.getJettonBalanceByAddressQueryOptions = exports.getJettonWalletAddressQueryOptions = exports.getJettonInfoQueryOptions = exports.disconnectMutationOptions = exports.connectMutationOptions = exports.handleBalanceUpdate = exports.getBalanceByAddressQueryOptions = void 0; | ||
| // Balances | ||
@@ -57,4 +57,2 @@ var get_balance_by_address_1 = require("./balances/get-balance-by-address"); | ||
| // Staking | ||
| var get_staking_providers_1 = require("./staking/get-staking-providers"); | ||
| Object.defineProperty(exports, "getStakingProvidersQueryOptions", { enumerable: true, get: function () { return get_staking_providers_1.getStakingProvidersQueryOptions; } }); | ||
| var get_staking_quote_1 = require("./staking/get-staking-quote"); | ||
@@ -61,0 +59,0 @@ Object.defineProperty(exports, "getStakingQuoteQueryOptions", { enumerable: true, get: function () { return get_staking_quote_1.getStakingQuoteQueryOptions; } }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/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0B,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,qCAAqC,CAAC,UAAU,GAAG,6BAA6B,IAAI,YAAY,CACxG,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,iCAAiC,CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAClC,aAAa,WAAW,EACxB,0CAA0C;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3G,QAAQ,YAAY,SAoBvB,CAAC"} | ||
| {"version":3,"file":"get-jetton-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-balance-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,IAAI,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE9C,MAAM,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAExE,MAAM,MAAM,oCAAoC,CAAC,UAAU,GAAG,6BAA6B,IAAI,OAAO,CAClG,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CACV,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,iCAAiC,CACpC,CAAC;AAEN,eAAO,MAAM,qCAAqC,GAAI,UAAU,GAAG,6BAA6B,EAC5F,QAAQ,MAAM,EACd,iBAAgB,oCAAoC,CAAC,UAAU,CAAM,KACtE,qCAAqC,CAAC,UAAU,CAsBlD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE/D,eAAO,MAAM,iCAAiC,GAC1C,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,iCAEF,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,SAAS;IACrD,gBAAgB;IAChB,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,qCAAqC,CAAC,UAAU,GAAG,6BAA6B,IAAI,YAAY,CACxG,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,iCAAiC,CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAClC,aAAa,WAAW,EACxB,0CAA0C;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3G,QAAQ,YAAY,SAgBvB,CAAC"} |
@@ -15,3 +15,8 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| jettonAddress: (0, utils_1.tryToBounceableAddress)(initialOptions.jettonAddress) ?? initialOptions.jettonAddress, | ||
| ownerAddress: (0, utils_1.tryToBounceableAddress)(initialOptions.ownerAddress) ?? initialOptions.ownerAddress, | ||
| }; | ||
| return { | ||
@@ -41,8 +46,8 @@ ...options.query, | ||
| const handleJettonBalanceUpdate = (queryClient, { ownerAddress, jettonAddress, network }, update) => { | ||
| const queryKey = (0, exports.getJettonBalanceByAddressQueryKey)({ | ||
| ownerAddress: (0, utils_1.tryToBounceableAddress)(ownerAddress) ?? ownerAddress, | ||
| jettonAddress: (0, utils_1.tryToBounceableAddress)(jettonAddress) ?? jettonAddress, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = (0, exports.getJettonBalanceByAddressQueryKey)({ | ||
| ownerAddress, | ||
| jettonAddress, | ||
| network, | ||
| }); | ||
| queryClient.setQueryData(queryKey, update.balance); | ||
@@ -52,7 +57,2 @@ (0, utils_1.sleep)(5000).then(() => queryClient.invalidateQueries({ queryKey })); | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = (0, exports.getJettonBalanceByAddressQueryKey)({ | ||
| ownerAddress, | ||
| jettonAddress, | ||
| network, | ||
| }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
@@ -59,0 +59,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE3C,MAAM,MAAM,wBAAwB,CAAC,UAAU,GAAG,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,GAC9G,cAAc,CAAC,wBAAwB,EAAE,sBAAsB,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAExG,eAAO,MAAM,yBAAyB,GAAI,UAAU,GAA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AAqB,CAAC,CAAC;AAExG,eAAO,MAAM,yBAAyB,GAAI,UAAU,GAAG,iBAAiB,EACpE,QAAQ,MAAM,EACd,iBAAgB,wBAAwB,CAAC,UAAU,CAAM,KAC1D,yBAAyB,CAAC,UAAU,CAoBtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEzD,eAAO,MAAM,qBAAqB,GAC9B,UAAS,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAM,KAC1D,qBAEF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAE1G,MAAM,MAAM,yBAAyB,CAAC,UAAU,GAAG,iBAAiB,IAAI,YAAY,CAChF,wBAAwB,EACxB,sBAAsB,EACtB,UAAU,EACV,qBAAqB,CACxB,CAAC"} |
@@ -15,3 +15,7 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: (0, utils_1.tryToBounceableAddress)(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -18,0 +22,0 @@ ...options.query, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,6BAA6B,IAAI,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACzI,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,gCAAgC,CAAC,CACjD,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,iBAAgB,iCAAiC,CAAC,UAAU,CAAM,KACnE,kCAAkC,CAAC,UAAU,CAiB/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAM,KACtE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,uBAAuB;IACvB,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,6BAA6B,IAAI,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACzI,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,gCAAgC,CAAC,CACjD,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,iBAAgB,iCAAiC,CAAC,UAAU,CAAM,KACnE,kCAAkC,CAAC,UAAU,CAsB/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAM,KACtE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,uBAAuB;IACvB,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} |
@@ -15,3 +15,8 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| jettonAddress: (0, utils_1.tryToBounceableAddress)(initialOptions.jettonAddress) ?? initialOptions.jettonAddress, | ||
| ownerAddress: (0, utils_1.tryToBounceableAddress)(initialOptions.ownerAddress) ?? initialOptions.ownerAddress, | ||
| }; | ||
| return { | ||
@@ -18,0 +23,0 @@ ...options.query, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jettons-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jettons-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,OAAO,CACtF,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAExG,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,iBAAgB,8BAA8B,CAAC,UAAU,CAAM,KAChE,+BAA+B,CAAC,UAAU,CAgB5C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAA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AAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,OAAO,CACtF,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAExG,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,iBAAgB,8BAA8B,CAAC,UAAU,CAAM,KAChE,+BAA+B,CAAC,UAAU,CAoB5C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B,GACpC,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,2BAEF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC5B,aAAa,WAAW,EACxB,sBAAsB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3D,QAAQ,YAAY,SAkCvB,CAAC"} |
@@ -15,3 +15,7 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: (0, utils_1.tryToBounceableAddress)(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -39,4 +43,7 @@ ...options.query, | ||
| const handleJettonsUpdate = (queryClient, { address, network }, update) => { | ||
| const queryKey = (0, exports.getJettonsByAddressQueryKey)({ | ||
| address: (0, utils_1.tryToBounceableAddress)(address) ?? address, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = (0, exports.getJettonsByAddressQueryKey)({ address, network }); | ||
| const currentData = queryClient.getQueryData(queryKey); | ||
@@ -61,3 +68,2 @@ if (currentData?.jettons) { | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = (0, exports.getJettonsByAddressQueryKey)({ address, network }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
@@ -64,0 +70,0 @@ } |
@@ -16,3 +16,3 @@ /** | ||
| export declare const getNftQueryOptions: <selectData = GetNftData>(appKit: AppKit, initialOptions?: GetNftQueryConfig<selectData>) => GetNftQueryOptions<selectData>; | ||
| export type GetNftQueryFnData = Compute<NFT | null>; | ||
| export type GetNftQueryFnData = Compute<NFT | undefined>; | ||
| export type GetNftData = GetNftQueryFnData; | ||
@@ -19,0 +19,0 @@ export declare const getNftQueryKey: (options?: Compute<ExactPartial<GetNftParameters>>) => GetNftQueryKey; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-nft.d.ts","sourceRoot":"","sources":["../../../../src/queries/nft/get-nft.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC;AAEpC,MAAM,MAAM,iBAAiB,CAAC,UAAU,GAAG,UAAU,IAAI,OA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AU,GAAG,UAAU,IAAI,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,GAC5F,cAAc,CAAC,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,kBAAkB,GAAI,UAAU,GAAG,UAAU,EACtD,QAAQ,MAAM,EACd,iBAAgB,iBAAiB,CAAC,UAAU,CAAM,KACnD,kBAAkB,CAAC,UAAU,CAoB/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE3C,eAAO,MAAM,cAAc,GAAI,UAAS,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAM,KAAG,cAEtF,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAEvF,MAAM,MAAM,kBAAkB,CAAC,UAAU,GAAG,UAAU,IAAI,YAAY,CAClE,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,CACjB,CAAC"} |
@@ -15,3 +15,7 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: (0, utils_1.tryToBounceableAddress)(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -18,0 +22,0 @@ ...options.query, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-nfts-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/nft/get-nfts-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC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oB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAExF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAErC,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEtD,MAAM,MAAM,2BAA2B,CAAC,UAAU,GAAG,oBAAoB,IAAI,OAAO,CAChF,YAAY,CAAC,uBAAuB,CAAC,CACxC,GACG,cAAc,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;AAE/F,eAAO,MAAM,4BAA4B,GAAI,UAAU,GAAG,oBAAoB,EAC1E,QAAQ,MAAM,EACd,iBAAgB,2BAA2B,CAAC,UAAU,CAAM,KAC7D,4BAA4B,CAAC,UAAU,CAoBzC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAE9E,eAAO,MAAM,wBAAwB,GACjC,UAAS,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAM,KAC7D,wBAEF,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAEzG,MAAM,MAAM,4BAA4B,CAAC,UAAU,GAAG,oBAAoB,IAAI,YAAY,CACtF,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,wBAAwB,CAC3B,CAAC"} |
@@ -15,3 +15,7 @@ "use strict"; | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: (0, utils_1.tryToBounceableAddress)(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -18,0 +22,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| export type GetStakedBalanceQueryConfig<selectData = GetStakedBalanceData> = Compute<ExactPartial<GetStakedBalanceOptions>> & QueryParameter<GetStakedBalanceQueryFnData, GetStakedBalanceErrorType, selectData, GetStakedBalanceQueryKey>; | ||
| export declare const getStakedBalanceQueryOptions: <selectData = GetStakedBalanceData>(appKit: AppKit, options?: GetStakedBalanceQueryConfig<selectData>) => GetStakedBalanceQueryOptions<selectData>; | ||
| export declare const getStakedBalanceQueryOptions: <selectData = GetStakedBalanceData>(appKit: AppKit, initialOptions?: GetStakedBalanceQueryConfig<selectData>) => GetStakedBalanceQueryOptions<selectData>; | ||
| export type GetStakedBalanceQueryFnData = Compute<Awaited<GetStakedBalanceReturnType>>; | ||
@@ -18,0 +18,0 @@ export type GetStakedBalanceData = GetStakedBalanceQueryFnData; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staked-balance.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staked-balance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE9C,MAAM,MAAM,2BAA2B,CAAC,UAAU,GAAG,oBAAoB,IAAI,OAAO,CAChF,YAAY,CAA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AAC,UAAU,GAAG,oBAAoB,IAAI,OAAO,CAChF,YAAY,CAAC,uBAAuB,CAAC,CACxC,GACG,cAAc,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;AAEjH,eAAO,MAAM,4BAA4B,GAAI,UAAU,GAAG,oBAAoB,EAC1E,QAAQ,MAAM,EACd,iBAAgB,2BAA2B,CAAC,UAAU,CAAM,KAC7D,4BAA4B,CAAC,UAAU,CAqBzC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAE/D,eAAO,MAAM,wBAAwB,GACjC,UAAS,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAM,KAC7D,wBAEF,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,4BAA4B,CAAC,UAAU,GAAG,oBAAoB,IAAI,YAAY,CACtF,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,wBAAwB,CAC3B,CAAC"} |
@@ -13,3 +13,9 @@ "use strict"; | ||
| const utils_1 = require("../../utils"); | ||
| const getStakedBalanceQueryOptions = (appKit, options = {}) => { | ||
| const getStakedBalanceQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| userAddress: (0, utils_1.tryToBounceableAddress)(initialOptions.userAddress) ?? initialOptions.userAddress, | ||
| }; | ||
| return { | ||
@@ -16,0 +22,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| export type GetStakingProviderInfoQueryConfig<selectData = GetStakingProviderInfoData> = Compute<ExactPartial<GetStakingProviderInfoOptions>> & QueryParameter<GetStakingProviderInfoQueryFnData, GetStakingProviderInfoErrorType, selectData, GetStakingProviderInfoQueryKey>; | ||
| export declare const getStakingProviderInfoQueryOptions: <selectData = GetStakingProviderInfoData>(appKit: AppKit, options?: GetStakingProviderInfoQueryConfig<selectData>) => GetStakingProviderInfoQueryOptions<selectData>; | ||
| export declare const getStakingProviderInfoQueryOptions: <selectData = GetStakingProviderInfoData>(appKit: AppKit, initialOptions?: GetStakingProviderInfoQueryConfig<selectData>) => GetStakingProviderInfoQueryOptions<selectData>; | ||
| export type GetStakingProviderInfoQueryFnData = Compute<Awaited<GetStakingProviderInfoReturnType>>; | ||
@@ -18,0 +18,0 @@ export type GetStakingProviderInfoData = GetStakingProviderInfoQueryFnData; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staking-provider-info.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-provider-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AACrG,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,6BAA6B,CAAC,CAC9C,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,UAAS,iCAAiC,CAAC,UAAU,CAAM,KAC5D,kCAAkC,CAAC,UAAU,CAS/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;AAEnG,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAM,KACnE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,qBAAqB;IACrB,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} | ||
| {"version":3,"file":"get-staking-provider-info.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-provider-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AACrG,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,6BAA6B,CAAC,CAC9C,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,iBAAgB,iCAAiC,CAAC,UAAU,CAAM,KACnE,kCAAkC,CAAC,UAAU,CAY/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;AAEnG,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAM,KACnE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,qBAAqB;IACrB,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} |
@@ -13,3 +13,5 @@ "use strict"; | ||
| const utils_1 = require("../../utils"); | ||
| const getStakingProviderInfoQueryOptions = (appKit, options = {}) => { | ||
| const getStakingProviderInfoQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| return { | ||
@@ -16,0 +18,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| export type GetStakingQuoteQueryConfig<selectData = GetStakingQuoteData> = Compute<ExactPartial<GetStakingQuoteOptions>> & QueryParameter<GetStakingQuoteQueryFnData, GetStakingQuoteErrorType, selectData, GetStakingQuoteQueryKey>; | ||
| export declare const getStakingQuoteQueryOptions: <selectData = GetStakingQuoteData>(appKit: AppKit, options?: GetStakingQuoteQueryConfig<selectData>) => GetStakingQuoteQueryOptions<selectData>; | ||
| export declare const getStakingQuoteQueryOptions: <selectData = GetStakingQuoteData>(appKit: AppKit, initialOptions?: GetStakingQuoteQueryConfig<selectData>) => GetStakingQuoteQueryOptions<selectData>; | ||
| export type GetStakingQuoteQueryFnData = Compute<Awaited<GetStakingQuoteReturnType>>; | ||
@@ -18,0 +18,0 @@ export type GetStakingQuoteData = GetStakingQuoteQueryFnData; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staking-quote.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAE7C,MAAM,MAAM,0BAA0B,CAAC,UAAU,GAAG,mBAAmB,IAAI,OAAO,CAC9E,YAAY,CAAC,sBAAsB,CAAC,CACvC,GACG,cAAc,CAAC,0BAA0B,EAAE,wBAAwB,EAAE,UAAU,EAAE,uBAAuB,CAAC,CAAC;AAE9G,eAAO,MAAM,2BAA2B,GAAI,UAAU,GAAG,mBAAmB,EACxE,QAAQ,MAAM,EACd,UAAS,0BAA0B,CAAC,UAAU,CAAM,KACrD,2BAA2B,CAAC,UAAU,CAcxC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;AAErF,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE7D,eAAO,MAAM,uBAAuB,GAChC,UAAS,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAM,KAC5D,uBAEF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,SA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M,KAC5D,uBAEF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC,cAAc,EAAE,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAE/G,MAAM,MAAM,2BAA2B,CAAC,UAAU,GAAG,mBAAmB,IAAI,YAAY,CACpF,0BAA0B,EAC1B,wBAAwB,EACxB,UAAU,EACV,uBAAuB,CAC1B,CAAC"} |
@@ -13,6 +13,12 @@ "use strict"; | ||
| const utils_1 = require("../../utils"); | ||
| const getStakingQuoteQueryOptions = (appKit, options = {}) => { | ||
| const getStakingQuoteQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = (0, utils_1.resolveNetwork)(appKit, initialOptions.network); | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| userAddress: (0, utils_1.tryToBounceableAddress)(initialOptions.userAddress) ?? initialOptions.userAddress, | ||
| }; | ||
| return { | ||
| ...options.query, | ||
| enabled: Boolean(options.amount && options.direction && (options.query?.enabled ?? true)), | ||
| enabled: Boolean(options.amount && options.amount !== '0' && options.direction && (options.query?.enabled ?? true)), | ||
| queryFn: async (context) => { | ||
@@ -19,0 +25,0 @@ const [, parameters] = context.queryKey; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-swap-quote.d.ts","sourceRoot":"","sources":["../../../../src/queries/swap/get-swap-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,qBAAqB,GAAG,KA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,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE1C,MAAM,MAAM,uBAAuB,CAAC,UAAU,GAAG,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,GAC3G,cAAc,CAAC,uBAAuB,EAAE,qBAAqB,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC;AAErG,eAAO,MAAM,wBAAwB,GAAI,UAAU,GAAG,gBAAgB,EAClE,QAAQ,MAAM,EACd,iBAAgB,uBAAuB,CAAC,UAAU,CAAM,KACzD,wBAAwB,CAAC,UAAU,CA+BrC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,GAC7B,UAAS,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAM,KACzD,oBAEF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAEtG,MAAM,MAAM,wBAAwB,CAAC,UAAU,GAAG,gBAAgB,IAAI,YAAY,CAC9E,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,EACV,oBAAoB,CACvB,CAAC"} |
@@ -18,3 +18,3 @@ "use strict"; | ||
| ...options.query, | ||
| enabled: Boolean(options.amount && options.from && options.to && (options.query?.enabled ?? true)), | ||
| enabled: Boolean(options.amount && options.amount !== '0' && options.from && options.to && (options.query?.enabled ?? true)), | ||
| queryFn: async (context) => { | ||
@@ -21,0 +21,0 @@ const [, parameters] = context.queryKey; |
@@ -8,4 +8,4 @@ /** | ||
| */ | ||
| export { StakingProvider, UnstakeMode, StakingError, StakingManager } from '@ton/walletkit'; | ||
| export type { UnstakeModes, StakeParams, StakingAPI, StakingQuote, StakingQuoteParams, StakingBalance, StakingProviderInfo, StakingProviderInterface, StakingQuoteDirection, } from '@ton/walletkit'; | ||
| export { DefiError, StakingProvider, UnstakeMode, StakingError, StakingErrorCode, StakingManager, } from '@ton/walletkit'; | ||
| export type { UnstakeModes, StakeParams, StakingAPI, StakingQuote, StakingQuoteParams, StakingBalance, StakingProviderInfo, StakingProviderInterface, StakingQuoteDirection, StakingProviderMetadata, StakingTokenInfo, } from '@ton/walletkit'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/staking/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE5F,YAAY,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/staking/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACjB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACnB,MAAM,gBAAgB,CAAC"} |
@@ -10,7 +10,9 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.StakingManager = exports.StakingError = exports.UnstakeMode = exports.StakingProvider = void 0; | ||
| exports.StakingManager = exports.StakingErrorCode = exports.StakingError = exports.UnstakeMode = exports.StakingProvider = exports.DefiError = void 0; | ||
| var walletkit_1 = require("@ton/walletkit"); | ||
| Object.defineProperty(exports, "DefiError", { enumerable: true, get: function () { return walletkit_1.DefiError; } }); | ||
| Object.defineProperty(exports, "StakingProvider", { enumerable: true, get: function () { return walletkit_1.StakingProvider; } }); | ||
| Object.defineProperty(exports, "UnstakeMode", { enumerable: true, get: function () { return walletkit_1.UnstakeMode; } }); | ||
| Object.defineProperty(exports, "StakingError", { enumerable: true, get: function () { return walletkit_1.StakingError; } }); | ||
| Object.defineProperty(exports, "StakingErrorCode", { enumerable: true, get: function () { return walletkit_1.StakingErrorCode; } }); | ||
| Object.defineProperty(exports, "StakingManager", { enumerable: true, get: function () { return walletkit_1.StakingManager; } }); |
@@ -8,3 +8,4 @@ /** | ||
| */ | ||
| export type { SwapToken, TokenAmount, SwapParams, SwapAPI, SwapFee, SwapQuote, SwapQuoteParams, DefiManagerAPI, DefiProvider, SwapProvider, SwapError, SwapManager, } from '@ton/walletkit'; | ||
| export { DefiError, SwapError, SwapProvider, SwapManager } from '@ton/walletkit'; | ||
| export type { SwapToken, TokenAmount, SwapParams, SwapAPI, SwapQuote, SwapQuoteParams, DefiManagerAPI, DefiProvider, } from '@ton/walletkit'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swap/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,WAAW,GACd,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swap/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEjF,YAAY,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,YAAY,GACf,MAAM,gBAAgB,CAAC"} |
@@ -10,1 +10,7 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.SwapManager = exports.SwapProvider = exports.SwapError = exports.DefiError = void 0; | ||
| var walletkit_1 = require("@ton/walletkit"); | ||
| Object.defineProperty(exports, "DefiError", { enumerable: true, get: function () { return walletkit_1.DefiError; } }); | ||
| Object.defineProperty(exports, "SwapError", { enumerable: true, get: function () { return walletkit_1.SwapError; } }); | ||
| Object.defineProperty(exports, "SwapProvider", { enumerable: true, get: function () { return walletkit_1.SwapProvider; } }); | ||
| Object.defineProperty(exports, "SwapManager", { enumerable: true, get: function () { return walletkit_1.SwapManager; } }); |
@@ -40,3 +40,2 @@ /** | ||
| eventEmitter: AppKitEmitter; | ||
| ssr?: boolean; | ||
| } | ||
@@ -43,0 +42,0 @@ /** Factory function that creates a connector from context */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/types/connector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAErC,kCAAkC;IAClC,OAAO,I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,iBAAiB,CAAC;IAErC,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAC;IAEhB,uBAAuB;IACvB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD,0BAA0B;IAC1B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,4BAA4B;IAC5B,mBAAmB,IAAI,eAAe,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,cAAc,EAAE,oBAAoB,CAAC;IACrC,YAAY,EAAE,aAAa,CAAC;CAC/B;AAED,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,uBAAuB,KAAK,SAAS,CAAC;AAE3E,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAE1D,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAE3E"} |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| export type { Base64String } from '@ton/walletkit'; | ||
| export type { Base64String, UserFriendlyAddress, Hex } from '@ton/walletkit'; | ||
| //# sourceMappingURL=primitives.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/types/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/types/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC"} |
@@ -9,6 +9,15 @@ /** | ||
| export { formatUnits, parseUnits, compareAddress } from '@ton/walletkit'; | ||
| export * from './address/is-valid-address'; | ||
| export * from './address/to-bounceble-address'; | ||
| export * from './address/to-non-bounceble-address'; | ||
| export * from './amount/calc-fiat-value'; | ||
| export * from './amount/format-large-value'; | ||
| export * from './amount/truncate-decimals'; | ||
| export * from './amount/validate-numeric-string'; | ||
| export * from './balance/calc-max-spendable'; | ||
| export * from './balance/get-ton-shortfall'; | ||
| export * from './arrays/key-by'; | ||
| export * from './arrays/random-from-array'; | ||
| export * from './errors/get-error-message'; | ||
| export * from './functions/debounce'; | ||
| export * from './functions/noop'; | ||
@@ -18,2 +27,3 @@ export * from './jetton/jetton-info'; | ||
| export * from './object/map-values'; | ||
| export * from './predicate/is-number'; | ||
| export * from './predicate/is-string'; | ||
@@ -20,0 +30,0 @@ export * from './promise/cancel-promise'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEzE,cAAc,kCAAkC,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEzE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"} |
@@ -29,6 +29,15 @@ "use strict"; | ||
| Object.defineProperty(exports, "compareAddress", { enumerable: true, get: function () { return walletkit_1.compareAddress; } }); | ||
| __exportStar(require("./address/is-valid-address"), exports); | ||
| __exportStar(require("./address/to-bounceble-address"), exports); | ||
| __exportStar(require("./address/to-non-bounceble-address"), exports); | ||
| __exportStar(require("./amount/calc-fiat-value"), exports); | ||
| __exportStar(require("./amount/format-large-value"), exports); | ||
| __exportStar(require("./amount/truncate-decimals"), exports); | ||
| __exportStar(require("./amount/validate-numeric-string"), exports); | ||
| __exportStar(require("./balance/calc-max-spendable"), exports); | ||
| __exportStar(require("./balance/get-ton-shortfall"), exports); | ||
| __exportStar(require("./arrays/key-by"), exports); | ||
| __exportStar(require("./arrays/random-from-array"), exports); | ||
| __exportStar(require("./errors/get-error-message"), exports); | ||
| __exportStar(require("./functions/debounce"), exports); | ||
| __exportStar(require("./functions/noop"), exports); | ||
@@ -38,2 +47,3 @@ __exportStar(require("./jetton/jetton-info"), exports); | ||
| __exportStar(require("./object/map-values"), exports); | ||
| __exportStar(require("./predicate/is-number"), exports); | ||
| __exportStar(require("./predicate/is-string"), exports); | ||
@@ -40,0 +50,0 @@ __exportStar(require("./promise/cancel-promise"), exports); |
@@ -8,3 +8,4 @@ /** | ||
| */ | ||
| import type { Jetton } from '@ton/walletkit'; | ||
| import type { Jetton, JettonInfo } from '../../types/jetton'; | ||
| export declare const isJettonInfo: (value: unknown) => value is JettonInfo; | ||
| export declare const getJettonsSymbol: (jetton: Jetton) => string | undefined; | ||
@@ -11,0 +12,0 @@ export declare const getJettonsName: (jetton: Jetton) => string | undefined; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/jetton/jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAM1D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAMxD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAazD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM;;;;;;;;;;CAkBpD,CAAC"} | ||
| {"version":3,"file":"jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/jetton/jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAStD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAM1D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAMxD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAazD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM;;;;;;;;;;CAkBpD,CAAC"} |
@@ -10,3 +10,13 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getFormattedJettonInfo = exports.getJettonsImage = exports.getJettonsName = exports.getJettonsSymbol = void 0; | ||
| exports.getFormattedJettonInfo = exports.getJettonsImage = exports.getJettonsName = exports.getJettonsSymbol = exports.isJettonInfo = void 0; | ||
| const isJettonInfo = (value) => { | ||
| if (typeof value !== 'object' || value === null) | ||
| return false; | ||
| const v = value; | ||
| return (typeof v.address === 'string' && | ||
| typeof v.name === 'string' && | ||
| typeof v.symbol === 'string' && | ||
| typeof v.description === 'string'); | ||
| }; | ||
| exports.isJettonInfo = isJettonInfo; | ||
| const getJettonsSymbol = (jetton) => { | ||
@@ -13,0 +23,0 @@ if (!jetton?.info?.symbol) { |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| export declare function isString(value: unknown): value is string; | ||
| export declare const isString: (value: unknown) => value is string; | ||
| //# sourceMappingURL=is-string.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD"} | ||
| {"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAC"} |
@@ -10,5 +10,6 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.isString = void 0; | ||
| const isString = (value) => { | ||
| return typeof value === 'string'; | ||
| }; | ||
| exports.isString = isString; | ||
| function isString(value) { | ||
| return typeof value === 'string'; | ||
| } |
@@ -46,6 +46,13 @@ /** | ||
| export { getSwapManager, type GetSwapManagerReturnType } from './swap/get-swap-manager'; | ||
| export { getSwapProvider, type GetSwapProviderOptions, type GetSwapProviderReturnType } from './swap/get-swap-provider'; | ||
| export { getSwapProviders, type GetSwapProvidersReturnType } from './swap/get-swap-providers'; | ||
| export { setDefaultSwapProvider, type SetDefaultSwapProviderParameters, type SetDefaultSwapProviderReturnType, } from './swap/set-default-swap-provider'; | ||
| export { getSwapQuote, type GetSwapQuoteOptions, type GetSwapQuoteReturnType } from './swap/get-swap-quote'; | ||
| export { watchSwapProviders, type WatchSwapProvidersParameters, type WatchSwapProvidersReturnType, } from './swap/watch-swap-providers'; | ||
| export { buildSwapTransaction, type BuildSwapTransactionOptions, type BuildSwapTransactionReturnType, } from './swap/build-swap-transaction'; | ||
| export { getStakingManager, type GetStakingManagerReturnType } from './staking/get-staking-manager'; | ||
| export { getStakingProviders, type GetStakingProvidersReturnType } from './staking/get-staking-providers'; | ||
| export { getStakingProvider, type GetStakingProviderOptions, type GetStakingProviderReturnType, } from './staking/get-staking-provider'; | ||
| export { setDefaultStakingProvider, type SetDefaultStakingProviderParameters, type SetDefaultStakingProviderReturnType, } from './staking/set-default-staking-provider'; | ||
| export { watchStakingProviders, type WatchStakingProvidersParameters, type WatchStakingProvidersReturnType, } from './staking/watch-staking-providers'; | ||
| export { getStakingQuote, type GetStakingQuoteOptions, type GetStakingQuoteReturnType, } from './staking/get-staking-quote'; | ||
@@ -55,2 +62,3 @@ export { buildStakeTransaction, type BuildStakeTransactionOptions, type BuildStakeTransactionReturnType, } from './staking/build-stake-transaction'; | ||
| export { getStakingProviderInfo, type GetStakingProviderInfoOptions, type GetStakingProviderInfoReturnType, } from './staking/get-staking-provider-info'; | ||
| export { getStakingProviderMetadata, type GetStakingProviderMetadataOptions, type GetStakingProviderMetadataReturnType, } from './staking/get-staking-provider-metadata'; | ||
| export { sendTransaction, type SendTransactionParameters, type SendTransactionReturnType, } from './transaction/send-transaction'; | ||
@@ -57,0 +65,0 @@ export { transferTon, type TransferTonParameters, type TransferTonReturnType } from './transaction/transfer-ton'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACH,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,GACrC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,GACvC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAG/G,OAAO,EAAE,YAAY,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpH,OAAO,EAAE,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,KAAK,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,KAAK,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EACH,eAAe,EACf,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,gBAAgB,EAChB,KAAK,uBAAuB,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AAK,sCAAsC,EAC3C,KAAK,sCAAsC,GAC9C,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,mBAAmB,EAAE,KAAK,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACpG,OAAO,EACH,mBAAmB,EACnB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,GACrC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACH,mBAAmB,EACnB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,GACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,qBAAqB,EACrB,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,GACvC,MAAM,mCAAmC,CAAC"} |
@@ -54,3 +54,7 @@ /** | ||
| export { getSwapManager } from './swap/get-swap-manager'; | ||
| export { getSwapProvider } from './swap/get-swap-provider'; | ||
| export { getSwapProviders } from './swap/get-swap-providers'; | ||
| export { setDefaultSwapProvider, } from './swap/set-default-swap-provider'; | ||
| export { getSwapQuote } from './swap/get-swap-quote'; | ||
| export { watchSwapProviders, } from './swap/watch-swap-providers'; | ||
| export { buildSwapTransaction, } from './swap/build-swap-transaction'; | ||
@@ -60,2 +64,5 @@ // Staking | ||
| export { getStakingProviders } from './staking/get-staking-providers'; | ||
| export { getStakingProvider, } from './staking/get-staking-provider'; | ||
| export { setDefaultStakingProvider, } from './staking/set-default-staking-provider'; | ||
| export { watchStakingProviders, } from './staking/watch-staking-providers'; | ||
| export { getStakingQuote, } from './staking/get-staking-quote'; | ||
@@ -65,2 +72,3 @@ export { buildStakeTransaction, } from './staking/build-stake-transaction'; | ||
| export { getStakingProviderInfo, } from './staking/get-staking-provider-info'; | ||
| export { getStakingProviderMetadata, } from './staking/get-staking-provider-metadata'; | ||
| // Transactions | ||
@@ -67,0 +75,0 @@ export { sendTransaction, } from './transaction/send-transaction'; |
@@ -14,3 +14,3 @@ /** | ||
| amount: string; | ||
| jettonDecimals: number; | ||
| jettonDecimals?: number; | ||
| comment?: string; | ||
@@ -17,0 +17,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"create-transfer-jetton-transaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/create-transfer-jetton-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,MAAM,WAAW,yCAAyC;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,yCAAyC,GAAG,kBAAkB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,+BAA+B,GACxC,QAAQ,MAAM,EACd,YAAY,yCAAyC,KACtD,OAAO,CAAC,yCAAyC,CA8BnD,CAAC"} | ||
| {"version":3,"file":"create-transfer-jetton-transaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/create-transfer-jetton-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAKjD,MAAM,WAAW,yCAAyC;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,yCAAyC,GAAG,kBAAkB,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,+BAA+B,GACxC,QAAQ,MAAM,EACd,YAAY,yCAAyC,KACtD,OAAO,CAAC,yCAAyC,CA4CnD,CAAC"} |
@@ -10,2 +10,4 @@ /** | ||
| import { getSelectedWallet } from '../wallets/get-selected-wallet'; | ||
| import { getJettonInfo } from './get-jetton-info'; | ||
| import { isNumber } from '../../utils'; | ||
| /** | ||
@@ -21,10 +23,20 @@ * Create a Jetton transfer transaction request | ||
| // Get client from network manager | ||
| const client = appKit.networkManager.getClient(wallet.getNetwork()); | ||
| const network = wallet.getNetwork(); | ||
| const client = appKit.networkManager.getClient(network); | ||
| // Get jetton wallet address | ||
| const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, wallet.getAddress()); | ||
| const ownerAddress = wallet.getAddress(); | ||
| const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress); | ||
| let decimals = jettonDecimals; | ||
| if (!isNumber(decimals)) { | ||
| const jettonInfo = await getJettonInfo(appKit, { address: jettonAddress, network }); | ||
| if (!isNumber(jettonInfo?.decimals)) { | ||
| throw new Error(`Jetton decimals not found for address ${jettonAddress}`); | ||
| } | ||
| decimals = jettonInfo.decimals; | ||
| } | ||
| // Create jetton transfer payload | ||
| const jettonPayload = createJettonTransferPayload({ | ||
| amount: parseUnits(amount, jettonDecimals), | ||
| amount: parseUnits(amount, decimals), | ||
| destination: recipientAddress, | ||
| responseDestination: wallet.getAddress(), | ||
| responseDestination: ownerAddress, | ||
| comment, | ||
@@ -37,4 +49,4 @@ }); | ||
| payload: jettonPayload, | ||
| fromAddress: wallet.getAddress(), | ||
| fromAddress: ownerAddress, | ||
| }); | ||
| }; |
@@ -14,3 +14,3 @@ /** | ||
| ownerAddress: UserFriendlyAddress; | ||
| jettonDecimals: number; | ||
| jettonDecimals?: number; | ||
| network?: Network; | ||
@@ -17,0 +17,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-balance.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-balance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACpC,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC;AAErD,eAAO,MAAM,gBAAgB,GACzB,QAAQ,MAAM,EACd,SAAS,uBAAuB,KACjC,OAAO,CAAC,0BAA0B,CAapC,CAAC"} | ||
| {"version":3,"file":"get-jetton-balance.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-balance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,uBAAuB;IACpC,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC;AAErD,eAAO,MAAM,gBAAgB,GACzB,QAAQ,MAAM,EACd,SAAS,uBAAuB,KACjC,OAAO,CAAC,0BAA0B,CAmBpC,CAAC"} |
@@ -10,3 +10,4 @@ /** | ||
| import { getJettonWalletAddress } from './get-jetton-wallet-address'; | ||
| import { resolveNetwork } from '../../utils/network/resolve-network'; | ||
| import { getJettonInfo } from './get-jetton-info'; | ||
| import { isNumber, resolveNetwork } from '../../utils'; | ||
| export const getJettonBalance = async (appKit, options) => { | ||
@@ -21,3 +22,7 @@ const { jettonAddress, ownerAddress, jettonDecimals, network } = options; | ||
| const balance = await getJettonBalanceFromClient(client, jettonWalletAddress); | ||
| return formatUnits(balance, jettonDecimals); | ||
| if (isNumber(jettonDecimals)) { | ||
| return formatUnits(balance, jettonDecimals); | ||
| } | ||
| const jettonInfo = await getJettonInfo(appKit, { address: jettonAddress, network }); | ||
| return formatUnits(balance, jettonInfo?.decimals ?? 0); | ||
| }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,IAAI,CAAC;AAExD,eAAO,MAAM,aAAa,GACtB,QAAQ,MAAM,EACd,SAAS,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,CAgDjC,CAAC"} | ||
| {"version":3,"file":"get-jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,IAAI,CAAC;AAIxD,eAAO,MAAM,aAAa,GACtB,QAAQ,MAAM,EACd,SAAS,oBAAoB,KAC9B,OAAO,CAAC,uBAAuB,CAyDjC,CAAC"} |
@@ -8,8 +8,15 @@ /** | ||
| */ | ||
| import { resolveNetwork } from '../../utils/network/resolve-network'; | ||
| import { toBounceableAddress, resolveNetwork, isJettonInfo } from '../../utils'; | ||
| import { getCacheKey } from '../../core/cache'; | ||
| const getJettonInfoCacheKey = getCacheKey('jetton-info'); | ||
| export const getJettonInfo = async (appKit, options) => { | ||
| const { address, network } = options; | ||
| const client = appKit.networkManager.getClient(resolveNetwork(appKit, network)); | ||
| const address = toBounceableAddress(options.address); | ||
| const network = resolveNetwork(appKit, options.network); | ||
| const cacheKey = getJettonInfoCacheKey(address, network.chainId); | ||
| const cached = await appKit.cache.get(cacheKey); | ||
| if (cached && isJettonInfo(cached)) | ||
| return cached; | ||
| const client = appKit.networkManager.getClient(network); | ||
| const response = await client.jettonsByAddress({ | ||
| address: address, | ||
| address, | ||
| offset: 0, | ||
@@ -36,5 +43,5 @@ limit: 1, | ||
| } | ||
| return { | ||
| const result = { | ||
| address, | ||
| decimals, | ||
| address: jetton.jetton, | ||
| name: tokenInfo?.name ?? '', | ||
@@ -46,2 +53,4 @@ symbol: tokenInfo?.symbol ?? '', | ||
| }; | ||
| await appKit.cache.set(cacheKey, result); | ||
| return result; | ||
| }; |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| import type { UserFriendlyAddress } from '@ton/walletkit'; | ||
| import type { UserFriendlyAddress } from '../../types/primitives'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
@@ -11,0 +11,0 @@ import type { Network } from '../../types/network'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,6BAA6B;IAC1C,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAEnE,eAAO,MAAM,sBAAsB,GAC/B,QAAQ,MAAM,EACd,SAAS,6BAA6B,KACvC,OAAO,CAAC,gCAAgC,CAM1C,CAAC"} | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/actions/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,WAAW,6BAA6B;IAC1C,aAAa,EAAE,mBAAmB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gCAAgC,GAAG,mBAAmB,CAAC;AAInE,eAAO,MAAM,sBAAsB,GAC/B,QAAQ,MAAM,EACd,SAAS,6BAA6B,KACvC,OAAO,CAAC,gCAAgC,CAiB1C,CAAC"} |
@@ -9,7 +9,18 @@ /** | ||
| import { getJettonWalletAddressFromClient } from '@ton/walletkit'; | ||
| import { resolveNetwork } from '../../utils/network/resolve-network'; | ||
| import { getCacheKey } from '../../core/cache'; | ||
| import { isFriendlyTonAddress, resolveNetwork, toBounceableAddress } from '../../utils'; | ||
| const getJettonWalletCacheKey = getCacheKey('jetton-wallet-address'); | ||
| export const getJettonWalletAddress = async (appKit, options) => { | ||
| const { jettonAddress, ownerAddress, network } = options; | ||
| const client = appKit.networkManager.getClient(resolveNetwork(appKit, network)); | ||
| return getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress); | ||
| const ownerAddress = toBounceableAddress(options.ownerAddress); | ||
| const jettonAddress = toBounceableAddress(options.jettonAddress); | ||
| const network = resolveNetwork(appKit, options.network); | ||
| const cacheKey = getJettonWalletCacheKey(network.chainId, ownerAddress, jettonAddress); | ||
| const cached = await appKit.cache.get(cacheKey); | ||
| if (cached && isFriendlyTonAddress(cached)) { | ||
| return cached; | ||
| } | ||
| const client = appKit.networkManager.getClient(network); | ||
| const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress); | ||
| await appKit.cache.set(cacheKey, jettonWalletAddress); | ||
| return jettonWalletAddress; | ||
| }; |
@@ -16,4 +16,4 @@ /** | ||
| } | ||
| export type GetNftReturnType = NFT | null; | ||
| export type GetNftReturnType = NFT | undefined; | ||
| export declare const getNft: (appKit: AppKit, options: GetNftOptions) => Promise<GetNftReturnType>; | ||
| //# sourceMappingURL=get-nft.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-nft.d.ts","sourceRoot":"","sources":["../../../../src/actions/nft/get-nft.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;AAE1C,eAAO,MAAM,MAAM,GAAU,QAAQ,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,gBAAgB,CAO7F,CAAC"} | ||
| {"version":3,"file":"get-nft.d.ts","sourceRoot":"","sources":["../../../../src/actions/nft/get-nft.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG,SAAS,CAAC;AAE/C,eAAO,MAAM,MAAM,GAAU,QAAQ,MAAM,EAAE,SAAS,aAAa,KAAG,OAAO,CAAC,gBAAgB,CAO7F,CAAC"} |
@@ -8,8 +8,9 @@ /** | ||
| */ | ||
| import type { StakingProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProvidersReturnType = string[]; | ||
| export type GetStakingProvidersReturnType = StakingProviderInterface[]; | ||
| /** | ||
| * Get available staking provider IDs | ||
| * Get all registered staking providers. | ||
| */ | ||
| export declare const getStakingProviders: (appKit: AppKit) => GetStakingProvidersReturnType; | ||
| //# sourceMappingURL=get-staking-providers.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,6BAA6B,GAAG,MAAM,EAAE,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,6BAEpD,CAAC"} | ||
| {"version":3,"file":"get-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/actions/staking/get-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,EAAE,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,6BAEpD,CAAC"} |
@@ -9,6 +9,6 @@ /** | ||
| /** | ||
| * Get available staking provider IDs | ||
| * Get all registered staking providers. | ||
| */ | ||
| export const getStakingProviders = (appKit) => { | ||
| return appKit.stakingManager.getRegisteredProviders(); | ||
| return appKit.stakingManager.getProviders(); | ||
| }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-swap-quote.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,GAAG,OAAO,EAC1C,QAAQ,MAAM,EACd,SAAS,mBAAmB,CAAC,CAAC,CAAC,KAChC,sBAEF,CAAC"} | ||
| {"version":3,"file":"get-swap-quote.d.ts","sourceRoot":"","sources":["../../../../src/actions/swap/get-swap-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,GAAG,OAAO,EAC1C,QAAQ,MAAM,EACd,SAAS,mBAAmB,CAAC,CAAC,CAAC,KAChC,sBAOF,CAAC"} |
@@ -8,2 +8,3 @@ /** | ||
| */ | ||
| import { resolveNetwork } from '../../utils'; | ||
| /** | ||
@@ -13,3 +14,7 @@ * Get swap quote | ||
| export const getSwapQuote = async (appKit, options) => { | ||
| return appKit.swapManager.getQuote(options, options.providerId); | ||
| const optionsWithNetwork = { | ||
| ...options, | ||
| network: resolveNetwork(appKit, options.network), | ||
| }; | ||
| return appKit.swapManager.getQuote(optionsWithNetwork, options.providerId); | ||
| }; |
@@ -14,3 +14,3 @@ /** | ||
| export const createTonConnectConnector = (config) => { | ||
| return createConnector(({ eventEmitter, networkManager, ssr }) => { | ||
| return createConnector(({ eventEmitter, networkManager }) => { | ||
| let originalTonConnectUI = null; | ||
@@ -23,3 +23,3 @@ let unsubscribeTonConnect = null; | ||
| } | ||
| if (ssr && typeof window === 'undefined') { | ||
| if (typeof window === 'undefined') { | ||
| return null; | ||
@@ -26,0 +26,0 @@ } |
@@ -29,8 +29,2 @@ /** | ||
| }; | ||
| /** | ||
| * Plugin events | ||
| */ | ||
| export declare const PLUGIN_EVENTS: { | ||
| readonly REGISTERED: "plugin:registered"; | ||
| }; | ||
| //# sourceMappingURL=events.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/constants/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;;CAEhB,CAAC"} | ||
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/constants/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;;;CAGlB,CAAC"} |
@@ -29,7 +29,1 @@ /** | ||
| }; | ||
| /** | ||
| * Plugin events | ||
| */ | ||
| export const PLUGIN_EVENTS = { | ||
| REGISTERED: 'plugin:registered', | ||
| }; |
@@ -9,5 +9,5 @@ /** | ||
| export { AppKit } from './services/app-kit'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
| export type { AppKitConfig } from './types/config'; | ||
| export type { AppKitEmitter, AppKitEvents, WalletConnectedPayload, WalletDisconnectedPayload, PluginRegisteredPayload, DefaultNetworkChangedPayload, } from './types/events'; | ||
| export type { AppKitEmitter, AppKitEvents, WalletConnectedPayload, WalletDisconnectedPayload, DefaultNetworkChangedPayload, } from './types/events'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/app-kit/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEtG,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACR,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,GAC/B,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/app-kit/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEvF,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACR,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,GAC/B,MAAM,gBAAgB,CAAC"} |
@@ -9,2 +9,2 @@ /** | ||
| export { AppKit } from './services/app-kit'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from './constants/events'; |
@@ -10,2 +10,3 @@ /** | ||
| import type { ProviderInput } from '@ton/walletkit'; | ||
| import type { AppKitConfig } from '../types/config'; | ||
| import { StakingManager } from '../../../staking'; | ||
@@ -16,3 +17,3 @@ import type { Connector, ConnectorFactoryContext, ConnectorInput } from '../../../types/connector'; | ||
| import { AppKitNetworkManager } from '../../network'; | ||
| import type { AppKitConfig } from '../types/config'; | ||
| import type { AppKitCache } from '../../cache'; | ||
| /** | ||
@@ -31,2 +32,3 @@ * Central hub for wallet management. | ||
| readonly config: AppKitConfig; | ||
| readonly cache: AppKitCache; | ||
| constructor(config: AppKitConfig); | ||
@@ -33,0 +35,0 @@ createFactoryContext(): ConnectorFactoryContext; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"app-kit.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/services/app-kit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAmD,MAAM,gBAAgB,CAAC;AAErG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGnG,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,MAAM;IACf,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,CAAM;IACtC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAExC,QAAQ,CAAC,cAAc,EAAE,oBAAoB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AE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAExC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;gBAEhB,MAAM,EAAE,YAAY;IAiChC,oBAAoB,IAAI,uBAAuB;IAI/C;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,IAAI;IAgB/C;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAU3C;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAc5C;;OAEG;IACH,OAAO,CAAC,2BAA2B;CAWtC"} |
@@ -9,8 +9,9 @@ /** | ||
| import { SwapManager, StreamingManager } from '@ton/walletkit'; | ||
| import { CONNECTOR_EVENTS, WALLETS_EVENTS } from '../constants/events'; | ||
| import { StakingManager } from '../../../staking'; | ||
| import { EventEmitter } from '../../emitter'; | ||
| import { CONNECTOR_EVENTS, WALLETS_EVENTS } from '../constants/events'; | ||
| import { WalletsManager } from '../../wallets-manager'; | ||
| import { AppKitNetworkManager } from '../../network'; | ||
| import { Network } from '../../../types/network'; | ||
| import { LruAppKitCache } from '../../cache'; | ||
| /** | ||
@@ -24,2 +25,3 @@ * Central hub for wallet management. | ||
| this.config = config; | ||
| this.cache = config.cache ?? new LruAppKitCache(); | ||
| this.emitter = new EventEmitter(); | ||
@@ -49,3 +51,3 @@ this.emitter.on(CONNECTOR_EVENTS.CONNECTED, this.updateWalletsFromConnectors.bind(this)); | ||
| createFactoryContext() { | ||
| return { eventEmitter: this.emitter, networkManager: this.networkManager, ssr: this.config?.ssr }; | ||
| return { eventEmitter: this.emitter, networkManager: this.networkManager }; | ||
| } | ||
@@ -52,0 +54,0 @@ /** |
@@ -9,2 +9,3 @@ /** | ||
| import type { NetworkAdapters, ProviderInput } from '@ton/walletkit'; | ||
| import type { AppKitCache } from '../../cache'; | ||
| import type { ConnectorInput } from '../../../types/connector'; | ||
@@ -36,6 +37,7 @@ import type { Network } from '../../../types/network'; | ||
| /** | ||
| * Enable server-side rendering support | ||
| * Custom cache implementation. | ||
| * Defaults to an LRU cache with a 10-minute TTL and a maximum of 1000 entries. | ||
| */ | ||
| ssr?: boolean; | ||
| cache?: AppKitCache; | ||
| } | ||
| //# sourceMappingURL=config.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAE9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB"} | ||
| {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/types/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAE9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB"} |
@@ -8,5 +8,5 @@ /** | ||
| */ | ||
| import type { Network } from '../../../types/network'; | ||
| import type { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from '../constants/events'; | ||
| import type { SharedKitEvents } from '../../emitter'; | ||
| import type { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from '../constants/events'; | ||
| import type { Network } from '../../../types/network'; | ||
| import type { EventEmitter } from '../../emitter'; | ||
@@ -21,6 +21,2 @@ import type { WalletInterface } from '../../../types/wallet'; | ||
| } | ||
| export interface PluginRegisteredPayload { | ||
| pluginId: string; | ||
| pluginType: string; | ||
| } | ||
| export interface DefaultNetworkChangedPayload { | ||
@@ -40,5 +36,4 @@ network: Network | undefined; | ||
| [NETWORKS_EVENTS.DEFAULT_CHANGED]: DefaultNetworkChangedPayload; | ||
| [PLUGIN_EVENTS.REGISTERED]: PluginRegisteredPayload; | ||
| } & SharedKitEvents; | ||
| export type AppKitEmitter = EventEmitter<AppKitEvents>; | ||
| //# sourceMappingURL=events.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-kit/types/events.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE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@@ -29,0 +30,0 @@ export * from './core/network'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAExC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAG1B,cAAc,WAAW,CAAC;AAG1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,SAAS,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAExC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAG1B,cAAc,WAAW,CAAC;AAG1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,SAAS,CAAC"} |
@@ -28,2 +28,3 @@ /** | ||
| export * from './core/app-kit'; | ||
| export * from './core/cache'; | ||
| export * from './core/emitter'; | ||
@@ -30,0 +31,0 @@ export * from './core/network'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/balances/get-balance-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,OAAO,CACtF,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAExG,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,iBAAgB,8BAA8B,CAAC,UAAU,CAAM,KAChE,+BAA+B,CAAC,UAAU,CAe5C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B,GACpC,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,2BAEF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC5B,aAAa,WAAW,EACxB,sBAAsB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3D,QAAQ,aAAa,SAYxB,CAAC"} | ||
| {"version":3,"file":"get-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/balances/get-balance-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,OAAO,CACtF,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAExG,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,iBAAgB,8BAA8B,CAAC,UAAU,CAAM,KAChE,+BAA+B,CAAC,UAAU,CAmB5C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B,GACpC,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,2BAEF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC5B,aAAa,WAAW,EACxB,sBAAsB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3D,QAAQ,aAAa,SAexB,CAAC"} |
@@ -9,6 +9,10 @@ /** | ||
| import { getBalanceByAddress } from '../../actions/balances/get-balance-by-address'; | ||
| import { filterQueryOptions, resolveNetwork, sleep } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, sleep, tryToBounceableAddress } from '../../utils'; | ||
| export const getBalanceByAddressQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -34,4 +38,7 @@ ...options.query, | ||
| export const handleBalanceUpdate = (queryClient, { address, network }, update) => { | ||
| const queryKey = getBalanceByAddressQueryKey({ | ||
| address: tryToBounceableAddress(address) ?? address, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = getBalanceByAddressQueryKey({ address, network }); | ||
| queryClient.setQueryData(queryKey, update.balance); | ||
@@ -41,5 +48,4 @@ sleep(5000).then(() => queryClient.invalidateQueries({ queryKey })); | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = getBalanceByAddressQueryKey({ address, network }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
| } | ||
| }; |
@@ -25,3 +25,2 @@ /** | ||
| export { buildSwapTransactionMutationOptions, type BuildSwapTransactionMutationConfig, type BuildSwapTransactionMutationOptions, type BuildSwapTransactionData, type BuildSwapTransactionErrorType, type BuildSwapTransactionMutate, type BuildSwapTransactionMutateAsync, type BuildSwapTransactionVariables, } from './swap/build-swap-transaction'; | ||
| export { getStakingProvidersQueryOptions, type GetStakingProvidersData, type GetStakingProvidersErrorType, type GetStakingProvidersQueryConfig, } from './staking/get-staking-providers'; | ||
| export { getStakingQuoteQueryOptions, type GetStakingQuoteQueryConfig, type GetStakingQuoteQueryOptions, type GetStakingQuoteData, type GetStakingQuoteErrorType, type GetStakingQuoteQueryFnData, type GetStakingQuoteQueryKey, } from './staking/get-staking-quote'; | ||
@@ -28,0 +27,0 @@ export { getStakedBalanceQueryOptions, type GetStakedBalanceQueryConfig, type GetStakedBalanceData, type GetStakedBalanceErrorType, } from './staking/get-staked-balance'; |
@@ -1,1 +0,1 @@ | ||
| {"version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A4B,EAC5B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,kCAAkC,EAClC,KAAK,iCAAiC,EACtC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,GACvC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,oCAAoC,EACpC,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,GACtC,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EACH,0BAA0B,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACxC,MAAM,sCAAsC,CAAC"} |
@@ -33,3 +33,2 @@ /** | ||
| // Staking | ||
| export { getStakingProvidersQueryOptions, } from './staking/get-staking-providers'; | ||
| export { getStakingQuoteQueryOptions, } from './staking/get-staking-quote'; | ||
@@ -36,0 +35,0 @@ export { getStakedBalanceQueryOptions, } from './staking/get-staked-balance'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"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AS;IACrD,gBAAgB;IAChB,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,qCAAqC,CAAC,UAAU,GAAG,6BAA6B,IAAI,YAAY,CACxG,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,iCAAiC,CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAClC,aAAa,WAAW,EACxB,0CAA0C;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3G,QAAQ,YAAY,SAoBvB,CAAC"} | ||
| {"version":3,"file":"get-jetton-balance-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-balance-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,IAAI,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE9C,MAAM,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAExE,MAAM,MAAM,oCAAoC,CAAC,UAAU,GAAG,6BAA6B,IAAI,OAAO,CAClG,YAAY,CAAC,0BAA0B,CAAC,CAC3C,GACG,cAAc,CACV,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,iCAAiC,CACpC,CAAC;AAEN,eAAO,MAAM,qCAAqC,GAAI,UAAU,GAAG,6BAA6B,EAC5F,QAAQ,MAAM,EACd,iBAAgB,oCAAoC,CAAC,UAAU,CAAM,KACtE,qCAAqC,CAAC,UAAU,CAsBlD,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE/D,eAAO,MAAM,iCAAiC,GAC1C,UAAS,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAM,KAChE,iCAEF,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,SAAS;IACrD,gBAAgB;IAChB,OAAO,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,qCAAqC,CAAC,UAAU,GAAG,6BAA6B,IAAI,YAAY,CACxG,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,iCAAiC,CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAClC,aAAa,WAAW,EACxB,0CAA0C;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3G,QAAQ,YAAY,SAgBvB,CAAC"} |
@@ -9,6 +9,11 @@ /** | ||
| import { getJettonBalance } from '../../actions/jettons/get-jetton-balance'; | ||
| import { filterQueryOptions, resolveNetwork, sleep } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, sleep, tryToBounceableAddress } from '../../utils'; | ||
| export const getJettonBalanceByAddressQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| jettonAddress: tryToBounceableAddress(initialOptions.jettonAddress) ?? initialOptions.jettonAddress, | ||
| ownerAddress: tryToBounceableAddress(initialOptions.ownerAddress) ?? initialOptions.ownerAddress, | ||
| }; | ||
| return { | ||
@@ -36,8 +41,8 @@ ...options.query, | ||
| export const handleJettonBalanceUpdate = (queryClient, { ownerAddress, jettonAddress, network }, update) => { | ||
| const queryKey = getJettonBalanceByAddressQueryKey({ | ||
| ownerAddress: tryToBounceableAddress(ownerAddress) ?? ownerAddress, | ||
| jettonAddress: tryToBounceableAddress(jettonAddress) ?? jettonAddress, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = getJettonBalanceByAddressQueryKey({ | ||
| ownerAddress, | ||
| jettonAddress, | ||
| network, | ||
| }); | ||
| queryClient.setQueryData(queryKey, update.balance); | ||
@@ -47,9 +52,4 @@ sleep(5000).then(() => queryClient.invalidateQueries({ queryKey })); | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = getJettonBalanceByAddressQueryKey({ | ||
| ownerAddress, | ||
| jettonAddress, | ||
| network, | ||
| }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
| } | ||
| }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE3C,MAAM,MAAM,wBAAwB,CAAC,UAAU,GAAG,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,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wB,CAAC,UAAU,GAAG,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,GAC9G,cAAc,CAAC,wBAAwB,EAAE,sBAAsB,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAExG,eAAO,MAAM,yBAAyB,GAAI,UAAU,GAAG,iBAAiB,EACpE,QAAQ,MAAM,EACd,iBAAgB,wBAAwB,CAAC,UAAU,CAAM,KAC1D,yBAAyB,CAAC,UAAU,CAoBtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEzD,eAAO,MAAM,qBAAqB,GAC9B,UAAS,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAM,KAC1D,qBAEF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAE1G,MAAM,MAAM,yBAAyB,CAAC,UAAU,GAAG,iBAAiB,IAAI,YAAY,CAChF,wBAAwB,EACxB,sBAAsB,EACtB,UAAU,EACV,qBAAqB,CACxB,CAAC"} |
@@ -9,6 +9,10 @@ /** | ||
| import { getJettonInfo } from '../../actions/jettons/get-jetton-info'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| export const getJettonInfoQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -15,0 +19,0 @@ ...options.query, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jetton-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EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} | ||
| {"version":3,"file":"get-jetton-wallet-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jetton-wallet-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,6BAA6B,IAAI,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACzI,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,gCAAgC,CAAC,CACjD,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,iBAAgB,iCAAiC,CAAC,UAAU,CAAM,KACnE,kCAAkC,CAAC,UAAU,CAsB/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAM,KACtE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,uBAAuB;IACvB,OAAO,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} |
@@ -9,6 +9,11 @@ /** | ||
| import { getJettonWalletAddress } from '../../actions/jettons/get-jetton-wallet-address'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| export const getJettonWalletAddressQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| jettonAddress: tryToBounceableAddress(initialOptions.jettonAddress) ?? initialOptions.jettonAddress, | ||
| ownerAddress: tryToBounceableAddress(initialOptions.ownerAddress) ?? initialOptions.ownerAddress, | ||
| }; | ||
| return { | ||
@@ -15,0 +20,0 @@ ...options.query, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-jettons-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/jettons/get-jettons-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,mBAAmB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9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC5B,aAAa,WAAW,EACxB,sBAAsB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAC3D,QAAQ,YAAY,SAkCvB,CAAC"} |
@@ -9,6 +9,10 @@ /** | ||
| import { getJettonsByAddress } from '../../actions/jettons/get-jettons-by-address'; | ||
| import { filterQueryOptions, resolveNetwork, compareAddress, formatUnits, sleep } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, compareAddress, formatUnits, sleep, tryToBounceableAddress, } from '../../utils'; | ||
| export const getJettonsByAddressQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -34,4 +38,7 @@ ...options.query, | ||
| export const handleJettonsUpdate = (queryClient, { address, network }, update) => { | ||
| const queryKey = getJettonsByAddressQueryKey({ | ||
| address: tryToBounceableAddress(address) ?? address, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = getJettonsByAddressQueryKey({ address, network }); | ||
| const currentData = queryClient.getQueryData(queryKey); | ||
@@ -56,5 +63,4 @@ if (currentData?.jettons) { | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = getJettonsByAddressQueryKey({ address, network }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
| } | ||
| }; |
@@ -16,3 +16,3 @@ /** | ||
| export declare const getNftQueryOptions: <selectData = GetNftData>(appKit: AppKit, initialOptions?: GetNftQueryConfig<selectData>) => GetNftQueryOptions<selectData>; | ||
| export type GetNftQueryFnData = Compute<NFT | null>; | ||
| export type GetNftQueryFnData = Compute<NFT | undefined>; | ||
| export type GetNftData = GetNftQueryFnData; | ||
@@ -19,0 +19,0 @@ export declare const getNftQueryKey: (options?: Compute<ExactPartial<GetNftParameters>>) => GetNftQueryKey; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-nft.d.ts","sourceRoot":"","sources":["../../../../src/queries/nft/get-nft.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC;AAEpC,MAAM,MAAM,iBAAiB,CAAC,UAAU,GAAG,UAAU,IAAI,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,GAC5F,cAAc,CAAC,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,kBAAkB,GAAI,UAAU,GAAG,UAAU,EACtD,QAAQ,MAAM,EACd,iBAAgB,iBAAiB,CAAC,UAAU,CAAM,KACnD,kBAAkB,CAAC,UAAU,CAgB/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE3C,eAAO,MAAM,cAAc,GAAI,UAAS,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAM,KAAG,cAEtF,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAEvF,MAAM,MAAM,kBAAkB,CAAC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AAM,MAAM,kBAAkB,CAAC,UAAU,GAAG,UAAU,IAAI,YAAY,CAClE,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,CACjB,CAAC"} |
@@ -9,6 +9,10 @@ /** | ||
| import { getNft } from '../../actions/nft/get-nft'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| export const getNftQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -15,0 +19,0 @@ ...options.query, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-nfts-by-address.d.ts","sourceRoot":"","sources":["../../../../src/queries/nft/get-nfts-by-address.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAExF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAErC,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEtD,MAAM,MAAM,2BAA2B,CAAC,UAAU,GAAG,oBAAoB,IAAI,OAAO,CAChF,YAAY,CAAC,uBAAuB,CAAC,CACxC,GACG,cAAc,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;AAE/F,eAAO,MAAM,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AgB,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;AAE/F,eAAO,MAAM,4BAA4B,GAAI,UAAU,GAAG,oBAAoB,EAC1E,QAAQ,MAAM,EACd,iBAAgB,2BAA2B,CAAC,UAAU,CAAM,KAC7D,4BAA4B,CAAC,UAAU,CAoBzC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAE9E,eAAO,MAAM,wBAAwB,GACjC,UAAS,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAM,KAC7D,wBAEF,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAEzG,MAAM,MAAM,4BAA4B,CAAC,UAAU,GAAG,oBAAoB,IAAI,YAAY,CACtF,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,wBAAwB,CAC3B,CAAC"} |
@@ -9,6 +9,10 @@ /** | ||
| import { getNftsByAddress } from '../../actions/nft/get-nfts-by-address'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| export const getNFTsByAddressQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
| return { | ||
@@ -15,0 +19,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| export type GetStakedBalanceQueryConfig<selectData = GetStakedBalanceData> = Compute<ExactPartial<GetStakedBalanceOptions>> & QueryParameter<GetStakedBalanceQueryFnData, GetStakedBalanceErrorType, selectData, GetStakedBalanceQueryKey>; | ||
| export declare const getStakedBalanceQueryOptions: <selectData = GetStakedBalanceData>(appKit: AppKit, options?: GetStakedBalanceQueryConfig<selectData>) => GetStakedBalanceQueryOptions<selectData>; | ||
| export declare const getStakedBalanceQueryOptions: <selectData = GetStakedBalanceData>(appKit: AppKit, initialOptions?: GetStakedBalanceQueryConfig<selectData>) => GetStakedBalanceQueryOptions<selectData>; | ||
| export type GetStakedBalanceQueryFnData = Compute<Awaited<GetStakedBalanceReturnType>>; | ||
@@ -18,0 +18,0 @@ export type GetStakedBalanceData = GetStakedBalanceQueryFnData; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staked-balance.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staked-balance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE9C,MAAM,MAAM,2BAA2B,CAAC,UAAU,GAAG,oBAAoB,IAAI,OAAO,CAChF,YAAY,CAAC,uBAAuB,CAAC,CACxC,GACG,cAAc,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;AAEjH,eAAO,MAAM,4BAA4B,GAAI,UAAU,GAAG,oBAAoB,EAC1E,QAAQ,MAAM,EACd,UAAS,2BAA2B,CAAC,UAAU,CAAM,KACtD,4BAA4B,CAAC,UAAU,CAczC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAEvF,M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OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAE/D,eAAO,MAAM,wBAAwB,GACjC,UAAS,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAM,KAC7D,wBAEF,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,MAAM,4BAA4B,CAAC,UAAU,GAAG,oBAAoB,IAAI,YAAY,CACtF,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,wBAAwB,CAC3B,CAAC"} |
@@ -9,4 +9,10 @@ /** | ||
| import { getStakedBalance } from '../../actions/staking/get-staked-balance'; | ||
| import { filterQueryOptions } from '../../utils'; | ||
| export const getStakedBalanceQueryOptions = (appKit, options = {}) => { | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| export const getStakedBalanceQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| userAddress: tryToBounceableAddress(initialOptions.userAddress) ?? initialOptions.userAddress, | ||
| }; | ||
| return { | ||
@@ -13,0 +19,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| export type GetStakingProviderInfoQueryConfig<selectData = GetStakingProviderInfoData> = Compute<ExactPartial<GetStakingProviderInfoOptions>> & QueryParameter<GetStakingProviderInfoQueryFnData, GetStakingProviderInfoErrorType, selectData, GetStakingProviderInfoQueryKey>; | ||
| export declare const getStakingProviderInfoQueryOptions: <selectData = GetStakingProviderInfoData>(appKit: AppKit, options?: GetStakingProviderInfoQueryConfig<selectData>) => GetStakingProviderInfoQueryOptions<selectData>; | ||
| export declare const getStakingProviderInfoQueryOptions: <selectData = GetStakingProviderInfoData>(appKit: AppKit, initialOptions?: GetStakingProviderInfoQueryConfig<selectData>) => GetStakingProviderInfoQueryOptions<selectData>; | ||
| export type GetStakingProviderInfoQueryFnData = Compute<Awaited<GetStakingProviderInfoReturnType>>; | ||
@@ -18,0 +18,0 @@ export type GetStakingProviderInfoData = GetStakingProviderInfoQueryFnData; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staking-provider-info.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-provider-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AACrG,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,6BAA6B,CAAC,CAC9C,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,UAAS,iCAAiC,CAAC,UAAU,CAAM,KAC5D,kCAAkC,CAAC,UAAU,CAS/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;AAEnG,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAM,KACnE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,qBAAqB;IACrB,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} | ||
| {"version":3,"file":"get-staking-provider-info.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-provider-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AACrG,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iCAAiC,CAAC,UAAU,GAAG,0BAA0B,IAAI,OAAO,CAC5F,YAAY,CAAC,6BAA6B,CAAC,CAC9C,GACG,cAAc,CACV,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC;AAEN,eAAO,MAAM,kCAAkC,GAAI,UAAU,GAAG,0BAA0B,EACtF,QAAQ,MAAM,EACd,iBAAgB,iCAAiC,CAAC,UAAU,CAAM,KACnE,kCAAkC,CAAC,UAAU,CAY/C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,CAAC;AAEnG,MAAM,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AAE3E,eAAO,MAAM,8BAA8B,GACvC,UAAS,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAM,KACnE,8BAEF,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,SAAS;IAClD,qBAAqB;IACrB,OAAO,CAAC,YAAY,CAAC,6BAA6B,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,kCAAkC,CAAC,UAAU,GAAG,0BAA0B,IAAI,YAAY,CAClG,iCAAiC,EACjC,+BAA+B,EAC/B,UAAU,EACV,8BAA8B,CACjC,CAAC"} |
@@ -9,4 +9,6 @@ /** | ||
| import { getStakingProviderInfo } from '../../actions/staking/get-staking-provider-info'; | ||
| import { filterQueryOptions } from '../../utils'; | ||
| export const getStakingProviderInfoQueryOptions = (appKit, options = {}) => { | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| export const getStakingProviderInfoQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| return { | ||
@@ -13,0 +15,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| export type GetStakingQuoteQueryConfig<selectData = GetStakingQuoteData> = Compute<ExactPartial<GetStakingQuoteOptions>> & QueryParameter<GetStakingQuoteQueryFnData, GetStakingQuoteErrorType, selectData, GetStakingQuoteQueryKey>; | ||
| export declare const getStakingQuoteQueryOptions: <selectData = GetStakingQuoteData>(appKit: AppKit, options?: GetStakingQuoteQueryConfig<selectData>) => GetStakingQuoteQueryOptions<selectData>; | ||
| export declare const getStakingQuoteQueryOptions: <selectData = GetStakingQuoteData>(appKit: AppKit, initialOptions?: GetStakingQuoteQueryConfig<selectData>) => GetStakingQuoteQueryOptions<selectData>; | ||
| export type GetStakingQuoteQueryFnData = Compute<Awaited<GetStakingQuoteReturnType>>; | ||
@@ -18,0 +18,0 @@ export type GetStakingQuoteData = GetStakingQuoteQueryFnData; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-staking-quote.d.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AI,YAAY,CACpF,0BAA0B,EAC1B,wBAAwB,EACxB,UAAU,EACV,uBAAuB,CAC1B,CAAC"} |
@@ -9,7 +9,13 @@ /** | ||
| import { getStakingQuote } from '../../actions/staking/get-staking-quote'; | ||
| import { filterQueryOptions } from '../../utils'; | ||
| export const getStakingQuoteQueryOptions = (appKit, options = {}) => { | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| export const getStakingQuoteQueryOptions = (appKit, initialOptions = {}) => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| userAddress: tryToBounceableAddress(initialOptions.userAddress) ?? initialOptions.userAddress, | ||
| }; | ||
| return { | ||
| ...options.query, | ||
| enabled: Boolean(options.amount && options.direction && (options.query?.enabled ?? true)), | ||
| enabled: Boolean(options.amount && options.amount !== '0' && options.direction && (options.query?.enabled ?? true)), | ||
| queryFn: async (context) => { | ||
@@ -16,0 +22,0 @@ const [, parameters] = context.queryKey; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"get-swap-quote.d.ts","sourceRoot":"","sources":["../../../../src/queries/swap/get-swap-quote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE1C,MAAM,MAAM,uBAAuB,CAAC,UAAU,GAAG,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,GAC3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B,IAAI,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,GAC3G,cAAc,CAAC,uBAAuB,EAAE,qBAAqB,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC;AAErG,eAAO,MAAM,wBAAwB,GAAI,UAAU,GAAG,gBAAgB,EAClE,QAAQ,MAAM,EACd,iBAAgB,uBAAuB,CAAC,UAAU,CAAM,KACzD,wBAAwB,CAAC,UAAU,CA+BrC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,GAC7B,UAAS,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAM,KACzD,oBAEF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAEtG,MAAM,MAAM,wBAAwB,CAAC,UAAU,GAAG,gBAAgB,IAAI,YAAY,CAC9E,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,EACV,oBAAoB,CACvB,CAAC"} |
@@ -15,3 +15,3 @@ /** | ||
| ...options.query, | ||
| enabled: Boolean(options.amount && options.from && options.to && (options.query?.enabled ?? true)), | ||
| enabled: Boolean(options.amount && options.amount !== '0' && options.from && options.to && (options.query?.enabled ?? true)), | ||
| queryFn: async (context) => { | ||
@@ -18,0 +18,0 @@ const [, parameters] = context.queryKey; |
@@ -8,4 +8,4 @@ /** | ||
| */ | ||
| export { StakingProvider, UnstakeMode, StakingError, StakingManager } from '@ton/walletkit'; | ||
| export type { UnstakeModes, StakeParams, StakingAPI, StakingQuote, StakingQuoteParams, StakingBalance, StakingProviderInfo, StakingProviderInterface, StakingQuoteDirection, } from '@ton/walletkit'; | ||
| export { DefiError, StakingProvider, UnstakeMode, StakingError, StakingErrorCode, StakingManager, } from '@ton/walletkit'; | ||
| export type { UnstakeModes, StakeParams, StakingAPI, StakingQuote, StakingQuoteParams, StakingBalance, StakingProviderInfo, StakingProviderInterface, StakingQuoteDirection, StakingProviderMetadata, StakingTokenInfo, } from '@ton/walletkit'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/staking/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE5F,YAAY,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,GACxB,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/staking/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACjB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACnB,MAAM,gBAAgB,CAAC"} |
@@ -8,2 +8,2 @@ /** | ||
| */ | ||
| export { StakingProvider, UnstakeMode, StakingError, StakingManager } from '@ton/walletkit'; | ||
| export { DefiError, StakingProvider, UnstakeMode, StakingError, StakingErrorCode, StakingManager, } from '@ton/walletkit'; |
@@ -8,3 +8,4 @@ /** | ||
| */ | ||
| export type { SwapToken, TokenAmount, SwapParams, SwapAPI, SwapFee, SwapQuote, SwapQuoteParams, DefiManagerAPI, DefiProvider, SwapProvider, SwapError, SwapManager, } from '@ton/walletkit'; | ||
| export { DefiError, SwapError, SwapProvider, SwapManager } from '@ton/walletkit'; | ||
| export type { SwapToken, TokenAmount, SwapParams, SwapAPI, SwapQuote, SwapQuoteParams, DefiManagerAPI, DefiProvider, } from '@ton/walletkit'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swap/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,WAAW,GACd,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swap/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEjF,YAAY,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,YAAY,GACf,MAAM,gBAAgB,CAAC"} |
@@ -8,2 +8,2 @@ /** | ||
| */ | ||
| export {}; | ||
| export { DefiError, SwapError, SwapProvider, SwapManager } from '@ton/walletkit'; |
@@ -40,3 +40,2 @@ /** | ||
| eventEmitter: AppKitEmitter; | ||
| ssr?: boolean; | ||
| } | ||
@@ -43,0 +42,0 @@ /** Factory function that creates a connector from context */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/types/connector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EA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E,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAErC,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAC;IAEhB,uBAAuB;IACvB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD,0BAA0B;IAC1B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,4BAA4B;IAC5B,mBAAmB,IAAI,eAAe,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,cAAc,EAAE,oBAAoB,CAAC;IACrC,YAAY,EAAE,aAAa,CAAC;CAC/B;AAED,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,uBAAuB,KAAK,SAAS,CAAC;AAE3E,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAE1D,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAE3E"} |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| export type { Base64String } from '@ton/walletkit'; | ||
| export type { Base64String, UserFriendlyAddress, Hex } from '@ton/walletkit'; | ||
| //# sourceMappingURL=primitives.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/types/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"} | ||
| {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/types/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC"} |
@@ -9,6 +9,15 @@ /** | ||
| export { formatUnits, parseUnits, compareAddress } from '@ton/walletkit'; | ||
| export * from './address/is-valid-address'; | ||
| export * from './address/to-bounceble-address'; | ||
| export * from './address/to-non-bounceble-address'; | ||
| export * from './amount/calc-fiat-value'; | ||
| export * from './amount/format-large-value'; | ||
| export * from './amount/truncate-decimals'; | ||
| export * from './amount/validate-numeric-string'; | ||
| export * from './balance/calc-max-spendable'; | ||
| export * from './balance/get-ton-shortfall'; | ||
| export * from './arrays/key-by'; | ||
| export * from './arrays/random-from-array'; | ||
| export * from './errors/get-error-message'; | ||
| export * from './functions/debounce'; | ||
| export * from './functions/noop'; | ||
@@ -18,2 +27,3 @@ export * from './jetton/jetton-info'; | ||
| export * from './object/map-values'; | ||
| export * from './predicate/is-number'; | ||
| export * from './predicate/is-string'; | ||
@@ -20,0 +30,0 @@ export * from './promise/cancel-promise'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEzE,cAAc,kCAAkC,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEzE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"} |
@@ -9,6 +9,15 @@ /** | ||
| export { formatUnits, parseUnits, compareAddress } from '@ton/walletkit'; | ||
| export * from './address/is-valid-address'; | ||
| export * from './address/to-bounceble-address'; | ||
| export * from './address/to-non-bounceble-address'; | ||
| export * from './amount/calc-fiat-value'; | ||
| export * from './amount/format-large-value'; | ||
| export * from './amount/truncate-decimals'; | ||
| export * from './amount/validate-numeric-string'; | ||
| export * from './balance/calc-max-spendable'; | ||
| export * from './balance/get-ton-shortfall'; | ||
| export * from './arrays/key-by'; | ||
| export * from './arrays/random-from-array'; | ||
| export * from './errors/get-error-message'; | ||
| export * from './functions/debounce'; | ||
| export * from './functions/noop'; | ||
@@ -18,2 +27,3 @@ export * from './jetton/jetton-info'; | ||
| export * from './object/map-values'; | ||
| export * from './predicate/is-number'; | ||
| export * from './predicate/is-string'; | ||
@@ -20,0 +30,0 @@ export * from './promise/cancel-promise'; |
@@ -8,3 +8,4 @@ /** | ||
| */ | ||
| import type { Jetton } from '@ton/walletkit'; | ||
| import type { Jetton, JettonInfo } from '../../types/jetton'; | ||
| export declare const isJettonInfo: (value: unknown) => value is JettonInfo; | ||
| export declare const getJettonsSymbol: (jetton: Jetton) => string | undefined; | ||
@@ -11,0 +12,0 @@ export declare const getJettonsName: (jetton: Jetton) => string | undefined; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/jetton/jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAM1D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAMxD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAazD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM;;;;;;;;;;CAkBpD,CAAC"} | ||
| {"version":3,"file":"jetton-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/jetton/jetton-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,UAStD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAM1D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAMxD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAazD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM;;;;;;;;;;CAkBpD,CAAC"} |
@@ -8,2 +8,11 @@ /** | ||
| */ | ||
| export const isJettonInfo = (value) => { | ||
| if (typeof value !== 'object' || value === null) | ||
| return false; | ||
| const v = value; | ||
| return (typeof v.address === 'string' && | ||
| typeof v.name === 'string' && | ||
| typeof v.symbol === 'string' && | ||
| typeof v.description === 'string'); | ||
| }; | ||
| export const getJettonsSymbol = (jetton) => { | ||
@@ -10,0 +19,0 @@ if (!jetton?.info?.symbol) { |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| export declare function isString(value: unknown): value is string; | ||
| export declare const isString: (value: unknown) => value is string; | ||
| //# sourceMappingURL=is-string.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD"} | ||
| {"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAC"} |
@@ -8,4 +8,4 @@ /** | ||
| */ | ||
| export function isString(value) { | ||
| export const isString = (value) => { | ||
| return typeof value === 'string'; | ||
| } | ||
| }; |
+57
-9
@@ -205,3 +205,2 @@ <!-- | ||
| ownerAddress: selectedWallet.getAddress(), | ||
| jettonDecimals: 6, | ||
| }); | ||
@@ -250,3 +249,2 @@ console.log('Jetton Balance:', balance.toString()); | ||
| comment: 'Hello Jetton', | ||
| jettonDecimals: 6, | ||
| }); | ||
@@ -265,3 +263,2 @@ console.log('Transfer Transaction:', tx); | ||
| amount: '100', | ||
| jettonDecimals: 6, | ||
| }); | ||
@@ -451,7 +448,8 @@ console.log('Transfer Result:', result); | ||
| ```ts | ||
| const omnistonProvider = new OmnistonSwapProvider({ | ||
| defaultSlippageBps: 100, // 1% | ||
| }); | ||
| registerProvider(appKit, omnistonProvider); | ||
| registerProvider( | ||
| appKit, | ||
| createOmnistonProvider({ | ||
| defaultSlippageBps: 100, // 1% | ||
| }), | ||
| ); | ||
| ``` | ||
@@ -509,2 +507,41 @@ | ||
| ### `getSwapProvider` | ||
| Get a specific swap provider by its ID. | ||
| ```ts | ||
| const swapProvider = getSwapProvider(appKit, { id: 'stonfi' }); | ||
| ``` | ||
| ### `getSwapProviders` | ||
| Get all registered swap providers. The returned array keeps a stable reference until the provider list changes. | ||
| ```ts | ||
| const swapProviders = getSwapProviders(appKit); | ||
| console.log( | ||
| 'Registered providers:', | ||
| swapProviders.map((p) => p.providerId), | ||
| ); | ||
| ``` | ||
| ### `setDefaultSwapProvider` | ||
| Set the default swap provider. Subsequent quote and swap-transaction calls will use this provider when none is specified. | ||
| ```ts | ||
| setDefaultSwapProvider(appKit, { providerId: 'stonfi' }); | ||
| ``` | ||
| ### `watchSwapProviders` | ||
| Watch for new swap providers registration. | ||
| ```ts | ||
| const unsubscribe = watchSwapProviders(appKit, { | ||
| onChange: () => console.log('Swap providers updated'), | ||
| }); | ||
| unsubscribe(); | ||
| ``` | ||
| ### `getSwapQuote` | ||
@@ -554,3 +591,3 @@ | ||
| Get information about a specific staking provider. | ||
| Get dynamic information about a specific staking provider (e.g. APY, rate). | ||
@@ -564,2 +601,13 @@ ```ts | ||
| ### `getStakingProviderMetadata` | ||
| Get static metadata about a specific staking provider. | ||
| ```ts | ||
| const providerMetadata = getStakingProviderMetadata(appKit, { | ||
| providerId: 'tonstakers', | ||
| }); | ||
| console.log('Provider Metadata:', providerMetadata); | ||
| ``` | ||
| ### `getStakingQuote` | ||
@@ -566,0 +614,0 @@ |
+4
-4
@@ -40,7 +40,7 @@ <!-- | ||
| providers: [ | ||
| new OmnistonSwapProvider({ | ||
| createOmnistonProvider({ | ||
| apiUrl: 'https://api.ston.fi', | ||
| defaultSlippageBps: 100, // 1% | ||
| }), | ||
| new DeDustSwapProvider({ | ||
| createDeDustProvider({ | ||
| defaultSlippageBps: 100, | ||
@@ -71,4 +71,4 @@ referralAddress: 'EQ...', // Optional | ||
| // 2. Register swap providers | ||
| registerProvider(appKit, new OmnistonSwapProvider({ defaultSlippageBps: 100 })); | ||
| registerProvider(appKit, new DeDustSwapProvider({ defaultSlippageBps: 100 })); | ||
| registerProvider(appKit, createOmnistonProvider({ defaultSlippageBps: 100 })); | ||
| registerProvider(appKit, createDeDustProvider({ defaultSlippageBps: 100 })); | ||
| ``` | ||
@@ -75,0 +75,0 @@ |
+4
-3
| { | ||
| "name": "@ton/appkit", | ||
| "version": "0.0.5-alpha.3", | ||
| "version": "1.0.0-alpha.0", | ||
| "description": "", | ||
@@ -82,3 +82,4 @@ "repository": { | ||
| "dependencies": { | ||
| "@ton/walletkit": "0.0.12-alpha.3" | ||
| "lru-cache": "11.3.5", | ||
| "@ton/walletkit": "1.0.0-alpha.0" | ||
| }, | ||
@@ -108,3 +109,3 @@ "peerDependencies": { | ||
| "@ton/core": "0.63.1", | ||
| "@tonconnect/ui": "2.4.4", | ||
| "@tonconnect/ui": "2.5.0-alpha.0", | ||
| "typescript": "~5.9.3", | ||
@@ -111,0 +112,0 @@ "vitest": "^4.1.4" |
+32
-0
@@ -118,4 +118,16 @@ /** | ||
| export { getSwapManager, type GetSwapManagerReturnType } from './swap/get-swap-manager'; | ||
| export { getSwapProvider, type GetSwapProviderOptions, type GetSwapProviderReturnType } from './swap/get-swap-provider'; | ||
| export { getSwapProviders, type GetSwapProvidersReturnType } from './swap/get-swap-providers'; | ||
| export { | ||
| setDefaultSwapProvider, | ||
| type SetDefaultSwapProviderParameters, | ||
| type SetDefaultSwapProviderReturnType, | ||
| } from './swap/set-default-swap-provider'; | ||
| export { getSwapQuote, type GetSwapQuoteOptions, type GetSwapQuoteReturnType } from './swap/get-swap-quote'; | ||
| export { | ||
| watchSwapProviders, | ||
| type WatchSwapProvidersParameters, | ||
| type WatchSwapProvidersReturnType, | ||
| } from './swap/watch-swap-providers'; | ||
| export { | ||
| buildSwapTransaction, | ||
@@ -130,2 +142,17 @@ type BuildSwapTransactionOptions, | ||
| export { | ||
| getStakingProvider, | ||
| type GetStakingProviderOptions, | ||
| type GetStakingProviderReturnType, | ||
| } from './staking/get-staking-provider'; | ||
| export { | ||
| setDefaultStakingProvider, | ||
| type SetDefaultStakingProviderParameters, | ||
| type SetDefaultStakingProviderReturnType, | ||
| } from './staking/set-default-staking-provider'; | ||
| export { | ||
| watchStakingProviders, | ||
| type WatchStakingProvidersParameters, | ||
| type WatchStakingProvidersReturnType, | ||
| } from './staking/watch-staking-providers'; | ||
| export { | ||
| getStakingQuote, | ||
@@ -150,2 +177,7 @@ type GetStakingQuoteOptions, | ||
| } from './staking/get-staking-provider-info'; | ||
| export { | ||
| getStakingProviderMetadata, | ||
| type GetStakingProviderMetadataOptions, | ||
| type GetStakingProviderMetadataReturnType, | ||
| } from './staking/get-staking-provider-metadata'; | ||
@@ -152,0 +184,0 @@ // Transactions |
@@ -20,2 +20,4 @@ /** | ||
| import { getSelectedWallet } from '../wallets/get-selected-wallet'; | ||
| import { getJettonInfo } from './get-jetton-info'; | ||
| import { isNumber } from '../../utils'; | ||
@@ -26,3 +28,3 @@ export interface CreateTransferJettonTransactionParameters { | ||
| amount: string; | ||
| jettonDecimals: number; | ||
| jettonDecimals?: number; | ||
| comment?: string; | ||
@@ -49,12 +51,26 @@ } | ||
| // Get client from network manager | ||
| const client = appKit.networkManager.getClient(wallet.getNetwork()); | ||
| const network = wallet.getNetwork(); | ||
| const client = appKit.networkManager.getClient(network); | ||
| // Get jetton wallet address | ||
| const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, wallet.getAddress()); | ||
| const ownerAddress = wallet.getAddress(); | ||
| const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress); | ||
| let decimals = jettonDecimals; | ||
| if (!isNumber(decimals)) { | ||
| const jettonInfo = await getJettonInfo(appKit, { address: jettonAddress, network }); | ||
| if (!isNumber(jettonInfo?.decimals)) { | ||
| throw new Error(`Jetton decimals not found for address ${jettonAddress}`); | ||
| } | ||
| decimals = jettonInfo.decimals; | ||
| } | ||
| // Create jetton transfer payload | ||
| const jettonPayload = createJettonTransferPayload({ | ||
| amount: parseUnits(amount, jettonDecimals), | ||
| amount: parseUnits(amount, decimals), | ||
| destination: recipientAddress, | ||
| responseDestination: wallet.getAddress(), | ||
| responseDestination: ownerAddress, | ||
| comment, | ||
@@ -68,4 +84,4 @@ }); | ||
| payload: jettonPayload, | ||
| fromAddress: wallet.getAddress(), | ||
| fromAddress: ownerAddress, | ||
| }); | ||
| }; |
@@ -14,3 +14,4 @@ /** | ||
| import { getJettonWalletAddress } from './get-jetton-wallet-address'; | ||
| import { resolveNetwork } from '../../utils/network/resolve-network'; | ||
| import { getJettonInfo } from './get-jetton-info'; | ||
| import { isNumber, resolveNetwork } from '../../utils'; | ||
| import type { Network } from '../../types/network'; | ||
@@ -21,3 +22,3 @@ | ||
| ownerAddress: UserFriendlyAddress; | ||
| jettonDecimals: number; | ||
| jettonDecimals?: number; | ||
| network?: Network; | ||
@@ -43,3 +44,9 @@ } | ||
| return formatUnits(balance, jettonDecimals); | ||
| if (isNumber(jettonDecimals)) { | ||
| return formatUnits(balance, jettonDecimals); | ||
| } | ||
| const jettonInfo = await getJettonInfo(appKit, { address: jettonAddress, network }); | ||
| return formatUnits(balance, jettonInfo?.decimals ?? 0); | ||
| }; |
@@ -12,4 +12,5 @@ /** | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| import { resolveNetwork } from '../../utils/network/resolve-network'; | ||
| import { toBounceableAddress, resolveNetwork, isJettonInfo } from '../../utils'; | ||
| import type { Network } from '../../types/network'; | ||
| import { getCacheKey } from '../../core/cache'; | ||
@@ -23,2 +24,4 @@ export interface GetJettonInfoOptions { | ||
| const getJettonInfoCacheKey = getCacheKey('jetton-info'); | ||
| export const getJettonInfo = async ( | ||
@@ -28,8 +31,13 @@ appKit: AppKit, | ||
| ): Promise<GetJettonInfoReturnType> => { | ||
| const { address, network } = options; | ||
| const address = toBounceableAddress(options.address); | ||
| const network = resolveNetwork(appKit, options.network); | ||
| const cacheKey = getJettonInfoCacheKey(address, network.chainId); | ||
| const client = appKit.networkManager.getClient(resolveNetwork(appKit, network)); | ||
| const cached = await appKit.cache.get(cacheKey); | ||
| if (cached && isJettonInfo(cached)) return cached; | ||
| const client = appKit.networkManager.getClient(network); | ||
| const response = await client.jettonsByAddress({ | ||
| address: address, | ||
| address, | ||
| offset: 0, | ||
@@ -67,5 +75,5 @@ limit: 1, | ||
| return { | ||
| const result: GetJettonInfoReturnType = { | ||
| address, | ||
| decimals, | ||
| address: jetton.jetton, | ||
| name: tokenInfo?.name ?? '', | ||
@@ -77,2 +85,6 @@ symbol: tokenInfo?.symbol ?? '', | ||
| }; | ||
| await appKit.cache.set(cacheKey, result); | ||
| return result; | ||
| }; |
@@ -10,7 +10,8 @@ /** | ||
| import { getJettonWalletAddressFromClient } from '@ton/walletkit'; | ||
| import type { UserFriendlyAddress } from '@ton/walletkit'; | ||
| import type { UserFriendlyAddress } from '../../types/primitives'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| import { resolveNetwork } from '../../utils/network/resolve-network'; | ||
| import type { Network } from '../../types/network'; | ||
| import { getCacheKey } from '../../core/cache'; | ||
| import { isFriendlyTonAddress, resolveNetwork, toBounceableAddress } from '../../utils'; | ||
@@ -25,2 +26,4 @@ export interface GetJettonWalletAddressOptions { | ||
| const getJettonWalletCacheKey = getCacheKey('jetton-wallet-address'); | ||
| export const getJettonWalletAddress = async ( | ||
@@ -30,7 +33,18 @@ appKit: AppKit, | ||
| ): Promise<GetJettonWalletAddressReturnType> => { | ||
| const { jettonAddress, ownerAddress, network } = options; | ||
| const ownerAddress = toBounceableAddress(options.ownerAddress); | ||
| const jettonAddress = toBounceableAddress(options.jettonAddress); | ||
| const network = resolveNetwork(appKit, options.network); | ||
| const client = appKit.networkManager.getClient(resolveNetwork(appKit, network)); | ||
| const cacheKey = getJettonWalletCacheKey(network.chainId, ownerAddress, jettonAddress); | ||
| return getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress); | ||
| const cached = await appKit.cache.get(cacheKey); | ||
| if (cached && isFriendlyTonAddress(cached)) { | ||
| return cached; | ||
| } | ||
| const client = appKit.networkManager.getClient(network); | ||
| const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress); | ||
| await appKit.cache.set(cacheKey, jettonWalletAddress); | ||
| return jettonWalletAddress; | ||
| }; |
@@ -22,3 +22,3 @@ /** | ||
| export type GetNftReturnType = NFT | null; | ||
| export type GetNftReturnType = NFT | undefined; | ||
@@ -25,0 +25,0 @@ export const getNft = async (appKit: AppKit, options: GetNftOptions): Promise<GetNftReturnType> => { |
@@ -9,11 +9,13 @@ /** | ||
| import type { StakingProviderInterface } from '@ton/walletkit'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| export type GetStakingProvidersReturnType = string[]; | ||
| export type GetStakingProvidersReturnType = StakingProviderInterface[]; | ||
| /** | ||
| * Get available staking provider IDs | ||
| * Get all registered staking providers. | ||
| */ | ||
| export const getStakingProviders = (appKit: AppKit): GetStakingProvidersReturnType => { | ||
| return appKit.stakingManager.getRegisteredProviders(); | ||
| return appKit.stakingManager.getProviders(); | ||
| }; |
@@ -12,2 +12,3 @@ /** | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| import { resolveNetwork } from '../../utils'; | ||
@@ -27,3 +28,8 @@ export type GetSwapQuoteOptions<T = unknown> = SwapQuoteParams<T> & { | ||
| ): GetSwapQuoteReturnType => { | ||
| return appKit.swapManager.getQuote(options, options.providerId); | ||
| const optionsWithNetwork = { | ||
| ...options, | ||
| network: resolveNetwork(appKit, options.network), | ||
| }; | ||
| return appKit.swapManager.getQuote(optionsWithNetwork, options.providerId); | ||
| }; |
@@ -32,3 +32,3 @@ /** | ||
| export const createTonConnectConnector = (config: TonConnectConnectorConfig) => { | ||
| return createConnector(({ eventEmitter, networkManager, ssr }): TonConnectConnector => { | ||
| return createConnector(({ eventEmitter, networkManager }): TonConnectConnector => { | ||
| let originalTonConnectUI: TonConnectUI | null = null; | ||
@@ -44,3 +44,3 @@ let unsubscribeTonConnect: (() => void) | null = null; | ||
| if (ssr && typeof window === 'undefined') { | ||
| if (typeof window === 'undefined') { | ||
| return null; | ||
@@ -47,0 +47,0 @@ } |
@@ -32,8 +32,1 @@ /** | ||
| } as const; | ||
| /** | ||
| * Plugin events | ||
| */ | ||
| export const PLUGIN_EVENTS = { | ||
| REGISTERED: 'plugin:registered', | ||
| } as const; |
@@ -10,3 +10,3 @@ /** | ||
| export { AppKit } from './services/app-kit'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
| export { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from './constants/events'; | ||
@@ -19,4 +19,3 @@ export type { AppKitConfig } from './types/config'; | ||
| WalletDisconnectedPayload, | ||
| PluginRegisteredPayload, | ||
| DefaultNetworkChangedPayload, | ||
| } from './types/events'; |
@@ -12,6 +12,7 @@ /** | ||
| import type { AppKitConfig } from '../types/config'; | ||
| import { CONNECTOR_EVENTS, WALLETS_EVENTS } from '../constants/events'; | ||
| import { StakingManager } from '../../../staking'; | ||
| import type { Connector, ConnectorFactoryContext, ConnectorInput } from '../../../types/connector'; | ||
| import { EventEmitter } from '../../emitter'; | ||
| import { CONNECTOR_EVENTS, WALLETS_EVENTS } from '../constants/events'; | ||
| import type { AppKitEmitter, AppKitEvents } from '../types/events'; | ||
@@ -22,3 +23,4 @@ import type { WalletInterface } from '../../../types/wallet'; | ||
| import { Network } from '../../../types/network'; | ||
| import type { AppKitConfig } from '../types/config'; | ||
| import type { AppKitCache } from '../../cache'; | ||
| import { LruAppKitCache } from '../../cache'; | ||
@@ -39,5 +41,7 @@ /** | ||
| readonly config: AppKitConfig; | ||
| readonly cache: AppKitCache; | ||
| constructor(config: AppKitConfig) { | ||
| this.config = config; | ||
| this.cache = config.cache ?? new LruAppKitCache(); | ||
@@ -74,3 +78,3 @@ this.emitter = new EventEmitter<AppKitEvents>(); | ||
| createFactoryContext(): ConnectorFactoryContext { | ||
| return { eventEmitter: this.emitter, networkManager: this.networkManager, ssr: this.config?.ssr }; | ||
| return { eventEmitter: this.emitter, networkManager: this.networkManager }; | ||
| } | ||
@@ -77,0 +81,0 @@ |
@@ -11,2 +11,3 @@ /** | ||
| import type { AppKitCache } from '../../cache'; | ||
| import type { ConnectorInput } from '../../../types/connector'; | ||
@@ -43,5 +44,6 @@ import type { Network } from '../../../types/network'; | ||
| /** | ||
| * Enable server-side rendering support | ||
| * Custom cache implementation. | ||
| * Defaults to an LRU cache with a 10-minute TTL and a maximum of 1000 entries. | ||
| */ | ||
| ssr?: boolean; | ||
| cache?: AppKitCache; | ||
| } |
@@ -9,5 +9,5 @@ /** | ||
| import type { Network } from '../../../types/network'; | ||
| import type { CONNECTOR_EVENTS, WALLETS_EVENTS, NETWORKS_EVENTS } from '../constants/events'; | ||
| import type { SharedKitEvents } from '../../emitter'; | ||
| import type { CONNECTOR_EVENTS, WALLETS_EVENTS, PLUGIN_EVENTS, NETWORKS_EVENTS } from '../constants/events'; | ||
| import type { Network } from '../../../types/network'; | ||
| import type { EventEmitter } from '../../emitter'; | ||
@@ -25,7 +25,2 @@ import type { WalletInterface } from '../../../types/wallet'; | ||
| export interface PluginRegisteredPayload { | ||
| pluginId: string; | ||
| pluginType: string; | ||
| } | ||
| export interface DefaultNetworkChangedPayload { | ||
@@ -47,7 +42,4 @@ network: Network | undefined; | ||
| [NETWORKS_EVENTS.DEFAULT_CHANGED]: DefaultNetworkChangedPayload; | ||
| // Plugin events | ||
| [PLUGIN_EVENTS.REGISTERED]: PluginRegisteredPayload; | ||
| } & SharedKitEvents; | ||
| export type AppKitEmitter = EventEmitter<AppKitEvents>; |
+1
-0
@@ -30,2 +30,3 @@ /** | ||
| export * from './core/app-kit'; | ||
| export * from './core/cache'; | ||
| export * from './core/emitter'; | ||
@@ -32,0 +33,0 @@ export * from './core/network'; |
@@ -16,3 +16,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork, sleep } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, sleep, tryToBounceableAddress } from '../../utils'; | ||
| import type { GetBalanceByAddressReturnType } from '../../actions/balances/get-balance-by-address'; | ||
@@ -36,3 +36,7 @@ import type { BalanceUpdate } from '../../core/streaming'; | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
@@ -77,4 +81,8 @@ return { | ||
| ) => { | ||
| const queryKey = getBalanceByAddressQueryKey({ | ||
| address: tryToBounceableAddress(address) ?? address, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = getBalanceByAddressQueryKey({ address, network }); | ||
| queryClient.setQueryData(queryKey, update.balance); | ||
@@ -85,5 +93,4 @@ sleep(5000).then(() => queryClient.invalidateQueries({ queryKey })); | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = getBalanceByAddressQueryKey({ address, network }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
| } | ||
| }; |
@@ -170,8 +170,2 @@ /** | ||
| export { | ||
| getStakingProvidersQueryOptions, | ||
| type GetStakingProvidersData, | ||
| type GetStakingProvidersErrorType, | ||
| type GetStakingProvidersQueryConfig, | ||
| } from './staking/get-staking-providers'; | ||
| export { | ||
| getStakingQuoteQueryOptions, | ||
@@ -178,0 +172,0 @@ type GetStakingQuoteQueryConfig, |
@@ -17,3 +17,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork, sleep } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, sleep, tryToBounceableAddress } from '../../utils'; | ||
| import type { JettonUpdate } from '../../core/streaming'; | ||
@@ -41,3 +41,8 @@ import type { Network } from '../../types/network'; | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| jettonAddress: tryToBounceableAddress(initialOptions.jettonAddress) ?? initialOptions.jettonAddress, | ||
| ownerAddress: tryToBounceableAddress(initialOptions.ownerAddress) ?? initialOptions.ownerAddress, | ||
| }; | ||
@@ -87,8 +92,9 @@ return { | ||
| ) => { | ||
| const queryKey = getJettonBalanceByAddressQueryKey({ | ||
| ownerAddress: tryToBounceableAddress(ownerAddress) ?? ownerAddress, | ||
| jettonAddress: tryToBounceableAddress(jettonAddress) ?? jettonAddress, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = getJettonBalanceByAddressQueryKey({ | ||
| ownerAddress, | ||
| jettonAddress, | ||
| network, | ||
| }); | ||
| queryClient.setQueryData(queryKey, update.balance); | ||
@@ -99,9 +105,4 @@ sleep(5000).then(() => queryClient.invalidateQueries({ queryKey })); | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = getJettonBalanceByAddressQueryKey({ | ||
| ownerAddress, | ||
| jettonAddress, | ||
| network, | ||
| }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
| } | ||
| }; |
@@ -15,3 +15,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
@@ -28,3 +28,7 @@ export type GetJettonInfoErrorType = Error; | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
@@ -31,0 +35,0 @@ return { |
@@ -16,3 +16,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
@@ -36,3 +36,8 @@ export type GetJettonWalletAddressErrorType = Error; | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| jettonAddress: tryToBounceableAddress(initialOptions.jettonAddress) ?? initialOptions.jettonAddress, | ||
| ownerAddress: tryToBounceableAddress(initialOptions.ownerAddress) ?? initialOptions.ownerAddress, | ||
| }; | ||
@@ -39,0 +44,0 @@ return { |
@@ -16,3 +16,10 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork, compareAddress, formatUnits, sleep } from '../../utils'; | ||
| import { | ||
| filterQueryOptions, | ||
| resolveNetwork, | ||
| compareAddress, | ||
| formatUnits, | ||
| sleep, | ||
| tryToBounceableAddress, | ||
| } from '../../utils'; | ||
| import type { GetJettonsByAddressReturnType } from '../../actions/jettons/get-jettons-by-address'; | ||
@@ -36,3 +43,7 @@ import type { JettonUpdate } from '../../core/streaming'; | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
@@ -78,4 +89,8 @@ return { | ||
| ) => { | ||
| const queryKey = getJettonsByAddressQueryKey({ | ||
| address: tryToBounceableAddress(address) ?? address, | ||
| network, | ||
| }); | ||
| if (update.status === 'finalized') { | ||
| const queryKey = getJettonsByAddressQueryKey({ address, network }); | ||
| const currentData = queryClient.getQueryData(queryKey) as GetJettonsByAddressData | undefined; | ||
@@ -105,5 +120,4 @@ | ||
| if (update.status === 'invalidated') { | ||
| const queryKey = getJettonsByAddressQueryKey({ address, network }); | ||
| queryClient.invalidateQueries({ queryKey }); | ||
| } | ||
| }; |
@@ -16,3 +16,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
@@ -29,3 +29,7 @@ export type GetNftErrorType = Error; | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
@@ -46,3 +50,3 @@ return { | ||
| export type GetNftQueryFnData = Compute<NFT | null>; | ||
| export type GetNftQueryFnData = Compute<NFT | undefined>; | ||
@@ -49,0 +53,0 @@ export type GetNftData = GetNftQueryFnData; |
@@ -14,3 +14,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
| import type { GetNftsByAddressReturnType } from '../../actions/nft/get-nfts-by-address'; | ||
@@ -32,3 +32,7 @@ | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| address: tryToBounceableAddress(initialOptions.address) ?? initialOptions.address, | ||
| }; | ||
@@ -35,0 +39,0 @@ return { |
@@ -15,3 +15,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
@@ -27,4 +27,11 @@ export type GetStakedBalanceErrorType = Error; | ||
| appKit: AppKit, | ||
| options: GetStakedBalanceQueryConfig<selectData> = {}, | ||
| initialOptions: GetStakedBalanceQueryConfig<selectData> = {}, | ||
| ): GetStakedBalanceQueryOptions<selectData> => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| userAddress: tryToBounceableAddress(initialOptions.userAddress) ?? initialOptions.userAddress, | ||
| }; | ||
| return { | ||
@@ -52,3 +59,3 @@ ...options.query, | ||
| ): GetStakedBalanceQueryKey => { | ||
| return ['stakedBalance', filterQueryOptions(options as unknown as Record<string, unknown>)] as const; | ||
| return ['stakedBalance', filterQueryOptions(options)] as const; | ||
| }; | ||
@@ -55,0 +62,0 @@ |
@@ -15,3 +15,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork } from '../../utils'; | ||
@@ -32,4 +32,7 @@ export type GetStakingProviderInfoErrorType = Error; | ||
| appKit: AppKit, | ||
| options: GetStakingProviderInfoQueryConfig<selectData> = {}, | ||
| initialOptions: GetStakingProviderInfoQueryConfig<selectData> = {}, | ||
| ): GetStakingProviderInfoQueryOptions<selectData> => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { ...initialOptions, network }; | ||
| return { | ||
@@ -36,0 +39,0 @@ ...options.query, |
@@ -15,3 +15,3 @@ /** | ||
| import type { Compute, ExactPartial } from '../../types/utils'; | ||
| import { filterQueryOptions } from '../../utils'; | ||
| import { filterQueryOptions, resolveNetwork, tryToBounceableAddress } from '../../utils'; | ||
@@ -27,7 +27,16 @@ export type GetStakingQuoteErrorType = Error; | ||
| appKit: AppKit, | ||
| options: GetStakingQuoteQueryConfig<selectData> = {}, | ||
| initialOptions: GetStakingQuoteQueryConfig<selectData> = {}, | ||
| ): GetStakingQuoteQueryOptions<selectData> => { | ||
| const network = resolveNetwork(appKit, initialOptions.network); | ||
| const options = { | ||
| ...initialOptions, | ||
| network, | ||
| userAddress: tryToBounceableAddress(initialOptions.userAddress) ?? initialOptions.userAddress, | ||
| }; | ||
| return { | ||
| ...options.query, | ||
| enabled: Boolean(options.amount && options.direction && (options.query?.enabled ?? true)), | ||
| enabled: Boolean( | ||
| options.amount && options.amount !== '0' && options.direction && (options.query?.enabled ?? true), | ||
| ), | ||
| queryFn: async (context) => { | ||
@@ -52,3 +61,3 @@ const [, parameters] = context.queryKey as [string, GetStakingQuoteOptions]; | ||
| ): GetStakingQuoteQueryKey => { | ||
| return ['stakingQuote', filterQueryOptions(options as unknown as Record<string, unknown>)] as const; | ||
| return ['stakingQuote', filterQueryOptions(options)] as const; | ||
| }; | ||
@@ -55,0 +64,0 @@ |
@@ -31,3 +31,5 @@ /** | ||
| ...options.query, | ||
| enabled: Boolean(options.amount && options.from && options.to && (options.query?.enabled ?? true)), | ||
| enabled: Boolean( | ||
| options.amount && options.amount !== '0' && options.from && options.to && (options.query?.enabled ?? true), | ||
| ), | ||
| queryFn: async (context) => { | ||
@@ -34,0 +36,0 @@ const [, parameters] = context.queryKey as [string, GetSwapQuoteOptions]; |
+10
-1
@@ -9,3 +9,10 @@ /** | ||
| export { StakingProvider, UnstakeMode, StakingError, StakingManager } from '@ton/walletkit'; | ||
| export { | ||
| DefiError, | ||
| StakingProvider, | ||
| UnstakeMode, | ||
| StakingError, | ||
| StakingErrorCode, | ||
| StakingManager, | ||
| } from '@ton/walletkit'; | ||
@@ -22,2 +29,4 @@ export type { | ||
| StakingQuoteDirection, | ||
| StakingProviderMetadata, | ||
| StakingTokenInfo, | ||
| } from '@ton/walletkit'; |
@@ -9,2 +9,4 @@ /** | ||
| export { DefiError, SwapError, SwapProvider, SwapManager } from '@ton/walletkit'; | ||
| export type { | ||
@@ -15,3 +17,2 @@ SwapToken, | ||
| SwapAPI, | ||
| SwapFee, | ||
| SwapQuote, | ||
@@ -21,5 +22,2 @@ SwapQuoteParams, | ||
| DefiProvider, | ||
| SwapProvider, | ||
| SwapError, | ||
| SwapManager, | ||
| } from '@ton/walletkit'; |
@@ -50,3 +50,2 @@ /** | ||
| eventEmitter: AppKitEmitter; | ||
| ssr?: boolean; | ||
| } | ||
@@ -53,0 +52,0 @@ |
@@ -9,2 +9,2 @@ /** | ||
| export type { Base64String } from '@ton/walletkit'; | ||
| export type { Base64String, UserFriendlyAddress, Hex } from '@ton/walletkit'; |
+10
-0
@@ -11,6 +11,15 @@ /** | ||
| export * from './address/is-valid-address'; | ||
| export * from './address/to-bounceble-address'; | ||
| export * from './address/to-non-bounceble-address'; | ||
| export * from './amount/calc-fiat-value'; | ||
| export * from './amount/format-large-value'; | ||
| export * from './amount/truncate-decimals'; | ||
| export * from './amount/validate-numeric-string'; | ||
| export * from './balance/calc-max-spendable'; | ||
| export * from './balance/get-ton-shortfall'; | ||
| export * from './arrays/key-by'; | ||
| export * from './arrays/random-from-array'; | ||
| export * from './errors/get-error-message'; | ||
| export * from './functions/debounce'; | ||
| export * from './functions/noop'; | ||
@@ -20,2 +29,3 @@ export * from './jetton/jetton-info'; | ||
| export * from './object/map-values'; | ||
| export * from './predicate/is-number'; | ||
| export * from './predicate/is-string'; | ||
@@ -22,0 +32,0 @@ export * from './promise/cancel-promise'; |
@@ -9,4 +9,15 @@ /** | ||
| import type { Jetton } from '@ton/walletkit'; | ||
| import type { Jetton, JettonInfo } from '../../types/jetton'; | ||
| export const isJettonInfo = (value: unknown): value is JettonInfo => { | ||
| if (typeof value !== 'object' || value === null) return false; | ||
| const v = value as Record<string, unknown>; | ||
| return ( | ||
| typeof v.address === 'string' && | ||
| typeof v.name === 'string' && | ||
| typeof v.symbol === 'string' && | ||
| typeof v.description === 'string' | ||
| ); | ||
| }; | ||
| export const getJettonsSymbol = (jetton: Jetton): string | undefined => { | ||
@@ -13,0 +24,0 @@ if (!jetton?.info?.symbol) { |
@@ -9,4 +9,4 @@ /** | ||
| export function isString(value: unknown): value is string { | ||
| export const isString = (value: unknown): value is string => { | ||
| return typeof value === 'string'; | ||
| } | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { GetStakingProvidersReturnType } from '../../actions/staking/get-staking-providers'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| import type { QueryOptions, QueryParameter } from '../../types/query'; | ||
| import type { Compute } from '../../types/utils'; | ||
| export type GetStakingProvidersErrorType = Error; | ||
| export type GetStakingProvidersQueryConfig<selectData = GetStakingProvidersData> = QueryParameter<GetStakingProvidersQueryFnData, GetStakingProvidersErrorType, selectData, GetStakingProvidersQueryKey>; | ||
| export declare const getStakingProvidersQueryOptions: <selectData = GetStakingProvidersData>(appKit: AppKit, options?: GetStakingProvidersQueryConfig<selectData>) => GetStakingProvidersQueryOptions<selectData>; | ||
| export type GetStakingProvidersQueryFnData = Compute<Awaited<GetStakingProvidersReturnType>>; | ||
| export type GetStakingProvidersData = GetStakingProvidersQueryFnData; | ||
| export declare const getStakingProvidersQueryKey: () => GetStakingProvidersQueryKey; | ||
| export type GetStakingProvidersQueryKey = readonly ['stakingProviders']; | ||
| export type GetStakingProvidersQueryOptions<selectData = GetStakingProvidersData> = QueryOptions<GetStakingProvidersQueryFnData, GetStakingProvidersErrorType, selectData, GetStakingProvidersQueryKey>; | ||
| //# sourceMappingURL=get-staking-providers.d.ts.map |
| {"version":3,"file":"get-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAAC;AAEjD,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,cAAc,CAC7F,8BAA8B,EAC9B,4BAA4B,EAC5B,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,UAAS,8BAA8B,CAAC,UAAU,CAAM,KACzD,+BAA+B,CAAC,UAAU,CAQ5C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAE7F,MAAM,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAErE,eAAO,MAAM,2BAA2B,QAAO,2BAE9C,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAExE,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,8BAA8B,EAC9B,4BAA4B,EAC5B,UAAU,EACV,2BAA2B,CAC9B,CAAC"} |
| "use strict"; | ||
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getStakingProvidersQueryKey = exports.getStakingProvidersQueryOptions = void 0; | ||
| const get_staking_providers_1 = require("../../actions/staking/get-staking-providers"); | ||
| const getStakingProvidersQueryOptions = (appKit, options = {}) => { | ||
| return { | ||
| ...options.query, | ||
| queryFn: async () => { | ||
| return (0, get_staking_providers_1.getStakingProviders)(appKit); | ||
| }, | ||
| queryKey: (0, exports.getStakingProvidersQueryKey)(), | ||
| }; | ||
| }; | ||
| exports.getStakingProvidersQueryOptions = getStakingProvidersQueryOptions; | ||
| const getStakingProvidersQueryKey = () => { | ||
| return ['stakingProviders']; | ||
| }; | ||
| exports.getStakingProvidersQueryKey = getStakingProvidersQueryKey; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import type { GetStakingProvidersReturnType } from '../../actions/staking/get-staking-providers'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| import type { QueryOptions, QueryParameter } from '../../types/query'; | ||
| import type { Compute } from '../../types/utils'; | ||
| export type GetStakingProvidersErrorType = Error; | ||
| export type GetStakingProvidersQueryConfig<selectData = GetStakingProvidersData> = QueryParameter<GetStakingProvidersQueryFnData, GetStakingProvidersErrorType, selectData, GetStakingProvidersQueryKey>; | ||
| export declare const getStakingProvidersQueryOptions: <selectData = GetStakingProvidersData>(appKit: AppKit, options?: GetStakingProvidersQueryConfig<selectData>) => GetStakingProvidersQueryOptions<selectData>; | ||
| export type GetStakingProvidersQueryFnData = Compute<Awaited<GetStakingProvidersReturnType>>; | ||
| export type GetStakingProvidersData = GetStakingProvidersQueryFnData; | ||
| export declare const getStakingProvidersQueryKey: () => GetStakingProvidersQueryKey; | ||
| export type GetStakingProvidersQueryKey = readonly ['stakingProviders']; | ||
| export type GetStakingProvidersQueryOptions<selectData = GetStakingProvidersData> = QueryOptions<GetStakingProvidersQueryFnData, GetStakingProvidersErrorType, selectData, GetStakingProvidersQueryKey>; | ||
| //# sourceMappingURL=get-staking-providers.d.ts.map |
| {"version":3,"file":"get-staking-providers.d.ts","sourceRoot":"","sources":["../../../../src/queries/staking/get-staking-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAAC;AAEjD,MAAM,MAAM,8BAA8B,CAAC,UAAU,GAAG,uBAAuB,IAAI,cAAc,CAC7F,8BAA8B,EAC9B,4BAA4B,EAC5B,UAAU,EACV,2BAA2B,CAC9B,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,UAAU,GAAG,uBAAuB,EAChF,QAAQ,MAAM,EACd,UAAS,8BAA8B,CAAC,UAAU,CAAM,KACzD,+BAA+B,CAAC,UAAU,CAQ5C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAE7F,MAAM,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAErE,eAAO,MAAM,2BAA2B,QAAO,2BAE9C,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC;AAExE,MAAM,MAAM,+BAA+B,CAAC,UAAU,GAAG,uBAAuB,IAAI,YAAY,CAC5F,8BAA8B,EAC9B,4BAA4B,EAC5B,UAAU,EACV,2BAA2B,CAC9B,CAAC"} |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { getStakingProviders } from '../../actions/staking/get-staking-providers'; | ||
| export const getStakingProvidersQueryOptions = (appKit, options = {}) => { | ||
| return { | ||
| ...options.query, | ||
| queryFn: async () => { | ||
| return getStakingProviders(appKit); | ||
| }, | ||
| queryKey: getStakingProvidersQueryKey(), | ||
| }; | ||
| }; | ||
| export const getStakingProvidersQueryKey = () => { | ||
| return ['stakingProviders']; | ||
| }; |
| /** | ||
| * Copyright (c) TonTech. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| * | ||
| */ | ||
| import { getStakingProviders } from '../../actions/staking/get-staking-providers'; | ||
| import type { GetStakingProvidersReturnType } from '../../actions/staking/get-staking-providers'; | ||
| import type { AppKit } from '../../core/app-kit'; | ||
| import type { QueryOptions, QueryParameter } from '../../types/query'; | ||
| import type { Compute } from '../../types/utils'; | ||
| export type GetStakingProvidersErrorType = Error; | ||
| export type GetStakingProvidersQueryConfig<selectData = GetStakingProvidersData> = QueryParameter< | ||
| GetStakingProvidersQueryFnData, | ||
| GetStakingProvidersErrorType, | ||
| selectData, | ||
| GetStakingProvidersQueryKey | ||
| >; | ||
| export const getStakingProvidersQueryOptions = <selectData = GetStakingProvidersData>( | ||
| appKit: AppKit, | ||
| options: GetStakingProvidersQueryConfig<selectData> = {}, | ||
| ): GetStakingProvidersQueryOptions<selectData> => { | ||
| return { | ||
| ...options.query, | ||
| queryFn: async () => { | ||
| return getStakingProviders(appKit); | ||
| }, | ||
| queryKey: getStakingProvidersQueryKey(), | ||
| }; | ||
| }; | ||
| export type GetStakingProvidersQueryFnData = Compute<Awaited<GetStakingProvidersReturnType>>; | ||
| export type GetStakingProvidersData = GetStakingProvidersQueryFnData; | ||
| export const getStakingProvidersQueryKey = (): GetStakingProvidersQueryKey => { | ||
| return ['stakingProviders'] as const; | ||
| }; | ||
| export type GetStakingProvidersQueryKey = readonly ['stakingProviders']; | ||
| export type GetStakingProvidersQueryOptions<selectData = GetStakingProvidersData> = QueryOptions< | ||
| GetStakingProvidersQueryFnData, | ||
| GetStakingProvidersErrorType, | ||
| selectData, | ||
| GetStakingProvidersQueryKey | ||
| >; |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1188341
22.42%1218
20%23051
25.03%6
20%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated