@getpara/wagmi-v2-connector 2.0.0-alpha.3 → 2.0.0-alpha.5

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.
@@ -9,8 +9,9 @@ interface ParaEIP1193ProviderOpts {
9
9
  disableModal?: boolean;
10
10
  storageOverride?: Pick<Storage, 'setItem' | 'getItem'>;
11
11
  transports?: Record<number, Transport>;
12
- renderModal?: (onClose: () => void) => void;
13
- openModal?: () => void;
12
+ renderModal?: (onClose: () => void) => {
13
+ openModal: () => void;
14
+ };
14
15
  }
15
16
  export declare class ParaEIP1193Provider extends EventEmitter implements EIP1193Provider {
16
17
  private currentHexChainId;
@@ -0,0 +1,268 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadProps,
5
+ __spreadValues
6
+ } from "./chunk-IV3L3JVM.js";
7
+ import {
8
+ ProviderRpcError,
9
+ webSocket,
10
+ publicActions,
11
+ http,
12
+ formatTransaction
13
+ } from "viem";
14
+ import { EventEmitter } from "eventemitter3";
15
+ import { extractRpcUrls } from "@wagmi/core";
16
+ import { getViemChain, createParaViemClient, createParaAccount } from "@getpara/viem-v2-integration";
17
+ import { decimalToHex, hexToDecimal } from "@getpara/web-sdk";
18
+ const STORAGE_CHAIN_ID_KEY = "@CAPSULE/chainId";
19
+ const TEN_MINUTES_MS = 6e5;
20
+ const serverSessionStorageStub = {
21
+ setItem: () => {
22
+ },
23
+ getItem: () => null
24
+ };
25
+ class ParaEIP1193Provider extends EventEmitter {
26
+ constructor(opts) {
27
+ super();
28
+ this.getRpcUrlsFromViemChain = (chain) => {
29
+ return extractRpcUrls({ chain, transports: this.transports });
30
+ };
31
+ this.wagmiChainToAddEthereumChainParameters = (chain) => {
32
+ const hexChainId = decimalToHex(`${chain.id}`);
33
+ return [
34
+ hexChainId,
35
+ {
36
+ chainId: hexChainId,
37
+ chainName: chain.name,
38
+ nativeCurrency: chain.nativeCurrency,
39
+ rpcUrls: this.getRpcUrlsFromViemChain(chain)
40
+ }
41
+ ];
42
+ };
43
+ this.wagmiChainsToAddEthereumChainParameters = (chains) => {
44
+ return Object.fromEntries(chains.map(this.wagmiChainToAddEthereumChainParameters));
45
+ };
46
+ this.accountFromAddress = (address) => {
47
+ return createParaAccount(this.para, address);
48
+ };
49
+ this.setCurrentChain = (chainId) => {
50
+ const chain = this.chains[chainId];
51
+ this.setChainId(chainId);
52
+ const viemChain = this.viemChains[chainId] || getViemChain(hexToDecimal(chainId));
53
+ const rpcUrls = this.getRpcUrlsFromViemChain(viemChain);
54
+ let transport;
55
+ if (this.transports[viemChain.id]) {
56
+ transport = this.transports[viemChain.id];
57
+ } else if (rpcUrls[0].startsWith("ws")) {
58
+ transport = webSocket(chain.rpcUrls[0]);
59
+ } else {
60
+ transport = http(rpcUrls[0]);
61
+ this.chainTransportSubscribe = void 0;
62
+ }
63
+ const chainTransport = transport({
64
+ chain: viemChain
65
+ });
66
+ if (chainTransport.config.type === "ws") {
67
+ this.chainTransportSubscribe = chainTransport.value.subscribe;
68
+ }
69
+ this.walletClient = createParaViemClient(
70
+ this.para,
71
+ {
72
+ chain: viemChain,
73
+ transport
74
+ // @ts-ignore
75
+ },
76
+ { noAccount: true }
77
+ ).extend(publicActions);
78
+ this.emit("chainChanged", this.currentHexChainId);
79
+ };
80
+ this.closeModal = () => {
81
+ this.isModalClosed = true;
82
+ };
83
+ this.request = (args) => __async(this, null, function* () {
84
+ var _a;
85
+ const { method, params } = args;
86
+ switch (method) {
87
+ case "eth_accounts": {
88
+ const accounts = this.accounts;
89
+ return accounts || [];
90
+ }
91
+ case "eth_chainId": {
92
+ return this.currentHexChainId;
93
+ }
94
+ case "eth_requestAccounts": {
95
+ if (yield this.para.isFullyLoggedIn()) {
96
+ const accounts = this.accounts;
97
+ if (accounts && accounts.length > 0) {
98
+ return accounts;
99
+ }
100
+ }
101
+ this.isModalClosed = false;
102
+ (_a = this.openModal) == null ? void 0 : _a.call(this);
103
+ yield this.waitForLogin();
104
+ try {
105
+ const accounts = yield this.waitForAccounts();
106
+ this.emit("accountsChanged", accounts);
107
+ return accounts;
108
+ } catch (error) {
109
+ throw new ProviderRpcError(new Error("accounts not available after login"), {
110
+ code: 4001,
111
+ shortMessage: "accounts not available after login"
112
+ });
113
+ }
114
+ }
115
+ case "eth_sendTransaction": {
116
+ const fromAddress = params[0].from;
117
+ return this.walletClient.sendTransaction(__spreadProps(__spreadValues({}, formatTransaction(params[0])), {
118
+ chain: void 0,
119
+ // uses the chain from the wallet client
120
+ account: this.accountFromAddress(fromAddress)
121
+ }));
122
+ }
123
+ case "eth_sign":
124
+ case "personal_sign": {
125
+ return this.walletClient.signMessage({
126
+ message: { raw: params[0] },
127
+ account: this.accountFromAddress(params[1])
128
+ });
129
+ }
130
+ case "eth_signTransaction": {
131
+ const fromAddress = params[0].from;
132
+ return this.accountFromAddress(fromAddress).signTransaction(formatTransaction(params[0]));
133
+ }
134
+ case "eth_signTypedData_v4": {
135
+ const fromAddress = params[0];
136
+ let typedMessage = params[1];
137
+ if (typeof typedMessage === "string") {
138
+ typedMessage = JSON.parse(typedMessage);
139
+ }
140
+ return this.walletClient.signTypedData(__spreadProps(__spreadValues({}, typedMessage), {
141
+ account: this.accountFromAddress(fromAddress)
142
+ }));
143
+ }
144
+ case "eth_subscribe": {
145
+ if (!this.chainTransportSubscribe) {
146
+ throw new ProviderRpcError(new Error("chain does not support subscriptions"), {
147
+ code: 4200,
148
+ shortMessage: "chain does not support subscriptions"
149
+ });
150
+ }
151
+ const res = yield this.chainTransportSubscribe({
152
+ params,
153
+ onData: (data) => {
154
+ this.emit("message", {
155
+ type: "eth_subscription",
156
+ data
157
+ });
158
+ }
159
+ });
160
+ return res.subscriptionId;
161
+ }
162
+ case "wallet_addEthereumChain": {
163
+ if (!this.chains[params[0].chainId]) {
164
+ this.chains[params[0].chainId] = params[0];
165
+ }
166
+ return null;
167
+ }
168
+ case "wallet_getPermissions": {
169
+ return [];
170
+ }
171
+ case "wallet_requestPermissions": {
172
+ return [];
173
+ }
174
+ case "wallet_switchEthereumChain": {
175
+ if (!this.chains[params[0].chainId]) {
176
+ const chain = getViemChain(hexToDecimal(params[0].chainId));
177
+ const [hexChainId, addEthereumChainParameter] = this.wagmiChainToAddEthereumChainParameters(chain);
178
+ this.chains[hexChainId] = addEthereumChainParameter;
179
+ this.setCurrentChain(params[0].chainId);
180
+ }
181
+ if (this.currentHexChainId !== params[0].chainId) {
182
+ this.setCurrentChain(params[0].chainId);
183
+ }
184
+ return null;
185
+ }
186
+ case "wallet_watchAsset": {
187
+ return false;
188
+ }
189
+ default: {
190
+ return this.walletClient.request({
191
+ method,
192
+ params
193
+ });
194
+ }
195
+ }
196
+ });
197
+ this.storage = opts.storageOverride || typeof window === "undefined" ? serverSessionStorageStub : sessionStorage;
198
+ this.isModalClosed = true;
199
+ this.para = opts.para;
200
+ this.disableModal = !!opts.disableModal;
201
+ this.viemChains = opts.chains.reduce((acc, curChain) => {
202
+ acc[decimalToHex(`${curChain.id}`)] = curChain;
203
+ return acc;
204
+ }, {});
205
+ this.chains = this.wagmiChainsToAddEthereumChainParameters(opts.chains);
206
+ this.transports = opts.transports;
207
+ if (!this.disableModal && opts.renderModal) {
208
+ const { openModal } = opts.renderModal(this.closeModal);
209
+ this.openModal = openModal;
210
+ }
211
+ const defaultChainId = this.getStorageChainId() || opts.chainId;
212
+ const currentChainId = this.chains[decimalToHex(defaultChainId)] ? defaultChainId : `${opts.chains[0].id}`;
213
+ this.setCurrentChain(decimalToHex(currentChainId));
214
+ this.emit("connect", { chainId: this.currentHexChainId });
215
+ }
216
+ get accounts() {
217
+ return this.para.getWalletsByType("EVM").map((w) => w.address);
218
+ }
219
+ getStorageChainId() {
220
+ return this.storage.getItem(STORAGE_CHAIN_ID_KEY);
221
+ }
222
+ setChainId(hexChainId) {
223
+ this.currentHexChainId = hexChainId;
224
+ this.storage.setItem(STORAGE_CHAIN_ID_KEY, hexToDecimal(hexChainId));
225
+ }
226
+ waitForLogin() {
227
+ return __async(this, arguments, function* (timeoutMs = TEN_MINUTES_MS) {
228
+ const startTime = Date.now();
229
+ while (Date.now() - startTime < timeoutMs) {
230
+ if (yield this.para.isFullyLoggedIn()) {
231
+ return true;
232
+ }
233
+ if (!this.disableModal && this.isModalClosed) {
234
+ throw new ProviderRpcError(new Error("user closed modal"), {
235
+ code: 4001,
236
+ shortMessage: "user closed modal"
237
+ });
238
+ }
239
+ yield new Promise((resolve) => setTimeout(resolve, 2e3));
240
+ }
241
+ throw new ProviderRpcError(new Error("timed out waiting for user to log in"), {
242
+ code: 4900,
243
+ //provider is disconnected code
244
+ shortMessage: "timed out waiting for user to log in"
245
+ });
246
+ });
247
+ }
248
+ waitForAccounts(timeoutMs = 5e3) {
249
+ return __async(this, null, function* () {
250
+ const startTime = Date.now();
251
+ while (Date.now() - startTime < timeoutMs) {
252
+ const accounts = this.accounts;
253
+ if (accounts && accounts.length > 0) {
254
+ return accounts;
255
+ }
256
+ yield new Promise((resolve) => setTimeout(resolve, 500));
257
+ }
258
+ throw new ProviderRpcError(new Error("timed out waiting for accounts to load"), {
259
+ code: 4900,
260
+ //provider is disconnected code
261
+ shortMessage: "timed out waiting for accounts to load"
262
+ });
263
+ });
264
+ }
265
+ }
266
+ export {
267
+ ParaEIP1193Provider
268
+ };
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+
42
+ export {
43
+ __spreadValues,
44
+ __spreadProps,
45
+ __async
46
+ };
package/dist/index.js CHANGED
@@ -1,362 +1,3 @@
1
1
  "use client";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __async = (__this, __arguments, generator) => {
22
- return new Promise((resolve, reject) => {
23
- var fulfilled = (value) => {
24
- try {
25
- step(generator.next(value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- };
30
- var rejected = (value) => {
31
- try {
32
- step(generator.throw(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
- step((generator = generator.apply(__this, __arguments)).next());
39
- });
40
- };
41
-
42
- // src/paraConnector.ts
43
- import { injected } from "wagmi/connectors";
44
-
45
- // src/ParaEIP1193Provider.ts
46
- import {
47
- ProviderRpcError,
48
- webSocket,
49
- publicActions,
50
- http,
51
- formatTransaction
52
- } from "viem";
53
- import { EventEmitter } from "eventemitter3";
54
- import { extractRpcUrls } from "@wagmi/core";
55
- import { getViemChain, createParaViemClient, createParaAccount } from "@getpara/viem-v2-integration";
56
- import { decimalToHex, hexToDecimal } from "@getpara/web-sdk";
57
- var STORAGE_CHAIN_ID_KEY = "@CAPSULE/chainId";
58
- var TEN_MINUTES_MS = 6e5;
59
- var serverSessionStorageStub = {
60
- setItem: () => {
61
- },
62
- getItem: () => null
63
- };
64
- var ParaEIP1193Provider = class extends EventEmitter {
65
- constructor(opts) {
66
- var _a;
67
- super();
68
- this.getRpcUrlsFromViemChain = (chain) => {
69
- return extractRpcUrls({ chain, transports: this.transports });
70
- };
71
- this.wagmiChainToAddEthereumChainParameters = (chain) => {
72
- const hexChainId = decimalToHex(`${chain.id}`);
73
- return [
74
- hexChainId,
75
- {
76
- chainId: hexChainId,
77
- chainName: chain.name,
78
- nativeCurrency: chain.nativeCurrency,
79
- rpcUrls: this.getRpcUrlsFromViemChain(chain)
80
- }
81
- ];
82
- };
83
- this.wagmiChainsToAddEthereumChainParameters = (chains) => {
84
- return Object.fromEntries(chains.map(this.wagmiChainToAddEthereumChainParameters));
85
- };
86
- this.accountFromAddress = (address) => {
87
- return createParaAccount(this.para, address);
88
- };
89
- this.setCurrentChain = (chainId) => {
90
- const chain = this.chains[chainId];
91
- this.setChainId(chainId);
92
- const viemChain = this.viemChains[chainId] || getViemChain(hexToDecimal(chainId));
93
- const rpcUrls = this.getRpcUrlsFromViemChain(viemChain);
94
- let transport;
95
- if (this.transports[viemChain.id]) {
96
- transport = this.transports[viemChain.id];
97
- } else if (rpcUrls[0].startsWith("ws")) {
98
- transport = webSocket(chain.rpcUrls[0]);
99
- } else {
100
- transport = http(rpcUrls[0]);
101
- this.chainTransportSubscribe = void 0;
102
- }
103
- const chainTransport = transport({
104
- chain: viemChain
105
- });
106
- if (chainTransport.config.type === "ws") {
107
- this.chainTransportSubscribe = chainTransport.value.subscribe;
108
- }
109
- this.walletClient = createParaViemClient(
110
- this.para,
111
- {
112
- chain: viemChain,
113
- transport
114
- // @ts-ignore
115
- },
116
- { noAccount: true }
117
- ).extend(publicActions);
118
- this.emit("chainChanged", this.currentHexChainId);
119
- };
120
- this.closeModal = () => {
121
- this.isModalClosed = true;
122
- };
123
- this.request = (args) => __async(this, null, function* () {
124
- const { method, params } = args;
125
- switch (method) {
126
- case "eth_accounts": {
127
- const accounts = this.accounts;
128
- return accounts || [];
129
- }
130
- case "eth_chainId": {
131
- return this.currentHexChainId;
132
- }
133
- case "eth_requestAccounts": {
134
- if (yield this.para.isFullyLoggedIn()) {
135
- const accounts = this.accounts;
136
- if (accounts && accounts.length > 0) {
137
- return accounts;
138
- }
139
- }
140
- this.isModalClosed = false;
141
- this.openModal();
142
- yield this.waitForLogin();
143
- try {
144
- const accounts = yield this.waitForAccounts();
145
- this.emit("accountsChanged", accounts);
146
- return accounts;
147
- } catch (error) {
148
- throw new ProviderRpcError(new Error("accounts not available after login"), {
149
- code: 4001,
150
- shortMessage: "accounts not available after login"
151
- });
152
- }
153
- }
154
- case "eth_sendTransaction": {
155
- const fromAddress = params[0].from;
156
- return this.walletClient.sendTransaction(__spreadProps(__spreadValues({}, formatTransaction(params[0])), {
157
- chain: void 0,
158
- // uses the chain from the wallet client
159
- account: this.accountFromAddress(fromAddress)
160
- }));
161
- }
162
- case "eth_sign":
163
- case "personal_sign": {
164
- return this.walletClient.signMessage({
165
- message: { raw: params[0] },
166
- account: this.accountFromAddress(params[1])
167
- });
168
- }
169
- case "eth_signTransaction": {
170
- const fromAddress = params[0].from;
171
- return this.accountFromAddress(fromAddress).signTransaction(formatTransaction(params[0]));
172
- }
173
- case "eth_signTypedData_v4": {
174
- const fromAddress = params[0];
175
- let typedMessage = params[1];
176
- if (typeof typedMessage === "string") {
177
- typedMessage = JSON.parse(typedMessage);
178
- }
179
- return this.walletClient.signTypedData(__spreadProps(__spreadValues({}, typedMessage), {
180
- account: this.accountFromAddress(fromAddress)
181
- }));
182
- }
183
- case "eth_subscribe": {
184
- if (!this.chainTransportSubscribe) {
185
- throw new ProviderRpcError(new Error("chain does not support subscriptions"), {
186
- code: 4200,
187
- shortMessage: "chain does not support subscriptions"
188
- });
189
- }
190
- const res = yield this.chainTransportSubscribe({
191
- params,
192
- onData: (data) => {
193
- this.emit("message", {
194
- type: "eth_subscription",
195
- data
196
- });
197
- }
198
- });
199
- return res.subscriptionId;
200
- }
201
- case "wallet_addEthereumChain": {
202
- if (!this.chains[params[0].chainId]) {
203
- this.chains[params[0].chainId] = params[0];
204
- }
205
- return null;
206
- }
207
- case "wallet_getPermissions": {
208
- return [];
209
- }
210
- case "wallet_requestPermissions": {
211
- return [];
212
- }
213
- case "wallet_switchEthereumChain": {
214
- if (!this.chains[params[0].chainId]) {
215
- const chain = getViemChain(hexToDecimal(params[0].chainId));
216
- const [hexChainId, addEthereumChainParameter] = this.wagmiChainToAddEthereumChainParameters(chain);
217
- this.chains[hexChainId] = addEthereumChainParameter;
218
- this.setCurrentChain(params[0].chainId);
219
- }
220
- if (this.currentHexChainId !== params[0].chainId) {
221
- this.setCurrentChain(params[0].chainId);
222
- }
223
- return null;
224
- }
225
- case "wallet_watchAsset": {
226
- return false;
227
- }
228
- default: {
229
- return this.walletClient.request({
230
- method,
231
- params
232
- });
233
- }
234
- }
235
- });
236
- this.storage = opts.storageOverride || typeof window === "undefined" ? serverSessionStorageStub : sessionStorage;
237
- this.isModalClosed = true;
238
- this.para = opts.para;
239
- this.disableModal = !!opts.disableModal;
240
- this.viemChains = opts.chains.reduce((acc, curChain) => {
241
- acc[decimalToHex(`${curChain.id}`)] = curChain;
242
- return acc;
243
- }, {});
244
- this.chains = this.wagmiChainsToAddEthereumChainParameters(opts.chains);
245
- this.transports = opts.transports;
246
- this.openModal = opts.openModal;
247
- if (!this.disableModal) {
248
- (_a = opts.renderModal) == null ? void 0 : _a.call(opts, this.closeModal);
249
- }
250
- const defaultChainId = this.getStorageChainId() || opts.chainId;
251
- const currentChainId = this.chains[decimalToHex(defaultChainId)] ? defaultChainId : `${opts.chains[0].id}`;
252
- this.setCurrentChain(decimalToHex(currentChainId));
253
- this.emit("connect", { chainId: this.currentHexChainId });
254
- }
255
- get accounts() {
256
- return this.para.getWalletsByType("EVM").map((w) => w.address);
257
- }
258
- getStorageChainId() {
259
- return this.storage.getItem(STORAGE_CHAIN_ID_KEY);
260
- }
261
- setChainId(hexChainId) {
262
- this.currentHexChainId = hexChainId;
263
- this.storage.setItem(STORAGE_CHAIN_ID_KEY, hexToDecimal(hexChainId));
264
- }
265
- waitForLogin() {
266
- return __async(this, arguments, function* (timeoutMs = TEN_MINUTES_MS) {
267
- const startTime = Date.now();
268
- while (Date.now() - startTime < timeoutMs) {
269
- if (yield this.para.isFullyLoggedIn()) {
270
- return true;
271
- }
272
- if (!this.disableModal && this.isModalClosed) {
273
- throw new ProviderRpcError(new Error("user closed modal"), {
274
- code: 4001,
275
- shortMessage: "user closed modal"
276
- });
277
- }
278
- yield new Promise((resolve) => setTimeout(resolve, 2e3));
279
- }
280
- throw new ProviderRpcError(new Error("timed out waiting for user to log in"), {
281
- code: 4900,
282
- //provider is disconnected code
283
- shortMessage: "timed out waiting for user to log in"
284
- });
285
- });
286
- }
287
- waitForAccounts(timeoutMs = 5e3) {
288
- return __async(this, null, function* () {
289
- const startTime = Date.now();
290
- while (Date.now() - startTime < timeoutMs) {
291
- const accounts = this.accounts;
292
- if (accounts && accounts.length > 0) {
293
- return accounts;
294
- }
295
- yield new Promise((resolve) => setTimeout(resolve, 500));
296
- }
297
- throw new ProviderRpcError(new Error("timed out waiting for accounts to load"), {
298
- code: 4900,
299
- //provider is disconnected code
300
- shortMessage: "timed out waiting for accounts to load"
301
- });
302
- });
303
- }
304
- };
305
-
306
- // src/paraConnector.ts
307
- import { createConnector } from "wagmi";
308
- var PARA_ID = "para";
309
- var PARA_NAME = "Para";
310
- var PARA_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjE2IiBoZWlnaHQ9IjIwNCIgdmlld0JveD0iMCAwIDIxNiAyMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik02MCAwSDE0NEMxODMuNzY0IDAgMjE2IDMyLjIzNTUgMjE2IDcyQzIxNiAxMTEuNzY1IDE4My43NjQgMTQ0IDE0NCAxNDRIOTZDODIuNzQ1MiAxNDQgNzIgMTU0Ljc0NSA3MiAxNjhWMjA0SDBWMTMySDM2QzQ5LjI1NDggMTMyIDYwIDEyMS4yNTUgNjAgMTA4TDYwIDBaIiBmaWxsPSJibGFjayIvPgo8L3N2Zz4K";
311
- var createParaConnector = ({
312
- para,
313
- chains: _chains,
314
- disableModal,
315
- storageOverride,
316
- options,
317
- iconOverride,
318
- nameOverride,
319
- idOverride,
320
- transports,
321
- renderModal,
322
- openModal
323
- }) => {
324
- return createConnector((config) => {
325
- const chains = [...config.chains];
326
- const eip1193Provider = new ParaEIP1193Provider({
327
- para,
328
- chainId: `${chains[0].id}`,
329
- chains,
330
- disableModal,
331
- storageOverride,
332
- transports: transports || config.transports,
333
- renderModal,
334
- openModal
335
- });
336
- const injectedObj = injected(__spreadValues({
337
- target: {
338
- name: PARA_NAME,
339
- id: idOverride != null ? idOverride : PARA_ID,
340
- provider: eip1193Provider
341
- }
342
- }, options))(config);
343
- return __spreadProps(__spreadValues({}, injectedObj), {
344
- type: idOverride != null ? idOverride : PARA_ID,
345
- name: nameOverride != null ? nameOverride : PARA_NAME,
346
- icon: iconOverride != null ? iconOverride : PARA_ICON,
347
- disconnect: () => __async(void 0, null, function* () {
348
- eip1193Provider.closeModal();
349
- yield injectedObj.disconnect();
350
- para.logout();
351
- })
352
- });
353
- });
354
- };
355
- var paraConnector = (opts) => {
356
- return createParaConnector(opts);
357
- };
358
- export {
359
- ParaEIP1193Provider,
360
- createParaConnector,
361
- paraConnector
362
- };
2
+ export * from "./paraConnector.js";
3
+ export * from "./ParaEIP1193Provider.js";
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": false
4
+ }
@@ -17,15 +17,27 @@ export interface ParaConnectorOpts {
17
17
  nameOverride?: string;
18
18
  transports?: Record<number, Transport>;
19
19
  }
20
- export declare const createParaConnector: ({ para, chains: _chains, disableModal, storageOverride, options, iconOverride, nameOverride, idOverride, transports, renderModal, openModal, }: ParaConnectorOpts & {
21
- renderModal?: (onClose: () => void) => void;
22
- openModal?: () => void;
23
- }) => import("wagmi").CreateConnectorFn<unknown, {
20
+ export declare const createParaConnector: ({ para, chains: _chains, disableModal, storageOverride, options, iconOverride, nameOverride, idOverride, transports, renderModal, }: ParaConnectorOpts & {
21
+ renderModal?: (onClose: () => void) => {
22
+ openModal: () => void;
23
+ };
24
+ }) => (config: {
25
+ chains: readonly [Chain, ...Chain[]];
26
+ emitter: import("@wagmi/core/internal").Emitter<import("wagmi").ConnectorEventMap>;
27
+ storage?: {
28
+ key: string;
29
+ getItem: <key extends string, value extends (import("@wagmi/core").StorageItemMap & Record<string, unknown>)[key], defaultValue extends value>(key: key, defaultValue?: defaultValue) => (defaultValue extends null ? value : value) | Promise<defaultValue extends null ? value : value>;
30
+ setItem: <key_1 extends string, value_1 extends (import("@wagmi/core").StorageItemMap & Record<string, unknown>)[key_1]>(key: key_1, value: value_1) => void | Promise<void>;
31
+ removeItem: (key: string) => void | Promise<void>;
32
+ };
33
+ transports?: Record<number, import("wagmi").Transport>;
34
+ }) => {
24
35
  type: string;
25
36
  name: string;
26
37
  icon: string;
27
38
  disconnect: () => Promise<void>;
28
39
  id: string;
40
+ rdns?: string | readonly string[];
29
41
  supportsSimulation?: boolean;
30
42
  setup?: () => Promise<void>;
31
43
  connect: (parameters?: {
@@ -40,8 +52,8 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
40
52
  getProvider: (parameters?: {
41
53
  chainId?: number;
42
54
  }) => Promise<{
43
- on: <TEvent extends keyof import("viem").EIP1193EventMap>(event: TEvent, listener: import("viem").EIP1193EventMap[TEvent]) => void;
44
- removeListener: <TEvent_1 extends keyof import("viem").EIP1193EventMap>(event: TEvent_1, listener: import("viem").EIP1193EventMap[TEvent_1]) => void;
55
+ on: <event extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
56
+ removeListener: <event_1 extends keyof import("viem").EIP1193EventMap>(event: event_1, listener: import("viem").EIP1193EventMap[event_1]) => void;
45
57
  request: import("viem").EIP1193RequestFn<[{
46
58
  Method: "web3_clientVersion";
47
59
  Parameters?: undefined;
@@ -74,6 +86,13 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
74
86
  Method: "eth_call";
75
87
  Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier, stateOverrideSet: import("viem").RpcStateOverride];
76
88
  ReturnType: `0x${string}`;
89
+ }, {
90
+ Method: "eth_createAccessList";
91
+ Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
92
+ ReturnType: {
93
+ accessList: import("viem").AccessList;
94
+ gasUsed: `0x${string}`;
95
+ };
77
96
  }, {
78
97
  Method: "eth_chainId";
79
98
  Parameters?: undefined;
@@ -241,6 +260,40 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
241
260
  Method: "eth_sendRawTransaction";
242
261
  Parameters: [signedTransaction: `0x${string}`];
243
262
  ReturnType: `0x${string}`;
263
+ }, {
264
+ Method: "eth_simulateV1";
265
+ Parameters: [{
266
+ blockStateCalls: readonly {
267
+ blockOverrides?: import("viem").RpcBlockOverrides;
268
+ calls?: readonly import("viem").ExactPartial<import("viem").RpcTransactionRequest>[];
269
+ stateOverrides?: import("viem").RpcStateOverride;
270
+ }[];
271
+ returnFullTransactions?: boolean;
272
+ traceTransfers?: boolean;
273
+ validation?: boolean;
274
+ }, `0x${string}` | import("viem").BlockTag];
275
+ ReturnType: readonly (import("viem").RpcBlock & {
276
+ calls: readonly {
277
+ error?: {
278
+ data?: `0x${string}`;
279
+ code: number;
280
+ message: string;
281
+ };
282
+ logs?: readonly {
283
+ address: `0x${string}`;
284
+ blockHash: `0x${string}`;
285
+ blockNumber: `0x${string}`;
286
+ data: `0x${string}`;
287
+ logIndex: `0x${string}`;
288
+ transactionHash: `0x${string}`;
289
+ transactionIndex: `0x${string}`;
290
+ removed: boolean;
291
+ }[];
292
+ gasUsed: `0x${string}`;
293
+ returnData: `0x${string}`;
294
+ status: `0x${string}`;
295
+ }[];
296
+ })[];
244
297
  }, {
245
298
  Method: "eth_uninstallFilter";
246
299
  Parameters: [filterId: `0x${string}`];
@@ -345,6 +398,10 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
345
398
  Method: "wallet_sendCalls";
346
399
  Parameters?: import("viem").WalletSendCallsParameters<import("viem").WalletCapabilities, `0x${string}`, `0x${string}`>;
347
400
  ReturnType: string;
401
+ }, {
402
+ Method: "wallet_sendTransaction";
403
+ Parameters: [transaction: import("viem").RpcTransactionRequest];
404
+ ReturnType: `0x${string}`;
348
405
  }, {
349
406
  Method: "wallet_showCallsStatus";
350
407
  Parameters?: [string];
@@ -385,7 +442,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
385
442
  ReturnType: readonly `0x${string}`[];
386
443
  }, {
387
444
  Method: "pm_getPaymasterStubData";
388
- Parameters?: [userOperation: import("viem").OneOf<import("wagmi/chains").PartialBy<Pick<{
445
+ Parameters?: [userOperation: import("viem").OneOf<import("viem").PartialBy<Pick<{
389
446
  callData: `0x${string}`;
390
447
  callGasLimit: `0x${string}`;
391
448
  initCode?: `0x${string}`;
@@ -397,7 +454,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
397
454
  sender: `0x${string}`;
398
455
  signature: `0x${string}`;
399
456
  verificationGasLimit: `0x${string}`;
400
- }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("wagmi/chains").PartialBy<Pick<{
457
+ }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("viem").PartialBy<Pick<{
401
458
  callData: `0x${string}`;
402
459
  callGasLimit: `0x${string}`;
403
460
  factory?: `0x${string}`;
@@ -467,7 +524,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
467
524
  paymasterVerificationGasLimit: `0x${string}`;
468
525
  paymasterPostOpGasLimit: `0x${string}`;
469
526
  }>;
470
- }]>;
527
+ }], false>;
471
528
  isApexWallet?: true;
472
529
  isAvalanche?: true;
473
530
  isBackpack?: true;
@@ -503,11 +560,12 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
503
560
  isTokenary?: true;
504
561
  isTrust?: true;
505
562
  isTrustWallet?: true;
563
+ isUniswapWallet?: true;
506
564
  isXDEFI?: true;
507
565
  isZerion?: true;
508
566
  providers?: {
509
- on: <event extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
510
- removeListener: <event_1 extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
567
+ on: <event_2 extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
568
+ removeListener: <event_3 extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
511
569
  request: import("viem").EIP1193RequestFn<[{
512
570
  Method: "web3_clientVersion";
513
571
  Parameters?: undefined;
@@ -540,6 +598,13 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
540
598
  Method: "eth_call";
541
599
  Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier, stateOverrideSet: import("viem").RpcStateOverride];
542
600
  ReturnType: `0x${string}`;
601
+ }, {
602
+ Method: "eth_createAccessList";
603
+ Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
604
+ ReturnType: {
605
+ accessList: import("viem").AccessList;
606
+ gasUsed: `0x${string}`;
607
+ };
543
608
  }, {
544
609
  Method: "eth_chainId";
545
610
  Parameters?: undefined;
@@ -707,6 +772,40 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
707
772
  Method: "eth_sendRawTransaction";
708
773
  Parameters: [signedTransaction: `0x${string}`];
709
774
  ReturnType: `0x${string}`;
775
+ }, {
776
+ Method: "eth_simulateV1";
777
+ Parameters: [{
778
+ blockStateCalls: readonly {
779
+ blockOverrides?: import("viem").RpcBlockOverrides;
780
+ calls?: readonly import("viem").ExactPartial<import("viem").RpcTransactionRequest>[];
781
+ stateOverrides?: import("viem").RpcStateOverride;
782
+ }[];
783
+ returnFullTransactions?: boolean;
784
+ traceTransfers?: boolean;
785
+ validation?: boolean;
786
+ }, `0x${string}` | import("viem").BlockTag];
787
+ ReturnType: readonly (import("viem").RpcBlock & {
788
+ calls: readonly {
789
+ error?: {
790
+ data?: `0x${string}`;
791
+ code: number;
792
+ message: string;
793
+ };
794
+ logs?: readonly {
795
+ address: `0x${string}`;
796
+ blockHash: `0x${string}`;
797
+ blockNumber: `0x${string}`;
798
+ data: `0x${string}`;
799
+ logIndex: `0x${string}`;
800
+ transactionHash: `0x${string}`;
801
+ transactionIndex: `0x${string}`;
802
+ removed: boolean;
803
+ }[];
804
+ gasUsed: `0x${string}`;
805
+ returnData: `0x${string}`;
806
+ status: `0x${string}`;
807
+ }[];
808
+ })[];
710
809
  }, {
711
810
  Method: "eth_uninstallFilter";
712
811
  Parameters: [filterId: `0x${string}`];
@@ -811,6 +910,10 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
811
910
  Method: "wallet_sendCalls";
812
911
  Parameters?: import("viem").WalletSendCallsParameters<import("viem").WalletCapabilities, `0x${string}`, `0x${string}`>;
813
912
  ReturnType: string;
913
+ }, {
914
+ Method: "wallet_sendTransaction";
915
+ Parameters: [transaction: import("viem").RpcTransactionRequest];
916
+ ReturnType: `0x${string}`;
814
917
  }, {
815
918
  Method: "wallet_showCallsStatus";
816
919
  Parameters?: [string];
@@ -851,7 +954,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
851
954
  ReturnType: readonly `0x${string}`[];
852
955
  }, {
853
956
  Method: "pm_getPaymasterStubData";
854
- Parameters?: [userOperation: import("viem").OneOf<import("wagmi/chains").PartialBy<Pick<{
957
+ Parameters?: [userOperation: import("viem").OneOf<import("viem").PartialBy<Pick<{
855
958
  callData: `0x${string}`;
856
959
  callGasLimit: `0x${string}`;
857
960
  initCode?: `0x${string}`;
@@ -863,7 +966,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
863
966
  sender: `0x${string}`;
864
967
  signature: `0x${string}`;
865
968
  verificationGasLimit: `0x${string}`;
866
- }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("wagmi/chains").PartialBy<Pick<{
969
+ }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("viem").PartialBy<Pick<{
867
970
  callData: `0x${string}`;
868
971
  callGasLimit: `0x${string}`;
869
972
  factory?: `0x${string}`;
@@ -933,7 +1036,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
933
1036
  paymasterVerificationGasLimit: `0x${string}`;
934
1037
  paymasterPostOpGasLimit: `0x${string}`;
935
1038
  }>;
936
- }]>;
1039
+ }], false>;
937
1040
  isApexWallet?: true;
938
1041
  isAvalanche?: true;
939
1042
  isBackpack?: true;
@@ -969,6 +1072,7 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
969
1072
  isTokenary?: true;
970
1073
  isTrust?: true;
971
1074
  isTrustWallet?: true;
1075
+ isUniswapWallet?: true;
972
1076
  isXDEFI?: true;
973
1077
  isZerion?: true;
974
1078
  providers?: any[];
@@ -1007,13 +1111,24 @@ export declare const createParaConnector: ({ para, chains: _chains, disableModal
1007
1111
  onConnect: ((connectInfo: import("viem").ProviderConnectInfo) => void) & ((connectInfo: import("viem").ProviderConnectInfo) => void);
1008
1112
  onDisconnect: (error?: Error) => void;
1009
1113
  onMessage?: (message: import("viem").ProviderMessage) => void;
1010
- }, Record<string, unknown>>;
1011
- export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi").CreateConnectorFn<unknown, {
1114
+ };
1115
+ export declare const paraConnector: (opts: ParaConnectorOpts) => (config: {
1116
+ chains: readonly [Chain, ...Chain[]];
1117
+ emitter: import("@wagmi/core/internal").Emitter<import("wagmi").ConnectorEventMap>;
1118
+ storage?: {
1119
+ key: string;
1120
+ getItem: <key extends string, value extends (import("@wagmi/core").StorageItemMap & Record<string, unknown>)[key], defaultValue extends value>(key: key, defaultValue?: defaultValue) => (defaultValue extends null ? value : value) | Promise<defaultValue extends null ? value : value>;
1121
+ setItem: <key_1 extends string, value_1 extends (import("@wagmi/core").StorageItemMap & Record<string, unknown>)[key_1]>(key: key_1, value: value_1) => void | Promise<void>;
1122
+ removeItem: (key: string) => void | Promise<void>;
1123
+ };
1124
+ transports?: Record<number, import("wagmi").Transport>;
1125
+ }) => {
1012
1126
  type: string;
1013
1127
  name: string;
1014
1128
  icon: string;
1015
1129
  disconnect: () => Promise<void>;
1016
1130
  id: string;
1131
+ rdns?: string | readonly string[];
1017
1132
  supportsSimulation?: boolean;
1018
1133
  setup?: () => Promise<void>;
1019
1134
  connect: (parameters?: {
@@ -1028,8 +1143,8 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1028
1143
  getProvider: (parameters?: {
1029
1144
  chainId?: number;
1030
1145
  }) => Promise<{
1031
- on: <TEvent extends keyof import("viem").EIP1193EventMap>(event: TEvent, listener: import("viem").EIP1193EventMap[TEvent]) => void;
1032
- removeListener: <TEvent_1 extends keyof import("viem").EIP1193EventMap>(event: TEvent_1, listener: import("viem").EIP1193EventMap[TEvent_1]) => void;
1146
+ on: <event extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
1147
+ removeListener: <event_1 extends keyof import("viem").EIP1193EventMap>(event: event_1, listener: import("viem").EIP1193EventMap[event_1]) => void;
1033
1148
  request: import("viem").EIP1193RequestFn<[{
1034
1149
  Method: "web3_clientVersion";
1035
1150
  Parameters?: undefined;
@@ -1062,6 +1177,13 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1062
1177
  Method: "eth_call";
1063
1178
  Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier, stateOverrideSet: import("viem").RpcStateOverride];
1064
1179
  ReturnType: `0x${string}`;
1180
+ }, {
1181
+ Method: "eth_createAccessList";
1182
+ Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
1183
+ ReturnType: {
1184
+ accessList: import("viem").AccessList;
1185
+ gasUsed: `0x${string}`;
1186
+ };
1065
1187
  }, {
1066
1188
  Method: "eth_chainId";
1067
1189
  Parameters?: undefined;
@@ -1229,6 +1351,40 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1229
1351
  Method: "eth_sendRawTransaction";
1230
1352
  Parameters: [signedTransaction: `0x${string}`];
1231
1353
  ReturnType: `0x${string}`;
1354
+ }, {
1355
+ Method: "eth_simulateV1";
1356
+ Parameters: [{
1357
+ blockStateCalls: readonly {
1358
+ blockOverrides?: import("viem").RpcBlockOverrides;
1359
+ calls?: readonly import("viem").ExactPartial<import("viem").RpcTransactionRequest>[];
1360
+ stateOverrides?: import("viem").RpcStateOverride;
1361
+ }[];
1362
+ returnFullTransactions?: boolean;
1363
+ traceTransfers?: boolean;
1364
+ validation?: boolean;
1365
+ }, `0x${string}` | import("viem").BlockTag];
1366
+ ReturnType: readonly (import("viem").RpcBlock & {
1367
+ calls: readonly {
1368
+ error?: {
1369
+ data?: `0x${string}`;
1370
+ code: number;
1371
+ message: string;
1372
+ };
1373
+ logs?: readonly {
1374
+ address: `0x${string}`;
1375
+ blockHash: `0x${string}`;
1376
+ blockNumber: `0x${string}`;
1377
+ data: `0x${string}`;
1378
+ logIndex: `0x${string}`;
1379
+ transactionHash: `0x${string}`;
1380
+ transactionIndex: `0x${string}`;
1381
+ removed: boolean;
1382
+ }[];
1383
+ gasUsed: `0x${string}`;
1384
+ returnData: `0x${string}`;
1385
+ status: `0x${string}`;
1386
+ }[];
1387
+ })[];
1232
1388
  }, {
1233
1389
  Method: "eth_uninstallFilter";
1234
1390
  Parameters: [filterId: `0x${string}`];
@@ -1333,6 +1489,10 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1333
1489
  Method: "wallet_sendCalls";
1334
1490
  Parameters?: import("viem").WalletSendCallsParameters<import("viem").WalletCapabilities, `0x${string}`, `0x${string}`>;
1335
1491
  ReturnType: string;
1492
+ }, {
1493
+ Method: "wallet_sendTransaction";
1494
+ Parameters: [transaction: import("viem").RpcTransactionRequest];
1495
+ ReturnType: `0x${string}`;
1336
1496
  }, {
1337
1497
  Method: "wallet_showCallsStatus";
1338
1498
  Parameters?: [string];
@@ -1373,7 +1533,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1373
1533
  ReturnType: readonly `0x${string}`[];
1374
1534
  }, {
1375
1535
  Method: "pm_getPaymasterStubData";
1376
- Parameters?: [userOperation: import("viem").OneOf<import("wagmi/chains").PartialBy<Pick<{
1536
+ Parameters?: [userOperation: import("viem").OneOf<import("viem").PartialBy<Pick<{
1377
1537
  callData: `0x${string}`;
1378
1538
  callGasLimit: `0x${string}`;
1379
1539
  initCode?: `0x${string}`;
@@ -1385,7 +1545,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1385
1545
  sender: `0x${string}`;
1386
1546
  signature: `0x${string}`;
1387
1547
  verificationGasLimit: `0x${string}`;
1388
- }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("wagmi/chains").PartialBy<Pick<{
1548
+ }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("viem").PartialBy<Pick<{
1389
1549
  callData: `0x${string}`;
1390
1550
  callGasLimit: `0x${string}`;
1391
1551
  factory?: `0x${string}`;
@@ -1455,7 +1615,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1455
1615
  paymasterVerificationGasLimit: `0x${string}`;
1456
1616
  paymasterPostOpGasLimit: `0x${string}`;
1457
1617
  }>;
1458
- }]>;
1618
+ }], false>;
1459
1619
  isApexWallet?: true;
1460
1620
  isAvalanche?: true;
1461
1621
  isBackpack?: true;
@@ -1491,11 +1651,12 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1491
1651
  isTokenary?: true;
1492
1652
  isTrust?: true;
1493
1653
  isTrustWallet?: true;
1654
+ isUniswapWallet?: true;
1494
1655
  isXDEFI?: true;
1495
1656
  isZerion?: true;
1496
1657
  providers?: {
1497
- on: <event extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
1498
- removeListener: <event_1 extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
1658
+ on: <event_2 extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
1659
+ removeListener: <event_3 extends keyof import("viem").EIP1193EventMap>(event: event, listener: import("viem").EIP1193EventMap[event]) => void;
1499
1660
  request: import("viem").EIP1193RequestFn<[{
1500
1661
  Method: "web3_clientVersion";
1501
1662
  Parameters?: undefined;
@@ -1528,6 +1689,13 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1528
1689
  Method: "eth_call";
1529
1690
  Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier, stateOverrideSet: import("viem").RpcStateOverride];
1530
1691
  ReturnType: `0x${string}`;
1692
+ }, {
1693
+ Method: "eth_createAccessList";
1694
+ Parameters: [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>] | [transaction: import("viem").ExactPartial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
1695
+ ReturnType: {
1696
+ accessList: import("viem").AccessList;
1697
+ gasUsed: `0x${string}`;
1698
+ };
1531
1699
  }, {
1532
1700
  Method: "eth_chainId";
1533
1701
  Parameters?: undefined;
@@ -1695,6 +1863,40 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1695
1863
  Method: "eth_sendRawTransaction";
1696
1864
  Parameters: [signedTransaction: `0x${string}`];
1697
1865
  ReturnType: `0x${string}`;
1866
+ }, {
1867
+ Method: "eth_simulateV1";
1868
+ Parameters: [{
1869
+ blockStateCalls: readonly {
1870
+ blockOverrides?: import("viem").RpcBlockOverrides;
1871
+ calls?: readonly import("viem").ExactPartial<import("viem").RpcTransactionRequest>[];
1872
+ stateOverrides?: import("viem").RpcStateOverride;
1873
+ }[];
1874
+ returnFullTransactions?: boolean;
1875
+ traceTransfers?: boolean;
1876
+ validation?: boolean;
1877
+ }, `0x${string}` | import("viem").BlockTag];
1878
+ ReturnType: readonly (import("viem").RpcBlock & {
1879
+ calls: readonly {
1880
+ error?: {
1881
+ data?: `0x${string}`;
1882
+ code: number;
1883
+ message: string;
1884
+ };
1885
+ logs?: readonly {
1886
+ address: `0x${string}`;
1887
+ blockHash: `0x${string}`;
1888
+ blockNumber: `0x${string}`;
1889
+ data: `0x${string}`;
1890
+ logIndex: `0x${string}`;
1891
+ transactionHash: `0x${string}`;
1892
+ transactionIndex: `0x${string}`;
1893
+ removed: boolean;
1894
+ }[];
1895
+ gasUsed: `0x${string}`;
1896
+ returnData: `0x${string}`;
1897
+ status: `0x${string}`;
1898
+ }[];
1899
+ })[];
1698
1900
  }, {
1699
1901
  Method: "eth_uninstallFilter";
1700
1902
  Parameters: [filterId: `0x${string}`];
@@ -1799,6 +2001,10 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1799
2001
  Method: "wallet_sendCalls";
1800
2002
  Parameters?: import("viem").WalletSendCallsParameters<import("viem").WalletCapabilities, `0x${string}`, `0x${string}`>;
1801
2003
  ReturnType: string;
2004
+ }, {
2005
+ Method: "wallet_sendTransaction";
2006
+ Parameters: [transaction: import("viem").RpcTransactionRequest];
2007
+ ReturnType: `0x${string}`;
1802
2008
  }, {
1803
2009
  Method: "wallet_showCallsStatus";
1804
2010
  Parameters?: [string];
@@ -1839,7 +2045,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1839
2045
  ReturnType: readonly `0x${string}`[];
1840
2046
  }, {
1841
2047
  Method: "pm_getPaymasterStubData";
1842
- Parameters?: [userOperation: import("viem").OneOf<import("wagmi/chains").PartialBy<Pick<{
2048
+ Parameters?: [userOperation: import("viem").OneOf<import("viem").PartialBy<Pick<{
1843
2049
  callData: `0x${string}`;
1844
2050
  callGasLimit: `0x${string}`;
1845
2051
  initCode?: `0x${string}`;
@@ -1851,7 +2057,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1851
2057
  sender: `0x${string}`;
1852
2058
  signature: `0x${string}`;
1853
2059
  verificationGasLimit: `0x${string}`;
1854
- }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("wagmi/chains").PartialBy<Pick<{
2060
+ }, "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "callData" | "callGasLimit" | "preVerificationGas" | "sender" | "verificationGasLimit" | "initCode">, "maxFeePerGas" | "maxPriorityFeePerGas" | "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "initCode"> | import("viem").PartialBy<Pick<{
1855
2061
  callData: `0x${string}`;
1856
2062
  callGasLimit: `0x${string}`;
1857
2063
  factory?: `0x${string}`;
@@ -1921,7 +2127,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1921
2127
  paymasterVerificationGasLimit: `0x${string}`;
1922
2128
  paymasterPostOpGasLimit: `0x${string}`;
1923
2129
  }>;
1924
- }]>;
2130
+ }], false>;
1925
2131
  isApexWallet?: true;
1926
2132
  isAvalanche?: true;
1927
2133
  isBackpack?: true;
@@ -1957,6 +2163,7 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1957
2163
  isTokenary?: true;
1958
2164
  isTrust?: true;
1959
2165
  isTrustWallet?: true;
2166
+ isUniswapWallet?: true;
1960
2167
  isXDEFI?: true;
1961
2168
  isZerion?: true;
1962
2169
  providers?: any[];
@@ -1995,4 +2202,4 @@ export declare const paraConnector: (opts: ParaConnectorOpts) => import("wagmi")
1995
2202
  onConnect: ((connectInfo: import("viem").ProviderConnectInfo) => void) & ((connectInfo: import("viem").ProviderConnectInfo) => void);
1996
2203
  onDisconnect: (error?: Error) => void;
1997
2204
  onMessage?: (message: import("viem").ProviderMessage) => void;
1998
- }, Record<string, unknown>>;
2205
+ };
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadProps,
5
+ __spreadValues
6
+ } from "./chunk-IV3L3JVM.js";
7
+ import { injected } from "wagmi/connectors";
8
+ import { ParaEIP1193Provider } from "./ParaEIP1193Provider.js";
9
+ import { createConnector } from "wagmi";
10
+ const PARA_ID = "para";
11
+ const PARA_NAME = "Para";
12
+ const PARA_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjE2IiBoZWlnaHQ9IjIwNCIgdmlld0JveD0iMCAwIDIxNiAyMDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik02MCAwSDE0NEMxODMuNzY0IDAgMjE2IDMyLjIzNTUgMjE2IDcyQzIxNiAxMTEuNzY1IDE4My43NjQgMTQ0IDE0NCAxNDRIOTZDODIuNzQ1MiAxNDQgNzIgMTU0Ljc0NSA3MiAxNjhWMjA0SDBWMTMySDM2QzQ5LjI1NDggMTMyIDYwIDEyMS4yNTUgNjAgMTA4TDYwIDBaIiBmaWxsPSJibGFjayIvPgo8L3N2Zz4K";
13
+ const createParaConnector = ({
14
+ para,
15
+ chains: _chains,
16
+ disableModal,
17
+ storageOverride,
18
+ options,
19
+ iconOverride,
20
+ nameOverride,
21
+ idOverride,
22
+ transports,
23
+ renderModal
24
+ }) => {
25
+ return createConnector((config) => {
26
+ const chains = [...config.chains];
27
+ const eip1193Provider = new ParaEIP1193Provider({
28
+ para,
29
+ chainId: `${chains[0].id}`,
30
+ chains,
31
+ disableModal,
32
+ storageOverride,
33
+ transports: transports || config.transports,
34
+ renderModal
35
+ });
36
+ const injectedObj = injected(__spreadValues({
37
+ target: {
38
+ name: PARA_NAME,
39
+ id: idOverride != null ? idOverride : PARA_ID,
40
+ provider: eip1193Provider
41
+ }
42
+ }, options))(config);
43
+ return __spreadProps(__spreadValues({}, injectedObj), {
44
+ type: idOverride != null ? idOverride : PARA_ID,
45
+ name: nameOverride != null ? nameOverride : PARA_NAME,
46
+ icon: iconOverride != null ? iconOverride : PARA_ICON,
47
+ disconnect: () => __async(void 0, null, function* () {
48
+ eip1193Provider.closeModal();
49
+ yield injectedObj.disconnect();
50
+ para.logout();
51
+ })
52
+ });
53
+ });
54
+ };
55
+ const paraConnector = (opts) => {
56
+ return createParaConnector(opts);
57
+ };
58
+ export {
59
+ createParaConnector,
60
+ paraConnector
61
+ };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/wagmi-v2-connector",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "dependencies": {
9
- "@getpara/viem-v2-integration": "2.0.0-alpha.3",
10
- "@getpara/web-sdk": "2.0.0-alpha.3"
9
+ "@getpara/viem-v2-integration": "2.0.0-alpha.5",
10
+ "@getpara/web-sdk": "2.0.0-alpha.5"
11
11
  },
12
12
  "scripts": {
13
13
  "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
@@ -15,18 +15,18 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "typescript": "5.1.6",
18
- "viem": "2.x",
19
- "wagmi": "2.x"
18
+ "viem": "^2.24.2",
19
+ "wagmi": "^2.14.16"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react": "*",
23
23
  "react-dom": "*",
24
- "viem": "2.x",
25
- "wagmi": "2.x"
24
+ "viem": "^2.24.2",
25
+ "wagmi": "^2.14.16"
26
26
  },
27
27
  "files": [
28
28
  "dist",
29
29
  "package.json"
30
30
  ],
31
- "gitHead": "77a1e04b06258842ca9c81e3db2a2b0092517659"
31
+ "gitHead": "3ecfca088f24489f2e8fa5493d0f4459b08880e1"
32
32
  }
package/dist/index.js.br DELETED
Binary file
package/dist/index.js.gz DELETED
Binary file