@dynamic-labs/flow 0.17.0-RC.13 → 0.17.0-RC.14

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 CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [0.17.0-RC.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.13...v0.17.0-RC.14) (2023-05-12)
3
+
4
+
5
+ ### Features
6
+
7
+ * add local flowNetwork prop to toggle between mainnet and testnet ([#2094](https://github.com/dynamic-labs/DynamicAuth/issues/2094)) ([43c3f20](https://github.com/dynamic-labs/DynamicAuth/commit/43c3f20abf2d6c83e88e48f885749b978cec078a))
8
+ * deprecate multiWallet sdk setting and fetch it from projectSettings ([#2079](https://github.com/dynamic-labs/DynamicAuth/issues/2079)) ([8b7f11d](https://github.com/dynamic-labs/DynamicAuth/commit/8b7f11d9eb71a17056be05cc8006d15dc149e3ff))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **balance:** correctly compare AVAX address when fetching balance ([#2064](https://github.com/dynamic-labs/DynamicAuth/issues/2064)) ([c5942d1](https://github.com/dynamic-labs/DynamicAuth/commit/c5942d112804f3a935bca396221fb33a3c7cc42a))
14
+ * **DYN-2231:** restore User Profile display when social is the only enabled flag in information capture ([#2070](https://github.com/dynamic-labs/DynamicAuth/issues/2070)) ([6790bc7](https://github.com/dynamic-labs/DynamicAuth/commit/6790bc7e54afb1807be9996dc47129932441bbae))
15
+
2
16
  ## [0.17.0-RC.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.12...v0.17.0-RC.13) (2023-05-10)
3
17
 
4
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/flow",
3
- "version": "0.17.0-RC.13",
3
+ "version": "0.17.0-RC.14",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@onflow/fcl": "^1.3.2",
30
- "@dynamic-labs/utils": "0.17.0-RC.13",
31
- "@dynamic-labs/wallet-connector-core": "0.17.0-RC.13"
30
+ "@dynamic-labs/utils": "0.17.0-RC.14",
31
+ "@dynamic-labs/wallet-connector-core": "0.17.0-RC.14"
32
32
  },
33
33
  "peerDependencies": {}
34
34
  }
@@ -33,17 +33,18 @@ const LOCAL_STORAGE = {
33
33
  put: (key, value) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return set(key, value); }),
34
34
  };
35
35
  class FlowWalletConnector extends walletConnectorCore.WalletConnectorBase {
36
- constructor({ appName, appLogoUrl, }) {
36
+ constructor({ appName, appLogoUrl, flowNetwork, }) {
37
37
  super();
38
38
  this.connectedChain = 'FLOW';
39
39
  this.supportedChains = ['FLOW'];
40
40
  this.appName = appName;
41
41
  this.appLogoUrl = appLogoUrl;
42
+ this.network = flowNetwork !== null && flowNetwork !== void 0 ? flowNetwork : 'mainnet';
42
43
  }
43
44
  connect() {
44
45
  var _a;
45
46
  return _tslib.__awaiter(this, void 0, void 0, function* () {
46
- this.setupConfig();
47
+ yield this.setupConfig();
47
48
  const { addr } = yield fcl.currentUser().authenticate();
48
49
  if (addr) {
49
50
  yield ((_a = this.onAccountChange) === null || _a === void 0 ? void 0 : _a.call(this, [addr]));
@@ -53,16 +54,22 @@ class FlowWalletConnector extends walletConnectorCore.WalletConnectorBase {
53
54
  setupEventListeners(listeners) {
54
55
  this.onAccountChange = listeners.onAccountChange;
55
56
  }
56
- setupConfig() {
57
- this.baseConfig();
57
+ getNetwork() {
58
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
59
+ return this.network;
60
+ });
58
61
  }
59
- baseConfig() {
60
- fcl.config()
61
- .put('app.detail.title', this.appName)
62
- .put('app.detail.icon', this.appLogoUrl)
63
- .put('accessNode.api', 'https://rest-mainnet.onflow.org')
64
- .put('flow.network', 'mainnet')
65
- .put('fcl.storage', LOCAL_STORAGE);
62
+ setupConfig() {
63
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
64
+ yield fcl.config()
65
+ .put('app.detail.title', this.appName)
66
+ .put('app.detail.icon', this.appLogoUrl)
67
+ .put('fcl.storage', LOCAL_STORAGE)
68
+ .put('accessNode.api', this.network === 'testnet'
69
+ ? 'https://rest-testnet.onflow.org'
70
+ : 'https://rest-mainnet.onflow.org')
71
+ .put('flow.network', this.network);
72
+ });
66
73
  }
67
74
  fetchPublicAddress() {
68
75
  return _tslib.__awaiter(this, void 0, void 0, function* () {
@@ -110,7 +117,7 @@ class FlowWalletConnector extends walletConnectorCore.WalletConnectorBase {
110
117
  }
111
118
  getBalance() {
112
119
  return _tslib.__awaiter(this, void 0, void 0, function* () {
113
- this.baseConfig();
120
+ yield this.setupConfig();
114
121
  const address = yield this.fetchPublicAddress();
115
122
  if (address) {
116
123
  const code = `
@@ -10,14 +10,16 @@ export declare abstract class FlowWalletConnector extends WalletConnectorBase {
10
10
  protected onAccountChange?: (address: string[]) => Promise<void>;
11
11
  connectedChain: Chain;
12
12
  supportedChains: Chain[];
13
- constructor({ appName, appLogoUrl, }: {
13
+ protected network: 'mainnet' | 'testnet';
14
+ constructor({ appName, appLogoUrl, flowNetwork, }: {
14
15
  appLogoUrl?: string;
15
16
  appName?: string;
17
+ flowNetwork?: 'mainnet' | 'testnet';
16
18
  });
17
19
  connect(): Promise<void>;
18
20
  setupEventListeners(listeners: WalletEventListeners): void;
19
- setupConfig(): void;
20
- baseConfig(): void;
21
+ getNetwork(): Promise<string>;
22
+ setupConfig(): Promise<void>;
21
23
  fetchPublicAddress(): Promise<string | undefined>;
22
24
  proveOwnership(messageToSign: string): Promise<string | undefined>;
23
25
  signMessage(messageToSign: string): Promise<string | undefined>;
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from '../_virtual/_tslib.js';
2
- import { config, currentUser, send, script, decode } from '@onflow/fcl';
2
+ import { currentUser, config, send, script, decode } from '@onflow/fcl';
3
3
  import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
4
4
  import { DynamicError } from '@dynamic-labs/utils';
5
5
 
@@ -29,17 +29,18 @@ const LOCAL_STORAGE = {
29
29
  put: (key, value) => __awaiter(void 0, void 0, void 0, function* () { return set(key, value); }),
30
30
  };
31
31
  class FlowWalletConnector extends WalletConnectorBase {
32
- constructor({ appName, appLogoUrl, }) {
32
+ constructor({ appName, appLogoUrl, flowNetwork, }) {
33
33
  super();
34
34
  this.connectedChain = 'FLOW';
35
35
  this.supportedChains = ['FLOW'];
36
36
  this.appName = appName;
37
37
  this.appLogoUrl = appLogoUrl;
38
+ this.network = flowNetwork !== null && flowNetwork !== void 0 ? flowNetwork : 'mainnet';
38
39
  }
39
40
  connect() {
40
41
  var _a;
41
42
  return __awaiter(this, void 0, void 0, function* () {
42
- this.setupConfig();
43
+ yield this.setupConfig();
43
44
  const { addr } = yield currentUser().authenticate();
44
45
  if (addr) {
45
46
  yield ((_a = this.onAccountChange) === null || _a === void 0 ? void 0 : _a.call(this, [addr]));
@@ -49,16 +50,22 @@ class FlowWalletConnector extends WalletConnectorBase {
49
50
  setupEventListeners(listeners) {
50
51
  this.onAccountChange = listeners.onAccountChange;
51
52
  }
52
- setupConfig() {
53
- this.baseConfig();
53
+ getNetwork() {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ return this.network;
56
+ });
54
57
  }
55
- baseConfig() {
56
- config()
57
- .put('app.detail.title', this.appName)
58
- .put('app.detail.icon', this.appLogoUrl)
59
- .put('accessNode.api', 'https://rest-mainnet.onflow.org')
60
- .put('flow.network', 'mainnet')
61
- .put('fcl.storage', LOCAL_STORAGE);
58
+ setupConfig() {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ yield config()
61
+ .put('app.detail.title', this.appName)
62
+ .put('app.detail.icon', this.appLogoUrl)
63
+ .put('fcl.storage', LOCAL_STORAGE)
64
+ .put('accessNode.api', this.network === 'testnet'
65
+ ? 'https://rest-testnet.onflow.org'
66
+ : 'https://rest-mainnet.onflow.org')
67
+ .put('flow.network', this.network);
68
+ });
62
69
  }
63
70
  fetchPublicAddress() {
64
71
  return __awaiter(this, void 0, void 0, function* () {
@@ -106,7 +113,7 @@ class FlowWalletConnector extends WalletConnectorBase {
106
113
  }
107
114
  getBalance() {
108
115
  return __awaiter(this, void 0, void 0, function* () {
109
- this.baseConfig();
116
+ yield this.setupConfig();
110
117
  const address = yield this.fetchPublicAddress();
111
118
  if (address) {
112
119
  const code = `
package/src/blocto.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var _tslib = require('../_virtual/_tslib.cjs');
3
4
  var fcl = require('@onflow/fcl');
4
5
  var FlowWalletConnector = require('./FlowWalletConnector.cjs');
5
6
 
@@ -10,12 +11,19 @@ class Blocto extends FlowWalletConnector.FlowWalletConnector {
10
11
  this.canConnectViaCustodialService = true;
11
12
  }
12
13
  setupConfig() {
13
- super.setupConfig();
14
- fcl.config()
15
- .put('challenge.scope', 'email')
16
- .put('discovery.wallet', 'https://flow-wallet.blocto.app/authn')
17
- .put('service.OpenID.scopes', 'email!')
18
- .put('discovery.wallet.method', undefined);
14
+ const _super = Object.create(null, {
15
+ setupConfig: { get: () => super.setupConfig }
16
+ });
17
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
18
+ yield _super.setupConfig.call(this);
19
+ yield fcl.config()
20
+ .put('challenge.scope', 'email')
21
+ .put('discovery.wallet', this.network === 'testnet'
22
+ ? 'https://flow-wallet-testnet.blocto.app/authn'
23
+ : 'https://flow-wallet.blocto.app/authn')
24
+ .put('service.OpenID.scopes', 'email!')
25
+ .put('discovery.wallet.method', undefined);
26
+ });
19
27
  }
20
28
  }
21
29
 
package/src/blocto.d.ts CHANGED
@@ -2,6 +2,6 @@ import { FlowWalletConnector } from './FlowWalletConnector';
2
2
  declare class Blocto extends FlowWalletConnector {
3
3
  name: string;
4
4
  canConnectViaCustodialService: boolean;
5
- setupConfig(): void;
5
+ setupConfig(): Promise<void>;
6
6
  }
7
7
  export default Blocto;
package/src/blocto.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from '../_virtual/_tslib.js';
1
2
  import { config } from '@onflow/fcl';
2
3
  import { FlowWalletConnector } from './FlowWalletConnector.js';
3
4
 
@@ -8,12 +9,19 @@ class Blocto extends FlowWalletConnector {
8
9
  this.canConnectViaCustodialService = true;
9
10
  }
10
11
  setupConfig() {
11
- super.setupConfig();
12
- config()
13
- .put('challenge.scope', 'email')
14
- .put('discovery.wallet', 'https://flow-wallet.blocto.app/authn')
15
- .put('service.OpenID.scopes', 'email!')
16
- .put('discovery.wallet.method', undefined);
12
+ const _super = Object.create(null, {
13
+ setupConfig: { get: () => super.setupConfig }
14
+ });
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield _super.setupConfig.call(this);
17
+ yield config()
18
+ .put('challenge.scope', 'email')
19
+ .put('discovery.wallet', this.network === 'testnet'
20
+ ? 'https://flow-wallet-testnet.blocto.app/authn'
21
+ : 'https://flow-wallet.blocto.app/authn')
22
+ .put('service.OpenID.scopes', 'email!')
23
+ .put('discovery.wallet.method', undefined);
24
+ });
17
25
  }
18
26
  }
19
27
 
package/src/dapper.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var _tslib = require('../_virtual/_tslib.cjs');
3
4
  var fcl = require('@onflow/fcl');
4
5
  var FlowWalletConnector = require('./FlowWalletConnector.cjs');
5
6
 
@@ -10,12 +11,19 @@ class Dapper extends FlowWalletConnector.FlowWalletConnector {
10
11
  this.canConnectViaCustodialService = true;
11
12
  }
12
13
  setupConfig() {
13
- super.setupConfig();
14
- fcl.config()
15
- .put('challenge.scope', undefined)
16
- .put('discovery.wallet', 'https://accounts.meetdapper.com/fcl/authn-restricted')
17
- .put('service.OpenID.scopes', undefined)
18
- .put('discovery.wallet.method', 'POP/RPC');
14
+ const _super = Object.create(null, {
15
+ setupConfig: { get: () => super.setupConfig }
16
+ });
17
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
18
+ yield _super.setupConfig.call(this);
19
+ yield fcl.config()
20
+ .put('challenge.scope', undefined)
21
+ .put('discovery.wallet', this.network === 'testnet'
22
+ ? 'https://staging.accounts.meetdapper.com/fcl/authn-restricted'
23
+ : 'https://accounts.meetdapper.com/fcl/authn-restricted')
24
+ .put('service.OpenID.scopes', undefined)
25
+ .put('discovery.wallet.method', 'POP/RPC');
26
+ });
19
27
  }
20
28
  }
21
29
 
package/src/dapper.d.ts CHANGED
@@ -2,6 +2,6 @@ import { FlowWalletConnector } from './FlowWalletConnector';
2
2
  declare class Dapper extends FlowWalletConnector {
3
3
  name: string;
4
4
  canConnectViaCustodialService: boolean;
5
- setupConfig(): void;
5
+ setupConfig(): Promise<void>;
6
6
  }
7
7
  export default Dapper;
package/src/dapper.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from '../_virtual/_tslib.js';
1
2
  import { config } from '@onflow/fcl';
2
3
  import { FlowWalletConnector } from './FlowWalletConnector.js';
3
4
 
@@ -8,12 +9,19 @@ class Dapper extends FlowWalletConnector {
8
9
  this.canConnectViaCustodialService = true;
9
10
  }
10
11
  setupConfig() {
11
- super.setupConfig();
12
- config()
13
- .put('challenge.scope', undefined)
14
- .put('discovery.wallet', 'https://accounts.meetdapper.com/fcl/authn-restricted')
15
- .put('service.OpenID.scopes', undefined)
16
- .put('discovery.wallet.method', 'POP/RPC');
12
+ const _super = Object.create(null, {
13
+ setupConfig: { get: () => super.setupConfig }
14
+ });
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield _super.setupConfig.call(this);
17
+ yield config()
18
+ .put('challenge.scope', undefined)
19
+ .put('discovery.wallet', this.network === 'testnet'
20
+ ? 'https://staging.accounts.meetdapper.com/fcl/authn-restricted'
21
+ : 'https://accounts.meetdapper.com/fcl/authn-restricted')
22
+ .put('service.OpenID.scopes', undefined)
23
+ .put('discovery.wallet.method', 'POP/RPC');
24
+ });
17
25
  }
18
26
  }
19
27
 
package/src/lilico.cjs CHANGED
@@ -11,12 +11,17 @@ class Lilico extends FlowWalletConnector.FlowWalletConnector {
11
11
  this.name = 'Lilico';
12
12
  }
13
13
  setupConfig() {
14
- super.setupConfig();
15
- fcl.config()
16
- .put('challenge.scope', undefined)
17
- .put('discovery.wallet', 'chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html')
18
- .put('service.OpenID.scopes', undefined)
19
- .put('discovery.wallet.method', 'EXT/RPC');
14
+ const _super = Object.create(null, {
15
+ setupConfig: { get: () => super.setupConfig }
16
+ });
17
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
18
+ yield _super.setupConfig.call(this);
19
+ fcl.config()
20
+ .put('challenge.scope', undefined)
21
+ .put('discovery.wallet', 'chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html')
22
+ .put('service.OpenID.scopes', undefined)
23
+ .put('discovery.wallet.method', 'EXT/RPC');
24
+ });
20
25
  }
