@dynamic-labs/multi-wallet 0.5.19

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.
Files changed (91) hide show
  1. package/LICENSE +201 -0
  2. package/package.json +25 -0
  3. package/src/data/wallet-connect-wallets.json +6265 -0
  4. package/src/data/wallet-links.json +2134 -0
  5. package/src/index.d.ts +15 -0
  6. package/src/index.js +48 -0
  7. package/src/index.js.map +1 -0
  8. package/src/multi-wallet.d.ts +10 -0
  9. package/src/multi-wallet.js +126 -0
  10. package/src/multi-wallet.js.map +1 -0
  11. package/src/polyfills.d.ts +1 -0
  12. package/src/polyfills.js +16 -0
  13. package/src/polyfills.js.map +1 -0
  14. package/src/services/name-service-lookup.d.ts +6 -0
  15. package/src/services/name-service-lookup.js +25 -0
  16. package/src/services/name-service-lookup.js.map +1 -0
  17. package/src/types.d.ts +44 -0
  18. package/src/types.js +3 -0
  19. package/src/types.js.map +1 -0
  20. package/src/utils/console.d.ts +4 -0
  21. package/src/utils/console.js +18 -0
  22. package/src/utils/console.js.map +1 -0
  23. package/src/utils/convertors.d.ts +1 -0
  24. package/src/utils/convertors.js +11 -0
  25. package/src/utils/convertors.js.map +1 -0
  26. package/src/utils/isMobile.d.ts +4 -0
  27. package/src/utils/isMobile.js +13 -0
  28. package/src/utils/isMobile.js.map +1 -0
  29. package/src/utils/message.d.ts +10 -0
  30. package/src/utils/message.js +44 -0
  31. package/src/utils/message.js.map +1 -0
  32. package/src/utils/normalizeWalletName.d.ts +1 -0
  33. package/src/utils/normalizeWalletName.js +6 -0
  34. package/src/utils/normalizeWalletName.js.map +1 -0
  35. package/src/utils/platform.d.ts +3 -0
  36. package/src/utils/platform.js +11 -0
  37. package/src/utils/platform.js.map +1 -0
  38. package/src/utils/walletConnect.d.ts +5 -0
  39. package/src/utils/walletConnect.js +21 -0
  40. package/src/utils/walletConnect.js.map +1 -0
  41. package/src/utils/walletLinks.d.ts +15 -0
  42. package/src/utils/walletLinks.js +13 -0
  43. package/src/utils/walletLinks.js.map +1 -0
  44. package/src/wallets/clients/coinbase/coinbase.d.ts +6 -0
  45. package/src/wallets/clients/coinbase/coinbase.js +73 -0
  46. package/src/wallets/clients/coinbase/coinbase.js.map +1 -0
  47. package/src/wallets/clients/coinbase/index.d.ts +2 -0
  48. package/src/wallets/clients/coinbase/index.js +19 -0
  49. package/src/wallets/clients/coinbase/index.js.map +1 -0
  50. package/src/wallets/clients/coinbase/types.d.ts +12 -0
  51. package/src/wallets/clients/coinbase/types.js +3 -0
  52. package/src/wallets/clients/coinbase/types.js.map +1 -0
  53. package/src/wallets/ethereum/coinbase.d.ts +19 -0
  54. package/src/wallets/ethereum/coinbase.js +56 -0
  55. package/src/wallets/ethereum/coinbase.js.map +1 -0
  56. package/src/wallets/ethereum/eth-provider.d.ts +27 -0
  57. package/src/wallets/ethereum/eth-provider.js +131 -0
  58. package/src/wallets/ethereum/eth-provider.js.map +1 -0
  59. package/src/wallets/ethereum/meta-mask.d.ts +17 -0
  60. package/src/wallets/ethereum/meta-mask.js +78 -0
  61. package/src/wallets/ethereum/meta-mask.js.map +1 -0
  62. package/src/wallets/ethereum/tallyho.d.ts +13 -0
  63. package/src/wallets/ethereum/tallyho.js +40 -0
  64. package/src/wallets/ethereum/tallyho.js.map +1 -0
  65. package/src/wallets/solana/glow.d.ts +11 -0
  66. package/src/wallets/solana/glow.js +35 -0
  67. package/src/wallets/solana/glow.js.map +1 -0
  68. package/src/wallets/solana/phantom.d.ts +11 -0
  69. package/src/wallets/solana/phantom.js +42 -0
  70. package/src/wallets/solana/phantom.js.map +1 -0
  71. package/src/wallets/solana/slope.d.ts +22 -0
  72. package/src/wallets/solana/slope.js +58 -0
  73. package/src/wallets/solana/slope.js.map +1 -0
  74. package/src/wallets/solana/sol-providers.d.ts +27 -0
  75. package/src/wallets/solana/sol-providers.js +100 -0
  76. package/src/wallets/solana/sol-providers.js.map +1 -0
  77. package/src/wallets/solana/solflare.d.ts +11 -0
  78. package/src/wallets/solana/solflare.js +57 -0
  79. package/src/wallets/solana/solflare.js.map +1 -0
  80. package/src/wallets/wallet-connect-client.d.ts +50 -0
  81. package/src/wallets/wallet-connect-client.js +155 -0
  82. package/src/wallets/wallet-connect-client.js.map +1 -0
  83. package/src/wallets/wallet-connect.d.ts +17 -0
  84. package/src/wallets/wallet-connect.js +82 -0
  85. package/src/wallets/wallet-connect.js.map +1 -0
  86. package/src/wallets/wallet-connector.d.ts +23 -0
  87. package/src/wallets/wallet-connector.js +3 -0
  88. package/src/wallets/wallet-connector.js.map +1 -0
  89. package/src/wallets/window.d.ts +46 -0
  90. package/src/wallets/window.js +3 -0
  91. package/src/wallets/window.js.map +1 -0
