@dynamic-labs/utils 2.1.0-alpha.30 → 2.1.0-alpha.32
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 +26 -0
- package/package.json +3 -3
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/template/index.d.ts +1 -0
- package/src/template/template.cjs +25 -0
- package/src/template/template.d.ts +18 -0
- package/src/template/template.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.31...v2.1.0-alpha.32) (2024-06-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* favor base mainnet when using coinbase sdk ([#5834](https://github.com/dynamic-labs/DynamicAuth/issues/5834)) ([fee5294](https://github.com/dynamic-labs/DynamicAuth/commit/fee529461e6b033938d3ec044c139f5efcb24f6d))
|
|
8
|
+
* open OKX deep link for Bitcoin ([#5818](https://github.com/dynamic-labs/DynamicAuth/issues/5818)) ([c33e93c](https://github.com/dynamic-labs/DynamicAuth/commit/c33e93c81b384d8cd91b3bd0414dd9ea669405c4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* change Bitget Wallet to Bitget ([#5824](https://github.com/dynamic-labs/DynamicAuth/issues/5824)) ([23b8813](https://github.com/dynamic-labs/DynamicAuth/commit/23b8813e233be07392f5a3e283226b238b9fd99b))
|
|
14
|
+
* coinbase isInstalled ([#5821](https://github.com/dynamic-labs/DynamicAuth/issues/5821)) ([d0e5a37](https://github.com/dynamic-labs/DynamicAuth/commit/d0e5a37c6dd0cb6b85a5704767c93d495aa22854))
|
|
15
|
+
* filter window.solana in solProviderHelper if no extensionLocators are set ([#5819](https://github.com/dynamic-labs/DynamicAuth/issues/5819)) ([ca098ad](https://github.com/dynamic-labs/DynamicAuth/commit/ca098adb787365f9969c1a1f853d3c65ddd40d54))
|
|
16
|
+
* only send ordinal address if only one address retrieved from btc wallet ([#5817](https://github.com/dynamic-labs/DynamicAuth/issues/5817)) ([d54cef4](https://github.com/dynamic-labs/DynamicAuth/commit/d54cef424368b804fde0a4e607fefce22877a304))
|
|
17
|
+
|
|
18
|
+
## [2.1.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.30...v2.1.0-alpha.31) (2024-05-31)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* export solana private keys in the correct format ([#5809](https://github.com/dynamic-labs/DynamicAuth/issues/5809)) ([08ac1f8](https://github.com/dynamic-labs/DynamicAuth/commit/08ac1f87bb02ad07fd1fc1f544fdcc64ebe635b8))
|
|
24
|
+
* magiceden evm network switching ([#5800](https://github.com/dynamic-labs/DynamicAuth/issues/5800)) ([9b86797](https://github.com/dynamic-labs/DynamicAuth/commit/9b8679735f3db4b33bb57409c3a69adf2beb82aa))
|
|
25
|
+
* pass all signing inputs to createPsbtOptions ([#5798](https://github.com/dynamic-labs/DynamicAuth/issues/5798)) ([628ad4f](https://github.com/dynamic-labs/DynamicAuth/commit/628ad4f8c161496a0610ecbc3052735f8ceae98d))
|
|
26
|
+
* trigger onboarding async ([#5805](https://github.com/dynamic-labs/DynamicAuth/issues/5805)) ([2c1f98c](https://github.com/dynamic-labs/DynamicAuth/commit/2c1f98c0d91422f75e2d6d32ea4a27c2bc8d8376))
|
|
27
|
+
|
|
2
28
|
## [2.1.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.29...v2.1.0-alpha.30) (2024-05-31)
|
|
3
29
|
|
|
4
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.32",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@dynamic-labs/sdk-api-core": "0.0.453",
|
|
30
30
|
"tldts": "6.0.16",
|
|
31
|
-
"@dynamic-labs/logger": "2.1.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "2.1.0-alpha.
|
|
31
|
+
"@dynamic-labs/logger": "2.1.0-alpha.32",
|
|
32
|
+
"@dynamic-labs/types": "2.1.0-alpha.32",
|
|
33
33
|
"buffer": "6.0.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -59,6 +59,7 @@ var runSafe = require('./runSafe/runSafe.cjs');
|
|
|
59
59
|
var PlatformService = require('./services/PlatformService/PlatformService.cjs');
|
|
60
60
|
var createBrowserPlatformService = require('./services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs');
|
|
61
61
|
var FetchService = require('./services/FetchService/FetchService.cjs');
|
|
62
|
+
var template = require('./template/template.cjs');
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
|
|
@@ -132,3 +133,4 @@ exports.runSafe = runSafe.runSafe;
|
|
|
132
133
|
exports.PlatformService = PlatformService.PlatformService;
|
|
133
134
|
exports.createBrowserPlatformService = createBrowserPlatformService.createBrowserPlatformService;
|
|
134
135
|
exports.FetchService = FetchService.FetchService;
|
|
136
|
+
exports.template = template.template;
|
package/src/index.d.ts
CHANGED
|
@@ -24,3 +24,4 @@ export * from './isLedgerAddressViaVerifiedCredentials';
|
|
|
24
24
|
export { runSafe } from './runSafe';
|
|
25
25
|
export { PlatformService, createBrowserPlatformService, type IPlatformService, } from './services/PlatformService';
|
|
26
26
|
export { FetchService } from './services/FetchService';
|
|
27
|
+
export { template } from './template';
|
package/src/index.js
CHANGED
|
@@ -55,3 +55,4 @@ export { runSafe } from './runSafe/runSafe.js';
|
|
|
55
55
|
export { PlatformService } from './services/PlatformService/PlatformService.js';
|
|
56
56
|
export { createBrowserPlatformService } from './services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js';
|
|
57
57
|
export { FetchService } from './services/FetchService/FetchService.js';
|
|
58
|
+
export { template } from './template/template.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { template } from './template';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a template function that replaces placeholders with corresponding values from a data object.
|
|
8
|
+
* @param {string} templateText - The template string containing placeholders in the form {{placeholder}}.
|
|
9
|
+
* @returns {(data) => string} - A function that replaces the placeholders with the values from the data object.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Basic usage
|
|
13
|
+
* const compiled = template('Test text {{placeholder}} value');
|
|
14
|
+
* console.log(compiled({ placeholder: 'test' })); // Output: 'Test text test value'
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Multiple placeholders
|
|
18
|
+
* const compiled = template('Test text {{placeholder}} value {{placeholder2}}');
|
|
19
|
+
* console.log(compiled({ placeholder: 'test', placeholder2: 'test2' })); // Output: 'Test text test value test2'
|
|
20
|
+
*/
|
|
21
|
+
const template = (templateText) => {
|
|
22
|
+
return (data) => templateText.replace(/{{(\w+?)}}/g, (match, key) => key in data ? data[key] : match);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.template = template;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type ExtractPlaceholders<T extends string> = T extends `${infer _Start}{{${infer Placeholder}}}${infer Rest}` ? Placeholder | ExtractPlaceholders<Rest> : never;
|
|
2
|
+
/**
|
|
3
|
+
* Creates a template function that replaces placeholders with corresponding values from a data object.
|
|
4
|
+
* @param {string} templateText - The template string containing placeholders in the form {{placeholder}}.
|
|
5
|
+
* @returns {(data) => string} - A function that replaces the placeholders with the values from the data object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Basic usage
|
|
9
|
+
* const compiled = template('Test text {{placeholder}} value');
|
|
10
|
+
* console.log(compiled({ placeholder: 'test' })); // Output: 'Test text test value'
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Multiple placeholders
|
|
14
|
+
* const compiled = template('Test text {{placeholder}} value {{placeholder2}}');
|
|
15
|
+
* console.log(compiled({ placeholder: 'test', placeholder2: 'test2' })); // Output: 'Test text test value test2'
|
|
16
|
+
*/
|
|
17
|
+
export declare const template: <T extends string>(templateText: T) => (data: { [key in ExtractPlaceholders<T>]: string; }) => string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Creates a template function that replaces placeholders with corresponding values from a data object.
|
|
4
|
+
* @param {string} templateText - The template string containing placeholders in the form {{placeholder}}.
|
|
5
|
+
* @returns {(data) => string} - A function that replaces the placeholders with the values from the data object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Basic usage
|
|
9
|
+
* const compiled = template('Test text {{placeholder}} value');
|
|
10
|
+
* console.log(compiled({ placeholder: 'test' })); // Output: 'Test text test value'
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Multiple placeholders
|
|
14
|
+
* const compiled = template('Test text {{placeholder}} value {{placeholder2}}');
|
|
15
|
+
* console.log(compiled({ placeholder: 'test', placeholder2: 'test2' })); // Output: 'Test text test value test2'
|
|
16
|
+
*/
|
|
17
|
+
const template = (templateText) => {
|
|
18
|
+
return (data) => templateText.replace(/{{(\w+?)}}/g, (match, key) => key in data ? data[key] : match);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { template };
|