@reown/appkit-ethers-react-native 0.0.0-feat-multichain-phantom-20250606183519 → 0.0.0-feat-multichain-phantom-20250606195341

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reown/appkit-ethers-react-native",
3
- "version": "0.0.0-feat-multichain-phantom-20250606183519",
3
+ "version": "0.0.0-feat-multichain-phantom-20250606195341",
4
4
  "main": "lib/commonjs/index.js",
5
5
  "types": "lib/typescript/index.d.ts",
6
6
  "module": "lib/module/index.js",
@@ -38,10 +38,10 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@reown/appkit-common-react-native": "0.0.0-feat-multichain-phantom-20250606183519",
42
- "@reown/appkit-react-native": "0.0.0-feat-multichain-phantom-20250606183519",
43
- "@reown/appkit-scaffold-utils-react-native": "0.0.0-feat-multichain-phantom-20250606183519",
44
- "@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-phantom-20250606183519",
41
+ "@reown/appkit-common-react-native": "0.0.0-feat-multichain-phantom-20250606195341",
42
+ "@reown/appkit-react-native": "0.0.0-feat-multichain-phantom-20250606195341",
43
+ "@reown/appkit-scaffold-utils-react-native": "0.0.0-feat-multichain-phantom-20250606195341",
44
+ "@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-phantom-20250606195341",
45
45
  "@walletconnect/ethereum-provider": "2.20.2"
46
46
  },
