@dynamic-labs/utils 3.0.0-alpha.4 → 3.0.0-alpha.5
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 +24 -0
- package/package.json +4 -6
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +0 -1
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +0 -1
- package/src/index.cjs +0 -4
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/retryableFn.cjs +0 -1
- package/src/retryableFn.js +0 -1
- package/src/getOrMapViemChain.cjs +0 -77
- package/src/getOrMapViemChain.d.ts +0 -11
- package/src/getOrMapViemChain.js +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2024-06-14)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* remove viem dependency from non-evm packages (#5508)
|
|
8
|
+
* move rpc providers into their own packages (#5981)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add in-app browser navigation support for sats-connect ([#5988](https://github.com/dynamic-labs/DynamicAuth/issues/5988)) ([be27d2d](https://github.com/dynamic-labs/DynamicAuth/commit/be27d2d4030bbe2157e879497d8e6a00b4a3e404))
|
|
13
|
+
* move rpc providers into their own packages ([#5981](https://github.com/dynamic-labs/DynamicAuth/issues/5981)) ([d7a62d6](https://github.com/dynamic-labs/DynamicAuth/commit/d7a62d60e79dfa6d6651b0fa103e90b6f8a9ccf3))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* embedded solana wallets can send SPL tokens and estimate gas ([#5982](https://github.com/dynamic-labs/DynamicAuth/issues/5982)) ([36623eb](https://github.com/dynamic-labs/DynamicAuth/commit/36623eb99d1d1dfebfd8b6f3194eeff31e7de2bf))
|
|
19
|
+
* improve logic related to turnkey and emailVerifcation ([#5946](https://github.com/dynamic-labs/DynamicAuth/issues/5946)) ([dd0b2dc](https://github.com/dynamic-labs/DynamicAuth/commit/dd0b2dc6d93a8bbbcb6eef88732e62b747005bb3))
|
|
20
|
+
* show linked wallets with unavailable providers in user wallets list ([#5992](https://github.com/dynamic-labs/DynamicAuth/issues/5992)) ([996079c](https://github.com/dynamic-labs/DynamicAuth/commit/996079ced360651c7b1eb5273548e0548f6f9f3a))
|
|
21
|
+
* switch network modal not closing after switching to a supported network ([#5979](https://github.com/dynamic-labs/DynamicAuth/issues/5979)) ([f239952](https://github.com/dynamic-labs/DynamicAuth/commit/f2399523dd82bb28046992cac4582688b688bdc0))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* remove viem dependency from non-evm packages ([#5508](https://github.com/dynamic-labs/DynamicAuth/issues/5508)) ([0299dc3](https://github.com/dynamic-labs/DynamicAuth/commit/0299dc3cbb611182d763e9a89d1270c2e2f32df5))
|
|
25
|
+
|
|
2
26
|
## [3.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.3...v3.0.0-alpha.4) (2024-06-12)
|
|
3
27
|
|
|
4
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -28,11 +28,9 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@dynamic-labs/sdk-api-core": "0.0.461",
|
|
30
30
|
"tldts": "6.0.16",
|
|
31
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
31
|
+
"@dynamic-labs/logger": "3.0.0-alpha.5",
|
|
32
|
+
"@dynamic-labs/types": "3.0.0-alpha.5",
|
|
33
33
|
"buffer": "6.0.3"
|
|
34
34
|
},
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"viem": "^2.7.6"
|
|
37
|
-
}
|
|
35
|
+
"peerDependencies": {}
|
|
38
36
|
}
|
|
@@ -9,7 +9,6 @@ require('../logger/logger.cjs');
|
|
|
9
9
|
var isMobile = require('../isMobile.cjs');
|
|
10
10
|
require('../../_virtual/_tslib.cjs');
|
|
11
11
|
require('../bufferPolyfill.cjs');
|
|
12
|
-
require('viem/chains');
|
|
13
12
|
require('tldts');
|
|
14
13
|
|
|
15
14
|
const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
|
|
@@ -5,7 +5,6 @@ import '../logger/logger.js';
|
|
|
5
5
|
import { isSamsungBrowser } from '../isMobile.js';
|
|
6
6
|
import '../../_virtual/_tslib.js';
|
|
7
7
|
import '../bufferPolyfill.js';
|
|
8
|
-
import 'viem/chains';
|
|
9
8
|
import 'tldts';
|
|
10
9
|
|
|
11
10
|
const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
|
package/src/index.cjs
CHANGED
|
@@ -43,7 +43,6 @@ var bufferToBase64 = require('./bufferToBase64.cjs');
|
|
|
43
43
|
var last = require('./last.cjs');
|
|
44
44
|
var getProvidersFromWindow = require('./getProvidersFromWindow.cjs');
|
|
45
45
|
var sleep = require('./sleep/sleep.cjs');
|
|
46
|
-
var getOrMapViemChain = require('./getOrMapViemChain.cjs');
|
|
47
46
|
var retryableFn = require('./retryableFn.cjs');
|
|
48
47
|
var wrapMethodWithCallback = require('./wrapMethodWithCallback/wrapMethodWithCallback.cjs');
|
|
49
48
|
var DeferredPromise = require('./DeferredPromise/DeferredPromise.cjs');
|
|
@@ -117,9 +116,6 @@ exports.bufferToBase64 = bufferToBase64.bufferToBase64;
|
|
|
117
116
|
exports.last = last.last;
|
|
118
117
|
exports.getProvidersFromWindow = getProvidersFromWindow.getProvidersFromWindow;
|
|
119
118
|
exports.sleep = sleep.sleep;
|
|
120
|
-
exports.getChain = getOrMapViemChain.getChain;
|
|
121
|
-
exports.getOrMapViemChain = getOrMapViemChain.getOrMapViemChain;
|
|
122
|
-
exports.mapChain = getOrMapViemChain.mapChain;
|
|
123
119
|
exports.FALLBACK_UNDEFINED = retryableFn.FALLBACK_UNDEFINED;
|
|
124
120
|
exports.retryableFn = retryableFn.retryableFn;
|
|
125
121
|
exports.wrapMethodWithCallback = wrapMethodWithCallback.wrapMethodWithCallback;
|
package/src/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export * from './bufferToBase64';
|
|
|
9
9
|
export * from './last';
|
|
10
10
|
export * from './getProvidersFromWindow';
|
|
11
11
|
export * from './sleep';
|
|
12
|
-
export * from './getOrMapViemChain';
|
|
13
12
|
export * from './retryableFn';
|
|
14
13
|
export * from './wrapMethodWithCallback';
|
|
15
14
|
export * from './DeferredPromise';
|
package/src/index.js
CHANGED
|
@@ -39,7 +39,6 @@ export { bufferToBase64 } from './bufferToBase64.js';
|
|
|
39
39
|
export { last } from './last.js';
|
|
40
40
|
export { getProvidersFromWindow } from './getProvidersFromWindow.js';
|
|
41
41
|
export { sleep } from './sleep/sleep.js';
|
|
42
|
-
export { getChain, getOrMapViemChain, mapChain } from './getOrMapViemChain.js';
|
|
43
42
|
export { FALLBACK_UNDEFINED, retryableFn } from './retryableFn.js';
|
|
44
43
|
export { wrapMethodWithCallback } from './wrapMethodWithCallback/wrapMethodWithCallback.js';
|
|
45
44
|
export { DeferredPromise } from './DeferredPromise/DeferredPromise.js';
|
package/src/retryableFn.cjs
CHANGED
|
@@ -9,7 +9,6 @@ require('./errors/TransactionGasCannotBeSponsoredError.cjs');
|
|
|
9
9
|
require('./logger/logger.cjs');
|
|
10
10
|
require('./bufferPolyfill.cjs');
|
|
11
11
|
var sleep = require('./sleep/sleep.cjs');
|
|
12
|
-
require('viem/chains');
|
|
13
12
|
require('tldts');
|
|
14
13
|
|
|
15
14
|
const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
|
package/src/retryableFn.js
CHANGED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var chains = require('viem/chains');
|
|
7
|
-
|
|
8
|
-
function _interopNamespace(e) {
|
|
9
|
-
if (e && e.__esModule) return e;
|
|
10
|
-
var n = Object.create(null);
|
|
11
|
-
if (e) {
|
|
12
|
-
Object.keys(e).forEach(function (k) {
|
|
13
|
-
if (k !== 'default') {
|
|
14
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () { return e[k]; }
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
n["default"] = e;
|
|
23
|
-
return Object.freeze(n);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var chains__namespace = /*#__PURE__*/_interopNamespace(chains);
|
|
27
|
-
|
|
28
|
-
// eslint-disable-next-line import/no-namespace
|
|
29
|
-
/**
|
|
30
|
-
* Gets the chain object for the given chain id.
|
|
31
|
-
* @param chainId - Chain id of the target EVM chain.
|
|
32
|
-
* @returns Viem's chain object.
|
|
33
|
-
*/
|
|
34
|
-
const getChain = (chainId) => {
|
|
35
|
-
for (const chain of Object.values(chains__namespace)) {
|
|
36
|
-
if ('id' in chain) {
|
|
37
|
-
if (chain.id === chainId) {
|
|
38
|
-
return chain;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw new Error(`Chain with id ${chainId} not found`);
|
|
43
|
-
};
|
|
44
|
-
const mapChain = (network) => {
|
|
45
|
-
var _a;
|
|
46
|
-
return ({
|
|
47
|
-
blockExplorers: ((_a = network.blockExplorerUrls) === null || _a === void 0 ? void 0 : _a[0])
|
|
48
|
-
? {
|
|
49
|
-
default: {
|
|
50
|
-
name: network.blockExplorerUrls[0],
|
|
51
|
-
url: network.blockExplorerUrls[0],
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
: undefined,
|
|
55
|
-
id: network.chainId,
|
|
56
|
-
name: network.vanityName || network.name || network.chainName,
|
|
57
|
-
nativeCurrency: network.nativeCurrency,
|
|
58
|
-
rpcUrls: {
|
|
59
|
-
default: { http: network.rpcUrls },
|
|
60
|
-
public: { http: network.rpcUrls },
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const getOrMapViemChain = (network) => {
|
|
65
|
-
let chain;
|
|
66
|
-
try {
|
|
67
|
-
chain = getChain(network.chainId);
|
|
68
|
-
}
|
|
69
|
-
catch (_a) {
|
|
70
|
-
chain = mapChain(network);
|
|
71
|
-
}
|
|
72
|
-
return chain;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
exports.getChain = getChain;
|
|
76
|
-
exports.getOrMapViemChain = getOrMapViemChain;
|
|
77
|
-
exports.mapChain = mapChain;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
2
|
-
import * as chains from 'viem/chains';
|
|
3
|
-
import { EvmNetwork } from '@dynamic-labs/types';
|
|
4
|
-
/**
|
|
5
|
-
* Gets the chain object for the given chain id.
|
|
6
|
-
* @param chainId - Chain id of the target EVM chain.
|
|
7
|
-
* @returns Viem's chain object.
|
|
8
|
-
*/
|
|
9
|
-
export declare const getChain: (chainId: number) => chains.Chain;
|
|
10
|
-
export declare const mapChain: (network: EvmNetwork) => Chain;
|
|
11
|
-
export declare const getOrMapViemChain: (network: EvmNetwork) => Chain;
|
package/src/getOrMapViemChain.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import * as chains from 'viem/chains';
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line import/no-namespace
|
|
5
|
-
/**
|
|
6
|
-
* Gets the chain object for the given chain id.
|
|
7
|
-
* @param chainId - Chain id of the target EVM chain.
|
|
8
|
-
* @returns Viem's chain object.
|
|
9
|
-
*/
|
|
10
|
-
const getChain = (chainId) => {
|
|
11
|
-
for (const chain of Object.values(chains)) {
|
|
12
|
-
if ('id' in chain) {
|
|
13
|
-
if (chain.id === chainId) {
|
|
14
|
-
return chain;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
throw new Error(`Chain with id ${chainId} not found`);
|
|
19
|
-
};
|
|
20
|
-
const mapChain = (network) => {
|
|
21
|
-
var _a;
|
|
22
|
-
return ({
|
|
23
|
-
blockExplorers: ((_a = network.blockExplorerUrls) === null || _a === void 0 ? void 0 : _a[0])
|
|
24
|
-
? {
|
|
25
|
-
default: {
|
|
26
|
-
name: network.blockExplorerUrls[0],
|
|
27
|
-
url: network.blockExplorerUrls[0],
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
: undefined,
|
|
31
|
-
id: network.chainId,
|
|
32
|
-
name: network.vanityName || network.name || network.chainName,
|
|
33
|
-
nativeCurrency: network.nativeCurrency,
|
|
34
|
-
rpcUrls: {
|
|
35
|
-
default: { http: network.rpcUrls },
|
|
36
|
-
public: { http: network.rpcUrls },
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
const getOrMapViemChain = (network) => {
|
|
41
|
-
let chain;
|
|
42
|
-
try {
|
|
43
|
-
chain = getChain(network.chainId);
|
|
44
|
-
}
|
|
45
|
-
catch (_a) {
|
|
46
|
-
chain = mapChain(network);
|
|
47
|
-
}
|
|
48
|
-
return chain;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export { getChain, getOrMapViemChain, mapChain };
|