@multiplatform.one/web3 7.32.0 → 7.33.0
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/README.md +21 -0
- package/dist/cjs/phantom/evm.cjs +133 -0
- package/dist/cjs/phantom/evm.native.js +269 -0
- package/dist/cjs/phantom/evm.native.js.map +1 -0
- package/dist/cjs/phantom/index.cjs +36 -0
- package/dist/cjs/phantom/index.native.js +39 -0
- package/dist/cjs/phantom/index.native.js.map +1 -0
- package/dist/cjs/phantom/urls.cjs +33 -0
- package/dist/cjs/phantom/urls.native.js +38 -0
- package/dist/cjs/phantom/urls.native.js.map +1 -0
- package/dist/esm/phantom/evm.mjs +103 -0
- package/dist/esm/phantom/evm.mjs.map +1 -0
- package/dist/esm/phantom/evm.native.js +236 -0
- package/dist/esm/phantom/evm.native.js.map +1 -0
- package/dist/esm/phantom/index.mjs +4 -0
- package/dist/esm/phantom/index.mjs.map +1 -0
- package/dist/esm/phantom/index.native.js +4 -0
- package/dist/esm/phantom/index.native.js.map +1 -0
- package/dist/esm/phantom/urls.mjs +7 -0
- package/dist/esm/phantom/urls.mjs.map +1 -0
- package/dist/esm/phantom/urls.native.js +9 -0
- package/dist/esm/phantom/urls.native.js.map +1 -0
- package/dist/jsx/phantom/evm.mjs +103 -0
- package/dist/jsx/phantom/evm.mjs.map +1 -0
- package/dist/jsx/phantom/evm.native.js +269 -0
- package/dist/jsx/phantom/evm.native.js.map +1 -0
- package/dist/jsx/phantom/index.mjs +4 -0
- package/dist/jsx/phantom/index.mjs.map +1 -0
- package/dist/jsx/phantom/index.native.js +39 -0
- package/dist/jsx/phantom/index.native.js.map +1 -0
- package/dist/jsx/phantom/urls.mjs +7 -0
- package/dist/jsx/phantom/urls.mjs.map +1 -0
- package/dist/jsx/phantom/urls.native.js +38 -0
- package/dist/jsx/phantom/urls.native.js.map +1 -0
- package/package.json +12 -6
- package/src/phantom/evm.spec.ts +195 -0
- package/src/phantom/evm.ts +163 -0
- package/src/phantom/index.ts +16 -0
- package/src/phantom/urls.spec.ts +29 -0
- package/src/phantom/urls.ts +16 -0
- package/types/phantom/evm.d.ts +76 -0
- package/types/phantom/evm.d.ts.map +1 -0
- package/types/phantom/index.d.ts +3 -0
- package/types/phantom/index.d.ts.map +1 -0
- package/types/phantom/urls.d.ts +11 -0
- package/types/phantom/urls.d.ts.map +1 -0
package/README.md
CHANGED
|
@@ -543,6 +543,27 @@ if (status === "profile-incomplete") {
|
|
|
543
543
|
}
|
|
544
544
|
```
|
|
545
545
|
|
|
546
|
+
## Phantom on a phone
|
|
547
|
+
|
|
548
|
+
`@multiplatform.one/web3/phantom` reaches Phantom's EVM wallet from Chrome
|
|
549
|
+
or Safari on a phone, Custom Tabs and `ASWebAuthenticationSession` included.
|
|
550
|
+
Phantom's deeplinks carry no EVM methods, so it goes through Phantom's in-app
|
|
551
|
+
browser. Off Phantom, the tap calls `openInPhantom()` with nothing awaited
|
|
552
|
+
first. The page reopens inside Phantom, where its EVM provider is injected and
|
|
553
|
+
`connectPhantomEvm` returns the usual EVM client. Base Sepolia and other testnets need Phantom's Testnet Mode.
|
|
554
|
+
|
|
555
|
+
```ts
|
|
556
|
+
import { connectPhantomEvm, openInPhantom, phantomEvmRoute } from "@multiplatform.one/web3/phantom";
|
|
557
|
+
import { baseSepolia } from "viem/chains";
|
|
558
|
+
|
|
559
|
+
button.onclick = () => {
|
|
560
|
+
if (phantomEvmRoute() === "browse") return void openInPhantom();
|
|
561
|
+
void connectPhantomEvm({ chain: baseSepolia }).then((client) =>
|
|
562
|
+
client.erc20.transfer({ token: qcc, to: treasury, amount }),
|
|
563
|
+
);
|
|
564
|
+
};
|
|
565
|
+
```
|
|
566
|
+
|
|
546
567
|
## License
|
|
547
568
|
|
|
548
569
|
Apache-2.0
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var evm_exports = {};
|
|
24
|
+
__export(evm_exports, {
|
|
25
|
+
PhantomNotInjectedError: () => PhantomNotInjectedError,
|
|
26
|
+
connectPhantomEvm: () => connectPhantomEvm,
|
|
27
|
+
discoverPhantomEthereumProvider: () => discoverPhantomEthereumProvider,
|
|
28
|
+
openInPhantom: () => openInPhantom,
|
|
29
|
+
phantomEthereumProvider: () => phantomEthereumProvider,
|
|
30
|
+
phantomEvmRoute: () => phantomEvmRoute
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(evm_exports);
|
|
33
|
+
var import_viem = require("viem");
|
|
34
|
+
var import_evm = require("../clients/evm.cjs");
|
|
35
|
+
var import_urls = require("./urls.cjs");
|
|
36
|
+
const phantomRdns = "app.phantom";
|
|
37
|
+
function phantomEthereumProvider(win = globalThis) {
|
|
38
|
+
const own = win.phantom?.ethereum;
|
|
39
|
+
if (own?.isPhantom) return own;
|
|
40
|
+
if (win.ethereum?.isPhantom) return win.ethereum;
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
function discoverPhantomEthereumProvider(options = {}) {
|
|
44
|
+
const win = options.window ?? globalThis;
|
|
45
|
+
const found = phantomEthereumProvider(win);
|
|
46
|
+
if (found || !win.addEventListener || !win.dispatchEvent) return Promise.resolve(found);
|
|
47
|
+
return new Promise(resolve => {
|
|
48
|
+
const onAnnounce = event => {
|
|
49
|
+
const detail = event.detail;
|
|
50
|
+
if (detail?.info?.rdns !== phantomRdns || !detail.provider) return;
|
|
51
|
+
done(detail.provider);
|
|
52
|
+
};
|
|
53
|
+
const timer = setTimeout(() => done(phantomEthereumProvider(win)), options.timeout ?? 500);
|
|
54
|
+
const done = provider => {
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
win.removeEventListener?.("eip6963:announceProvider", onAnnounce);
|
|
57
|
+
resolve(provider);
|
|
58
|
+
};
|
|
59
|
+
win.addEventListener?.("eip6963:announceProvider", onAnnounce);
|
|
60
|
+
win.dispatchEvent?.(new Event("eip6963:requestProvider"));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function phantomEvmRoute(win = globalThis) {
|
|
64
|
+
return phantomEthereumProvider(win) ? "injected" : "browse";
|
|
65
|
+
}
|
|
66
|
+
function openInPhantom(options = {}) {
|
|
67
|
+
const win = options.window ?? globalThis;
|
|
68
|
+
const url = options.url ?? win.location?.href;
|
|
69
|
+
const ref = options.ref ?? win.location?.origin ?? url;
|
|
70
|
+
if (!url || !ref) throw new Error("openInPhantom: no page URL here; pass `url` and `ref`");
|
|
71
|
+
const link = (0, import_urls.phantomBrowseUrl)(url, ref, {
|
|
72
|
+
base: options.base
|
|
73
|
+
});
|
|
74
|
+
(options.navigate ?? (target => win.location?.assign(target)))(link);
|
|
75
|
+
return link;
|
|
76
|
+
}
|
|
77
|
+
class PhantomNotInjectedError extends Error {
|
|
78
|
+
constructor() {
|
|
79
|
+
super("Phantom's EVM provider is not on this page: on a phone, reopen it in Phantom with openInPhantom()");
|
|
80
|
+
this.name = "PhantomNotInjectedError";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const errorCode = error => error?.code ?? error?.cause?.code;
|
|
84
|
+
async function ensureChain(provider, chain) {
|
|
85
|
+
const current = await provider.request({
|
|
86
|
+
method: "eth_chainId"
|
|
87
|
+
});
|
|
88
|
+
if (Number(current) === chain.id) return;
|
|
89
|
+
const chainId = (0, import_viem.numberToHex)(chain.id);
|
|
90
|
+
try {
|
|
91
|
+
await provider.request({
|
|
92
|
+
method: "wallet_switchEthereumChain",
|
|
93
|
+
params: [{
|
|
94
|
+
chainId
|
|
95
|
+
}]
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (errorCode(error) !== 4902) throw error;
|
|
99
|
+
await provider.request({
|
|
100
|
+
method: "wallet_addEthereumChain",
|
|
101
|
+
params: [{
|
|
102
|
+
chainId,
|
|
103
|
+
chainName: chain.name,
|
|
104
|
+
nativeCurrency: chain.nativeCurrency,
|
|
105
|
+
rpcUrls: [...chain.rpcUrls.default.http],
|
|
106
|
+
blockExplorerUrls: chain.blockExplorers ? [chain.blockExplorers.default.url] : void 0
|
|
107
|
+
}]
|
|
108
|
+
});
|
|
109
|
+
await provider.request({
|
|
110
|
+
method: "wallet_switchEthereumChain",
|
|
111
|
+
params: [{
|
|
112
|
+
chainId
|
|
113
|
+
}]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function connectPhantomEvm(options) {
|
|
118
|
+
const provider = options.provider ?? phantomEthereumProvider();
|
|
119
|
+
if (!provider) throw new PhantomNotInjectedError();
|
|
120
|
+
const accounts = await provider.request({
|
|
121
|
+
method: "eth_requestAccounts"
|
|
122
|
+
});
|
|
123
|
+
const account = accounts[0];
|
|
124
|
+
if (!account) throw new Error("Phantom returned no EVM account");
|
|
125
|
+
await ensureChain(provider, options.chain);
|
|
126
|
+
return (0, import_evm.evmClient)({
|
|
127
|
+
provider,
|
|
128
|
+
account,
|
|
129
|
+
chain: options.chain,
|
|
130
|
+
publicClient: options.publicClient,
|
|
131
|
+
rpcUrl: options.rpcUrl
|
|
132
|
+
});
|
|
133
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var evm_exports = {};
|
|
26
|
+
__export(evm_exports, {
|
|
27
|
+
PhantomNotInjectedError: () => PhantomNotInjectedError,
|
|
28
|
+
connectPhantomEvm: () => connectPhantomEvm,
|
|
29
|
+
discoverPhantomEthereumProvider: () => discoverPhantomEthereumProvider,
|
|
30
|
+
openInPhantom: () => openInPhantom,
|
|
31
|
+
phantomEthereumProvider: () => phantomEthereumProvider,
|
|
32
|
+
phantomEvmRoute: () => phantomEvmRoute
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(evm_exports);
|
|
35
|
+
var import_viem = require("viem");
|
|
36
|
+
var import_evm = require("../clients/evm.native.js");
|
|
37
|
+
var import_urls = require("./urls.native.js");
|
|
38
|
+
function _assert_this_initialized(self) {
|
|
39
|
+
if (self === void 0) {
|
|
40
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
41
|
+
}
|
|
42
|
+
return self;
|
|
43
|
+
}
|
|
44
|
+
function _call_super(_this, derived, args) {
|
|
45
|
+
derived = _get_prototype_of(derived);
|
|
46
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
47
|
+
}
|
|
48
|
+
function _class_call_check(instance, Constructor) {
|
|
49
|
+
if (!(instance instanceof Constructor)) {
|
|
50
|
+
throw new TypeError("Cannot call a class as a function");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function _construct(Parent, args, Class) {
|
|
54
|
+
if (_is_native_reflect_construct()) {
|
|
55
|
+
_construct = Reflect.construct;
|
|
56
|
+
} else {
|
|
57
|
+
_construct = function construct(Parent2, args2, Class2) {
|
|
58
|
+
var a = [null];
|
|
59
|
+
a.push.apply(a, args2);
|
|
60
|
+
var Constructor = Function.bind.apply(Parent2, a);
|
|
61
|
+
var instance = new Constructor();
|
|
62
|
+
if (Class2) _set_prototype_of(instance, Class2.prototype);
|
|
63
|
+
return instance;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return _construct.apply(null, arguments);
|
|
67
|
+
}
|
|
68
|
+
function _get_prototype_of(o) {
|
|
69
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
|
|
70
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
71
|
+
};
|
|
72
|
+
return _get_prototype_of(o);
|
|
73
|
+
}
|
|
74
|
+
function _inherits(subClass, superClass) {
|
|
75
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
76
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
77
|
+
}
|
|
78
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
79
|
+
constructor: {
|
|
80
|
+
value: subClass,
|
|
81
|
+
writable: true,
|
|
82
|
+
configurable: true
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
86
|
+
}
|
|
87
|
+
function _is_native_function(fn) {
|
|
88
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
89
|
+
}
|
|
90
|
+
function _possible_constructor_return(self, call) {
|
|
91
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
92
|
+
return call;
|
|
93
|
+
}
|
|
94
|
+
return _assert_this_initialized(self);
|
|
95
|
+
}
|
|
96
|
+
function _set_prototype_of(o, p) {
|
|
97
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
|
|
98
|
+
o2.__proto__ = p2;
|
|
99
|
+
return o2;
|
|
100
|
+
};
|
|
101
|
+
return _set_prototype_of(o, p);
|
|
102
|
+
}
|
|
103
|
+
function _type_of(obj) {
|
|
104
|
+
"@swc/helpers - typeof";
|
|
105
|
+
|
|
106
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
107
|
+
}
|
|
108
|
+
function _wrap_native_super(Class) {
|
|
109
|
+
var _cache = typeof Map === "function" ? /* @__PURE__ */new Map() : void 0;
|
|
110
|
+
_wrap_native_super = function wrapNativeSuper(Class2) {
|
|
111
|
+
if (Class2 === null || !_is_native_function(Class2)) return Class2;
|
|
112
|
+
if (typeof Class2 !== "function") {
|
|
113
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
114
|
+
}
|
|
115
|
+
if (typeof _cache !== "undefined") {
|
|
116
|
+
if (_cache.has(Class2)) return _cache.get(Class2);
|
|
117
|
+
_cache.set(Class2, Wrapper);
|
|
118
|
+
}
|
|
119
|
+
function Wrapper() {
|
|
120
|
+
return _construct(Class2, arguments, _get_prototype_of(this).constructor);
|
|
121
|
+
}
|
|
122
|
+
Wrapper.prototype = Object.create(Class2.prototype, {
|
|
123
|
+
constructor: {
|
|
124
|
+
value: Wrapper,
|
|
125
|
+
enumerable: false,
|
|
126
|
+
writable: true,
|
|
127
|
+
configurable: true
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return _set_prototype_of(Wrapper, Class2);
|
|
131
|
+
};
|
|
132
|
+
return _wrap_native_super(Class);
|
|
133
|
+
}
|
|
134
|
+
function _is_native_reflect_construct() {
|
|
135
|
+
try {
|
|
136
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
137
|
+
} catch (_) {}
|
|
138
|
+
return (_is_native_reflect_construct = function () {
|
|
139
|
+
return !!result;
|
|
140
|
+
})();
|
|
141
|
+
}
|
|
142
|
+
var phantomRdns = "app.phantom";
|
|
143
|
+
function phantomEthereumProvider() {
|
|
144
|
+
var win = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;
|
|
145
|
+
var _win_phantom, _win_ethereum;
|
|
146
|
+
var own = (_win_phantom = win.phantom) === null || _win_phantom === void 0 ? void 0 : _win_phantom.ethereum;
|
|
147
|
+
if (own === null || own === void 0 ? void 0 : own.isPhantom) return own;
|
|
148
|
+
if ((_win_ethereum = win.ethereum) === null || _win_ethereum === void 0 ? void 0 : _win_ethereum.isPhantom) return win.ethereum;
|
|
149
|
+
return void 0;
|
|
150
|
+
}
|
|
151
|
+
function discoverPhantomEthereumProvider() {
|
|
152
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
153
|
+
var _options_window;
|
|
154
|
+
var win = (_options_window = options.window) !== null && _options_window !== void 0 ? _options_window : globalThis;
|
|
155
|
+
var found = phantomEthereumProvider(win);
|
|
156
|
+
if (found || !win.addEventListener || !win.dispatchEvent) return Promise.resolve(found);
|
|
157
|
+
return new Promise(function (resolve) {
|
|
158
|
+
var _options_timeout;
|
|
159
|
+
var _win_addEventListener, _win_dispatchEvent;
|
|
160
|
+
var onAnnounce = function onAnnounce2(event) {
|
|
161
|
+
var _detail_info;
|
|
162
|
+
var detail = event.detail;
|
|
163
|
+
if ((detail === null || detail === void 0 ? void 0 : (_detail_info = detail.info) === null || _detail_info === void 0 ? void 0 : _detail_info.rdns) !== phantomRdns || !detail.provider) return;
|
|
164
|
+
done(detail.provider);
|
|
165
|
+
};
|
|
166
|
+
var timer = setTimeout(function () {
|
|
167
|
+
return done(phantomEthereumProvider(win));
|
|
168
|
+
}, (_options_timeout = options.timeout) !== null && _options_timeout !== void 0 ? _options_timeout : 500);
|
|
169
|
+
var done = function done2(provider) {
|
|
170
|
+
var _win_removeEventListener;
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
(_win_removeEventListener = win.removeEventListener) === null || _win_removeEventListener === void 0 ? void 0 : _win_removeEventListener.call(win, "eip6963:announceProvider", onAnnounce);
|
|
173
|
+
resolve(provider);
|
|
174
|
+
};
|
|
175
|
+
(_win_addEventListener = win.addEventListener) === null || _win_addEventListener === void 0 ? void 0 : _win_addEventListener.call(win, "eip6963:announceProvider", onAnnounce);
|
|
176
|
+
(_win_dispatchEvent = win.dispatchEvent) === null || _win_dispatchEvent === void 0 ? void 0 : _win_dispatchEvent.call(win, new Event("eip6963:requestProvider"));
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function phantomEvmRoute() {
|
|
180
|
+
var win = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : globalThis;
|
|
181
|
+
return phantomEthereumProvider(win) ? "injected" : "browse";
|
|
182
|
+
}
|
|
183
|
+
function openInPhantom() {
|
|
184
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
185
|
+
var _options_window, _options_url, _ref, _options_ref, _options_navigate;
|
|
186
|
+
var _win_location, _win_location1;
|
|
187
|
+
var win = (_options_window = options.window) !== null && _options_window !== void 0 ? _options_window : globalThis;
|
|
188
|
+
var url = (_options_url = options.url) !== null && _options_url !== void 0 ? _options_url : (_win_location = win.location) === null || _win_location === void 0 ? void 0 : _win_location.href;
|
|
189
|
+
var ref = (_ref = (_options_ref = options.ref) !== null && _options_ref !== void 0 ? _options_ref : (_win_location1 = win.location) === null || _win_location1 === void 0 ? void 0 : _win_location1.origin) !== null && _ref !== void 0 ? _ref : url;
|
|
190
|
+
if (!url || !ref) throw new Error("openInPhantom: no page URL here; pass `url` and `ref`");
|
|
191
|
+
var link = (0, import_urls.phantomBrowseUrl)(url, ref, {
|
|
192
|
+
base: options.base
|
|
193
|
+
});
|
|
194
|
+
((_options_navigate = options.navigate) !== null && _options_navigate !== void 0 ? _options_navigate : function (target) {
|
|
195
|
+
var _win_location2;
|
|
196
|
+
return (_win_location2 = win.location) === null || _win_location2 === void 0 ? void 0 : _win_location2.assign(target);
|
|
197
|
+
})(link);
|
|
198
|
+
return link;
|
|
199
|
+
}
|
|
200
|
+
var PhantomNotInjectedError = /* @__PURE__ */function (Error1) {
|
|
201
|
+
"use strict";
|
|
202
|
+
|
|
203
|
+
_inherits(PhantomNotInjectedError2, Error1);
|
|
204
|
+
function PhantomNotInjectedError2() {
|
|
205
|
+
_class_call_check(this, PhantomNotInjectedError2);
|
|
206
|
+
var _this;
|
|
207
|
+
_this = _call_super(this, PhantomNotInjectedError2, ["Phantom's EVM provider is not on this page: on a phone, reopen it in Phantom with openInPhantom()"]);
|
|
208
|
+
_this.name = "PhantomNotInjectedError";
|
|
209
|
+
return _this;
|
|
210
|
+
}
|
|
211
|
+
return PhantomNotInjectedError2;
|
|
212
|
+
}(_wrap_native_super(Error));
|
|
213
|
+
var errorCode = function errorCode2(error) {
|
|
214
|
+
var _ref;
|
|
215
|
+
var _error_cause;
|
|
216
|
+
return (_ref = error === null || error === void 0 ? void 0 : error.code) !== null && _ref !== void 0 ? _ref : error === null || error === void 0 ? void 0 : (_error_cause = error.cause) === null || _error_cause === void 0 ? void 0 : _error_cause.code;
|
|
217
|
+
};
|
|
218
|
+
async function ensureChain(provider, chain) {
|
|
219
|
+
var current = await provider.request({
|
|
220
|
+
method: "eth_chainId"
|
|
221
|
+
});
|
|
222
|
+
if (Number(current) === chain.id) return;
|
|
223
|
+
var chainId = (0, import_viem.numberToHex)(chain.id);
|
|
224
|
+
try {
|
|
225
|
+
await provider.request({
|
|
226
|
+
method: "wallet_switchEthereumChain",
|
|
227
|
+
params: [{
|
|
228
|
+
chainId
|
|
229
|
+
}]
|
|
230
|
+
});
|
|
231
|
+
} catch (error) {
|
|
232
|
+
if (errorCode(error) !== 4902) throw error;
|
|
233
|
+
await provider.request({
|
|
234
|
+
method: "wallet_addEthereumChain",
|
|
235
|
+
params: [{
|
|
236
|
+
chainId,
|
|
237
|
+
chainName: chain.name,
|
|
238
|
+
nativeCurrency: chain.nativeCurrency,
|
|
239
|
+
rpcUrls: [...chain.rpcUrls.default.http],
|
|
240
|
+
blockExplorerUrls: chain.blockExplorers ? [chain.blockExplorers.default.url] : void 0
|
|
241
|
+
}]
|
|
242
|
+
});
|
|
243
|
+
await provider.request({
|
|
244
|
+
method: "wallet_switchEthereumChain",
|
|
245
|
+
params: [{
|
|
246
|
+
chainId
|
|
247
|
+
}]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async function connectPhantomEvm(options) {
|
|
252
|
+
var _options_provider;
|
|
253
|
+
var provider = (_options_provider = options.provider) !== null && _options_provider !== void 0 ? _options_provider : phantomEthereumProvider();
|
|
254
|
+
if (!provider) throw new PhantomNotInjectedError();
|
|
255
|
+
var accounts = await provider.request({
|
|
256
|
+
method: "eth_requestAccounts"
|
|
257
|
+
});
|
|
258
|
+
var account = accounts[0];
|
|
259
|
+
if (!account) throw new Error("Phantom returned no EVM account");
|
|
260
|
+
await ensureChain(provider, options.chain);
|
|
261
|
+
return (0, import_evm.evmClient)({
|
|
262
|
+
provider,
|
|
263
|
+
account,
|
|
264
|
+
chain: options.chain,
|
|
265
|
+
publicClient: options.publicClient,
|
|
266
|
+
rpcUrl: options.rpcUrl
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=evm.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","evm_exports","__export","PhantomNotInjectedError","connectPhantomEvm","discoverPhantomEthereumProvider","openInPhantom","phantomEthereumProvider","phantomEvmRoute","module","exports","import_viem","require","import_evm","import_urls","_assert_this_initialized","self","ReferenceError","_call_super","_this","derived","args","_get_prototype_of","_possible_constructor_return","_is_native_reflect_construct","Reflect","construct","constructor","apply","_class_call_check","instance","Constructor","TypeError","_construct","Parent","Class","Parent2","args2","Class2","a","push","Function","bind","_set_prototype_of","prototype","arguments","o","Object","setPrototypeOf","getPrototypeOf","o2","__proto__","_inherits","subClass","superClass","create","writable","configurable","_is_native_function","fn","toString","call","indexOf","_type_of","p","p2","obj","Symbol","_wrap_native_super","_cache","Map","wrapNativeSuper","has","get","set","Wrapper"],"sources":["../../../src/phantom/evm.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var phantom_exports = {};
|
|
24
|
+
__export(phantom_exports, {
|
|
25
|
+
PhantomNotInjectedError: () => import_evm.PhantomNotInjectedError,
|
|
26
|
+
connectPhantomEvm: () => import_evm.connectPhantomEvm,
|
|
27
|
+
discoverPhantomEthereumProvider: () => import_evm.discoverPhantomEthereumProvider,
|
|
28
|
+
openInPhantom: () => import_evm.openInPhantom,
|
|
29
|
+
phantomBrowseUrl: () => import_urls.phantomBrowseUrl,
|
|
30
|
+
phantomEthereumProvider: () => import_evm.phantomEthereumProvider,
|
|
31
|
+
phantomEvmRoute: () => import_evm.phantomEvmRoute,
|
|
32
|
+
phantomUniversalLinkBase: () => import_urls.phantomUniversalLinkBase
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(phantom_exports);
|
|
35
|
+
var import_evm = require("./evm.cjs");
|
|
36
|
+
var import_urls = require("./urls.cjs");
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var phantom_exports = {};
|
|
26
|
+
__export(phantom_exports, {
|
|
27
|
+
PhantomNotInjectedError: () => import_evm.PhantomNotInjectedError,
|
|
28
|
+
connectPhantomEvm: () => import_evm.connectPhantomEvm,
|
|
29
|
+
discoverPhantomEthereumProvider: () => import_evm.discoverPhantomEthereumProvider,
|
|
30
|
+
openInPhantom: () => import_evm.openInPhantom,
|
|
31
|
+
phantomBrowseUrl: () => import_urls.phantomBrowseUrl,
|
|
32
|
+
phantomEthereumProvider: () => import_evm.phantomEthereumProvider,
|
|
33
|
+
phantomEvmRoute: () => import_evm.phantomEvmRoute,
|
|
34
|
+
phantomUniversalLinkBase: () => import_urls.phantomUniversalLinkBase
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(phantom_exports);
|
|
37
|
+
var import_evm = require("./evm.native.js");
|
|
38
|
+
var import_urls = require("./urls.native.js");
|
|
39
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","phantom_exports","__export","PhantomNotInjectedError","import_evm","connectPhantomEvm","discoverPhantomEthereumProvider","openInPhantom","phantomBrowseUrl","import_urls","phantomEthereumProvider","phantomEvmRoute","phantomUniversalLinkBase","module","exports","require"],"sources":["../../../src/phantom/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAC,UAAA,CAAAD,uBAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAD,UAAA,CAAAC,iBAAA;EAAAC,+BAAA,EAAAA,CAAA,KAAAF,UAAA,CAAAE,+BAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAH,UAAA,CAAAG,aAAA;EAAAC,gBAAA,EAAAA,CAAA,KAAAC,WAAA,CAAAD,gBAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAN,UAAA,CAAAM,uBAAA;EAAAC,eAAA,EAAAA,CAAA,KAAAP,UAAA,CAAAO,eAAA;EAAAC,wBAAA,EAAAA,CAAA,KAAAH,WAAA,CAAAG;AAAA;AAIAC,MAAA,CAAAC,OAAA,GAUOlB,YAAA,CAAAK,eAAA;AACP,IAAAG,UAAA,GAAAW,OAA2D","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var urls_exports = {};
|
|
24
|
+
__export(urls_exports, {
|
|
25
|
+
phantomBrowseUrl: () => phantomBrowseUrl,
|
|
26
|
+
phantomUniversalLinkBase: () => phantomUniversalLinkBase
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(urls_exports);
|
|
29
|
+
const phantomUniversalLinkBase = "https://phantom.com/ul";
|
|
30
|
+
function phantomBrowseUrl(url, ref, options = {}) {
|
|
31
|
+
const base = (options.base ?? phantomUniversalLinkBase).replace(/\/+$/, "");
|
|
32
|
+
return `${base}/browse/${encodeURIComponent(url)}?ref=${encodeURIComponent(ref)}`;
|
|
33
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var urls_exports = {};
|
|
26
|
+
__export(urls_exports, {
|
|
27
|
+
phantomBrowseUrl: () => phantomBrowseUrl,
|
|
28
|
+
phantomUniversalLinkBase: () => phantomUniversalLinkBase
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(urls_exports);
|
|
31
|
+
var phantomUniversalLinkBase = "https://phantom.com/ul";
|
|
32
|
+
function phantomBrowseUrl(url, ref) {
|
|
33
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
34
|
+
var _options_base;
|
|
35
|
+
var base = ((_options_base = options.base) !== null && _options_base !== void 0 ? _options_base : phantomUniversalLinkBase).replace(/\/+$/, "");
|
|
36
|
+
return `${base}/browse/${encodeURIComponent(url)}?ref=${encodeURIComponent(ref)}`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=urls.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","urls_exports","__export","phantomBrowseUrl","phantomUniversalLinkBase","module","exports","url","ref","options","arguments","length","_options_base"],"sources":["../../../src/phantom/urls.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,YAAA;AAAAC,QAAA,CAAAD,YAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA,gBAAA;EAAAC,wBAAA,EAAAA,CAAA,KAAAA;AAAA;AACOC,MAAM,CAAAC,OAAA,GAAAV,YAAA,CAAAK,YAA2B;AAOjC,IAAAG,wBACL,GACA,wBAEQ;AACR,SAAMD,gBAAgBA,CAAAI,GAAA,EAAAC,GAAQ;EAC9B,IAAAC,OAAU,GAAIC,SAAA,CAAAC,MAAW,QAAAD,SAAsB,CAAC,YAAQ,IAAAA,SAAA,EAAmB,IAAI;EACjF,IAAAE,aAAA","ignoreList":[]}
|