47
47
  "peerDependencies": {
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EthersAdapter = void 0;
7
- var _appkitCommonReactNative = require("@reown/appkit-common-react-native");
8
- var _appkitScaffoldUtilsReactNative = require("@reown/appkit-scaffold-utils-react-native");
9
- var _helpers = require("./helpers");
10
- class EthersAdapter extends _appkitCommonReactNative.EVMAdapter {
11
- static supportedNamespace = 'eip155';
12
- constructor(configParams) {
13
- super({
14
- projectId: configParams.projectId,
15
- supportedNamespace: EthersAdapter.supportedNamespace
16
- });
17
- }
18
- async getBalance(params) {
19
- const {
20
- network,
21
- address
22
- } = params;
23
- if (!this.connector) throw new Error('No active connector');
24
- if (!network) throw new Error('No network provided');
25
- const balanceAddress = address || this.getAccounts()?.find(account => account.includes(network.id.toString()));
26
- const balance = {
27
- amount: '0.00',
28
- symbol: network.nativeCurrency.symbol || 'ETH'
29
- };
30
- if (!balanceAddress) return balance;
31
- const account = balanceAddress.split(':')[2];
32
- const rpcUrl = network.rpcUrls.default.http?.[0];
33
- if (!rpcUrl || !account) return balance;
34
- try {
35
- const wei = await (0, _helpers.getEthBalance)(rpcUrl, account);
36
- balance.amount = (0, _helpers.formatEther)(wei);
37
- this.emit('balanceChanged', {
38
- address: balanceAddress,
39
- balance
40
- });
41
- return balance;
42
- } catch {
43
- return balance;
44
- }
45
- }
46
- async switchNetwork(network) {
47
- if (!this.connector) throw new Error('No active connector');
48
- const provider = this.connector.getProvider();
49
- if (!provider) throw new Error('No active provider');
50
- try {
51
- await provider.request({
52
- method: 'wallet_switchEthereumChain',
53
- params: [{
54
- chainId: _appkitScaffoldUtilsReactNative.EthersHelpersUtil.numberToHexString(Number(network.id))
55
- }] //TODO: check util
56
- }, `${EthersAdapter.supportedNamespace}:${network.id}`);
57
- } catch (switchError) {
58
- const message = switchError?.message;
59
- if (/(?<temp1>user rejected)/u.test(message?.toLowerCase())) {
60
- throw new Error('Chain is not supported');
61
- }
62
- throw switchError;
63
- }
64
- }
65
- getAccounts() {
66
- if (!this.connector) throw new Error('No active connector');
67
- const namespaces = this.connector.getNamespaces();
68
- return namespaces[this.getSupportedNamespace()]?.accounts;
69
- }
70
- disconnect() {
71
- if (!this.connector) throw new Error('EthersAdapter:disconnect - No active connector');
72
- return this.connector.disconnect();
73
- }
74
- getSupportedNamespace() {
75
- return EthersAdapter.supportedNamespace;
76
- }
77
- }
78
- exports.EthersAdapter = EthersAdapter;
79
- //# sourceMappingURL=adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_appkitCommonReactNative","require","_appkitScaffoldUtilsReactNative","_helpers","EthersAdapter","EVMAdapter","supportedNamespace","constructor","configParams","projectId","getBalance","params","network","address","connector","Error","balanceAddress","getAccounts","find","account","includes","id","toString","balance","amount","symbol","nativeCurrency","split","rpcUrl","rpcUrls","default","http","wei","getEthBalance","formatEther","emit","switchNetwork","provider","getProvider","request","method","chainId","EthersHelpersUtil","numberToHexString","Number","switchError","message","test","toLowerCase","namespaces","getNamespaces","getSupportedNamespace","accounts","disconnect","exports"],"sourceRoot":"../../src","sources":["adapter.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAQA,IAAAC,+BAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEO,MAAMG,aAAa,SAASC,mCAAU,CAAC;EAC5C,OAAeC,kBAAkB,GAAmB,QAAQ;EAE5DC,WAAWA,CAACC,YAAmC,EAAE;IAC/C,KAAK,CAAC;MACJC,SAAS,EAAED,YAAY,CAACC,SAAS;MACjCH,kBAAkB,EAAEF,aAAa,CAACE;IACpC,CAAC,CAAC;EACJ;EAEA,MAAMI,UAAUA,CAACC,MAAwB,EAA+B;IACtE,MAAM;MAAEC,OAAO;MAAEC;IAAQ,CAAC,GAAGF,MAAM;IAEnC,IAAI,CAAC,IAAI,CAACG,SAAS,EAAE,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;IAC3D,IAAI,CAACH,OAAO,EAAE,MAAM,IAAIG,KAAK,CAAC,qBAAqB,CAAC;IAEpD,MAAMC,cAAc,GAClBH,OAAO,IAAI,IAAI,CAACI,WAAW,CAAC,CAAC,EAAEC,IAAI,CAACC,OAAO,IAAIA,OAAO,CAACC,QAAQ,CAACR,OAAO,CAACS,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEzF,MAAMC,OAA2B,GAAG;MAClCC,MAAM,EAAE,MAAM;MACdC,MA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ACH,CAAC,CAAC,OAAOwB,WAAgB,EAAE;MACzB,MAAMC,OAAO,GAAGD,WAAW,EAAEC,OAAiB;MAC9C,IAAI,0BAA0B,CAACC,IAAI,CAACD,OAAO,EAAEE,WAAW,CAAC,CAAC,CAAC,EAAE;QAC3D,MAAM,IAAIjC,KAAK,CAAC,wBAAwB,CAAC;MAC3C;MAEA,MAAM8B,WAAW;IACnB;EACF;EAEA5B,WAAWA,CAAA,EAA8B;IACvC,IAAI,CAAC,IAAI,CAACH,SAAS,EAAE,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;IAC3D,MAAMkC,UAAU,GAAG,IAAI,CAACnC,SAAS,CAACoC,aAAa,CAAC,CAAC;IAEjD,OAAOD,UAAU,CAAC,IAAI,CAACE,qBAAqB,CAAC,CAAC,CAAC,EAAEC,QAAQ;EAC3D;EAEAC,UAAUA,CAAA,EAAkB;IAC1B,IAAI,CAAC,IAAI,CAACvC,SAAS,EAAE,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;IAEtF,OAAO,IAAI,CAACD,SAAS,CAACuC,UAAU,CAAC,CAAC;EACpC;EAEAF,qBAAqBA,CAAA,EAAmB;IACtC,OAAO/C,aAAa,CAACE,kBAAkB;EACzC;AACF;AAACgD,OAAA,CAAAlD,aAAA,GAAAA,aAAA"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.formatEther = void 0;
7
- exports.getEthBalance = getEthBalance;
8
- // Helper to convert Wei (as string or bigint) to ETH
9
- const formatEther = wei => {
10
- return (Number(wei) / 1e18).toString();
11
- };
12
-
13
- // Raw JSON-RPC for balance lookup
14
- exports.formatEther = formatEther;
15
- async function getEthBalance(rpcUrl, address) {
16
- const body = {
17
- jsonrpc: '2.0',
18
- method: 'eth_getBalance',
19
- params: [address, 'latest'],
20
- id: 1
21
- };
22
- const response = await fetch(rpcUrl, {
23
- method: 'POST',
24
- headers: {
25
- 'Content-Type': 'application/json'
26
- },
27
- body: JSON.stringify(body)
28
- });
29
- const json = await response.json();
30
- if (json.error) throw new Error(json.error.message);
31
- return BigInt(json.result); // result is hex string
32
- }
33
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["formatEther","wei","Number","toString","exports","getEthBalance","rpcUrl","address","body","jsonrpc","method","params","id","response","fetch","headers","JSON","stringify","json","error","Error","message","BigInt","result"],"sourceRoot":"../../src","sources":["helpers.ts"],"mappings":";;;;;;;AAAA;AACO,MAAMA,WAAW,GAAIC,GAAW,IAAa;EAClD,OAAO,CAACC,MAAM,CAACD,GAAG,CAAC,GAAG,IAAI,EAAEE,QAAQ,CAAC,CAAC;AACxC,CAAC;;AAED;AAAAC,OAAA,CAAAJ,WAAA,GAAAA,WAAA;AACO,eAAeK,aAAaA,CAACC,MAAc,EAAEC,OAAe,EAAmB;EACpF,MAAMC,IAAI,GAAG;IACXC,OAAO,EAAE,KAAK;IACdC,MAAM,EAAE,gBAAgB;IACxBC,MAAM,EAAE,CAACJ,OAAO,EAAE,QAAQ,CAAC;IAC3BK,EAAE,EAAE;EACN,CAAC;EAED,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACR,MAAM,EAAE;IACnCI,MAAM,EAAE,MAAM;IACdK,OAAO,EAAE;MAAE,cAAc,EAAE;IAAmB,CAAC;IAC/CP,IAAI,EAAEQ,IAAI,CAACC,SAAS,CAACT,IAAI;EAC3B,CAAC,CAAC;EAEF,MAAMU,IAAI,GAAG,MAAML,QAAQ,CAACK,IAAI,CAAC,CAAC;EAClC,IAAIA,IAAI,CAACC,KAAK,EAAE,MAAM,IAAIC,KAAK,CAACF,IAAI,CAACC,KAAK,CAACE,OAAO,CAAC;EAEnD,OAAOC,MAAM,CAACJ,IAAI,CAACK,MAAM,CAAC,CAAC,CAAC;AAC9B"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "EthersAdapter", {
7
- enumerable: true,
8
- get: function () {
9
- return _adapter.EthersAdapter;
10
- }
11
- });
12
- var _adapter = require("./adapter");
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_adapter","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA"}
@@ -1,72 +0,0 @@
1
- import { EVMAdapter } from '@reown/appkit-common-react-native';
2
- import { EthersHelpersUtil } from '@reown/appkit-scaffold-utils-react-native';
3
- import { formatEther, getEthBalance } from './helpers';
4
- export class EthersAdapter extends EVMAdapter {
5
- static supportedNamespace = 'eip155';
6
- constructor(configParams) {
7
- super({
8
- projectId: configParams.projectId,
9
- supportedNamespace: EthersAdapter.supportedNamespace
10
- });
11
- }
12
- async getBalance(params) {
13
- const {
14
- network,
15
- address
16
- } = params;
17
- if (!this.connector) throw new Error('No active connector');
18
- if (!network) throw new Error('No network provided');
19
- const balanceAddress = address || this.getAccounts()?.find(account => account.includes(network.id.toString()));
20
- const balance = {
21
- amount: '0.00',
22
- symbol: network.nativeCurrency.symbol || 'ETH'
23
- };
24
- if (!balanceAddress) return balance;
25
- const account = balanceAddress.split(':')[2];
26
- const rpcUrl = network.rpcUrls.default.http?.[0];
27
- if (!rpcUrl || !account) return balance;
28
- try {
29
- const wei = await getEthBalance(rpcUrl, account);
30
- balance.amount = formatEther(wei);
31
- this.emit('balanceChanged', {
32
- address: balanceAddress,
33
- balance
34
- });
35
- return balance;
36
- } catch {
37
- return balance;
38
- }
39
- }
40
- async switchNetwork(network) {
41
- if (!this.connector) throw new Error('No active connector');
42
- const provider = this.connector.getProvider();
43
- if (!provider) throw new Error('No active provider');
44
- try {
45
- await provider.request({
46
- method: 'wallet_switchEthereumChain',
47
- params: [{
48
- chainId: EthersHelpersUtil.numberToHexString(Number(network.id))
49
- }] //TODO: check util
50
- }, `${EthersAdapter.supportedNamespace}:${network.id}`);
51
- } catch (switchError) {
52
- const message = switchError?.message;
53
- if (/(?<temp1>user rejected)/u.test(message?.toLowerCase())) {
54
- throw new Error('Chain is not supported');
55
- }
56
- throw switchError;
57
- }
58
- }
59
- getAccounts() {
60
- if (!this.connector) throw new Error('No active connector');
61
- const namespaces = this.connector.getNamespaces();
62
- return namespaces[this.getSupportedNamespace()]?.accounts;
63
- }
64
- disconnect() {
65
- if (!this.connector) throw new Error('EthersAdapter:disconnect - No active connector');
66
- return this.connector.disconnect();
67
- }
68
- getSupportedNamespace() {
69
- return EthersAdapter.supportedNamespace;
70
- }
71
- }
72
- //# sourceMappingURL=adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["EVMAdapter","EthersHelpersUtil","formatEther","getEthBalance","EthersAdapter","supportedNamespace","constructor","configParams","projectId","getBalance","params","network","address","connector","Error","balanceAddress","getAccounts","find","account","includes","id","toString","balance","amount","symbol","nativeCurrency","split","rpcUrl","rpcUrls","default","http","wei","emit","switchNetwork","provider","getProvider","request","method","chainId","numberToHexString","Number","switchError","message","test","toLowerCase","namespaces","getNamespaces","getSupportedNamespace","accounts","disconnect"],"sourceRoot":"../../src","sources":["adapter.ts"],"mappings":"AAAA,SACEA,UAAU,QAML,mCAAmC;AAC1C,SAASC,iBAAiB,QAAQ,2CAA2C;AAC7E,SAASC,WAAW,EAAEC,aAAa,QAAQ,WAAW;AAEtD,OAAO,MAAMC,aAAa,SAASJ,UAAU,CAAC;EAC5C,OAAeK,kBAAkB,GAAmB,QAAQ;EAE5DC,WAAWA,CAACC,YAAmC,EAAE;IAC/C,KAAK,CAAC;MACJC,SAAS,EAAED,YAAY,CAACC,SAAS;MACjCH,kBAAkB,EAAED,aAAa,CAACC;IACpC,CAAC,CAAC;EACJ;EAEA,MAAMI,UAAUA,CAACC,MAAwB,EAA+B;IACtE,MAAM;MAAEC,OAAO;MAAEC;IAAQ,CAAC,GAAGF,MAAM;IAEnC,IAAI,CAAC,IAAI,CAACG,SAAS,EAAE,MAAM,I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AAM,IAAIpB,KAAK,CAAC,oBAAoB,CAAC;IAEpD,IAAI;MACF,MAAMoB,QAAQ,CAACE,OAAO,CACpB;QACEC,MAAM,EAAE,4BAA4B;QACpC3B,MAAM,EAAE,CAAC;UAAE4B,OAAO,EAAErC,iBAAiB,CAACsC,iBAAiB,CAACC,MAAM,CAAC7B,OAAO,CAACS,EAAE,CAAC;QAAE,CAAC,CAAC,CAAC;MACjF,CAAC,EACA,GAAEhB,aAAa,CAACC,kBAAmB,IAAGM,OAAO,CAACS,EAAG,EACpD,CAAC;IACH,CAAC,CAAC,OAAOqB,WAAgB,EAAE;MACzB,MAAMC,OAAO,GAAGD,WAAW,EAAEC,OAAiB;MAC9C,IAAI,0BAA0B,CAACC,IAAI,CAACD,OAAO,EAAEE,WAAW,CAAC,CAAC,CAAC,EAAE;QAC3D,MAAM,IAAI9B,KAAK,CAAC,wBAAwB,CAAC;MAC3C;MAEA,MAAM2B,WAAW;IACnB;EACF;EAEAzB,WAAWA,CAAA,EAA8B;IACvC,IAAI,CAAC,IAAI,CAACH,SAAS,EAAE,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;IAC3D,MAAM+B,UAAU,GAAG,IAAI,CAAChC,SAAS,CAACiC,aAAa,CAAC,CAAC;IAEjD,OAAOD,UAAU,CAAC,IAAI,CAACE,qBAAqB,CAAC,CAAC,CAAC,EAAEC,QAAQ;EAC3D;EAEAC,UAAUA,CAAA,EAAkB;IAC1B,IAAI,CAAC,IAAI,CAACpC,SAAS,EAAE,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;IAEtF,OAAO,IAAI,CAACD,SAAS,CAACoC,UAAU,CAAC,CAAC;EACpC;EAEAF,qBAAqBA,CAAA,EAAmB;IACtC,OAAO3C,aAAa,CAACC,kBAAkB;EACzC;AACF"}
@@ -1,25 +0,0 @@
1
- // Helper to convert Wei (as string or bigint) to ETH
2
- export const formatEther = wei => {
3
- return (Number(wei) / 1e18).toString();
4
- };
5
-
6
- // Raw JSON-RPC for balance lookup
7
- export async function getEthBalance(rpcUrl, address) {
8
- const body = {
9
- jsonrpc: '2.0',
10
- method: 'eth_getBalance',
11
- params: [address, 'latest'],
12
- id: 1
13
- };
14
- const response = await fetch(rpcUrl, {
15
- method: 'POST',
16
- headers: {
17
- 'Content-Type': 'application/json'
18
- },
19
- body: JSON.stringify(body)
20
- });
21
- const json = await response.json();
22
- if (json.error) throw new Error(json.error.message);
23
- return BigInt(json.result); // result is hex string
24
- }
25
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["formatEther","wei","Number","toString","getEthBalance","rpcUrl","address","body","jsonrpc","method","params","id","response","fetch","headers","JSON","stringify","json","error","Error","message","BigInt","result"],"sourceRoot":"../../src","sources":["helpers.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,WAAW,GAAIC,GAAW,IAAa;EAClD,OAAO,CAACC,MAAM,CAACD,GAAG,CAAC,GAAG,IAAI,EAAEE,QAAQ,CAAC,CAAC;AACxC,CAAC;;AAED;AACA,OAAO,eAAeC,aAAaA,CAACC,MAAc,EAAEC,OAAe,EAAmB;EACpF,MAAMC,IAAI,GAAG;IACXC,OAAO,EAAE,KAAK;IACdC,MAAM,EAAE,gBAAgB;IACxBC,MAAM,EAAE,CAACJ,OAAO,EAAE,QAAQ,CAAC;IAC3BK,EAAE,EAAE;EACN,CAAC;EAED,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACR,MAAM,EAAE;IACnCI,MAAM,EAAE,MAAM;IACdK,OAAO,EAAE;MAAE,cAAc,EAAE;IAAmB,CAAC;IAC/CP,IAAI,EAAEQ,IAAI,CAACC,SAAS,CAACT,IAAI;EAC3B,CAAC,CAAC;EAEF,MAAMU,IAAI,GAAG,MAAML,QAAQ,CAACK,IAAI,CAAC,CAAC;EAClC,IAAIA,IAAI,CAACC,KAAK,EAAE,MAAM,IAAIC,KAAK,CAACF,IAAI,CAACC,KAAK,CAACE,OAAO,CAAC;EAEnD,OAAOC,MAAM,CAACJ,IAAI,CAACK,MAAM,CAAC,CAAC,CAAC;AAC9B"}
@@ -1,3 +0,0 @@
1
- import { EthersAdapter } from './adapter';
2
- export { EthersAdapter };
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["EthersAdapter"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,QAAQ,WAAW;AACzC,SAASA,aAAa"}
@@ -1,13 +0,0 @@
1
- import { EVMAdapter, type AppKitNetwork, type CaipAddress, type ChainNamespace, type GetBalanceParams, type GetBalanceResponse } from '@reown/appkit-common-react-native';
2
- export declare class EthersAdapter extends EVMAdapter {
3
- private static supportedNamespace;
4
- constructor(configParams: {
5
- projectId: string;
6
- });
7
- getBalance(params: GetBalanceParams): Promise<GetBalanceResponse>;
8
- switchNetwork(network: AppKitNetwork): Promise<void>;
9
- getAccounts(): CaipAddress[] | undefined;
10
- disconnect(): Promise<void>;
11
- getSupportedNamespace(): ChainNamespace;
12
- }
13
- //# sourceMappingURL=adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAI3C,qBAAa,aAAc,SAAQ,UAAU;IAC3C,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA4B;gBAEjD,YAAY,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAOzC,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgCjE,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1D,WAAW,IAAI,WAAW,EAAE,GAAG,SAAS;IAOxC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,qBAAqB,IAAI,cAAc;CAGxC"}
@@ -1,3 +0,0 @@
1
- export declare const formatEther: (wei: bigint) => string;
2
- export declare function getEthBalance(rpcUrl: string, address: string): Promise<bigint>;
3
- //# sourceMappingURL=helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAEzC,CAAC;AAGF,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBpF"}
@@ -1,3 +0,0 @@
1
- import { EthersAdapter } from './adapter';
2
- export { EthersAdapter };
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,CAAC"}