@dynamic-labs/utils 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.json +4 -3
- package/src/bufferPolyfill.cjs +14 -0
- package/src/bufferPolyfill.d.ts +1 -0
- package/src/bufferPolyfill.js +12 -0
- package/src/bufferToBase64.cjs +2 -0
- package/src/bufferToBase64.d.ts +1 -0
- package/src/bufferToBase64.js +2 -0
- package/src/getOrMapViemChain.cjs +1 -1
- package/src/getOrMapViemChain.js +1 -1
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +1 -0
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +1 -0
- package/src/retryableFn.cjs +2 -1
- package/src/retryableFn.js +2 -1
- package/src/runSafe/runSafe.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.0.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.1...v2.0.2) (2024-04-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* buffer polyfill for utils package ([#5404](https://github.com/dynamic-labs/DynamicAuth/issues/5404)) ([#5405](https://github.com/dynamic-labs/DynamicAuth/issues/5405)) ([679c197](https://github.com/dynamic-labs/DynamicAuth/commit/679c197a52969a0db614ed280d7b9a0bf172bf72))
|
|
8
|
+
|
|
9
|
+
### [2.0.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0...v2.0.1) (2024-04-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add redirectUri to farcaster connect ([#5373](https://github.com/dynamic-labs/DynamicAuth/issues/5373)) ([#5383](https://github.com/dynamic-labs/DynamicAuth/issues/5383)) ([d031d7e](https://github.com/dynamic-labs/DynamicAuth/commit/d031d7ee5705de5ec83ef328f03633d5f3524786))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* copy and ui fixes ([#5367](https://github.com/dynamic-labs/DynamicAuth/issues/5367)) ([e39ea97](https://github.com/dynamic-labs/DynamicAuth/commit/e39ea97d98de6b7087c24f2326a5fdc07ab9c8c3))
|
|
20
|
+
* bitcoin connector improvements
|
|
21
|
+
* solana package improvements ([#5360](https://github.com/dynamic-labs/DynamicAuth/issues/5360)) ([#5385](https://github.com/dynamic-labs/DynamicAuth/issues/5385)) ([9010bce](https://github.com/dynamic-labs/DynamicAuth/commit/9010bcebb4b0f2d293d517347187d38accbac0d3))
|
|
22
|
+
|
|
2
23
|
## [2.0.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.31...v2.0.0-alpha.32) (2024-04-15)
|
|
3
24
|
|
|
4
25
|
## [2.0.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.30...v2.0.0-alpha.31) (2024-04-11)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"tldts": "6.0.16",
|
|
30
|
-
"@dynamic-labs/logger": "2.0.
|
|
31
|
-
"@dynamic-labs/types": "2.0.
|
|
30
|
+
"@dynamic-labs/logger": "2.0.2",
|
|
31
|
+
"@dynamic-labs/types": "2.0.2",
|
|
32
|
+
"buffer": "6.0.3"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"viem": "^2.7.6"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _ = require('buffer/');
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
/**
|
|
7
|
+
* This is needed for the browser to work with buffer
|
|
8
|
+
*/
|
|
9
|
+
if (typeof window !== 'undefined') {
|
|
10
|
+
window.global = globalThis;
|
|
11
|
+
if (!window.Buffer && typeof window.Buffer === 'undefined') {
|
|
12
|
+
Object.assign(window, { Buffer: _.Buffer });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Buffer } from 'buffer/index.js';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* This is needed for the browser to work with buffer
|
|
6
|
+
*/
|
|
7
|
+
if (typeof window !== 'undefined') {
|
|
8
|
+
window.global = globalThis;
|
|
9
|
+
if (!window.Buffer && typeof window.Buffer === 'undefined') {
|
|
10
|
+
Object.assign(window, { Buffer });
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/bufferToBase64.cjs
CHANGED
package/src/bufferToBase64.d.ts
CHANGED
package/src/bufferToBase64.js
CHANGED
|
@@ -52,7 +52,7 @@ const mapChain = (network) => {
|
|
|
52
52
|
}
|
|
53
53
|
: undefined,
|
|
54
54
|
id: network.chainId,
|
|
55
|
-
name: network.vanityName || network.chainName,
|
|
55
|
+
name: network.vanityName || network.name || network.chainName,
|
|
56
56
|
nativeCurrency: network.nativeCurrency,
|
|
57
57
|
rpcUrls: {
|
|
58
58
|
default: { http: network.rpcUrls },
|
package/src/getOrMapViemChain.js
CHANGED
|
@@ -28,7 +28,7 @@ const mapChain = (network) => {
|
|
|
28
28
|
}
|
|
29
29
|
: undefined,
|
|
30
30
|
id: network.chainId,
|
|
31
|
-
name: network.vanityName || network.chainName,
|
|
31
|
+
name: network.vanityName || network.name || network.chainName,
|
|
32
32
|
nativeCurrency: network.nativeCurrency,
|
|
33
33
|
rpcUrls: {
|
|
34
34
|
default: { http: network.rpcUrls },
|
|
@@ -7,6 +7,7 @@ require('../errors/TransactionGasCannotBeSponsoredError.cjs');
|
|
|
7
7
|
require('../logger/logger.cjs');
|
|
8
8
|
var isMobile = require('../isMobile.cjs');
|
|
9
9
|
require('../../_virtual/_tslib.cjs');
|
|
10
|
+
require('../bufferPolyfill.cjs');
|
|
10
11
|
require('viem/chains');
|
|
11
12
|
require('tldts');
|
|
12
13
|
|
package/src/retryableFn.cjs
CHANGED
|
@@ -6,12 +6,13 @@ var _tslib = require('../_virtual/_tslib.cjs');
|
|
|
6
6
|
require('./errors/InsufficientFundsError.cjs');
|
|
7
7
|
require('./errors/TransactionGasCannotBeSponsoredError.cjs');
|
|
8
8
|
require('./logger/logger.cjs');
|
|
9
|
+
require('./bufferPolyfill.cjs');
|
|
9
10
|
var sleep = require('./sleep/sleep.cjs');
|
|
10
11
|
require('viem/chains');
|
|
11
12
|
require('tldts');
|
|
12
13
|
|
|
13
14
|
const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
|
|
14
|
-
const retryableFn = (
|
|
15
|
+
const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
|
|
15
16
|
const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
|
|
16
17
|
logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
|
|
17
18
|
currentRetry,
|
package/src/retryableFn.js
CHANGED
|
@@ -2,12 +2,13 @@ import { __awaiter } from '../_virtual/_tslib.js';
|
|
|
2
2
|
import './errors/InsufficientFundsError.js';
|
|
3
3
|
import './errors/TransactionGasCannotBeSponsoredError.js';
|
|
4
4
|
import './logger/logger.js';
|
|
5
|
+
import './bufferPolyfill.js';
|
|
5
6
|
import { sleep } from './sleep/sleep.js';
|
|
6
7
|
import 'viem/chains';
|
|
7
8
|
import 'tldts';
|
|
8
9
|
|
|
9
10
|
const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
|
|
10
|
-
const retryableFn = (
|
|
11
|
+
const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
|
|
11
12
|
const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
|
|
12
13
|
logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
|
|
13
14
|
currentRetry,
|
package/src/runSafe/runSafe.d.ts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {() => Promise<T> | T} callback A function that might throw an error.
|
|
6
6
|
* @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
|
|
7
7
|
*/
|
|
8
|
-
export declare const runSafe: <T, E>(callback: () => T |
|
|
8
|
+
export declare const runSafe: <T, E>(callback: () => Promise<T> | T) => Promise<[T | undefined, E | undefined]>;
|