@phantom/browser-injected-sdk 2.0.0 → 2.0.2
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/auto-confirm/index.js +1 -1
- package/dist/auto-confirm/index.mjs +1 -1
- package/dist/{chunk-RGKAWEP4.mjs → chunk-5OS2MTDZ.mjs} +1 -1
- package/dist/{chunk-YVP5ANEI.mjs → chunk-DAXQQQVE.mjs} +6 -6
- package/dist/ethereum/index.js +6 -6
- package/dist/ethereum/index.mjs +2 -2
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/dist/solana/index.js +5 -5
- package/dist/solana/index.mjs +5 -5
- package/package.json +6 -6
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__privateAdd,
|
|
5
5
|
__privateMethod,
|
|
6
6
|
isInstalled
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5OS2MTDZ.mjs";
|
|
8
8
|
|
|
9
9
|
// src/ethereum/siwe.ts
|
|
10
10
|
var ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
@@ -183,7 +183,7 @@ var InjectedEthereumStrategy = class {
|
|
|
183
183
|
method: onlyIfTrusted ? "eth_accounts" : "eth_requestAccounts"
|
|
184
184
|
});
|
|
185
185
|
return accounts;
|
|
186
|
-
} catch
|
|
186
|
+
} catch {
|
|
187
187
|
return void 0;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -198,7 +198,7 @@ var InjectedEthereumStrategy = class {
|
|
|
198
198
|
try {
|
|
199
199
|
const accounts = await provider.request({ method: "eth_accounts" });
|
|
200
200
|
return accounts || [];
|
|
201
|
-
} catch
|
|
201
|
+
} catch {
|
|
202
202
|
return [];
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -376,7 +376,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
376
376
|
triggerEvent("connect", accounts);
|
|
377
377
|
return accounts;
|
|
378
378
|
}
|
|
379
|
-
} catch
|
|
379
|
+
} catch {
|
|
380
380
|
}
|
|
381
381
|
if (onlyIfTrusted) {
|
|
382
382
|
throw new Error("No trusted connection available.");
|
|
@@ -387,7 +387,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
387
387
|
triggerEvent("connect", accounts);
|
|
388
388
|
return accounts;
|
|
389
389
|
}
|
|
390
|
-
} catch
|
|
390
|
+
} catch {
|
|
391
391
|
}
|
|
392
392
|
throw new Error("Failed to connect to Phantom.");
|
|
393
393
|
}
|
|
@@ -549,7 +549,7 @@ var Ethereum = class {
|
|
|
549
549
|
triggerEvent("chainChanged", chainId);
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
|
-
} catch
|
|
552
|
+
} catch {
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
};
|
package/dist/ethereum/index.js
CHANGED
|
@@ -170,7 +170,7 @@ function isInstalled() {
|
|
|
170
170
|
try {
|
|
171
171
|
const phantom = window?.phantom;
|
|
172
172
|
return !!phantom;
|
|
173
|
-
} catch
|
|
173
|
+
} catch {
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -229,7 +229,7 @@ var InjectedEthereumStrategy = class {
|
|
|
229
229
|
method: onlyIfTrusted ? "eth_accounts" : "eth_requestAccounts"
|
|
230
230
|
});
|
|
231
231
|
return accounts;
|
|
232
|
-
} catch
|
|
232
|
+
} catch {
|
|
233
233
|
return void 0;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -244,7 +244,7 @@ var InjectedEthereumStrategy = class {
|
|
|
244
244
|
try {
|
|
245
245
|
const accounts = await provider.request({ method: "eth_accounts" });
|
|
246
246
|
return accounts || [];
|
|
247
|
-
} catch
|
|
247
|
+
} catch {
|
|
248
248
|
return [];
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -422,7 +422,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
422
422
|
triggerEvent("connect", accounts);
|
|
423
423
|
return accounts;
|
|
424
424
|
}
|
|
425
|
-
} catch
|
|
425
|
+
} catch {
|
|
426
426
|
}
|
|
427
427
|
if (onlyIfTrusted) {
|
|
428
428
|
throw new Error("No trusted connection available.");
|
|
@@ -433,7 +433,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
433
433
|
triggerEvent("connect", accounts);
|
|
434
434
|
return accounts;
|
|
435
435
|
}
|
|
436
|
-
} catch
|
|
436
|
+
} catch {
|
|
437
437
|
}
|
|
438
438
|
throw new Error("Failed to connect to Phantom.");
|
|
439
439
|
}
|
|
@@ -595,7 +595,7 @@ var Ethereum = class {
|
|
|
595
595
|
triggerEvent("chainChanged", chainId);
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
} catch
|
|
598
|
+
} catch {
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
};
|
package/dist/ethereum/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEthereumPlugin,
|
|
3
3
|
createSiweMessage
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-DAXQQQVE.mjs";
|
|
5
5
|
import "../chunk-WUKYLWAZ.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-5OS2MTDZ.mjs";
|
|
7
7
|
export {
|
|
8
8
|
createEthereumPlugin,
|
|
9
9
|
createSiweMessage
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ function isInstalled() {
|
|
|
46
46
|
try {
|
|
47
47
|
const phantom = window?.phantom;
|
|
48
48
|
return !!phantom;
|
|
49
|
-
} catch
|
|
49
|
+
} catch {
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -243,7 +243,7 @@ var InjectedEthereumStrategy = class {
|
|
|
243
243
|
method: onlyIfTrusted ? "eth_accounts" : "eth_requestAccounts"
|
|
244
244
|
});
|
|
245
245
|
return accounts;
|
|
246
|
-
} catch
|
|
246
|
+
} catch {
|
|
247
247
|
return void 0;
|
|
248
248
|
}
|
|
249
249
|
}
|
|
@@ -258,7 +258,7 @@ var InjectedEthereumStrategy = class {
|
|
|
258
258
|
try {
|
|
259
259
|
const accounts = await provider.request({ method: "eth_accounts" });
|
|
260
260
|
return accounts || [];
|
|
261
|
-
} catch
|
|
261
|
+
} catch {
|
|
262
262
|
return [];
|
|
263
263
|
}
|
|
264
264
|
}
|
|
@@ -436,7 +436,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
436
436
|
triggerEvent("connect", accounts);
|
|
437
437
|
return accounts;
|
|
438
438
|
}
|
|
439
|
-
} catch
|
|
439
|
+
} catch {
|
|
440
440
|
}
|
|
441
441
|
if (onlyIfTrusted) {
|
|
442
442
|
throw new Error("No trusted connection available.");
|
|
@@ -447,7 +447,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
447
447
|
triggerEvent("connect", accounts);
|
|
448
448
|
return accounts;
|
|
449
449
|
}
|
|
450
|
-
} catch
|
|
450
|
+
} catch {
|
|
451
451
|
}
|
|
452
452
|
throw new Error("Failed to connect to Phantom.");
|
|
453
453
|
}
|
|
@@ -609,7 +609,7 @@ var Ethereum = class {
|
|
|
609
609
|
triggerEvent("chainChanged", chainId);
|
|
610
610
|
});
|
|
611
611
|
}
|
|
612
|
-
} catch
|
|
612
|
+
} catch {
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEthereumPlugin,
|
|
3
3
|
createSiweMessage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DAXQQQVE.mjs";
|
|
5
5
|
import "./chunk-WUKYLWAZ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isInstalled
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5OS2MTDZ.mjs";
|
|
9
9
|
|
|
10
10
|
// src/extension/plugin.ts
|
|
11
11
|
var extension = {
|
package/dist/solana/index.js
CHANGED
|
@@ -46,7 +46,7 @@ function isInstalled() {
|
|
|
46
46
|
try {
|
|
47
47
|
const phantom = window?.phantom;
|
|
48
48
|
return !!phantom;
|
|
49
|
-
} catch
|
|
49
|
+
} catch {
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -103,7 +103,7 @@ var InjectedSolanaStrategy = class {
|
|
|
103
103
|
try {
|
|
104
104
|
const result = await provider.connect({ onlyIfTrusted });
|
|
105
105
|
return result.publicKey.toString();
|
|
106
|
-
} catch
|
|
106
|
+
} catch {
|
|
107
107
|
return void 0;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -263,7 +263,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
263
263
|
triggerEvent("connect", address);
|
|
264
264
|
return address;
|
|
265
265
|
}
|
|
266
|
-
} catch
|
|
266
|
+
} catch {
|
|
267
267
|
}
|
|
268
268
|
if (onlyIfTrusted) {
|
|
269
269
|
throw new Error("No trusted connection available.");
|
|
@@ -274,7 +274,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
274
274
|
triggerEvent("connect", address);
|
|
275
275
|
return address;
|
|
276
276
|
}
|
|
277
|
-
} catch
|
|
277
|
+
} catch {
|
|
278
278
|
}
|
|
279
279
|
throw new Error("Failed to connect to Phantom.");
|
|
280
280
|
}
|
|
@@ -414,7 +414,7 @@ var Solana = class {
|
|
|
414
414
|
}
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
-
} catch
|
|
417
|
+
} catch {
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
};
|
package/dist/solana/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__privateAdd,
|
|
6
6
|
__privateMethod,
|
|
7
7
|
isInstalled
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-5OS2MTDZ.mjs";
|
|
9
9
|
|
|
10
10
|
// src/solana/strategies/injected.ts
|
|
11
11
|
var MAX_RETRIES = 6;
|
|
@@ -59,7 +59,7 @@ var InjectedSolanaStrategy = class {
|
|
|
59
59
|
try {
|
|
60
60
|
const result = await provider.connect({ onlyIfTrusted });
|
|
61
61
|
return result.publicKey.toString();
|
|
62
|
-
} catch
|
|
62
|
+
} catch {
|
|
63
63
|
return void 0;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -219,7 +219,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
219
219
|
triggerEvent("connect", address);
|
|
220
220
|
return address;
|
|
221
221
|
}
|
|
222
|
-
} catch
|
|
222
|
+
} catch {
|
|
223
223
|
}
|
|
224
224
|
if (onlyIfTrusted) {
|
|
225
225
|
throw new Error("No trusted connection available.");
|
|
@@ -230,7 +230,7 @@ async function connect({ onlyIfTrusted = false } = {}) {
|
|
|
230
230
|
triggerEvent("connect", address);
|
|
231
231
|
return address;
|
|
232
232
|
}
|
|
233
|
-
} catch
|
|
233
|
+
} catch {
|
|
234
234
|
}
|
|
235
235
|
throw new Error("Failed to connect to Phantom.");
|
|
236
236
|
}
|
|
@@ -370,7 +370,7 @@ var Solana = class {
|
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
|
-
} catch
|
|
373
|
+
} catch {
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/browser-injected-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/phantom/phantom-connect-sdk",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"build": "rimraf ./dist && tsup src/index.ts src/solana/index.ts src/auto-confirm/index.ts src/ethereum/index.ts --format cjs,esm --dts",
|
|
42
42
|
"build:watch": "rimraf ./dist && tsup src/index.ts src/solana/index.ts src/auto-confirm/index.ts src/ethereum/index.ts --format cjs,esm --dts --watch",
|
|
43
43
|
"dev": "rimraf ./dist && tsup src/index.ts src/solana/index.ts src/auto-confirm/index.ts src/ethereum/index.ts --format cjs,esm --dts --watch",
|
|
44
|
-
"lint": "tsc --noEmit && eslint --cache .
|
|
44
|
+
"lint": "tsc --noEmit && eslint --cache .",
|
|
45
45
|
"check-types": "tsc --noEmit",
|
|
46
46
|
"test": "jest",
|
|
47
47
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@phantom/chain-interfaces": "^2.0.
|
|
51
|
-
"@phantom/constants": "^2.0.
|
|
52
|
-
"@phantom/sdk-types": "^2.0.
|
|
50
|
+
"@phantom/chain-interfaces": "^2.0.2",
|
|
51
|
+
"@phantom/constants": "^2.0.2",
|
|
52
|
+
"@phantom/sdk-types": "^2.0.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@jest/fake-timers": "^29.7.0",
|
|
56
56
|
"@types/jest": "^29.5.14",
|
|
57
|
-
"eslint": "
|
|
57
|
+
"eslint": "10.2.1",
|
|
58
58
|
"jest": "^29.7.0",
|
|
59
59
|
"jest-environment-jsdom": "^29.7.0",
|
|
60
60
|
"prettier": "^3.5.2",
|