@dynamic-labs/flow 0.18.0 → 0.18.100-viem.1
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 +0 -24
- package/package.json +3 -3
- package/src/FlowWalletConnector.cjs +125 -125
- package/src/FlowWalletConnector.d.ts +26 -26
- package/src/FlowWalletConnector.js +125 -125
- package/src/blocto.cjs +21 -21
- package/src/blocto.d.ts +7 -7
- package/src/blocto.js +21 -21
- package/src/dapper.cjs +21 -21
- package/src/dapper.d.ts +7 -7
- package/src/dapper.js +21 -21
- package/src/index.cjs +1 -1
- package/src/index.d.ts +3 -3
- package/src/index.js +1 -1
- package/src/lilico.cjs +37 -37
- package/src/lilico.d.ts +9 -9
- package/src/lilico.js +37 -37
- package/src/types.d.ts +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
## [0.18.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-beta.32...v0.18.0) (2023-08-13)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
|
|
7
|
-
* add in OKX wallet integration ([#2871](https://github.com/dynamic-labs/DynamicAuth/issues/2871)) ([#2927](https://github.com/dynamic-labs/DynamicAuth/issues/2927)) ([f6d06bc](https://github.com/dynamic-labs/DynamicAuth/commit/f6d06bc75ee0e53c9d972f5fab1f4de11818bd82))
|
|
8
|
-
* update wallet locked view ([#2923](https://github.com/dynamic-labs/DynamicAuth/issues/2923)) ([3cc03ee](https://github.com/dynamic-labs/DynamicAuth/commit/3cc03ee5913434d99386fc89d4d26d5d3fb3ca19))
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* account already exist message not displaying automatically ([#2896](https://github.com/dynamic-labs/DynamicAuth/issues/2896)) ([#2906](https://github.com/dynamic-labs/DynamicAuth/issues/2906)) ([5e7478a](https://github.com/dynamic-labs/DynamicAuth/commit/5e7478acd864451a7cf7e8e62845cca7ef5439c6))
|
|
14
|
-
* don't let user update email if it's tied to an embedded wallet ([#2903](https://github.com/dynamic-labs/DynamicAuth/issues/2903)) ([33c52b5](https://github.com/dynamic-labs/DynamicAuth/commit/33c52b50a880a34b4161a700b8b1805c9b01527d)), closes [#2883](https://github.com/dynamic-labs/DynamicAuth/issues/2883)
|
|
15
|
-
* **GVTY-195:** issues with mergeUserAccountsView ([#2945](https://github.com/dynamic-labs/DynamicAuth/issues/2945)) ([2c6265e](https://github.com/dynamic-labs/DynamicAuth/commit/2c6265e3e709edb9ff1af6e6c139b85418e46d76))
|
|
16
|
-
* **Magic:** improve gas estimate for transactions ([#2947](https://github.com/dynamic-labs/DynamicAuth/issues/2947)) ([ad35a72](https://github.com/dynamic-labs/DynamicAuth/commit/ad35a722df6abd54b98ea491661ff4ec3e602621))
|
|
17
|
-
* missing enable isVerificationInProgress ([#2926](https://github.com/dynamic-labs/DynamicAuth/issues/2926)) ([98f54fd](https://github.com/dynamic-labs/DynamicAuth/commit/98f54fd1345713dfaf0ef837502dfaca3709d633))
|
|
18
|
-
* **networks:** merge custom network after API networks ([#2949](https://github.com/dynamic-labs/DynamicAuth/issues/2949)) ([ab22303](https://github.com/dynamic-labs/DynamicAuth/commit/ab22303294123c2a914a65f0d2c15481740647bb))
|
|
19
|
-
* onBeforeConnectSuccessConfirmation is being called multiple time ([#2965](https://github.com/dynamic-labs/DynamicAuth/issues/2965)) ([a276968](https://github.com/dynamic-labs/DynamicAuth/commit/a2769689bc82350dfb8123e1fe8a4e92a60b262c))
|
|
20
|
-
* **QNTM-249:** broken email update when user is authenticated ([#2932](https://github.com/dynamic-labs/DynamicAuth/issues/2932)) ([db33ba1](https://github.com/dynamic-labs/DynamicAuth/commit/db33ba14c317469958ce314a3822b706e20b07d0))
|
|
21
|
-
* reformat social sign-in text ([#2956](https://github.com/dynamic-labs/DynamicAuth/issues/2956)) ([#2961](https://github.com/dynamic-labs/DynamicAuth/issues/2961)) ([f8d2222](https://github.com/dynamic-labs/DynamicAuth/commit/f8d2222d102f5335f95ec917cbb63bf9b55eff0b))
|
|
22
|
-
* **transaction:** improve gas estimate in transaction confirmation ([#2938](https://github.com/dynamic-labs/DynamicAuth/issues/2938)) ([02d0f46](https://github.com/dynamic-labs/DynamicAuth/commit/02d0f46127e94e83b4decbaaf6a45dbae135c89d))
|
|
23
|
-
* useSyncPrimaryWallet overrides views with "wallet-locked-view" ([#2921](https://github.com/dynamic-labs/DynamicAuth/issues/2921)) ([aa8c369](https://github.com/dynamic-labs/DynamicAuth/commit/aa8c369d2a713eb57ecc99b16a6b62d465789370))
|
|
24
|
-
* **wallet-list:** update key to distinguish wallet and wallet group ([#2922](https://github.com/dynamic-labs/DynamicAuth/issues/2922)) ([f40c07c](https://github.com/dynamic-labs/DynamicAuth/commit/f40c07c65915775e99a1dbb8d07bb23824a92915)), closes [#2909](https://github.com/dynamic-labs/DynamicAuth/issues/2909)
|
|
25
|
-
|
|
26
2
|
## [0.18.0-beta.32](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-beta.31...v0.18.0-beta.32) (2023-08-09)
|
|
27
3
|
|
|
28
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/flow",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.100-viem.1",
|
|
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.4.1",
|
|
30
|
-
"@dynamic-labs/utils": "0.18.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "0.18.
|
|
30
|
+
"@dynamic-labs/utils": "0.18.100-viem.1",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "0.18.100-viem.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {}
|
|
34
34
|
}
|
|
@@ -7,136 +7,136 @@ var fcl = require('@onflow/fcl');
|
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
9
|
|
|
10
|
-
class FlowWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
11
|
-
constructor({ appName, appLogoUrl, flowNetwork, }) {
|
|
12
|
-
super();
|
|
13
|
-
this.connectedChain = 'FLOW';
|
|
14
|
-
this.supportedChains = ['FLOW'];
|
|
15
|
-
this.appName = appName;
|
|
16
|
-
this.appLogoUrl = appLogoUrl;
|
|
17
|
-
this.network = flowNetwork !== null && flowNetwork !== void 0 ? flowNetwork : 'mainnet';
|
|
18
|
-
}
|
|
19
|
-
connect() {
|
|
20
|
-
var _a;
|
|
21
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
yield this.setupConfig();
|
|
23
|
-
const { addr } = yield fcl.currentUser().authenticate();
|
|
24
|
-
if (addr) {
|
|
25
|
-
yield ((_a = this.onAccountChange) === null || _a === void 0 ? void 0 : _a.call(this, [addr]));
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
setupEventListeners(listeners) {
|
|
30
|
-
this.onAccountChange = listeners.onAccountChange;
|
|
31
|
-
}
|
|
32
|
-
getNetwork() {
|
|
33
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
return this.network;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
setupConfig() {
|
|
38
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
yield fcl.config()
|
|
40
|
-
.put('app.detail.title', this.appName)
|
|
41
|
-
.put('app.detail.icon', this.appLogoUrl)
|
|
42
|
-
.put('accessNode.api', this.network === 'testnet'
|
|
43
|
-
? 'https://rest-testnet.onflow.org'
|
|
44
|
-
: 'https://rest-mainnet.onflow.org')
|
|
45
|
-
.put('flow.network', this.network);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
fetchPublicAddress() {
|
|
49
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
try {
|
|
51
|
-
yield this.connect();
|
|
52
|
-
const user = yield fcl.currentUser().snapshot();
|
|
53
|
-
return user.addr;
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
walletConnectorCore.logger.error(error);
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
proveOwnership(messageToSign) {
|
|
62
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
try {
|
|
64
|
-
yield this.connect();
|
|
65
|
-
yield this.signDelay();
|
|
66
|
-
const signedMessage = yield this.signMessage(messageToSign);
|
|
67
|
-
if (!signedMessage) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
const data = {
|
|
71
|
-
appName: this.appName,
|
|
72
|
-
signedMessage: JSON.parse(signedMessage),
|
|
73
|
-
};
|
|
74
|
-
return JSON.stringify(data);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
walletConnectorCore.logger.error(error);
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
signMessage(messageToSign) {
|
|
83
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const message = Buffer.from(messageToSign).toString('hex');
|
|
85
|
-
const signedMessage = yield fcl.currentUser().signUserMessage(message);
|
|
86
|
-
if (signedMessage.includes('Declined')) {
|
|
87
|
-
throw new utils.DynamicError('User declined the signature');
|
|
88
|
-
}
|
|
89
|
-
return JSON.stringify(signedMessage);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
getBalance() {
|
|
93
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
yield this.setupConfig();
|
|
95
|
-
const address = yield this.fetchPublicAddress();
|
|
96
|
-
if (address) {
|
|
10
|
+
class FlowWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
11
|
+
constructor({ appName, appLogoUrl, flowNetwork, }) {
|
|
12
|
+
super();
|
|
13
|
+
this.connectedChain = 'FLOW';
|
|
14
|
+
this.supportedChains = ['FLOW'];
|
|
15
|
+
this.appName = appName;
|
|
16
|
+
this.appLogoUrl = appLogoUrl;
|
|
17
|
+
this.network = flowNetwork !== null && flowNetwork !== void 0 ? flowNetwork : 'mainnet';
|
|
18
|
+
}
|
|
19
|
+
connect() {
|
|
20
|
+
var _a;
|
|
21
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
yield this.setupConfig();
|
|
23
|
+
const { addr } = yield fcl.currentUser().authenticate();
|
|
24
|
+
if (addr) {
|
|
25
|
+
yield ((_a = this.onAccountChange) === null || _a === void 0 ? void 0 : _a.call(this, [addr]));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
setupEventListeners(listeners) {
|
|
30
|
+
this.onAccountChange = listeners.onAccountChange;
|
|
31
|
+
}
|
|
32
|
+
getNetwork() {
|
|
33
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return this.network;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
setupConfig() {
|
|
38
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
yield fcl.config()
|
|
40
|
+
.put('app.detail.title', this.appName)
|
|
41
|
+
.put('app.detail.icon', this.appLogoUrl)
|
|
42
|
+
.put('accessNode.api', this.network === 'testnet'
|
|
43
|
+
? 'https://rest-testnet.onflow.org'
|
|
44
|
+
: 'https://rest-mainnet.onflow.org')
|
|
45
|
+
.put('flow.network', this.network);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
fetchPublicAddress() {
|
|
49
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
try {
|
|
51
|
+
yield this.connect();
|
|
52
|
+
const user = yield fcl.currentUser().snapshot();
|
|
53
|
+
return user.addr;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
walletConnectorCore.logger.error(error);
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
proveOwnership(messageToSign) {
|
|
62
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
try {
|
|
64
|
+
yield this.connect();
|
|
65
|
+
yield this.signDelay();
|
|
66
|
+
const signedMessage = yield this.signMessage(messageToSign);
|
|
67
|
+
if (!signedMessage) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const data = {
|
|
71
|
+
appName: this.appName,
|
|
72
|
+
signedMessage: JSON.parse(signedMessage),
|
|
73
|
+
};
|
|
74
|
+
return JSON.stringify(data);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
walletConnectorCore.logger.error(error);
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
signMessage(messageToSign) {
|
|
83
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const message = Buffer.from(messageToSign).toString('hex');
|
|
85
|
+
const signedMessage = yield fcl.currentUser().signUserMessage(message);
|
|
86
|
+
if (signedMessage.includes('Declined')) {
|
|
87
|
+
throw new utils.DynamicError('User declined the signature');
|
|
88
|
+
}
|
|
89
|
+
return JSON.stringify(signedMessage);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
getBalance() {
|
|
93
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
yield this.setupConfig();
|
|
95
|
+
const address = yield this.fetchPublicAddress();
|
|
96
|
+
if (address) {
|
|
97
97
|
const code = `
|
|
98
98
|
pub fun main(): UFix64 {
|
|
99
99
|
let account = getAccount(${address});
|
|
100
100
|
return account.balance;
|
|
101
101
|
}
|
|
102
|
-
`;
|
|
103
|
-
try {
|
|
104
|
-
return yield fcl.send([fcl.script(code)]).then(fcl.decode);
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
walletConnectorCore.logger.error(error);
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
endSession() {
|
|
117
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
fcl.currentUser().unauthenticate();
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
switchNetwork() {
|
|
122
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
throw new utils.DynamicError('Not supported');
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
getConnectedAccounts() {
|
|
127
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
const user = yield fcl.currentUser().snapshot();
|
|
129
|
-
if (user.addr) {
|
|
130
|
-
return [user.addr];
|
|
131
|
-
}
|
|
132
|
-
return [];
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
signDelay() {
|
|
136
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
return Promise.resolve();
|
|
138
|
-
});
|
|
139
|
-
}
|
|
102
|
+
`;
|
|
103
|
+
try {
|
|
104
|
+
return yield fcl.send([fcl.script(code)]).then(fcl.decode);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
walletConnectorCore.logger.error(error);
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
endSession() {
|
|
117
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
fcl.currentUser().unauthenticate();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
switchNetwork() {
|
|
122
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
throw new utils.DynamicError('Not supported');
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
getConnectedAccounts() {
|
|
127
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const user = yield fcl.currentUser().snapshot();
|
|
129
|
+
if (user.addr) {
|
|
130
|
+
return [user.addr];
|
|
131
|
+
}
|
|
132
|
+
return [];
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
signDelay() {
|
|
136
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
return Promise.resolve();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
exports.FlowWalletConnector = FlowWalletConnector;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Chain, WalletConnectorBase, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
export declare abstract class FlowWalletConnector extends WalletConnectorBase {
|
|
3
|
-
protected appName?: string;
|
|
4
|
-
protected appLogoUrl?: string;
|
|
5
|
-
protected onAccountChange?: (address: string[]) => Promise<void>;
|
|
6
|
-
connectedChain: Chain;
|
|
7
|
-
supportedChains: Chain[];
|
|
8
|
-
protected network: 'mainnet' | 'testnet';
|
|
9
|
-
constructor({ appName, appLogoUrl, flowNetwork, }: {
|
|
10
|
-
appLogoUrl?: string;
|
|
11
|
-
appName?: string;
|
|
12
|
-
flowNetwork?: 'mainnet' | 'testnet';
|
|
13
|
-
});
|
|
14
|
-
connect(): Promise<void>;
|
|
15
|
-
setupEventListeners(listeners: WalletEventListeners): void;
|
|
16
|
-
getNetwork(): Promise<string>;
|
|
17
|
-
setupConfig(): Promise<void>;
|
|
18
|
-
fetchPublicAddress(): Promise<string | undefined>;
|
|
19
|
-
proveOwnership(messageToSign: string): Promise<string | undefined>;
|
|
20
|
-
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
21
|
-
getBalance(): Promise<string | undefined>;
|
|
22
|
-
endSession(): Promise<void>;
|
|
23
|
-
switchNetwork(): Promise<void>;
|
|
24
|
-
getConnectedAccounts(): Promise<string[]>;
|
|
25
|
-
signDelay(): Promise<void>;
|
|
26
|
-
}
|
|
1
|
+
import { Chain, WalletConnectorBase, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
export declare abstract class FlowWalletConnector extends WalletConnectorBase {
|
|
3
|
+
protected appName?: string;
|
|
4
|
+
protected appLogoUrl?: string;
|
|
5
|
+
protected onAccountChange?: (address: string[]) => Promise<void>;
|
|
6
|
+
connectedChain: Chain;
|
|
7
|
+
supportedChains: Chain[];
|
|
8
|
+
protected network: 'mainnet' | 'testnet';
|
|
9
|
+
constructor({ appName, appLogoUrl, flowNetwork, }: {
|
|
10
|
+
appLogoUrl?: string;
|
|
11
|
+
appName?: string;
|
|
12
|
+
flowNetwork?: 'mainnet' | 'testnet';
|
|
13
|
+
});
|
|
14
|
+
connect(): Promise<void>;
|
|
15
|
+
setupEventListeners(listeners: WalletEventListeners): void;
|
|
16
|
+
getNetwork(): Promise<string>;
|
|
17
|
+
setupConfig(): Promise<void>;
|
|
18
|
+
fetchPublicAddress(): Promise<string | undefined>;
|
|
19
|
+
proveOwnership(messageToSign: string): Promise<string | undefined>;
|
|
20
|
+
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
21
|
+
getBalance(): Promise<string | undefined>;
|
|
22
|
+
endSession(): Promise<void>;
|
|
23
|
+
switchNetwork(): Promise<void>;
|
|
24
|
+
getConnectedAccounts(): Promise<string[]>;
|
|
25
|
+
signDelay(): Promise<void>;
|
|
26
|
+
}
|
|
@@ -3,136 +3,136 @@ 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
|
|
|
6
|
-
class FlowWalletConnector extends WalletConnectorBase {
|
|
7
|
-
constructor({ appName, appLogoUrl, flowNetwork, }) {
|
|
8
|
-
super();
|
|
9
|
-
this.connectedChain = 'FLOW';
|
|
10
|
-
this.supportedChains = ['FLOW'];
|
|
11
|
-
this.appName = appName;
|
|
12
|
-
this.appLogoUrl = appLogoUrl;
|
|
13
|
-
this.network = flowNetwork !== null && flowNetwork !== void 0 ? flowNetwork : 'mainnet';
|
|
14
|
-
}
|
|
15
|
-
connect() {
|
|
16
|
-
var _a;
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
yield this.setupConfig();
|
|
19
|
-
const { addr } = yield currentUser().authenticate();
|
|
20
|
-
if (addr) {
|
|
21
|
-
yield ((_a = this.onAccountChange) === null || _a === void 0 ? void 0 : _a.call(this, [addr]));
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
setupEventListeners(listeners) {
|
|
26
|
-
this.onAccountChange = listeners.onAccountChange;
|
|
27
|
-
}
|
|
28
|
-
getNetwork() {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return this.network;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
setupConfig() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
yield config()
|
|
36
|
-
.put('app.detail.title', this.appName)
|
|
37
|
-
.put('app.detail.icon', this.appLogoUrl)
|
|
38
|
-
.put('accessNode.api', this.network === 'testnet'
|
|
39
|
-
? 'https://rest-testnet.onflow.org'
|
|
40
|
-
: 'https://rest-mainnet.onflow.org')
|
|
41
|
-
.put('flow.network', this.network);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
fetchPublicAddress() {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
try {
|
|
47
|
-
yield this.connect();
|
|
48
|
-
const user = yield currentUser().snapshot();
|
|
49
|
-
return user.addr;
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
logger.error(error);
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
proveOwnership(messageToSign) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
try {
|
|
60
|
-
yield this.connect();
|
|
61
|
-
yield this.signDelay();
|
|
62
|
-
const signedMessage = yield this.signMessage(messageToSign);
|
|
63
|
-
if (!signedMessage) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
const data = {
|
|
67
|
-
appName: this.appName,
|
|
68
|
-
signedMessage: JSON.parse(signedMessage),
|
|
69
|
-
};
|
|
70
|
-
return JSON.stringify(data);
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
logger.error(error);
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
signMessage(messageToSign) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
const message = Buffer.from(messageToSign).toString('hex');
|
|
81
|
-
const signedMessage = yield currentUser().signUserMessage(message);
|
|
82
|
-
if (signedMessage.includes('Declined')) {
|
|
83
|
-
throw new DynamicError('User declined the signature');
|
|
84
|
-
}
|
|
85
|
-
return JSON.stringify(signedMessage);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
getBalance() {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
yield this.setupConfig();
|
|
91
|
-
const address = yield this.fetchPublicAddress();
|
|
92
|
-
if (address) {
|
|
6
|
+
class FlowWalletConnector extends WalletConnectorBase {
|
|
7
|
+
constructor({ appName, appLogoUrl, flowNetwork, }) {
|
|
8
|
+
super();
|
|
9
|
+
this.connectedChain = 'FLOW';
|
|
10
|
+
this.supportedChains = ['FLOW'];
|
|
11
|
+
this.appName = appName;
|
|
12
|
+
this.appLogoUrl = appLogoUrl;
|
|
13
|
+
this.network = flowNetwork !== null && flowNetwork !== void 0 ? flowNetwork : 'mainnet';
|
|
14
|
+
}
|
|
15
|
+
connect() {
|
|
16
|
+
var _a;
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
yield this.setupConfig();
|
|
19
|
+
const { addr } = yield currentUser().authenticate();
|
|
20
|
+
if (addr) {
|
|
21
|
+
yield ((_a = this.onAccountChange) === null || _a === void 0 ? void 0 : _a.call(this, [addr]));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
setupEventListeners(listeners) {
|
|
26
|
+
this.onAccountChange = listeners.onAccountChange;
|
|
27
|
+
}
|
|
28
|
+
getNetwork() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return this.network;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
setupConfig() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
yield config()
|
|
36
|
+
.put('app.detail.title', this.appName)
|
|
37
|
+
.put('app.detail.icon', this.appLogoUrl)
|
|
38
|
+
.put('accessNode.api', this.network === 'testnet'
|
|
39
|
+
? 'https://rest-testnet.onflow.org'
|
|
40
|
+
: 'https://rest-mainnet.onflow.org')
|
|
41
|
+
.put('flow.network', this.network);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
fetchPublicAddress() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
try {
|
|
47
|
+
yield this.connect();
|
|
48
|
+
const user = yield currentUser().snapshot();
|
|
49
|
+
return user.addr;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
logger.error(error);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
proveOwnership(messageToSign) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
try {
|
|
60
|
+
yield this.connect();
|
|
61
|
+
yield this.signDelay();
|
|
62
|
+
const signedMessage = yield this.signMessage(messageToSign);
|
|
63
|
+
if (!signedMessage) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const data = {
|
|
67
|
+
appName: this.appName,
|
|
68
|
+
signedMessage: JSON.parse(signedMessage),
|
|
69
|
+
};
|
|
70
|
+
return JSON.stringify(data);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
logger.error(error);
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
signMessage(messageToSign) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const message = Buffer.from(messageToSign).toString('hex');
|
|
81
|
+
const signedMessage = yield currentUser().signUserMessage(message);
|
|
82
|
+
if (signedMessage.includes('Declined')) {
|
|
83
|
+
throw new DynamicError('User declined the signature');
|
|
84
|
+
}
|
|
85
|
+
return JSON.stringify(signedMessage);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getBalance() {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
yield this.setupConfig();
|
|
91
|
+
const address = yield this.fetchPublicAddress();
|
|
92
|
+
if (address) {
|
|
93
93
|
const code = `
|
|
94
94
|
pub fun main(): UFix64 {
|
|
95
95
|
let account = getAccount(${address});
|
|
96
96
|
return account.balance;
|
|
97
97
|
}
|
|
98
|
-
`;
|
|
99
|
-
try {
|
|
100
|
-
return yield send([script(code)]).then(decode);
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
logger.error(error);
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
endSession() {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
currentUser().unauthenticate();
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
switchNetwork() {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
throw new DynamicError('Not supported');
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
getConnectedAccounts() {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
const user = yield currentUser().snapshot();
|
|
125
|
-
if (user.addr) {
|
|
126
|
-
return [user.addr];
|
|
127
|
-
}
|
|
128
|
-
return [];
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
signDelay() {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
return Promise.resolve();
|
|
134
|
-
});
|
|
135
|
-
}
|
|
98
|
+
`;
|
|
99
|
+
try {
|
|
100
|
+
return yield send([script(code)]).then(decode);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
logger.error(error);
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
endSession() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
currentUser().unauthenticate();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
switchNetwork() {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
throw new DynamicError('Not supported');
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
getConnectedAccounts() {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const user = yield currentUser().snapshot();
|
|
125
|
+
if (user.addr) {
|
|
126
|
+
return [user.addr];
|
|
127
|
+
}
|
|
128
|
+
return [];
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
signDelay() {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export { FlowWalletConnector };
|
package/src/blocto.cjs
CHANGED
|
@@ -4,27 +4,27 @@ var _tslib = require('../_virtual/_tslib.cjs');
|
|
|
4
4
|
var fcl = require('@onflow/fcl');
|
|
5
5
|
var FlowWalletConnector = require('./FlowWalletConnector.cjs');
|
|
6
6
|
|
|
7
|
-
class Blocto extends FlowWalletConnector.FlowWalletConnector {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Blocto';
|
|
11
|
-
this.canConnectViaCustodialService = true;
|
|
12
|
-
}
|
|
13
|
-
setupConfig() {
|
|
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://wallet-v2-dev.blocto.app/api/flow/authn'
|
|
23
|
-
: 'https://wallet-v2.blocto.app/api/flow/authn')
|
|
24
|
-
.put('service.OpenID.scopes', 'email!')
|
|
25
|
-
.put('discovery.wallet.method', 'HTTP/POST');
|
|
26
|
-
});
|
|
27
|
-
}
|
|
7
|
+
class Blocto extends FlowWalletConnector.FlowWalletConnector {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = 'Blocto';
|
|
11
|
+
this.canConnectViaCustodialService = true;
|
|
12
|
+
}
|
|
13
|
+
setupConfig() {
|
|
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://wallet-v2-dev.blocto.app/api/flow/authn'
|
|
23
|
+
: 'https://wallet-v2.blocto.app/api/flow/authn')
|
|
24
|
+
.put('service.OpenID.scopes', 'email!')
|
|
25
|
+
.put('discovery.wallet.method', 'HTTP/POST');
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
module.exports = Blocto;
|
package/src/blocto.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FlowWalletConnector } from './FlowWalletConnector';
|
|
2
|
-
declare class Blocto extends FlowWalletConnector {
|
|
3
|
-
name: string;
|
|
4
|
-
canConnectViaCustodialService: boolean;
|
|
5
|
-
setupConfig(): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export default Blocto;
|
|
1
|
+
import { FlowWalletConnector } from './FlowWalletConnector';
|
|
2
|
+
declare class Blocto extends FlowWalletConnector {
|
|
3
|
+
name: string;
|
|
4
|
+
canConnectViaCustodialService: boolean;
|
|
5
|
+
setupConfig(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export default Blocto;
|
package/src/blocto.js
CHANGED
|
@@ -2,27 +2,27 @@ import { __awaiter } from '../_virtual/_tslib.js';
|
|
|
2
2
|
import { config } from '@onflow/fcl';
|
|
3
3
|
import { FlowWalletConnector } from './FlowWalletConnector.js';
|
|
4
4
|
|
|
5
|
-
class Blocto extends FlowWalletConnector {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'Blocto';
|
|
9
|
-
this.canConnectViaCustodialService = true;
|
|
10
|
-
}
|
|
11
|
-
setupConfig() {
|
|
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://wallet-v2-dev.blocto.app/api/flow/authn'
|
|
21
|
-
: 'https://wallet-v2.blocto.app/api/flow/authn')
|
|
22
|
-
.put('service.OpenID.scopes', 'email!')
|
|
23
|
-
.put('discovery.wallet.method', 'HTTP/POST');
|
|
24
|
-
});
|
|
25
|
-
}
|
|
5
|
+
class Blocto extends FlowWalletConnector {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.name = 'Blocto';
|
|
9
|
+
this.canConnectViaCustodialService = true;
|
|
10
|
+
}
|
|
11
|
+
setupConfig() {
|
|
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://wallet-v2-dev.blocto.app/api/flow/authn'
|
|
21
|
+
: 'https://wallet-v2.blocto.app/api/flow/authn')
|
|
22
|
+
.put('service.OpenID.scopes', 'email!')
|
|
23
|
+
.put('discovery.wallet.method', 'HTTP/POST');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export { Blocto as default };
|
package/src/dapper.cjs
CHANGED
|
@@ -4,27 +4,27 @@ var _tslib = require('../_virtual/_tslib.cjs');
|
|
|
4
4
|
var fcl = require('@onflow/fcl');
|
|
5
5
|
var FlowWalletConnector = require('./FlowWalletConnector.cjs');
|
|
6
6
|
|
|
7
|
-
class Dapper extends FlowWalletConnector.FlowWalletConnector {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.name = 'Dapper';
|
|
11
|
-
this.canConnectViaCustodialService = true;
|
|
12
|
-
}
|
|
13
|
-
setupConfig() {
|
|
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
|
-
});
|
|
27
|
-
}
|
|
7
|
+
class Dapper extends FlowWalletConnector.FlowWalletConnector {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = 'Dapper';
|
|
11
|
+
this.canConnectViaCustodialService = true;
|
|
12
|
+
}
|
|
13
|
+
setupConfig() {
|
|
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
|
+
});
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
module.exports = Dapper;
|
package/src/dapper.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FlowWalletConnector } from './FlowWalletConnector';
|
|
2
|
-
declare class Dapper extends FlowWalletConnector {
|
|
3
|
-
name: string;
|
|
4
|
-
canConnectViaCustodialService: boolean;
|
|
5
|
-
setupConfig(): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export default Dapper;
|
|
1
|
+
import { FlowWalletConnector } from './FlowWalletConnector';
|
|
2
|
+
declare class Dapper extends FlowWalletConnector {
|
|
3
|
+
name: string;
|
|
4
|
+
canConnectViaCustodialService: boolean;
|
|
5
|
+
setupConfig(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export default Dapper;
|
package/src/dapper.js
CHANGED
|
@@ -2,27 +2,27 @@ import { __awaiter } from '../_virtual/_tslib.js';
|
|
|
2
2
|
import { config } from '@onflow/fcl';
|
|
3
3
|
import { FlowWalletConnector } from './FlowWalletConnector.js';
|
|
4
4
|
|
|
5
|
-
class Dapper extends FlowWalletConnector {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'Dapper';
|
|
9
|
-
this.canConnectViaCustodialService = true;
|
|
10
|
-
}
|
|
11
|
-
setupConfig() {
|
|
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
|
-
});
|
|
25
|
-
}
|
|
5
|
+
class Dapper extends FlowWalletConnector {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.name = 'Dapper';
|
|
9
|
+
this.canConnectViaCustodialService = true;
|
|
10
|
+
}
|
|
11
|
+
setupConfig() {
|
|
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
|
+
});
|
|
25
|
+
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export { Dapper as default };
|
package/src/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var dapper = require('./dapper.cjs');
|
|
|
7
7
|
var lilico = require('./lilico.cjs');
|
|
8
8
|
var FlowWalletConnector = require('./FlowWalletConnector.cjs');
|
|
9
9
|
|
|
10
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11
11
|
const FlowWalletConnectors = (props) => [blocto, dapper, lilico];
|
|
12
12
|
|
|
13
13
|
exports.FlowWalletConnector = FlowWalletConnector.FlowWalletConnector;
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Blocto from './blocto';
|
|
2
|
-
export { FlowWalletConnector } from './FlowWalletConnector';
|
|
3
|
-
export declare const FlowWalletConnectors: (props: any) => (typeof Blocto)[];
|
|
1
|
+
import Blocto from './blocto';
|
|
2
|
+
export { FlowWalletConnector } from './FlowWalletConnector';
|
|
3
|
+
export declare const FlowWalletConnectors: (props: any) => (typeof Blocto)[];
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import Dapper from './dapper.js';
|
|
|
3
3
|
import Lilico from './lilico.js';
|
|
4
4
|
export { FlowWalletConnector } from './FlowWalletConnector.js';
|
|
5
5
|
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const FlowWalletConnectors = (props) => [Blocto, Dapper, Lilico];
|
|
8
8
|
|
|
9
9
|
export { FlowWalletConnectors };
|
package/src/lilico.cjs
CHANGED
|
@@ -5,43 +5,43 @@ var fcl = require('@onflow/fcl');
|
|
|
5
5
|
var utils = require('@dynamic-labs/utils');
|
|
6
6
|
var FlowWalletConnector = require('./FlowWalletConnector.cjs');
|
|
7
7
|
|
|
8
|
-
class Lilico extends FlowWalletConnector.FlowWalletConnector {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = 'Lilico';
|
|
12
|
-
}
|
|
13
|
-
setupConfig() {
|
|
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
|
-
});
|
|
25
|
-
}
|
|
26
|
-
isInstalledOnBrowser() {
|
|
27
|
-
var _a;
|
|
28
|
-
if (typeof window === 'undefined') {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return Boolean((_a = window.fcl_extensions) === null || _a === void 0 ? void 0 : _a.some((ext) => ext.id === 'hpclkefagolihohboafpheddmmgdffjm'));
|
|
32
|
-
}
|
|
33
|
-
signDelay() {
|
|
34
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
if (utils.isMobile()) {
|
|
36
|
-
return Promise.resolve();
|
|
37
|
-
}
|
|
38
|
-
return new Promise((resolve) => {
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
resolve();
|
|
41
|
-
}, 500);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
8
|
+
class Lilico extends FlowWalletConnector.FlowWalletConnector {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.name = 'Lilico';
|
|
12
|
+
}
|
|
13
|
+
setupConfig() {
|
|
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
|
+
});
|
|
25
|
+
}
|
|
26
|
+
isInstalledOnBrowser() {
|
|
27
|
+
var _a;
|
|
28
|
+
if (typeof window === 'undefined') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return Boolean((_a = window.fcl_extensions) === null || _a === void 0 ? void 0 : _a.some((ext) => ext.id === 'hpclkefagolihohboafpheddmmgdffjm'));
|
|
32
|
+
}
|
|
33
|
+
signDelay() {
|
|
34
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (utils.isMobile()) {
|
|
36
|
+
return Promise.resolve();
|
|
37
|
+
}
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
resolve();
|
|
41
|
+
}, 500);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
module.exports = Lilico;
|
package/src/lilico.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FlowWalletConnector } from './FlowWalletConnector';
|
|
2
|
-
import './types';
|
|
3
|
-
declare class Lilico extends FlowWalletConnector {
|
|
4
|
-
name: string;
|
|
5
|
-
setupConfig(): Promise<void>;
|
|
6
|
-
isInstalledOnBrowser(): boolean;
|
|
7
|
-
signDelay(): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export default Lilico;
|
|
1
|
+
import { FlowWalletConnector } from './FlowWalletConnector';
|
|
2
|
+
import './types';
|
|
3
|
+
declare class Lilico extends FlowWalletConnector {
|
|
4
|
+
name: string;
|
|
5
|
+
setupConfig(): Promise<void>;
|
|
6
|
+
isInstalledOnBrowser(): boolean;
|
|
7
|
+
signDelay(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export default Lilico;
|
package/src/lilico.js
CHANGED
|
@@ -3,43 +3,43 @@ import { config } from '@onflow/fcl';
|
|
|
3
3
|
import { isMobile } from '@dynamic-labs/utils';
|
|
4
4
|
import { FlowWalletConnector } from './FlowWalletConnector.js';
|
|
5
5
|
|
|
6
|
-
class Lilico extends FlowWalletConnector {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.name = 'Lilico';
|
|
10
|
-
}
|
|
11
|
-
setupConfig() {
|
|
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
|
-
});
|
|
23
|
-
}
|
|
24
|
-
isInstalledOnBrowser() {
|
|
25
|
-
var _a;
|
|
26
|
-
if (typeof window === 'undefined') {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return Boolean((_a = window.fcl_extensions) === null || _a === void 0 ? void 0 : _a.some((ext) => ext.id === 'hpclkefagolihohboafpheddmmgdffjm'));
|
|
30
|
-
}
|
|
31
|
-
signDelay() {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
if (isMobile()) {
|
|
34
|
-
return Promise.resolve();
|
|
35
|
-
}
|
|
36
|
-
return new Promise((resolve) => {
|
|
37
|
-
setTimeout(() => {
|
|
38
|
-
resolve();
|
|
39
|
-
}, 500);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
6
|
+
class Lilico extends FlowWalletConnector {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.name = 'Lilico';
|
|
10
|
+
}
|
|
11
|
+
setupConfig() {
|
|
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
|
+
});
|
|
23
|
+
}
|
|
24
|
+
isInstalledOnBrowser() {
|
|
25
|
+
var _a;
|
|
26
|
+
if (typeof window === 'undefined') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return Boolean((_a = window.fcl_extensions) === null || _a === void 0 ? void 0 : _a.some((ext) => ext.id === 'hpclkefagolihohboafpheddmmgdffjm'));
|
|
30
|
+
}
|
|
31
|
+
signDelay() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
if (isMobile()) {
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
resolve();
|
|
39
|
+
}, 500);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export { Lilico as default };
|
package/src/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface IFclProvider {
|
|
3
|
-
id: string;
|
|
4
|
-
}
|
|
5
|
-
interface Window {
|
|
6
|
-
fcl_extensions: IFclProvider[] | undefined;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
1
|
+
declare global {
|
|
2
|
+
interface IFclProvider {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
interface Window {
|
|
6
|
+
fcl_extensions: IFclProvider[] | undefined;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {};
|