21
26
  isInstalledOnBrowser() {
22
27
  var _a;
package/src/lilico.d.ts CHANGED
@@ -2,7 +2,7 @@ import { FlowWalletConnector } from './FlowWalletConnector';
2
2
  import './types';
3
3
  declare class Lilico extends FlowWalletConnector {
4
4
  name: string;
5
- setupConfig(): void;
5
+ setupConfig(): Promise<void>;
6
6
  isInstalledOnBrowser(): boolean;
7
7
  signDelay(): Promise<void>;
8
8
  }
package/src/lilico.js CHANGED
@@ -9,12 +9,17 @@ class Lilico extends FlowWalletConnector {
9
9
  this.name = 'Lilico';
10
10
  }
11
11
  setupConfig() {
12
- super.setupConfig();
13
- config()
14
- .put('challenge.scope', undefined)
15
- .put('discovery.wallet', 'chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html')
16
- .put('service.OpenID.scopes', undefined)
17
- .put('discovery.wallet.method', 'EXT/RPC');
12
+ const _super = Object.create(null, {
13
+ setupConfig: { get: () => super.setupConfig }
14
+ });
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ yield _super.setupConfig.call(this);
17
+ config()
18
+ .put('challenge.scope', undefined)
19
+ .put('discovery.wallet', 'chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html')
20
+ .put('service.OpenID.scopes', undefined)
21
+ .put('discovery.wallet.method', 'EXT/RPC');
22
+ });
18
23
  }
19
24
  isInstalledOnBrowser() {
20
25
  var _a;