@dynamic-labs/waas 4.20.2 → 4.20.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Dynamic Labs, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # waas
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build waas` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test waas` to execute the unit tests via [Jest](https://jestjs.io).
package/package.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var version = "4.20.4";
7
+
8
+ exports.version = version;
package/package.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ var version = "4.20.4";
3
+
4
+ export { version };
package/package.json CHANGED
@@ -1,19 +1,27 @@
1
1
  {
2
2
  "name": "@dynamic-labs/waas",
3
- "version": "4.20.2",
3
+ "version": "4.20.4",
4
4
  "type": "module",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
7
+ "main": "./src/index.cjs",
8
+ "module": "./src/index.js",
9
+ "types": "./src/index.d.ts",
7
10
  "exports": {
8
- ".": "./src/index.ts"
11
+ ".": {
12
+ "types": "./src/index.d.ts",
13
+ "import": "./src/index.js",
14
+ "require": "./src/index.cjs"
15
+ },
16
+ "./package.json": "./package.json"
9
17
  },
10
18
  "dependencies": {
11
- "@dynamic-labs/assert-package-version": "4.20.2",
12
- "@dynamic-labs/ethereum-core": "4.20.2",
13
- "@dynamic-labs/solana-core": "4.20.2",
14
- "@dynamic-labs/sui-core": "4.20.2"
19
+ "@dynamic-labs/assert-package-version": "4.20.4",
20
+ "@dynamic-labs-wallet/browser-wallet-client": "0.0.85",
21
+ "@dynamic-labs/ethereum-core": "4.20.4",
22
+ "@dynamic-labs/solana-core": "4.20.4",
23
+ "@dynamic-labs/sui-core": "4.20.4",
24
+ "@dynamic-labs/wallet-book": "4.20.4"
15
25
  },
16
- "module": "./index.js",
17
- "main": "./index.js",
18
- "types": "./src/index.d.ts"
19
- }
26
+ "peerDependencies": {}
27
+ }
@@ -0,0 +1,72 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var browserWalletClient = require('@dynamic-labs-wallet/browser-wallet-client');
7
+ var constants = require('../utils/constants.cjs');
8
+
9
+ const withDynamicWaas = (BaseClass) => {
10
+ class DynamicWaasMixin extends BaseClass {
11
+ setGetAuthTokenFunction(getAuthToken) {
12
+ this.getAuthToken = getAuthToken;
13
+ }
14
+ setEnvironmentId(environmentId) {
15
+ this.environmentId = environmentId;
16
+ }
17
+ setBaseApiUrl(baseApiUrl) {
18
+ this.baseApiUrl = baseApiUrl;
19
+ }
20
+ setRelayUrl(relayUrl) {
21
+ this.relayUrl = relayUrl;
22
+ }
23
+ setGetSignedSessionIdFunction(getSignedSessionId) {
24
+ this.getSignedSessionId = getSignedSessionId;
25
+ }
26
+ constructor(...args) {
27
+ super(...args);
28
+ this.name = 'Dynamic Waas';
29
+ this.overrideKey = 'dynamicwaas';
30
+ this.isEmbeddedWallet = true;
31
+ // Get the class name from the constructor
32
+ const { connectedChain } = this;
33
+ // Map class names to chain names
34
+ const chainNameMap = {
35
+ EVM: 'EVM',
36
+ SOL: 'SVM',
37
+ SUI: 'SUI',
38
+ };
39
+ const chainName = chainNameMap[connectedChain];
40
+ if (!chainName) {
41
+ throw new Error(`Unsupported chain: ${connectedChain}`);
42
+ }
43
+ this.chainName = chainName;
44
+ }
45
+ createDynamicWaasClient() {
46
+ var _a;
47
+ const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
48
+ if (!authToken) {
49
+ throw new Error('Auth token is required');
50
+ }
51
+ if (!this.environmentId) {
52
+ throw new Error('Environment ID is required');
53
+ }
54
+ return new browserWalletClient.DynamicWalletClient({
55
+ authToken,
56
+ baseApiUrl: this.baseApiUrl || constants.DEFAULT_BASE_API_URL,
57
+ baseMPCRelayApiUrl: this.relayUrl || constants.DEFAULT_BASE_MPC_RELAY_API_URL,
58
+ chainName: this.chainName,
59
+ environmentId: this.environmentId,
60
+ });
61
+ }
62
+ getWaasWalletClient() {
63
+ if (!this.dynamicWaasClient) {
64
+ this.dynamicWaasClient = this.createDynamicWaasClient();
65
+ }
66
+ return this.dynamicWaasClient;
67
+ }
68
+ }
69
+ return DynamicWaasMixin;
70
+ };
71
+
72
+ exports.withDynamicWaas = withDynamicWaas;
@@ -1,14 +1,21 @@
1
- import { EthereumWalletConnector } from '@dynamic-labs/ethereum-core';
2
- import { SuiWalletConnector } from '@dynamic-labs/sui-core';
3
- import { SolanaWalletConnector } from '@dynamic-labs/solana-core';
4
- export declare const withDynamicWaas: <T extends typeof EthereumWalletConnector | typeof SuiWalletConnector | typeof SolanaWalletConnector>(BaseClass: T) => {
5
- new (...args: any[]): {
6
- name: string;
7
- overrideKey: string;
8
- isEmbeddedWallet: boolean;
9
- getSignedSessionId?: (() => Promise<string>) | undefined;
10
- setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
11
- };
12
- prefixed: string | boolean;
13
- readonly EventEmitter: import("eventemitter3").EventEmitter.EventEmitterStatic;
14
- } & T;
1
+ import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
2
+ export declare const withDynamicWaas: <T extends abstract new (...args: any[]) => any>(BaseClass: T) => (abstract new (...args: any[]) => {
3
+ [x: string]: any;
4
+ name: string;
5
+ overrideKey: string;
6
+ isEmbeddedWallet: boolean;
7
+ getSignedSessionId?: (() => Promise<string>) | undefined;
8
+ getAuthToken?: (() => string) | undefined;
9
+ environmentId?: string | undefined;
10
+ baseApiUrl?: string | undefined;
11
+ relayUrl?: string | undefined;
12
+ dynamicWaasClient: DynamicWalletClient | undefined;
13
+ chainName: string;
14
+ setGetAuthTokenFunction(getAuthToken: () => string): void;
15
+ setEnvironmentId(environmentId: string): void;
16
+ setBaseApiUrl(baseApiUrl: string): void;
17
+ setRelayUrl(relayUrl: string): void;
18
+ setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
19
+ createDynamicWaasClient(): DynamicWalletClient;
20
+ getWaasWalletClient(): DynamicWalletClient;
21
+ }) & T;
@@ -0,0 +1,68 @@
1
+ 'use client'
2
+ import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
3
+ import { DEFAULT_BASE_API_URL, DEFAULT_BASE_MPC_RELAY_API_URL } from '../utils/constants.js';
4
+
5
+ const withDynamicWaas = (BaseClass) => {
6
+ class DynamicWaasMixin extends BaseClass {
7
+ setGetAuthTokenFunction(getAuthToken) {
8
+ this.getAuthToken = getAuthToken;
9
+ }
10
+ setEnvironmentId(environmentId) {
11
+ this.environmentId = environmentId;
12
+ }
13
+ setBaseApiUrl(baseApiUrl) {
14
+ this.baseApiUrl = baseApiUrl;
15
+ }
16
+ setRelayUrl(relayUrl) {
17
+ this.relayUrl = relayUrl;
18
+ }
19
+ setGetSignedSessionIdFunction(getSignedSessionId) {
20
+ this.getSignedSessionId = getSignedSessionId;
21
+ }
22
+ constructor(...args) {
23
+ super(...args);
24
+ this.name = 'Dynamic Waas';
25
+ this.overrideKey = 'dynamicwaas';
26
+ this.isEmbeddedWallet = true;
27
+ // Get the class name from the constructor
28
+ const { connectedChain } = this;
29
+ // Map class names to chain names
30
+ const chainNameMap = {
31
+ EVM: 'EVM',
32
+ SOL: 'SVM',
33
+ SUI: 'SUI',
34
+ };
35
+ const chainName = chainNameMap[connectedChain];
36
+ if (!chainName) {
37
+ throw new Error(`Unsupported chain: ${connectedChain}`);
38
+ }
39
+ this.chainName = chainName;
40
+ }
41
+ createDynamicWaasClient() {
42
+ var _a;
43
+ const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
44
+ if (!authToken) {
45
+ throw new Error('Auth token is required');
46
+ }
47
+ if (!this.environmentId) {
48
+ throw new Error('Environment ID is required');
49
+ }
50
+ return new DynamicWalletClient({
51
+ authToken,
52
+ baseApiUrl: this.baseApiUrl || DEFAULT_BASE_API_URL,
53
+ baseMPCRelayApiUrl: this.relayUrl || DEFAULT_BASE_MPC_RELAY_API_URL,
54
+ chainName: this.chainName,
55
+ environmentId: this.environmentId,
56
+ });
57
+ }
58
+ getWaasWalletClient() {
59
+ if (!this.dynamicWaasClient) {
60
+ this.dynamicWaasClient = this.createDynamicWaasClient();
61
+ }
62
+ return this.dynamicWaasClient;
63
+ }
64
+ }
65
+ return DynamicWaasMixin;
66
+ };
67
+
68
+ export { withDynamicWaas };
package/src/index.cjs ADDED
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var assertPackageVersion = require('@dynamic-labs/assert-package-version');
7
+ var _package = require('../package.cjs');
8
+ var DynamicWaasMixin = require('./DynamicWaasMixin.cjs');
9
+
10
+ assertPackageVersion.assertPackageVersion('@dynamic-labs/waas', _package.version);
11
+
12
+ exports.withDynamicWaas = DynamicWaasMixin.withDynamicWaas;
package/src/index.js ADDED
@@ -0,0 +1,6 @@
1
+ 'use client'
2
+ import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
3
+ import { version } from '../package.js';
4
+ export { withDynamicWaas } from './DynamicWaasMixin.js';
5
+
6
+ assertPackageVersion('@dynamic-labs/waas', version);
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const DEFAULT_BASE_API_URL = 'https://app.dynamicauth.com';
7
+ const DEFAULT_BASE_MPC_RELAY_API_URL = 'https://relay.dynamicauth.com';
8
+
9
+ exports.DEFAULT_BASE_API_URL = DEFAULT_BASE_API_URL;
10
+ exports.DEFAULT_BASE_MPC_RELAY_API_URL = DEFAULT_BASE_MPC_RELAY_API_URL;
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_BASE_API_URL = "https://app.dynamicauth.com";
2
+ export declare const DEFAULT_BASE_MPC_RELAY_API_URL = "https://relay.dynamicauth.com";
@@ -0,0 +1,5 @@
1
+ 'use client'
2
+ const DEFAULT_BASE_API_URL = 'https://app.dynamicauth.com';
3
+ const DEFAULT_BASE_MPC_RELAY_API_URL = 'https://relay.dynamicauth.com';
4
+
5
+ export { DEFAULT_BASE_API_URL, DEFAULT_BASE_MPC_RELAY_API_URL };
package/index.js DELETED
@@ -1,19 +0,0 @@
1
- import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
2
-
3
- var version = "4.20.2";
4
-
5
- const withDynamicWaas = (BaseClass) => class DynamicWaasMixin extends BaseClass {
6
- setGetSignedSessionIdFunction(getSignedSessionId) {
7
- this.getSignedSessionId = getSignedSessionId;
8
- }
9
- constructor(...args) {
10
- super(...args);
11
- this.name = 'Dynamic Waas';
12
- this.overrideKey = 'dynamicwaas';
13
- this.isEmbeddedWallet = true;
14
- }
15
- };
16
-
17
- assertPackageVersion('@dynamic-labs/waas', version);
18
-
19
- export { withDynamicWaas };