package/src/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import Console from './utils/console';
2
+ import './polyfills';
3
+ export * from './multi-wallet';
4
+ export * from './types';
5
+ export { Console };
6
+ export type { WalletConnector, Chain, FetchPublicAddressOpts, } from './wallets/wallet-connector';
7
+ export { generateMessageToSign } from './utils/message';
8
+ export { isMobile } from './utils/isMobile';
9
+ export { isAndroid, isPhone, isIPad } from './utils/platform';
10
+ export { normalizeWalletName } from './utils/normalizeWalletName';
11
+ export { walletMetadata, getWalletConnectMetadata, } from './utils/walletConnect';
12
+ export { getWalletLinks } from './utils/walletLinks';
13
+ export * from './wallets/wallet-connect-client';
14
+ export * from './wallets/clients/coinbase';
15
+ export type { LookupData } from './services/name-service-lookup';
package/src/index.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.getWalletLinks = exports.getWalletConnectMetadata = exports.walletMetadata = exports.normalizeWalletName = exports.isIPad = exports.isPhone = exports.isAndroid = exports.isMobile = exports.generateMessageToSign = exports.Console = void 0;
21
+ const console_1 = __importDefault(require("./utils/console"));
22
+ exports.Console = console_1.default;
23
+ require("./polyfills");
24
+ //
25
+ // TODO
26
+ // - README
27
+ // - Tests + Mocked wallet
28
+ //
29
+ __exportStar(require("./multi-wallet"), exports);
30
+ __exportStar(require("./types"), exports);
31
+ var message_1 = require("./utils/message");
32
+ Object.defineProperty(exports, "generateMessageToSign", { enumerable: true, get: function () { return message_1.generateMessageToSign; } });
33
+ var isMobile_1 = require("./utils/isMobile");
34
+ Object.defineProperty(exports, "isMobile", { enumerable: true, get: function () { return isMobile_1.isMobile; } });
35
+ var platform_1 = require("./utils/platform");
36
+ Object.defineProperty(exports, "isAndroid", { enumerable: true, get: function () { return platform_1.isAndroid; } });
37
+ Object.defineProperty(exports, "isPhone", { enumerable: true, get: function () { return platform_1.isPhone; } });
38
+ Object.defineProperty(exports, "isIPad", { enumerable: true, get: function () { return platform_1.isIPad; } });
39
+ var normalizeWalletName_1 = require("./utils/normalizeWalletName");
40
+ Object.defineProperty(exports, "normalizeWalletName", { enumerable: true, get: function () { return normalizeWalletName_1.normalizeWalletName; } });
41
+ var walletConnect_1 = require("./utils/walletConnect");
42
+ Object.defineProperty(exports, "walletMetadata", { enumerable: true, get: function () { return walletConnect_1.walletMetadata; } });
43
+ Object.defineProperty(exports, "getWalletConnectMetadata", { enumerable: true, get: function () { return walletConnect_1.getWalletConnectMetadata; } });
44
+ var walletLinks_1 = require("./utils/walletLinks");
45
+ Object.defineProperty(exports, "getWalletLinks", { enumerable: true, get: function () { return walletLinks_1.getWalletLinks; } });
46
+ __exportStar(require("./wallets/wallet-connect-client"), exports);
47
+ __exportStar(require("./wallets/clients/coinbase"), exports);
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/multi-wallet/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8DAAsC;AAY7B,kBAZF,iBAAO,CAYE;AAVhB,uBAAqB;AAErB,EAAE;AACF,OAAO;AACP,WAAW;AACX,0BAA0B;AAC1B,EAAE;AAEF,iDAA+B;AAC/B,0CAAwB;AAQxB,2CAAwD;AAA/C,gHAAA,qBAAqB,OAAA;AAC9B,6CAA4C;AAAnC,oGAAA,QAAQ,OAAA;AACjB,6CAA8D;AAArD,qGAAA,SAAS,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,kGAAA,MAAM,OAAA;AACnC,mEAAkE;AAAzD,0HAAA,mBAAmB,OAAA;AAC5B,uDAG+B;AAF7B,+GAAA,cAAc,OAAA;AACd,yHAAA,wBAAwB,OAAA;AAE1B,mDAAqD;AAA5C,6GAAA,cAAc,OAAA;AAEvB,kEAAgD;AAChD,6DAA2C"}
@@ -0,0 +1,10 @@
1
+ import { Chain, WalletConnector } from './wallets/wallet-connector';
2
+ import { GetSupportedWallets, GetSupportedWalletsOpts } from './types';
3
+ export declare const getSupportedWallets: GetSupportedWallets;
4
+ export declare const getSupportedChainsForWalletConnector: (walletConnector: WalletConnector) => Chain[];
5
+ export declare const getEnabledWallets: (props: {
6
+ enabledChains: Chain[];
7
+ getSupportedWalletOpts: GetSupportedWalletsOpts;
8
+ installed: boolean;
9
+ }) => WalletConnector[];
10
+ export declare const orderWallets: (wallets: WalletConnector[]) => WalletConnector[];
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.orderWallets = exports.getEnabledWallets = exports.getSupportedChainsForWalletConnector = exports.getSupportedWallets = void 0;
7
+ const phantom_1 = __importDefault(require("./wallets/solana/phantom"));
8
+ const meta_mask_1 = __importDefault(require("./wallets/ethereum/meta-mask"));
9
+ const coinbase_1 = __importDefault(require("./wallets/ethereum/coinbase"));
10
+ const tallyho_1 = __importDefault(require("./wallets/ethereum/tallyho"));
11
+ const slope_1 = __importDefault(require("./wallets/solana/slope"));
12
+ const solflare_1 = __importDefault(require("./wallets/solana/solflare"));
13
+ const glow_1 = __importDefault(require("./wallets/solana/glow"));
14
+ const wallet_connect_1 = __importDefault(require("./wallets/wallet-connect"));
15
+ const platform_1 = require("./utils/platform");
16
+ const isMobile_1 = require("./utils/isMobile");
17
+ const walletLinks_1 = require("./utils/walletLinks");
18
+ const normalizeWalletName_1 = require("./utils/normalizeWalletName");
19
+ const walletConnect_1 = require("./utils/walletConnect");
20
+ // TODO : Add constructor that defines which wallets need to be loaded
21
+ let wallets = [];
22
+ const getSupportedWallets = ({ appLogoUrl, appName } = { appLogoUrl: '', appName: '' }) => {
23
+ if (wallets.length > 0) {
24
+ return wallets;
25
+ }
26
+ const walletConnectWallets = (0, walletConnect_1.fetchWalletConnectWallets)();
27
+ // temporary hack to filter out metamask, which currently has walletconnect
28
+ // functionality built-in
29
+ // also filter out trust, which has issues with signing
30
+ // follow-up on: https://github.com/trustwallet/wallet-core/issues/2197
31
+ const filtered = walletConnectWallets.filter(({ name }) => name !== 'MetaMask' && name.toLocaleLowerCase() !== 'trust');
32
+ const allWallets = [
33
+ new phantom_1.default(),
34
+ new meta_mask_1.default(),
35
+ new coinbase_1.default({ appLogoUrl, appName }),
36
+ new tallyho_1.default(),
37
+ new solflare_1.default(),
38
+ new glow_1.default(),
39
+ new slope_1.default(),
40
+ new wallet_connect_1.default({ walletName: 'WalletConnect' }),
41
+ ...filtered,
42
+ ];
43
+ /**
44
+ * this function is meant to filter down wallets on mobile since we do not have
45
+ * deeplinking support for all wallets
46
+ *
47
+ * wallets-links.json is the source of truth for wallet support on mobile platforms.
48
+ * if a wallet has a non-empty value for ios, that means that wallet has an ios app
49
+ * and we support that app. the same goes for android
50
+ */
51
+ const filteredWalletsForPlatform = allWallets.filter((wallet) => {
52
+ const name = (0, normalizeWalletName_1.normalizeWalletName)(wallet.name);
53
+ const links = (0, walletLinks_1.getWalletLinks)(name);
54
+ // for now, treat ipad the same as iphone
55
+ // in the future, we may want to only show wallets that can connect via qrcode,
56
+ // or that have a safari extension
57
+ if ((0, platform_1.isPhone)() || (0, platform_1.isIPad)()) {
58
+ return links.mobile.ios !== '';
59
+ }
60
+ if ((0, isMobile_1.isMobile)()) {
61
+ return links.mobile.android !== '';
62
+ }
63
+ return true;
64
+ });
65
+ wallets = filteredWalletsForPlatform;
66
+ return wallets;
67
+ };
68
+ exports.getSupportedWallets = getSupportedWallets;
69
+ const chainStringToChain = {
70
+ 'eip155:1': 'ETH',
71
+ };
72
+ const getSupportedChainsForWalletConnector = (walletConnector) => {
73
+ const metadata = (0, walletConnect_1.getWalletConnectMetadata)(walletConnector.name);
74
+ // if this walletConnector is in the metadata, then it is a WalletConnect wallet
75
+ if (metadata) {
76
+ /**
77
+ * chains could contain multiple eth networks eg
78
+ * "eip155:1",
79
+ * "eip155:10",
80
+ * "eip155:56",
81
+ * "eip155:100",
82
+ *
83
+ * so we will use a set to ensure uniqueness
84
+ */
85
+ const chainSet = new Set();
86
+ const chainStringList = metadata.chains;
87
+ chainStringList.forEach((chainString) => {
88
+ const chain = chainStringToChain[chainString];
89
+ chainSet.add(chain);
90
+ });
91
+ return [...chainSet];
92
+ }
93
+ return walletConnector.supportedChains;
94
+ };
95
+ exports.getSupportedChainsForWalletConnector = getSupportedChainsForWalletConnector;
96
+ const getEnabledWallets = (props) => {
97
+ const allEnabledWallets = (0, exports.getSupportedWallets)(props.getSupportedWalletOpts).filter((wallet) => props.enabledChains.some((c) => (0, exports.getSupportedChainsForWalletConnector)(wallet).includes(c)) && wallet.isInstalledOnBrowser() === props.installed);
98
+ return (0, exports.orderWallets)(allEnabledWallets);
99
+ };
100
+ exports.getEnabledWallets = getEnabledWallets;
101
+ // Priority order:
102
+ // Metamask, Phantom, Coinbase, Rainbow, *Trust*, Glow, Slope, TallyHo, [all the rest in walletAllowlist]
103
+ const orderWallets = (wallets) => {
104
+ const topNames = [
105
+ 'metamask',
106
+ 'phantom',
107
+ 'coinbase',
108
+ 'rainbow',
109
+ 'walletconnect',
110
+ //'trust', // TODO: follow-up on https://github.com/trustwallet/wallet-core/issues/2197
111
+ 'glow',
112
+ 'slope',
113
+ 'tallyho',
114
+ ];
115
+ const topEnabledWallets = filterWalletsByName(wallets, topNames);
116
+ // bottom wallets = anything else that didn't bubble up to the top
117
+ const bottomEnabledWallets = wallets.filter((w) => !topEnabledWallets.includes(w));
118
+ return topEnabledWallets.concat(bottomEnabledWallets);
119
+ };
120
+ exports.orderWallets = orderWallets;
121
+ const filterWalletsByName = (wallets, names) => names
122
+ .flatMap((name) => wallets.find((w) => walletHasName(w, name)))
123
+ .filter(isWalletConnector);
124
+ const walletHasName = (wallet, name) => (0, normalizeWalletName_1.normalizeWalletName)(wallet.name) === name;
125
+ const isWalletConnector = (item) => Boolean(item);
126
+ //# sourceMappingURL=multi-wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-wallet.js","sourceRoot":"","sources":["../../../../packages/multi-wallet/src/multi-wallet.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,6EAAoD;AAEpD,2EAAmD;AACnD,yEAAiD;AACjD,mEAA2C;AAC3C,yEAAiD;AACjD,iEAAyC;AACzC,8EAAqD;AAErD,+CAAmD;AACnD,+CAA4C;AAC5C,qDAAqD;AACrD,qEAAkE;AAClE,yDAG+B;AAE/B,sEAAsE;AAEtE,IAAI,OAAO,GAAsB,EAA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@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const buffer_1 = require("buffer");
5
+ /**
6
+ * @walletconnect/client and @walletconnect/qrcode-modal use `global` and `Buffer`, respectively.
7
+ * This issue is captured here: https://github.com/WalletConnect/walletconnect-monorepo/issues/341
8
+ * Here are some GH issues of others facing the same problem:
9
+ * * https://github.com/WalletConnect/walletconnect-monorepo/issues/734
10
+ * * https://github.com/WalletConnect/walletconnect-monorepo/issues/748
11
+ */
12
+ if (typeof window !== 'undefined') {
13
+ window.global = globalThis;
14
+ window.Buffer = buffer_1.Buffer;
15
+ }
16
+ //# sourceMappingURL=polyfills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../../../../packages/multi-wallet/src/polyfills.ts"],"names":[],"mappings":";AAAA,oBAAoB;;AAEpB,mCAAgC;AAEhC;;;;;;GAMG;AACH,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,MAAM,GAAG,eAAM,CAAC;CACxB"}
@@ -0,0 +1,6 @@
1
+ import { ethers } from 'ethers';
2
+ export interface LookupData {
3
+ avatar?: string;
4
+ name?: string;
5
+ }
6
+ export declare const nameServiceLookup: (provider: ethers.providers.Web3Provider | ethers.providers.BaseProvider | undefined, address: string) => Promise<LookupData | undefined>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.nameServiceLookup = void 0;
13
+ const nameServiceLookup = (provider, address) => __awaiter(void 0, void 0, void 0, function* () {
14
+ if (!provider) {
15
+ return Promise.resolve(undefined);
16
+ }
17
+ const ensName = yield provider.lookupAddress(address);
18
+ const ensAvatar = yield provider.getAvatar(address);
19
+ return {
20
+ avatar: ensAvatar !== null && ensAvatar !== void 0 ? ensAvatar : undefined,
21
+ name: ensName !== null && ensName !== void 0 ? ensName : undefined,
22
+ };
23
+ });
24
+ exports.nameServiceLookup = nameServiceLookup;
25
+ //# sourceMappingURL=name-service-lookup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-service-lookup.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/services/name-service-lookup.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOO,MAAM,iBAAiB,GAAG,CAC/B,QAGa,EACb,OAAe,EACkB,EAAE;IACnC,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;KACnC;IAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAEpD,OAAO;QACL,MAAM,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,SAAS;QAC9B,IAAI,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,SAAS;KAC3B,CAAC;AACJ,CAAC,CAAA,CAAC;AAlBW,QAAA,iBAAiB,qBAkB5B"}
package/src/types.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { WalletConnector } from './wallets/wallet-connector';
2
+ export declare type WalletConnectWalletMetadata = {
3
+ app: {
4
+ android: string | null;
5
+ browser: string | null;
6
+ ios: string | null;
7
+ linux: string | null;
8
+ mac: string | null;
9
+ windows: string | null;
10
+ };
11
+ app_type: string;
12
+ chains: string[];
13
+ description: string | null;
14
+ desktop: {
15
+ native: string | null;
16
+ universal: string | null;
17
+ };
18
+ homepage: string;
19
+ id: string;
20
+ image_id: string;
21
+ image_url: {
22
+ lg: string;
23
+ md: string;
24
+ sm: string;
25
+ };
26
+ metadata: {
27
+ colors: {
28
+ primary: string | null;
29
+ secondary: string | null;
30
+ };
31
+ shortName: string | null;
32
+ };
33
+ mobile: {
34
+ native: string | null;
35
+ universal: string | null;
36
+ };
37
+ name: string;
38
+ versions: string[];
39
+ };
40
+ export declare type GetSupportedWalletsOpts = {
41
+ appLogoUrl: string;
42
+ appName: string;
43
+ };
44
+ export declare type GetSupportedWallets = (opts?: GetSupportedWalletsOpts) => WalletConnector[];
package/src/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/multi-wallet/src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export default class Console {
2
+ static log(...args: any[]): void;
3
+ static error(...args: any[]): void;
4
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable */
4
+ class Console {
5
+ static log(...args) {
6
+ if (process.env.NODE_ENV !== 'production') {
7
+ console.log(args);
8
+ }
9
+ }
10
+ static error(...args) {
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ console.error(args);
13
+ }
14
+ }
15
+ }
16
+ exports.default = Console;
17
+ /* eslint-enable */
18
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/console.ts"],"names":[],"mappings":";;AAAA,oBAAoB;AACpB,MAAqB,OAAO;IAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAW;QACvB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;YACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACnB;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,IAAW;QACzB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;YACzC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACrB;IACH,CAAC;CACF;AAZD,0BAYC;AACD,mBAAmB"}
@@ -0,0 +1 @@
1
+ export declare const bufferToBase64: (buf: Uint8Array) => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bufferToBase64 = void 0;
4
+ const bufferToBase64 = (buf) => {
5
+ const binstr = Array.prototype.map
6
+ .call(buf, (ch) => String.fromCharCode(ch))
7
+ .join('');
8
+ return btoa(binstr);
9
+ };
10
+ exports.bufferToBase64 = bufferToBase64;
11
+ //# sourceMappingURL=convertors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertors.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/convertors.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,GAAe,EAAU,EAAE;IACxD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG;SAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;SAClD,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sourced from http://detectmobilebrowsers.com/
3
+ */
4
+ export declare const isMobile: () => boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Sourced from http://detectmobilebrowsers.com/
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isMobile = void 0;
7
+ /* eslint-disable max-len, no-useless-escape */
8
+ const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
9
+ const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
10
+ const isMobile = () => userAgentRegex1.test(navigator.userAgent) ||
11
+ userAgentRegex2.test(navigator.userAgent.substring(0, 4));
12
+ exports.isMobile = isMobile;
13
+ //# sourceMappingURL=isMobile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMobile.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/isMobile.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,+CAA+C;AAE/C,MAAM,eAAe,GACnB,qVAAqV,CAAC;AAExV,MAAM,eAAe,GACnB,ykDAAykD,CAAC;AAErkD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAC3B,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;IACzC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAF/C,QAAA,QAAQ,YAEuC"}
@@ -0,0 +1,10 @@
1
+ export interface MessageParameters {
2
+ chain: string;
3
+ domain: string;
4
+ issuedAt?: string;
5
+ nonce: string;
6
+ publicKey: string;
7
+ statement?: string;
8
+ uri: string;
9
+ }
10
+ export declare const generateMessageToSign: ({ chain, domain, nonce, uri, publicKey, issuedAt, statement, }: MessageParameters) => string;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // Util class to generate a message to sign, inspired by EIP-4361
3
+ // https://docs.login.xyz/general-information/siwe-overview/eip-4361
4
+ // TODO:
5
+ // - We might need to add prefix: \x19Ethereum Signed Message:\n<length of message> as per EIP-712
6
+ // - This implementation is missing some of the optional values
7
+ // - The work above and more should be covered in DYN-252
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.generateMessageToSign = void 0;
10
+ // internal mapping of blockchain abbrev to full network name
11
+ const networkNames = {
12
+ ETH: 'Ethereum',
13
+ SOL: 'Solana',
14
+ };
15
+ // see: https://eips.ethereum.org/EIPS/eip-155#list-of-chain-ids
16
+ // this is an ethereum standard, so does not currently support solana
17
+ const chainIds = {
18
+ ETH: '1',
19
+ SOL: undefined,
20
+ };
21
+ const generateMessageToSign = ({ chain, domain, nonce, uri, publicKey, issuedAt = new Date().toISOString(), statement, }) => {
22
+ // This format follows the sign-in with ethereum (SIWE) standard,
23
+ // but we are using it also for non-ethereum wallets for now (eg. Solana)
24
+ // for more context on format and fields, please see:
25
+ // https://docs.login.xyz/general-information/siwe-overview/eip-4361
26
+ const networkName = networkNames[chain.toUpperCase()];
27
+ const header = `${domain} wants you to sign in with your ${networkName} account:`;
28
+ const prefix = [header, publicKey].join('\n');
29
+ const prefixWithStatement = `${[prefix, statement].join('\n\n')}\n`;
30
+ const suffixFields = [];
31
+ suffixFields.push(`URI: ${uri}`);
32
+ suffixFields.push('Version: 1');
33
+ // This is only required for Ethereum-based wallets
34
+ const chainId = chainIds[chain.toUpperCase()];
35
+ if (chainId) {
36
+ suffixFields.push(`Chain ID: ${chainId}`);
37
+ }
38
+ suffixFields.push(`Nonce: ${nonce}`);
39
+ suffixFields.push(`Issued At: ${issuedAt}`);
40
+ const suffix = suffixFields.join('\n');
41
+ return [prefixWithStatement, suffix].join('\n');
42
+ };
43
+ exports.generateMessageToSign = generateMessageToSign;
44
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/message.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,oEAAoE;AACpE,QAAQ;AACR,mGAAmG;AACnG,+DAA+D;AAC/D,yDAAyD;;;AAEzD,6DAA6D;AAC7D,MAAM,YAAY,GAA8B;IAC9C,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,QAAQ;CACd,CAAC;AAEF,gEAAgE;AAChE,qEAAqE;AACrE,MAAM,QAAQ,GAA0C;IACtD,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,SAAS;CACf,CAAC;AAYK,MAAM,qBAAqB,GAAG,CAAC,EACpC,KAAK,EACL,MAAM,EACN,KAAK,EACL,GAAG,EACH,SAAS,EACT,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EACnC,SAAS,GACS,EAAU,EAAE;IAC9B,iEAAiE;IACjE,yEAAyE;IACzE,qDAAqD;IACrD,oEAAoE;IACpE,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,GAAG,MAAM,mCAAmC,WAAW,WAAW,CAAC;IAClF,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAEpE,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,YAAY,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;IACjC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAEhC,mDAAmD;IACnD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9C,IAAI,OAAO,EAAE;QACX,YAAY,CAAC,IAAI,CAAC,aAAa,OAAO,EAAE,CAAC,CAAC;KAC3C;IAED,YAAY,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;IACrC,YAAY,CAAC,IAAI,CAAC,cAAc,QAAQ,EAAE,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEvC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC,CAAC;AAjCW,QAAA,qBAAqB,yBAiChC"}
@@ -0,0 +1 @@
1
+ export declare const normalizeWalletName: (name: string) => string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeWalletName = void 0;
4
+ const normalizeWalletName = (name) => name.replace(/\W/g, '').toLowerCase();
5
+ exports.normalizeWalletName = normalizeWalletName;
6
+ //# sourceMappingURL=normalizeWalletName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeWalletName.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/normalizeWalletName.ts"],"names":[],"mappings":";;;AAAO,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,EAAE,CAClD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAD3B,QAAA,mBAAmB,uBACQ"}
@@ -0,0 +1,3 @@
1
+ export declare const isPhone: () => boolean;
2
+ export declare const isAndroid: () => boolean;
3
+ export declare const isIPad: () => boolean;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIPad = exports.isAndroid = exports.isPhone = void 0;
4
+ const isPhone = () => /iPhone/.test(navigator.userAgent);
5
+ exports.isPhone = isPhone;
6
+ const isAndroid = () => /Android/.test(navigator.userAgent);
7
+ exports.isAndroid = isAndroid;
8
+ const isIPad = () => /iPad/.test(navigator.userAgent) ||
9
+ (/Mac/.test(navigator.userAgent) && navigator.maxTouchPoints === 5);
10
+ exports.isIPad = isIPad;
11
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/platform.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAAnD,QAAA,OAAO,WAA4C;AACzD,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAAtD,QAAA,SAAS,aAA6C;AAE5D,MAAM,MAAM,GAAG,GAAG,EAAE,CACzB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;IAChC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC;AAFzD,QAAA,MAAM,UAEmD"}
@@ -0,0 +1,5 @@
1
+ import { WalletConnectWalletMetadata } from '../types';
2
+ import WalletConnect from '../wallets/wallet-connect';
3
+ export declare const walletMetadata: Record<string, WalletConnectWalletMetadata>;
4
+ export declare const fetchWalletConnectWallets: () => WalletConnect[];
5
+ export declare const getWalletConnectMetadata: (walletName: string) => WalletConnectWalletMetadata;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWalletConnectMetadata = exports.fetchWalletConnectWallets = exports.walletMetadata = void 0;
7
+ const wallet_connect_wallets_json_1 = __importDefault(require("../data/wallet-connect-wallets.json"));
8
+ const wallet_connect_1 = __importDefault(require("../wallets/wallet-connect"));
9
+ const normalizeWalletName_1 = require("./normalizeWalletName");
10
+ exports.walletMetadata = {};
11
+ const fetchWalletConnectWallets = () => Object.values(wallet_connect_wallets_json_1.default).map((metadata) => {
12
+ const { shortName } = metadata.metadata;
13
+ const name = shortName || metadata.name;
14
+ const wallet = new wallet_connect_1.default({ walletName: name });
15
+ exports.walletMetadata[(0, normalizeWalletName_1.normalizeWalletName)(wallet.name)] = metadata;
16
+ return wallet;
17
+ });
18
+ exports.fetchWalletConnectWallets = fetchWalletConnectWallets;
19
+ const getWalletConnectMetadata = (walletName) => exports.walletMetadata[(0, normalizeWalletName_1.normalizeWalletName)(walletName)];
20
+ exports.getWalletConnectMetadata = getWalletConnectMetadata;
21
+ //# sourceMappingURL=walletConnect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walletConnect.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/walletConnect.ts"],"names":[],"mappings":";;;;;;AACA,sGAA2E;AAC3E,+EAAsD;AAEtD,+DAA4D;AAE/C,QAAA,cAAc,GAAgD,EAAE,CAAC;AAEvE,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAC5C,MAAM,CAAC,MAAM,CAAC,qCAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACxC,MAAM,IAAI,GAAG,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC;IAExC,MAAM,MAAM,GAAG,IAAI,wBAAa,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvD,sBAAc,CAAC,IAAA,yCAAmB,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;IAE5D,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC;AAVQ,QAAA,yBAAyB,6BAUjC;AAEE,MAAM,wBAAwB,GAAG,CAAC,UAAkB,EAAE,EAAE,CAC7D,sBAAc,CAAC,IAAA,yCAAmB,EAAC,UAAU,CAAC,CAAC,CAAC;AADrC,QAAA,wBAAwB,4BACa"}
@@ -0,0 +1,15 @@
1
+ export interface WalletLinks {
2
+ desktop: {
3
+ brave: string;
4
+ chrome: string;
5
+ edge: string;
6
+ firefox: string;
7
+ safari: string;
8
+ };
9
+ mobile: {
10
+ android: string;
11
+ ios: string;
12
+ };
13
+ }
14
+ export declare type WalletLinksJson = Record<string, WalletLinks>;
15
+ export declare const getWalletLinks: (walletName: string) => WalletLinks;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWalletLinks = void 0;
7
+ const wallet_links_json_1 = __importDefault(require("../data/wallet-links.json"));
8
+ const getWalletLinks = (walletName) => {
9
+ const json = wallet_links_json_1.default;
10
+ return json[walletName];
11
+ };
12
+ exports.getWalletLinks = getWalletLinks;
13
+ //# sourceMappingURL=walletLinks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walletLinks.js","sourceRoot":"","sources":["../../../../../packages/multi-wallet/src/utils/walletLinks.ts"],"names":[],"mappings":";;;;;;AAAA,kFAAwD;AAkBjD,MAAM,cAAc,GAAG,CAAC,UAAkB,EAAe,EAAE;IAChE,MAAM,IAAI,GAAoB,2BAAe,CAAC;IAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB"}
@@ -0,0 +1,6 @@
1
+ import { FetchPublicAddressOpts } from '../../wallet-connector';
2
+ import { GetCoinbaseProvider, GetCoinbaseProviderOpts } from './types';
3
+ export declare const getCoinbaseProvider: GetCoinbaseProvider;
4
+ export declare const killCoinbaseSession: () => void;
5
+ export declare const fetchPublicAddress: (coinbaseProviderOpts: GetCoinbaseProviderOpts, opts?: FetchPublicAddressOpts | undefined) => Promise<string | undefined>;
6
+ export declare const signMessage: (coinbaseProviderOpts: GetCoinbaseProviderOpts, messageToSign: string) => Promise<string | undefined>;