@etherplay/connect 0.0.5 → 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 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
- alwaysRequestSignatureOnlyAfterUserConfirmation?: boolean;
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
- // { alwaysRequestSignatureOnlyAfterUserConfirmation: true }
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
- set({
283
- step: 'NeedWalletSignature',
284
- mechanism: {
285
- ...mechanism,
286
- address: accounts[0]
287
- },
288
- wallets: $connection.wallets
289
- });
290
- watchForAccountChange(walletProvider);
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?.alwaysRequestSignatureOnlyAfterUserConfirmation) {
315
+ if (options?.requireUserConfirmationBeforeSIgnatureRequest) {
302
316
  set({
303
317
  step: 'NeedWalletSignature',
304
318
  mechanism: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherplay/connect",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -52,7 +52,7 @@
52
52
  "@scure/bip32": "^1.6.2",
53
53
  "@scure/bip39": "^1.5.4",
54
54
  "zustand": "^5.0.3",
55
- "@etherplay/alchemy": "0.0.4"
55
+ "@etherplay/alchemy": "0.0.5"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "vite dev --host --port 60002",