@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. | ||
| * | ||
| */ | ||
| export { withTimeout } from '@ton/walletkit'; | ||
| //# sourceMappingURL=with-timeout.d.ts.map |
| {"version":3,"file":"with-timeout.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise/with-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,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.withTimeout = void 0; | ||
| // Re-exported from walletkit so the kit packages share a single source of truth. | ||
| var walletkit_1 = require("@ton/walletkit"); | ||
| Object.defineProperty(exports, "withTimeout", { enumerable: true, get: function () { return walletkit_1.withTimeout; } }); |
| /** | ||
| * 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 { withTimeout } from '@ton/walletkit'; | ||
| //# sourceMappingURL=with-timeout.d.ts.map |
| {"version":3,"file":"with-timeout.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise/with-timeout.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,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. | ||
| * | ||
| */ | ||
| // Re-exported from walletkit so the kit packages share a single source of truth. | ||
| export { withTimeout } from '@ton/walletkit'; |
| /** | ||
| * 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. | ||
| * | ||
| */ | ||
| // Re-exported from walletkit so the kit packages share a single source of truth. | ||
| export { withTimeout } from '@ton/walletkit'; |
@@ -1,16 +0,4 @@ | ||
| > @ton/appkit@1.0.0-alpha.1 build /home/runner/work/kit/kit/packages/appkit | ||
| > pnpm build:clean && pnpm build:cjs && pnpm build:esm | ||
| > @ton/appkit@1.0.0-alpha.1 build:clean /home/runner/work/kit/kit/packages/appkit | ||
| > git clean -xdf dist | ||
| > @ton/appkit@1.0.0-alpha.1 build:cjs /home/runner/work/kit/kit/packages/appkit | ||
| > tsc -p tsconfig.cjs.json | ||
| > @ton/appkit@1.0.0-alpha.1 build:esm /home/runner/work/kit/kit/packages/appkit | ||
| > tsc -p tsconfig.json | ||
| $ pnpm build:clean && pnpm build:cjs && pnpm build:esm | ||
| $ git clean -xdf dist | ||
| $ tsc -p tsconfig.cjs.json | ||
| $ tsc -p tsconfig.json |
+11
-0
| # @ton/appkit | ||
| ## 1.0.0-alpha.2 | ||
| ### Patch Changes | ||
| - c1f0edf: - Added confirmation modals for the swap and staking widgets. | ||
| - Improved error handling across swap and staking flows, especially when the network is unavailable — failures now surface in the submit button instead of hanging. | ||
| - Moved `cancelPromise` from `@ton/appkit` to `@ton/walletkit` and renamed it to `withTimeout` to reflect what it actually does (it does not abort the underlying operation). `@ton/appkit` re-exports it. | ||
| - Updated dependencies [c1f0edf] | ||
| - Updated dependencies [864636c] | ||
| - @ton/walletkit@1.0.0-alpha.2 | ||
| ## 1.0.0-alpha.1 | ||
@@ -4,0 +15,0 @@ |
@@ -28,3 +28,3 @@ /** | ||
| export * from './predicate/is-string'; | ||
| export * from './promise/cancel-promise'; | ||
| export * from './promise/with-timeout'; | ||
| export * from './promise/sleep'; | ||
@@ -31,0 +31,0 @@ export * from './query/filter-query-options'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WA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AAc,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,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"} |
@@ -48,3 +48,3 @@ "use strict"; | ||
| __exportStar(require("./predicate/is-string"), exports); | ||
| __exportStar(require("./promise/cancel-promise"), exports); | ||
| __exportStar(require("./promise/with-timeout"), exports); | ||
| __exportStar(require("./promise/sleep"), exports); | ||
@@ -51,0 +51,0 @@ __exportStar(require("./query/filter-query-options"), exports); |
@@ -28,3 +28,3 @@ /** | ||
| export * from './predicate/is-string'; | ||
| export * from './promise/cancel-promise'; | ||
| export * from './promise/with-timeout'; | ||
| export * from './promise/sleep'; | ||
@@ -31,0 +31,0 @@ export * from './query/filter-query-options'; |
@@ -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,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"} | ||
| {"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,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"} |
@@ -28,3 +28,3 @@ /** | ||
| export * from './predicate/is-string'; | ||
| export * from './promise/cancel-promise'; | ||
| export * from './promise/with-timeout'; | ||
| export * from './promise/sleep'; | ||
@@ -31,0 +31,0 @@ export * from './query/filter-query-options'; |
+9
-8
| { | ||
| "name": "@ton/appkit", | ||
| "version": "1.0.0-alpha.1", | ||
| "version": "1.0.0-alpha.2", | ||
| "description": "", | ||
@@ -82,4 +82,4 @@ "repository": { | ||
| "dependencies": { | ||
| "lru-cache": "11.3.5", | ||
| "@ton/walletkit": "1.0.0-alpha.1" | ||
| "lru-cache": "^11.5.0", | ||
| "@ton/walletkit": "1.0.0-alpha.2" | ||
| }, | ||
@@ -90,3 +90,4 @@ "peerDependencies": { | ||
| "@ton/crypto": "^3.3.0", | ||
| "@tonconnect/ui": ">=2.4.1" | ||
| "@tonconnect/ui": ">=2.5.0-alpha.1", | ||
| "@tonconnect/sdk": ">=3.5.0-alpha.1" | ||
| }, | ||
@@ -108,6 +109,6 @@ "peerDependenciesMeta": { | ||
| "devDependencies": { | ||
| "@tanstack/query-core": "5.99.0", | ||
| "@ton/core": "0.63.1", | ||
| "@tonconnect/ui": "2.5.0-alpha.0", | ||
| "typescript": "~5.9.3", | ||
| "@tanstack/query-core": "^5.100.14", | ||
| "@ton/core": "^0.63.1", | ||
| "@tonconnect/ui": "^2.5.0-alpha.0", | ||
| "typescript": "5.9.3", | ||
| "vitest": "^4.1.4" | ||
@@ -114,0 +115,0 @@ }, |
@@ -30,3 +30,3 @@ /** | ||
| export * from './predicate/is-string'; | ||
| export * from './promise/cancel-promise'; | ||
| export * from './promise/with-timeout'; | ||
| export * from './promise/sleep'; | ||
@@ -33,0 +33,0 @@ export * from './query/filter-query-options'; |
| /** | ||
| * 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 cancelPromise: <T>(promise: T, timeoutMs: number) => Promise<T>; | ||
| //# sourceMappingURL=cancel-promise.d.ts.map |
| {"version":3,"file":"cancel-promise.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise/cancel-promise.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,SAAS,CAAC,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,CAAC,CAOzE,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.cancelPromise = void 0; | ||
| const cancelPromise = (promise, timeoutMs) => { | ||
| return Promise.race([ | ||
| promise, | ||
| new Promise((_, reject) => { | ||
| setTimeout(() => reject(new Error(`Execution timed out - ${timeoutMs}ms`)), timeoutMs); | ||
| }), | ||
| ]); | ||
| }; | ||
| exports.cancelPromise = cancelPromise; |
| /** | ||
| * 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=cancel-promise.test.d.ts.map |
| {"version":3,"file":"cancel-promise.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise/cancel-promise.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 cancel_promise_1 = require("./cancel-promise"); | ||
| (0, vitest_1.describe)('cancelPromise', () => { | ||
| (0, vitest_1.it)('should resolve if promise resolves before timeout', async () => { | ||
| const promise = new Promise((resolve) => setTimeout(() => resolve('success'), 10)); | ||
| await (0, vitest_1.expect)((0, cancel_promise_1.cancelPromise)(promise, 50)).resolves.toBe('success'); | ||
| }); | ||
| (0, vitest_1.it)('should reject if promise times out', async () => { | ||
| const promise = new Promise((resolve) => setTimeout(() => resolve('success'), 50)); | ||
| await (0, vitest_1.expect)((0, cancel_promise_1.cancelPromise)(promise, 10)).rejects.toThrow('Execution timed out - 10ms'); | ||
| }); | ||
| (0, vitest_1.it)('should propagate rejection from original promise', async () => { | ||
| const promise = new Promise((_, reject) => setTimeout(() => reject(new Error('failure')), 10)); | ||
| await (0, vitest_1.expect)((0, cancel_promise_1.cancelPromise)(promise, 50)).rejects.toThrow('failure'); | ||
| }); | ||
| }); |
| /** | ||
| * 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 cancelPromise: <T>(promise: T, timeoutMs: number) => Promise<T>; | ||
| //# sourceMappingURL=cancel-promise.d.ts.map |
| {"version":3,"file":"cancel-promise.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise/cancel-promise.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,SAAS,CAAC,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,CAAC,CAOzE,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 cancelPromise = (promise, timeoutMs) => { | ||
| return Promise.race([ | ||
| promise, | ||
| new Promise((_, reject) => { | ||
| setTimeout(() => reject(new Error(`Execution timed out - ${timeoutMs}ms`)), timeoutMs); | ||
| }), | ||
| ]); | ||
| }; |
| /** | ||
| * 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=cancel-promise.test.d.ts.map |
| {"version":3,"file":"cancel-promise.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/promise/cancel-promise.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 { cancelPromise } from './cancel-promise'; | ||
| describe('cancelPromise', () => { | ||
| it('should resolve if promise resolves before timeout', async () => { | ||
| const promise = new Promise((resolve) => setTimeout(() => resolve('success'), 10)); | ||
| await expect(cancelPromise(promise, 50)).resolves.toBe('success'); | ||
| }); | ||
| it('should reject if promise times out', async () => { | ||
| const promise = new Promise((resolve) => setTimeout(() => resolve('success'), 50)); | ||
| await expect(cancelPromise(promise, 10)).rejects.toThrow('Execution timed out - 10ms'); | ||
| }); | ||
| it('should propagate rejection from original promise', async () => { | ||
| const promise = new Promise((_, reject) => setTimeout(() => reject(new Error('failure')), 10)); | ||
| await expect(cancelPromise(promise, 50)).rejects.toThrow('failure'); | ||
| }); | ||
| }); |
| /** | ||
| * 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 { cancelPromise } from './cancel-promise'; | ||
| describe('cancelPromise', () => { | ||
| it('should resolve if promise resolves before timeout', async () => { | ||
| const promise = new Promise((resolve) => setTimeout(() => resolve('success'), 10)); | ||
| await expect(cancelPromise(promise, 50)).resolves.toBe('success'); | ||
| }); | ||
| it('should reject if promise times out', async () => { | ||
| const promise = new Promise((resolve) => setTimeout(() => resolve('success'), 50)); | ||
| await expect(cancelPromise(promise, 10)).rejects.toThrow('Execution timed out - 10ms'); | ||
| }); | ||
| it('should propagate rejection from original promise', async () => { | ||
| const promise = new Promise((_, reject) => setTimeout(() => reject(new Error('failure')), 10)); | ||
| await expect(cancelPromise(promise, 50)).rejects.toThrow('failure'); | ||
| }); | ||
| }); |
| /** | ||
| * 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 cancelPromise = <T>(promise: T, timeoutMs: number): Promise<T> => { | ||
| return Promise.race([ | ||
| promise, | ||
| new Promise((_, reject) => { | ||
| setTimeout(() => reject(new Error(`Execution timed out - ${timeoutMs}ms`)), timeoutMs); | ||
| }) as T, | ||
| ]); | ||
| }; |
1188410
-0.37%7
16.67%1211
-0.57%23007
-0.45%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated