@reef-knot/wallets-helpers 2.0.2 → 2.1.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/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { getWalletConnectConnector } from './walletconnect/getWalletConnectConnector.js';
2
2
  export { getWalletConnectUri } from './walletconnect/getWalletConnectUri.js';
3
3
  export { isValidHttpUrl } from './utils/isValidHttpUrl.js';
4
- export { device, isAndroid, isIOS, isIPad, isMobile, isMobileOrTablet, isTablet, os } from './utils/user-agents.js';
4
+ export { device, isAndroid, isIOS, isIPad, isMobile, isMobileOrTablet, isTablet, os } from './utils/userAgents.js';
5
+ export { getTargetEIP6963, isProviderExistsEIP6963 } from './utils/eip6963.js';
@@ -0,0 +1,297 @@
1
+ import type { Store, Rdns } from 'mipd';
2
+ export declare const getTargetEIP6963: (providersStore: Store, rdns: Rdns) => {
3
+ id: "com.coinbase" | "com.enkrypt" | "io.metamask" | "io.zerion" | (string & {});
4
+ name: string;
5
+ provider: {
6
+ on: <TEvent extends keyof import("viem").EIP1193EventMap>(event: TEvent, listener: import("viem").EIP1193EventMap[TEvent]) => void;
7
+ removeListener: <TEvent_1 extends keyof import("viem").EIP1193EventMap>(event: TEvent_1, listener: import("viem").EIP1193EventMap[TEvent_1]) => void;
8
+ request: import("viem").EIP1193RequestFn<[{
9
+ Method: "web3_clientVersion";
10
+ Parameters?: undefined;
11
+ ReturnType: string;
12
+ }, {
13
+ Method: "web3_sha3";
14
+ Parameters: [data: `0x${string}`];
15
+ ReturnType: string;
16
+ }, {
17
+ Method: "net_listening";
18
+ Parameters?: undefined;
19
+ ReturnType: boolean;
20
+ }, {
21
+ Method: "net_peerCount";
22
+ Parameters?: undefined;
23
+ ReturnType: `0x${string}`;
24
+ }, {
25
+ Method: "net_version";
26
+ Parameters?: undefined;
27
+ ReturnType: `0x${string}`;
28
+ }, {
29
+ Method: "eth_blobBaseFee";
30
+ Parameters?: undefined;
31
+ ReturnType: `0x${string}`;
32
+ }, {
33
+ Method: "eth_blockNumber";
34
+ Parameters?: undefined;
35
+ ReturnType: `0x${string}`;
36
+ }, {
37
+ Method: "eth_call";
38
+ 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];
39
+ ReturnType: `0x${string}`;
40
+ }, {
41
+ Method: "eth_chainId";
42
+ Parameters?: undefined;
43
+ ReturnType: `0x${string}`;
44
+ }, {
45
+ Method: "eth_coinbase";
46
+ Parameters?: undefined;
47
+ ReturnType: `0x${string}`;
48
+ }, {
49
+ Method: "eth_estimateGas";
50
+ Parameters: [transaction: import("viem").RpcTransactionRequest] | [transaction: import("viem").RpcTransactionRequest, block: `0x${string}` | import("viem").BlockTag] | [transaction: import("viem").RpcTransactionRequest, block: `0x${string}` | import("viem").BlockTag, import("viem").RpcStateOverride];
51
+ ReturnType: `0x${string}`;
52
+ }, {
53
+ Method: "eth_feeHistory";
54
+ Parameters: [blockCount: `0x${string}`, newestBlock: `0x${string}` | import("viem").BlockTag, rewardPercentiles: number[] | undefined];
55
+ ReturnType: import("viem").RpcFeeHistory;
56
+ }, {
57
+ Method: "eth_gasPrice";
58
+ Parameters?: undefined;
59
+ ReturnType: `0x${string}`;
60
+ }, {
61
+ Method: "eth_getBalance";
62
+ Parameters: [address: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
63
+ ReturnType: `0x${string}`;
64
+ }, {
65
+ Method: "eth_getBlockByHash";
66
+ Parameters: [hash: `0x${string}`, includeTransactionObjects: boolean];
67
+ ReturnType: import("viem").RpcBlock | null;
68
+ }, {
69
+ Method: "eth_getBlockByNumber";
70
+ Parameters: [block: `0x${string}` | import("viem").BlockTag, includeTransactionObjects: boolean];
71
+ ReturnType: import("viem").RpcBlock | null;
72
+ }, {
73
+ Method: "eth_getBlockTransactionCountByHash";
74
+ Parameters: [hash: `0x${string}`];
75
+ ReturnType: `0x${string}`;
76
+ }, {
77
+ Method: "eth_getBlockTransactionCountByNumber";
78
+ Parameters: [block: `0x${string}` | import("viem").BlockTag];
79
+ ReturnType: `0x${string}`;
80
+ }, {
81
+ Method: "eth_getCode";
82
+ Parameters: [address: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
83
+ ReturnType: `0x${string}`;
84
+ }, {
85
+ Method: "eth_getFilterChanges";
86
+ Parameters: [filterId: `0x${string}`];
87
+ ReturnType: import("viem").RpcLog[] | `0x${string}`[];
88
+ }, {
89
+ Method: "eth_getFilterLogs";
90
+ Parameters: [filterId: `0x${string}`];
91
+ ReturnType: import("viem").RpcLog[];
92
+ }, {
93
+ Method: "eth_getLogs";
94
+ Parameters: [{
95
+ address?: `0x${string}` | `0x${string}`[] | undefined;
96
+ topics?: import("viem").LogTopic[] | undefined;
97
+ } & ({
98
+ fromBlock?: `0x${string}` | import("viem").BlockTag | undefined;
99
+ toBlock?: `0x${string}` | import("viem").BlockTag | undefined;
100
+ blockHash?: undefined;
101
+ } | {
102
+ fromBlock?: undefined;
103
+ toBlock?: undefined;
104
+ blockHash?: `0x${string}` | undefined;
105
+ })];
106
+ ReturnType: import("viem").RpcLog[];
107
+ }, {
108
+ Method: "eth_getProof";
109
+ Parameters: [address: `0x${string}`, storageKeys: `0x${string}`[], block: `0x${string}` | import("viem").BlockTag];
110
+ ReturnType: import("viem").RpcProof;
111
+ }, {
112
+ Method: "eth_getStorageAt";
113
+ Parameters: [address: `0x${string}`, index: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
114
+ ReturnType: `0x${string}`;
115
+ }, {
116
+ Method: "eth_getTransactionByBlockHashAndIndex";
117
+ Parameters: [hash: `0x${string}`, index: `0x${string}`];
118
+ ReturnType: import("viem").RpcTransaction | null;
119
+ }, {
120
+ Method: "eth_getTransactionByBlockNumberAndIndex";
121
+ Parameters: [block: `0x${string}` | import("viem").BlockTag, index: `0x${string}`];
122
+ ReturnType: import("viem").RpcTransaction | null;
123
+ }, {
124
+ Method: "eth_getTransactionByHash";
125
+ Parameters: [hash: `0x${string}`];
126
+ ReturnType: import("viem").RpcTransaction | null;
127
+ }, {
128
+ Method: "eth_getTransactionCount";
129
+ Parameters: [address: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
130
+ ReturnType: `0x${string}`;
131
+ }, {
132
+ Method: "eth_getTransactionReceipt";
133
+ Parameters: [hash: `0x${string}`];
134
+ ReturnType: import("viem").RpcTransactionReceipt | null;
135
+ }, {
136
+ Method: "eth_getUncleByBlockHashAndIndex";
137
+ Parameters: [hash: `0x${string}`, index: `0x${string}`];
138
+ ReturnType: import("viem").RpcUncle | null;
139
+ }, {
140
+ Method: "eth_getUncleByBlockNumberAndIndex";
141
+ Parameters: [block: `0x${string}` | import("viem").BlockTag, index: `0x${string}`];
142
+ ReturnType: import("viem").RpcUncle | null;
143
+ }, {
144
+ Method: "eth_getUncleCountByBlockHash";
145
+ Parameters: [hash: `0x${string}`];
146
+ ReturnType: `0x${string}`;
147
+ }, {
148
+ Method: "eth_getUncleCountByBlockNumber";
149
+ Parameters: [block: `0x${string}` | import("viem").BlockTag];
150
+ ReturnType: `0x${string}`;
151
+ }, {
152
+ Method: "eth_maxPriorityFeePerGas";
153
+ Parameters?: undefined;
154
+ ReturnType: `0x${string}`;
155
+ }, {
156
+ Method: "eth_newBlockFilter";
157
+ Parameters?: undefined;
158
+ ReturnType: `0x${string}`;
159
+ }, {
160
+ Method: "eth_newFilter";
161
+ Parameters: [filter: {
162
+ fromBlock?: `0x${string}` | import("viem").BlockTag | undefined;
163
+ toBlock?: `0x${string}` | import("viem").BlockTag | undefined;
164
+ address?: `0x${string}` | `0x${string}`[] | undefined;
165
+ topics?: import("viem").LogTopic[] | undefined;
166
+ }];
167
+ ReturnType: `0x${string}`;
168
+ }, {
169
+ Method: "eth_newPendingTransactionFilter";
170
+ Parameters?: undefined;
171
+ ReturnType: `0x${string}`;
172
+ }, {
173
+ Method: "eth_protocolVersion";
174
+ Parameters?: undefined;
175
+ ReturnType: string;
176
+ }, {
177
+ Method: "eth_sendRawTransaction";
178
+ Parameters: [signedTransaction: `0x${string}`];
179
+ ReturnType: `0x${string}`;
180
+ }, {
181
+ Method: "eth_uninstallFilter";
182
+ Parameters: [filterId: `0x${string}`];
183
+ ReturnType: boolean;
184
+ }, {
185
+ Method: "eth_accounts";
186
+ Parameters?: undefined;
187
+ ReturnType: `0x${string}`[];
188
+ }, {
189
+ Method: "eth_chainId";
190
+ Parameters?: undefined;
191
+ ReturnType: `0x${string}`;
192
+ }, {
193
+ Method: "eth_estimateGas";
194
+ Parameters: [transaction: import("viem").RpcTransactionRequest] | [transaction: import("viem").RpcTransactionRequest, block: `0x${string}` | import("viem").BlockTag] | [transaction: import("viem").RpcTransactionRequest, block: `0x${string}` | import("viem").BlockTag, import("viem").RpcStateOverride];
195
+ ReturnType: `0x${string}`;
196
+ }, {
197
+ Method: "eth_requestAccounts";
198
+ Parameters?: undefined;
199
+ ReturnType: `0x${string}`[];
200
+ }, {
201
+ Method: "eth_sendTransaction";
202
+ Parameters: [transaction: import("viem").RpcTransactionRequest];
203
+ ReturnType: `0x${string}`;
204
+ }, {
205
+ Method: "eth_sendRawTransaction";
206
+ Parameters: [signedTransaction: `0x${string}`];
207
+ ReturnType: `0x${string}`;
208
+ }, {
209
+ Method: "eth_sign";
210
+ Parameters: [address: `0x${string}`, data: `0x${string}`];
211
+ ReturnType: `0x${string}`;
212
+ }, {
213
+ Method: "eth_signTransaction";
214
+ Parameters: [request: import("viem").RpcTransactionRequest];
215
+ ReturnType: `0x${string}`;
216
+ }, {
217
+ Method: "eth_signTypedData_v4";
218
+ Parameters: [address: `0x${string}`, message: string];
219
+ ReturnType: `0x${string}`;
220
+ }, {
221
+ Method: "eth_syncing";
222
+ Parameters?: undefined;
223
+ ReturnType: false | import("viem").NetworkSync;
224
+ }, {
225
+ Method: "personal_sign";
226
+ Parameters: [data: `0x${string}`, address: `0x${string}`];
227
+ ReturnType: `0x${string}`;
228
+ }, {
229
+ Method: "wallet_addEthereumChain";
230
+ Parameters: [chain: import("viem").AddEthereumChainParameter];
231
+ ReturnType: null;
232
+ }, {
233
+ Method: "wallet_getCallsStatus";
234
+ Parameters?: [string] | undefined;
235
+ ReturnType: import("viem").WalletGetCallsStatusReturnType<`0x${string}`, `0x${string}`>;
236
+ }, {
237
+ Method: "wallet_getCapabilities";
238
+ Parameters?: [`0x${string}`] | undefined;
239
+ ReturnType: {
240
+ [x: `0x${string}`]: import("viem").WalletCapabilities;
241
+ };
242
+ }, {
243
+ Method: "wallet_getPermissions";
244
+ Parameters?: undefined;
245
+ ReturnType: import("viem").WalletPermission[];
246
+ }, {
247
+ Method: "wallet_issuePermissions";
248
+ Parameters?: [import("viem").WalletIssuePermissionsParameters] | undefined;
249
+ ReturnType: {
250
+ expiry: number;
251
+ factory?: `0x${string}` | undefined;
252
+ factoryData?: string | undefined;
253
+ grantedPermissions: readonly {
254
+ type: string;
255
+ data: any;
256
+ }[];
257
+ permissionsContext: string;
258
+ signerData?: {
259
+ userOpBuilder?: `0x${string}` | undefined;
260
+ submitToAddress?: `0x${string}` | undefined;
261
+ } | undefined;
262
+ };
263
+ }, {
264
+ Method: "wallet_requestPermissions";
265
+ Parameters: [permissions: {
266
+ eth_accounts: Record<string, any>;
267
+ }];
268
+ ReturnType: import("viem").WalletPermission[];
269
+ }, {
270
+ Method: "wallet_revokePermissions";
271
+ Parameters: [permissions: {
272
+ eth_accounts: Record<string, any>;
273
+ }];
274
+ ReturnType: null;
275
+ }, {
276
+ Method: "wallet_sendCalls";
277
+ Parameters?: import("viem").WalletSendCallsParameters<import("viem").WalletCapabilities, `0x${string}`, `0x${string}`> | undefined;
278
+ ReturnType: string;
279
+ }, {
280
+ Method: "wallet_showCallsStatus";
281
+ Parameters?: [string] | undefined;
282
+ ReturnType: void;
283
+ }, {
284
+ Method: "wallet_switchEthereumChain";
285
+ Parameters: [chain: {
286
+ chainId: string;
287
+ }];
288
+ ReturnType: null;
289
+ }, {
290
+ Method: "wallet_watchAsset";
291
+ Parameters: import("viem").WatchAssetParams;
292
+ ReturnType: boolean;
293
+ }]>;
294
+ };
295
+ } | undefined;
296
+ export declare const isProviderExistsEIP6963: (providersStore: Store, rdns: Rdns) => boolean;
297
+ //# sourceMappingURL=eip6963.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip6963.d.ts","sourceRoot":"","sources":["../../src/utils/eip6963.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAExC,eAAO,MAAM,gBAAgB,mBAAoB,KAAK,QAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAQjE,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAAoB,KAAK,QAAQ,IAAI,YACzB,CAAC"}
@@ -0,0 +1,16 @@
1
+ const getTargetEIP6963 = (providersStore, rdns) => {
2
+ const providerDetail = providersStore.findProvider({
3
+ rdns
4
+ });
5
+ if (!providerDetail) return undefined;
6
+ return {
7
+ id: providerDetail.info.rdns,
8
+ name: providerDetail.info.name,
9
+ provider: providerDetail.provider
10
+ };
11
+ };
12
+ const isProviderExistsEIP6963 = (providersStore, rdns) => Boolean(providersStore.findProvider({
13
+ rdns
14
+ }));
15
+
16
+ export { getTargetEIP6963, isProviderExistsEIP6963 };
@@ -1,3 +1,4 @@
1
1
  export * from './isValidHttpUrl';
2
- export * from './user-agents';
2
+ export * from './userAgents';
3
+ export * from './eip6963';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
@@ -7,4 +7,4 @@ export declare const isIPad: boolean;
7
7
  export declare const isMobile: boolean;
8
8
  export declare const isTablet: boolean;
9
9
  export declare const isMobileOrTablet: boolean;
10
- //# sourceMappingURL=user-agents.d.ts.map
10
+ //# sourceMappingURL=userAgents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userAgents.d.ts","sourceRoot":"","sources":["../../src/utils/userAgents.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,EAAE,4BAAiB,CAAC;AACjC,eAAO,MAAM,KAAK,SAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,SAAwB,CAAC;AAE/C,eAAO,MAAM,MAAM,gCAAqB,CAAC;AACzC,eAAO,MAAM,MAAM,SAA0B,CAAC;AAC9C,eAAO,MAAM,QAAQ,SAA2B,CAAC;AACjD,eAAO,MAAM,QAAQ,SAA2B,CAAC;AACjD,eAAO,MAAM,gBAAgB,SAAuB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/wallets-helpers",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-agents.d.ts","sourceRoot":"","sources":["../../src/utils/user-agents.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,EAAE,4BAAiB,CAAC;AACjC,eAAO,MAAM,KAAK,SAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,SAAwB,CAAC;AAE/C,eAAO,MAAM,MAAM,gCAAqB,CAAC;AACzC,eAAO,MAAM,MAAM,SAA0B,CAAC;AAC9C,eAAO,MAAM,QAAQ,SAA2B,CAAC;AACjD,eAAO,MAAM,QAAQ,SAA2B,CAAC;AACjD,eAAO,MAAM,gBAAgB,SAAuB,CAAC"}
File without changes