@dynamic-labs/utils 2.1.0-alpha.24 → 2.1.0-alpha.25
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 +7 -0
- package/package.json +3 -3
- package/src/getTLD/getTLD.cjs +2 -2
- package/src/getTLD/getTLD.js +2 -2
- package/src/index.cjs +4 -6
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -3
- package/src/services/PlatformService/PlatformService.cjs +26 -0
- package/src/services/PlatformService/PlatformService.d.ts +8 -0
- package/src/services/PlatformService/PlatformService.js +22 -0
- package/src/services/{LocationService/utils/createLocationFromWindow/createLocationFromWindow.cjs → PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs} +2 -2
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.d.ts +2 -0
- package/src/services/{LocationService/utils/createLocationFromWindow/createLocationFromWindow.js → PlatformService/createBrowserPlatformService/createBrowserPlatformService.js} +2 -2
- package/src/services/PlatformService/createBrowserPlatformService/index.d.ts +1 -0
- package/src/services/PlatformService/index.d.ts +3 -0
- package/src/services/{LocationService → PlatformService}/types.d.ts +1 -1
- package/src/services/LocationService/LocationService.cjs +0 -26
- package/src/services/LocationService/LocationService.d.ts +0 -8
- package/src/services/LocationService/LocationService.js +0 -22
- package/src/services/LocationService/index.d.ts +0 -3
- package/src/services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.cjs +0 -14
- package/src/services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.d.ts +0 -2
- package/src/services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.js +0 -10
- package/src/services/LocationService/utils/createLocationFromOrigin/index.d.ts +0 -1
- package/src/services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.d.ts +0 -2
- package/src/services/LocationService/utils/createLocationFromWindow/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.24...v2.1.0-alpha.25) (2024-05-27)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* btc balance calculation ([#5737](https://github.com/dynamic-labs/DynamicAuth/issues/5737)) ([9b5ceb3](https://github.com/dynamic-labs/DynamicAuth/commit/9b5ceb32d543037f60d7104f0b81b3abc86ebd10))
|
|
8
|
+
|
|
2
9
|
## [2.1.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.23...v2.1.0-alpha.24) (2024-05-26)
|
|
3
10
|
|
|
4
11
|
|
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.25",
|
|
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.25",
|
|
32
|
+
"@dynamic-labs/types": "2.1.0-alpha.25",
|
|
33
33
|
"buffer": "6.0.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
package/src/getTLD/getTLD.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var PlatformService = require('../services/PlatformService/PlatformService.cjs');
|
|
7
7
|
require('tldts');
|
|
8
8
|
|
|
9
|
-
const getTLD = () =>
|
|
9
|
+
const getTLD = () => PlatformService.PlatformService.getTLD();
|
|
10
10
|
|
|
11
11
|
exports.getTLD = getTLD;
|
package/src/getTLD/getTLD.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import {
|
|
2
|
+
import { PlatformService } from '../services/PlatformService/PlatformService.js';
|
|
3
3
|
import 'tldts';
|
|
4
4
|
|
|
5
|
-
const getTLD = () =>
|
|
5
|
+
const getTLD = () => PlatformService.getTLD();
|
|
6
6
|
|
|
7
7
|
export { getTLD };
|
package/src/index.cjs
CHANGED
|
@@ -55,9 +55,8 @@ var ceil = require('./ceil/ceil.cjs');
|
|
|
55
55
|
var trimEnd = require('./trimEnd/trimEnd.cjs');
|
|
56
56
|
var isLedgerAddressViaVerifiedCredentials = require('./isLedgerAddressViaVerifiedCredentials.cjs');
|
|
57
57
|
var runSafe = require('./runSafe/runSafe.cjs');
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var createLocationFromOrigin = require('./services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.cjs');
|
|
58
|
+
var PlatformService = require('./services/PlatformService/PlatformService.cjs');
|
|
59
|
+
var createBrowserPlatformService = require('./services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs');
|
|
61
60
|
var FetchService = require('./services/FetchService/FetchService.cjs');
|
|
62
61
|
|
|
63
62
|
|
|
@@ -128,7 +127,6 @@ exports.ceil = ceil.ceil;
|
|
|
128
127
|
exports.trimEnd = trimEnd.trimEnd;
|
|
129
128
|
exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials.isLedgerAddressViaVerifiedCredentials;
|
|
130
129
|
exports.runSafe = runSafe.runSafe;
|
|
131
|
-
exports.
|
|
132
|
-
exports.
|
|
133
|
-
exports.createLocationFromOrigin = createLocationFromOrigin.createLocationFromOrigin;
|
|
130
|
+
exports.PlatformService = PlatformService.PlatformService;
|
|
131
|
+
exports.createBrowserPlatformService = createBrowserPlatformService.createBrowserPlatformService;
|
|
134
132
|
exports.FetchService = FetchService.FetchService;
|
package/src/index.d.ts
CHANGED
|
@@ -22,5 +22,5 @@ export * from './ceil';
|
|
|
22
22
|
export * from './trimEnd';
|
|
23
23
|
export * from './isLedgerAddressViaVerifiedCredentials';
|
|
24
24
|
export { runSafe } from './runSafe';
|
|
25
|
-
export {
|
|
25
|
+
export { PlatformService, createBrowserPlatformService, type IPlatformService, } from './services/PlatformService';
|
|
26
26
|
export { FetchService } from './services/FetchService';
|
package/src/index.js
CHANGED
|
@@ -51,7 +51,6 @@ export { ceil } from './ceil/ceil.js';
|
|
|
51
51
|
export { trimEnd } from './trimEnd/trimEnd.js';
|
|
52
52
|
export { isLedgerAddressViaVerifiedCredentials } from './isLedgerAddressViaVerifiedCredentials.js';
|
|
53
53
|
export { runSafe } from './runSafe/runSafe.js';
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export { createLocationFromOrigin } from './services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.js';
|
|
54
|
+
export { PlatformService } from './services/PlatformService/PlatformService.js';
|
|
55
|
+
export { createBrowserPlatformService } from './services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js';
|
|
57
56
|
export { FetchService } from './services/FetchService/FetchService.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var createBrowserPlatformService = require('./createBrowserPlatformService/createBrowserPlatformService.cjs');
|
|
7
|
+
|
|
8
|
+
class PlatformService {
|
|
9
|
+
static get implementation() {
|
|
10
|
+
if (!PlatformService._implementation) {
|
|
11
|
+
return createBrowserPlatformService.createBrowserPlatformService(window);
|
|
12
|
+
}
|
|
13
|
+
return PlatformService._implementation;
|
|
14
|
+
}
|
|
15
|
+
static setImplementation(implementation) {
|
|
16
|
+
PlatformService._implementation = implementation;
|
|
17
|
+
}
|
|
18
|
+
static get getHostname() {
|
|
19
|
+
return PlatformService.implementation.getHostname;
|
|
20
|
+
}
|
|
21
|
+
static get getTLD() {
|
|
22
|
+
return PlatformService.implementation.getTLD;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.PlatformService = PlatformService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IPlatformService } from './types';
|
|
2
|
+
export declare class PlatformService {
|
|
3
|
+
static _implementation: IPlatformService;
|
|
4
|
+
static get implementation(): IPlatformService;
|
|
5
|
+
static setImplementation(implementation: IPlatformService): void;
|
|
6
|
+
static get getHostname(): () => string;
|
|
7
|
+
static get getTLD(): () => string | undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { createBrowserPlatformService } from './createBrowserPlatformService/createBrowserPlatformService.js';
|
|
3
|
+
|
|
4
|
+
class PlatformService {
|
|
5
|
+
static get implementation() {
|
|
6
|
+
if (!PlatformService._implementation) {
|
|
7
|
+
return createBrowserPlatformService(window);
|
|
8
|
+
}
|
|
9
|
+
return PlatformService._implementation;
|
|
10
|
+
}
|
|
11
|
+
static setImplementation(implementation) {
|
|
12
|
+
PlatformService._implementation = implementation;
|
|
13
|
+
}
|
|
14
|
+
static get getHostname() {
|
|
15
|
+
return PlatformService.implementation.getHostname;
|
|
16
|
+
}
|
|
17
|
+
static get getTLD() {
|
|
18
|
+
return PlatformService.implementation.getTLD;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { PlatformService };
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var tldts = require('tldts');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const createBrowserPlatformService = (window) => ({
|
|
9
9
|
getHostname: () => window.location.hostname,
|
|
10
10
|
getTLD: () => {
|
|
11
11
|
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
@@ -21,4 +21,4 @@ const createLocationFromWindow = (window) => ({
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
exports.
|
|
24
|
+
exports.createBrowserPlatformService = createBrowserPlatformService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { parse } from 'tldts';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const createBrowserPlatformService = (window) => ({
|
|
5
5
|
getHostname: () => window.location.hostname,
|
|
6
6
|
getTLD: () => {
|
|
7
7
|
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
@@ -17,4 +17,4 @@ const createLocationFromWindow = (window) => ({
|
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { createBrowserPlatformService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createBrowserPlatformService } from './createBrowserPlatformService';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var createLocationFromWindow = require('./utils/createLocationFromWindow/createLocationFromWindow.cjs');
|
|
7
|
-
|
|
8
|
-
class LocationService {
|
|
9
|
-
static get implementation() {
|
|
10
|
-
if (!LocationService._implementation) {
|
|
11
|
-
return createLocationFromWindow.createLocationFromWindow(window);
|
|
12
|
-
}
|
|
13
|
-
return LocationService._implementation;
|
|
14
|
-
}
|
|
15
|
-
static setImplementation(implementation) {
|
|
16
|
-
LocationService._implementation = implementation;
|
|
17
|
-
}
|
|
18
|
-
static get getHostname() {
|
|
19
|
-
return LocationService.implementation.getHostname;
|
|
20
|
-
}
|
|
21
|
-
static get getTLD() {
|
|
22
|
-
return LocationService.implementation.getTLD;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
exports.LocationService = LocationService;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ILocation } from './types';
|
|
2
|
-
export declare class LocationService {
|
|
3
|
-
static _implementation: ILocation;
|
|
4
|
-
static get implementation(): ILocation;
|
|
5
|
-
static setImplementation(implementation: ILocation): void;
|
|
6
|
-
static get getHostname(): () => string;
|
|
7
|
-
static get getTLD(): () => string | undefined;
|
|
8
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { createLocationFromWindow } from './utils/createLocationFromWindow/createLocationFromWindow.js';
|
|
3
|
-
|
|
4
|
-
class LocationService {
|
|
5
|
-
static get implementation() {
|
|
6
|
-
if (!LocationService._implementation) {
|
|
7
|
-
return createLocationFromWindow(window);
|
|
8
|
-
}
|
|
9
|
-
return LocationService._implementation;
|
|
10
|
-
}
|
|
11
|
-
static setImplementation(implementation) {
|
|
12
|
-
LocationService._implementation = implementation;
|
|
13
|
-
}
|
|
14
|
-
static get getHostname() {
|
|
15
|
-
return LocationService.implementation.getHostname;
|
|
16
|
-
}
|
|
17
|
-
static get getTLD() {
|
|
18
|
-
return LocationService.implementation.getTLD;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { LocationService };
|
package/src/services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
const createLocationFromOrigin = (origin) => {
|
|
7
|
-
const url = new URL(origin);
|
|
8
|
-
return {
|
|
9
|
-
getHostname: () => url.hostname,
|
|
10
|
-
getTLD: () => url.hostname,
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports.createLocationFromOrigin = createLocationFromOrigin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createLocationFromOrigin } from './createLocationFromOrigin';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createLocationFromWindow } from './createLocationFromWindow';
|