@etherplay/connect 0.0.6 → 0.0.7
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/dist/index.d.ts +2 -1
- package/dist/index.js +25 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -73,8 +73,9 @@ export declare function createConnection(settings: {
|
|
|
73
73
|
}): {
|
|
74
74
|
subscribe: (this: void, run: import("svelte/store").Subscriber<Connection>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
75
75
|
connect: (mechanism?: Mechanism, options?: {
|
|
76
|
-
|
|
76
|
+
requireUserConfirmationBeforeSIgnatureRequest?: boolean;
|
|
77
77
|
doNotStoreLocally?: boolean;
|
|
78
|
+
requestSignatureRightAway?: boolean;
|
|
78
79
|
}) => Promise<void>;
|
|
79
80
|
cancel: () => void;
|
|
80
81
|
back: (step: "MechanismToChoose" | "Idle" | "WalletToChoose") => void;
|
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ export function createConnection(settings) {
|
|
|
223
223
|
// address: accounts[0],
|
|
224
224
|
// name: $connection.mechanism.name
|
|
225
225
|
// },
|
|
226
|
-
// {
|
|
226
|
+
// { requireUserConfirmationBeforeSIgnatureRequest: true }
|
|
227
227
|
// );
|
|
228
228
|
if (accounts.length > 0 &&
|
|
229
229
|
accounts[0].toLowerCase() != $connection.account.address.toLowerCase()) {
|
|
@@ -279,15 +279,29 @@ export function createConnection(settings) {
|
|
|
279
279
|
});
|
|
280
280
|
accounts = await provider.request({ method: 'eth_requestAccounts' });
|
|
281
281
|
if (accounts.length > 0) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
282
|
+
if (options?.requestSignatureRightAway) {
|
|
283
|
+
watchForAccountChange(walletProvider);
|
|
284
|
+
set({
|
|
285
|
+
step: 'NeedWalletSignature',
|
|
286
|
+
mechanism: {
|
|
287
|
+
...mechanism,
|
|
288
|
+
address: accounts[0]
|
|
289
|
+
},
|
|
290
|
+
wallets: $connection.wallets
|
|
291
|
+
});
|
|
292
|
+
await requestSignature();
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
set({
|
|
296
|
+
step: 'NeedWalletSignature',
|
|
297
|
+
mechanism: {
|
|
298
|
+
...mechanism,
|
|
299
|
+
address: accounts[0]
|
|
300
|
+
},
|
|
301
|
+
wallets: $connection.wallets
|
|
302
|
+
});
|
|
303
|
+
watchForAccountChange(walletProvider);
|
|
304
|
+
}
|
|
291
305
|
}
|
|
292
306
|
else {
|
|
293
307
|
set({
|
|
@@ -298,7 +312,7 @@ export function createConnection(settings) {
|
|
|
298
312
|
}
|
|
299
313
|
}
|
|
300
314
|
else {
|
|
301
|
-
if (options?.
|
|
315
|
+
if (options?.requireUserConfirmationBeforeSIgnatureRequest) {
|
|
302
316
|
set({
|
|
303
317
|
step: 'NeedWalletSignature',
|
|
304
318
|
mechanism: {
|