@etherplay/connect 0.0.2 → 0.0.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -152,10 +152,27 @@ export function createConnection(settings) {
152
152
  ...$connection,
153
153
  step: 'WaitingForSignature'
154
154
  });
155
- const signature = await provider.request({
156
- method: 'personal_sign',
157
- params: [msg, $connection.mechanism.address]
158
- });
155
+ let signature;
156
+ try {
157
+ signature = await provider.request({
158
+ method: 'personal_sign',
159
+ params: [msg, $connection.mechanism.address]
160
+ });
161
+ }
162
+ catch (err) {
163
+ // TODO handle rejection (code: 4001 ?)
164
+ set({
165
+ ...$connection,
166
+ step: 'NeedWalletSignature',
167
+ mechanism: {
168
+ type: 'wallet',
169
+ name: $connection.mechanism.name,
170
+ address: $connection.mechanism.address
171
+ },
172
+ error: { message: 'failed to sign message', cause: err }
173
+ });
174
+ return;
175
+ }
159
176
  const originKey = fromSignatureToKey(signature);
160
177
  const originMnemonic = fromEntropyKeyToMnemonic(originKey);
161
178
  const originAccount = fromMnemonicToFirstAccount(originMnemonic);
@@ -165,7 +182,7 @@ export function createConnection(settings) {
165
182
  origin,
166
183
  address: originAccount.address,
167
184
  privateKey: originAccount.privateKey,
168
- mnemomicKey: originKey
185
+ mnemonicKey: originKey
169
186
  },
170
187
  metadata: {},
171
188
  mechanismUsed: $connection.mechanism
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherplay/connect",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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.1"
55
+ "@etherplay/alchemy": "0.0.3"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "vite dev --host --port 60002",