@dynamic-labs/utils 4.4.4 → 4.5.0
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 +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +5 -5
- package/src/env/getEnvVarWithFallback.cjs +26 -0
- package/src/env/getEnvVarWithFallback.d.ts +7 -0
- package/src/env/getEnvVarWithFallback.js +22 -0
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.5.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.4...v4.5.0) (2025-02-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* allow injecting onramp providers for funding via sdk overrides ([#7967](https://github.com/dynamic-labs/dynamic-auth/issues/7967)) ([d738b3b](https://github.com/dynamic-labs/dynamic-auth/commit/d738b3ba1307bc6f2ffc5c8f98a44c6f509c0e96))
|
|
8
|
+
* headless transaction simulation ([#7928](https://github.com/dynamic-labs/dynamic-auth/issues/7928)) ([8eb4c9c](https://github.com/dynamic-labs/dynamic-auth/commit/8eb4c9cd9857a34c56f2e58aba124b5b7e185359))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* memo hooks and state to reduce rerenders ([#7912](https://github.com/dynamic-labs/dynamic-auth/issues/7912)) ([5351570](https://github.com/dynamic-labs/dynamic-auth/commit/5351570874eb3b9465d2a2c99ea5caaa787ecc80))
|
|
14
|
+
* rely on bitcoin sats-connect transaction inputs for handling sigHashTypes ([#7969](https://github.com/dynamic-labs/dynamic-auth/issues/7969)) ([e043306](https://github.com/dynamic-labs/dynamic-auth/commit/e043306be44dd9058265c19d7e14cb07dd6db1fe))
|
|
15
|
+
|
|
2
16
|
### [4.4.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.3...v4.4.4) (2025-01-31)
|
|
3
17
|
|
|
4
18
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.607",
|
|
22
22
|
"tldts": "6.0.16",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
24
|
-
"@dynamic-labs/logger": "4.
|
|
25
|
-
"@dynamic-labs/types": "4.
|
|
23
|
+
"@dynamic-labs/assert-package-version": "4.5.0",
|
|
24
|
+
"@dynamic-labs/logger": "4.5.0",
|
|
25
|
+
"@dynamic-labs/types": "4.5.0",
|
|
26
26
|
"buffer": "6.0.3",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Safely gets an environment variable with a required fallback value
|
|
8
|
+
* @param keys Single key or array of keys to try in order
|
|
9
|
+
* @param defaultValue Required default value if none of the keys are found
|
|
10
|
+
* @returns The first found environment variable value or the default value
|
|
11
|
+
*/
|
|
12
|
+
const getEnvVarWithFallback = (keys, defaultValue) => {
|
|
13
|
+
if (typeof process === 'undefined' || !process.env) {
|
|
14
|
+
return defaultValue;
|
|
15
|
+
}
|
|
16
|
+
const keysToTry = Array.isArray(keys) ? keys : [keys];
|
|
17
|
+
for (const key of keysToTry) {
|
|
18
|
+
const value = process.env[key];
|
|
19
|
+
if (value !== undefined) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return defaultValue;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.getEnvVarWithFallback = getEnvVarWithFallback;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely gets an environment variable with a required fallback value
|
|
3
|
+
* @param keys Single key or array of keys to try in order
|
|
4
|
+
* @param defaultValue Required default value if none of the keys are found
|
|
5
|
+
* @returns The first found environment variable value or the default value
|
|
6
|
+
*/
|
|
7
|
+
export declare const getEnvVarWithFallback: (keys: string | string[], defaultValue: string) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Safely gets an environment variable with a required fallback value
|
|
4
|
+
* @param keys Single key or array of keys to try in order
|
|
5
|
+
* @param defaultValue Required default value if none of the keys are found
|
|
6
|
+
* @returns The first found environment variable value or the default value
|
|
7
|
+
*/
|
|
8
|
+
const getEnvVarWithFallback = (keys, defaultValue) => {
|
|
9
|
+
if (typeof process === 'undefined' || !process.env) {
|
|
10
|
+
return defaultValue;
|
|
11
|
+
}
|
|
12
|
+
const keysToTry = Array.isArray(keys) ? keys : [keys];
|
|
13
|
+
for (const key of keysToTry) {
|
|
14
|
+
const value = process.env[key];
|
|
15
|
+
if (value !== undefined) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return defaultValue;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { getEnvVarWithFallback };
|
package/src/index.cjs
CHANGED
|
@@ -96,6 +96,7 @@ var createStorageService = require('./services/StorageService/createStorageServi
|
|
|
96
96
|
var applyPostfixToStorageService = require('./services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.cjs');
|
|
97
97
|
var connectWithAppleId = require('./services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.cjs');
|
|
98
98
|
var solToLamports = require('./solToLamports/solToLamports.cjs');
|
|
99
|
+
var getEnvVarWithFallback = require('./env/getEnvVarWithFallback.cjs');
|
|
99
100
|
|
|
100
101
|
assertPackageVersion.assertPackageVersion('@dynamic-labs/utils', _package.version);
|
|
101
102
|
|
|
@@ -208,3 +209,4 @@ exports.createStorageService = createStorageService.createStorageService;
|
|
|
208
209
|
exports.applyPostfixToStorageService = applyPostfixToStorageService.applyPostfixToStorageService;
|
|
209
210
|
exports.connectWithAppleId = connectWithAppleId.connectWithAppleId;
|
|
210
211
|
exports.solToLamports = solToLamports.solToLamports;
|
|
212
|
+
exports.getEnvVarWithFallback = getEnvVarWithFallback.getEnvVarWithFallback;
|
package/src/index.d.ts
CHANGED
|
@@ -42,3 +42,4 @@ export { Oauth2Service, type GetOauthCodeError, type GetOauthCodeProps, type IOa
|
|
|
42
42
|
export { type IStorageService, type StorageOptions, StorageService, createStorageService, applyPostfixToStorageService, } from './services/StorageService';
|
|
43
43
|
export { connectWithAppleId } from './services/Oauth2Service/utils/connectWithAppleId';
|
|
44
44
|
export { solToLamports } from './solToLamports';
|
|
45
|
+
export { getEnvVarWithFallback } from './env/getEnvVarWithFallback';
|
package/src/index.js
CHANGED
|
@@ -92,5 +92,6 @@ export { createStorageService } from './services/StorageService/createStorageSer
|
|
|
92
92
|
export { applyPostfixToStorageService } from './services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.js';
|
|
93
93
|
export { connectWithAppleId } from './services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.js';
|
|
94
94
|
export { solToLamports } from './solToLamports/solToLamports.js';
|
|
95
|
+
export { getEnvVarWithFallback } from './env/getEnvVarWithFallback.js';
|
|
95
96
|
|
|
96
97
|
assertPackageVersion('@dynamic-labs/utils', version);
|