@metamask/connect-solana 0.5.0 → 0.7.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/CHANGELOG.md +15 -1
- package/README.md +40 -1
- package/dist/browser/es/connect-solana.mjs +38 -10
- package/dist/browser/es/connect-solana.mjs.map +1 -1
- package/dist/node/cjs/connect-solana.js +35 -6
- package/dist/node/cjs/connect-solana.js.map +1 -1
- package/dist/node/es/connect-solana.mjs +38 -10
- package/dist/node/es/connect-solana.mjs.map +1 -1
- package/dist/types/index.d.ts +16 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `getInfuraRpcUrls({ infuraApiKey, networks })` helper to generate Solana `supportedNetworks` entries (mainnet/devnet) for `createSolanaClient` ([#235](https://github.com/MetaMask/connect-monorepo/pull/235))
|
|
15
|
+
|
|
16
|
+
## [0.6.0]
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- fix: Fix react-native-playground consumption of **PACKAGE_VERSION** build-time constant in connect packages ([#221](https://github.com/MetaMask/connect-monorepo/pull/221))
|
|
21
|
+
|
|
10
22
|
## [0.5.0]
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -49,7 +61,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
49
61
|
|
|
50
62
|
- Initial release
|
|
51
63
|
|
|
52
|
-
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.
|
|
64
|
+
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.7.0...HEAD
|
|
65
|
+
[0.7.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.6.0...@metamask/connect-solana@0.7.0
|
|
66
|
+
[0.6.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.5.0...@metamask/connect-solana@0.6.0
|
|
53
67
|
[0.5.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.4.0...@metamask/connect-solana@0.5.0
|
|
54
68
|
[0.4.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.3.0...@metamask/connect-solana@0.4.0
|
|
55
69
|
[0.3.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-solana@0.2.0...@metamask/connect-solana@0.3.0
|
package/README.md
CHANGED
|
@@ -26,7 +26,9 @@ npm install @metamask/connect-solana
|
|
|
26
26
|
## Quick Start
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
|
-
import { createSolanaClient } from '@metamask/connect-solana';
|
|
29
|
+
import { createSolanaClient, getInfuraRpcUrls } from '@metamask/connect-solana';
|
|
30
|
+
|
|
31
|
+
const INFURA_API_KEY = 'YOUR_INFURA_API_KEY';
|
|
30
32
|
|
|
31
33
|
// Create a Solana client
|
|
32
34
|
// MetaMask is automatically registered with the wallet-standard registry on creation
|
|
@@ -35,6 +37,12 @@ const client = await createSolanaClient({
|
|
|
35
37
|
name: 'My Solana DApp',
|
|
36
38
|
url: 'https://mydapp.com',
|
|
37
39
|
},
|
|
40
|
+
api: {
|
|
41
|
+
supportedNetworks: getInfuraRpcUrls({
|
|
42
|
+
infuraApiKey: INFURA_API_KEY,
|
|
43
|
+
networks: ['mainnet', 'devnet'],
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
38
46
|
});
|
|
39
47
|
```
|
|
40
48
|
|
|
@@ -109,6 +117,37 @@ Creates a new Solana client instance. By default, the wallet is automatically re
|
|
|
109
117
|
|
|
110
118
|
---
|
|
111
119
|
|
|
120
|
+
### `getInfuraRpcUrls(options)`
|
|
121
|
+
|
|
122
|
+
Generates Solana Infura RPC URLs keyed by Solana network name. The return value can be passed directly to `createSolanaClient({ api: { supportedNetworks } })`.
|
|
123
|
+
|
|
124
|
+
#### Parameters
|
|
125
|
+
|
|
126
|
+
| Name | Type | Required | Description |
|
|
127
|
+
| -------------- | ----------------- | -------- | ----------------------------------------------------------------- |
|
|
128
|
+
| `infuraApiKey` | `string` | Yes | Your Infura API key |
|
|
129
|
+
| `networks` | `SolanaNetwork[]` | Yes | Solana networks to include (for example, `['mainnet', 'devnet']`) |
|
|
130
|
+
|
|
131
|
+
#### Returns
|
|
132
|
+
|
|
133
|
+
`SolanaSupportedNetworks`
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { getInfuraRpcUrls } from '@metamask/connect-solana';
|
|
137
|
+
|
|
138
|
+
const supportedNetworks = getInfuraRpcUrls({
|
|
139
|
+
infuraApiKey: 'YOUR_INFURA_API_KEY',
|
|
140
|
+
networks: ['mainnet', 'devnet'],
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// {
|
|
144
|
+
// mainnet: 'https://solana-mainnet.infura.io/v3/YOUR_INFURA_API_KEY',
|
|
145
|
+
// devnet: 'https://solana-devnet.infura.io/v3/YOUR_INFURA_API_KEY',
|
|
146
|
+
// }
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
112
151
|
### `SolanaClient`
|
|
113
152
|
|
|
114
153
|
The object returned by `createSolanaClient`.
|
|
@@ -20,14 +20,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
// src/
|
|
24
|
-
import {
|
|
25
|
-
createMultichainClient
|
|
26
|
-
} from "@metamask/connect-multichain";
|
|
27
|
-
import {
|
|
28
|
-
getWalletStandard,
|
|
29
|
-
registerSolanaWalletStandard
|
|
30
|
-
} from "@metamask/solana-wallet-standard";
|
|
23
|
+
// src/infura.ts
|
|
24
|
+
import { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from "@metamask/connect-multichain";
|
|
31
25
|
|
|
32
26
|
// src/networks.ts
|
|
33
27
|
var SOLANA_CAIP_IDS = {
|
|
@@ -48,7 +42,36 @@ function convertNetworksToCAIP(networks) {
|
|
|
48
42
|
);
|
|
49
43
|
}
|
|
50
44
|
|
|
45
|
+
// src/infura.ts
|
|
46
|
+
var getInfuraRpcUrls = ({
|
|
47
|
+
infuraApiKey,
|
|
48
|
+
networks
|
|
49
|
+
}) => {
|
|
50
|
+
const caipChainIds = networks.map(
|
|
51
|
+
(network) => SOLANA_CAIP_IDS[network]
|
|
52
|
+
);
|
|
53
|
+
const caipMap = getInfuraRpcUrlsMultichain({
|
|
54
|
+
infuraApiKey,
|
|
55
|
+
caipChainIds
|
|
56
|
+
});
|
|
57
|
+
return networks.reduce((acc, network) => {
|
|
58
|
+
const caipId = SOLANA_CAIP_IDS[network];
|
|
59
|
+
const rpcUrl = caipMap[caipId];
|
|
60
|
+
if (rpcUrl) {
|
|
61
|
+
acc[network] = rpcUrl;
|
|
62
|
+
}
|
|
63
|
+
return acc;
|
|
64
|
+
}, {});
|
|
65
|
+
};
|
|
66
|
+
|
|
51
67
|
// src/connect.ts
|
|
68
|
+
import {
|
|
69
|
+
createMultichainClient
|
|
70
|
+
} from "@metamask/connect-multichain";
|
|
71
|
+
import {
|
|
72
|
+
getWalletStandard,
|
|
73
|
+
registerSolanaWalletStandard
|
|
74
|
+
} from "@metamask/solana-wallet-standard";
|
|
52
75
|
function createSolanaClient(options) {
|
|
53
76
|
return __async(this, null, function* () {
|
|
54
77
|
var _a, _b, _c;
|
|
@@ -64,7 +87,11 @@ function createSolanaClient(options) {
|
|
|
64
87
|
api: {
|
|
65
88
|
supportedNetworks
|
|
66
89
|
},
|
|
67
|
-
versions: {
|
|
90
|
+
versions: {
|
|
91
|
+
// typeof guard needed: Metro (React Native) bundles TS source directly,
|
|
92
|
+
// bypassing the tsup build that substitutes __PACKAGE_VERSION__.
|
|
93
|
+
"connect-solana": false ? "unknown" : "0.7.0"
|
|
94
|
+
}
|
|
68
95
|
});
|
|
69
96
|
const client = core.provider;
|
|
70
97
|
const walletName = "MetaMask Connect";
|
|
@@ -87,6 +114,7 @@ function createSolanaClient(options) {
|
|
|
87
114
|
});
|
|
88
115
|
}
|
|
89
116
|
export {
|
|
90
|
-
createSolanaClient
|
|
117
|
+
createSolanaClient,
|
|
118
|
+
getInfuraRpcUrls
|
|
91
119
|
};
|
|
92
120
|
//# sourceMappingURL=connect-solana.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/
|
|
1
|
+
{"version":3,"sources":["../../../src/infura.ts","../../../src/networks.ts","../../../src/connect.ts"],"sourcesContent":["import { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from '@metamask/connect-multichain';\nimport type { CaipChainId } from '@metamask/utils';\n\nimport { SOLANA_CAIP_IDS } from './networks';\nimport type { SolanaNetwork, SolanaSupportedNetworks } from './types';\n\n/**\n * Generates Infura RPC URLs for Solana networks keyed by Solana network name.\n *\n * The returned map is intended for `createSolanaClient({ api: { supportedNetworks } })`.\n *\n * @param options - The options for generating Solana Infura RPC URLs\n * @param options.infuraApiKey - The Infura API key\n * @param options.networks - Solana networks to include in the returned map\n * @returns A map of Solana network names to Infura RPC URLs\n */\nexport const getInfuraRpcUrls = ({\n infuraApiKey,\n networks,\n}: {\n infuraApiKey: string;\n networks: SolanaNetwork[];\n}): SolanaSupportedNetworks => {\n const caipChainIds = networks.map(\n (network) => SOLANA_CAIP_IDS[network] as CaipChainId,\n );\n const caipMap = getInfuraRpcUrlsMultichain({\n infuraApiKey,\n caipChainIds,\n });\n\n return networks.reduce<SolanaSupportedNetworks>((acc, network) => {\n const caipId = SOLANA_CAIP_IDS[network] as CaipChainId;\n const rpcUrl = caipMap[caipId];\n if (rpcUrl) {\n acc[network] = rpcUrl;\n }\n return acc;\n }, {});\n};\n","import type { SolanaNetwork, SolanaSupportedNetworks } from './types';\n\n/**\n * CAIP-2 chain IDs for Solana networks.\n * The reference is the first 32 characters of the Base58-encoded genesis hash.\n */\nexport const SOLANA_CAIP_IDS: Record<SolanaNetwork, string> = {\n mainnet: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n devnet: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n testnet: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n};\n\n/**\n * Converts a record of network names to RPC URLs into a record of CAIP IDs to RPC URLs.\n *\n * @param networks - A record of network names to RPC URLs\n * @returns A record of CAIP IDs to RPC URLs\n */\nexport function convertNetworksToCAIP(\n networks: SolanaSupportedNetworks,\n): Record<string, string> {\n return Object.entries(networks).reduce<Record<string, string>>(\n (acc, [network, rpcUrl]) => {\n const caipId = SOLANA_CAIP_IDS[network as SolanaNetwork];\n if (caipId && rpcUrl) {\n acc[caipId] = rpcUrl;\n }\n return acc;\n },\n {},\n );\n}\n","/* eslint-disable @typescript-eslint/naming-convention -- __PACKAGE_VERSION__ is an esbuild define convention */\nimport {\n createMultichainClient,\n type Scope,\n} from '@metamask/connect-multichain';\nimport {\n getWalletStandard,\n registerSolanaWalletStandard,\n} from '@metamask/solana-wallet-standard';\n\nimport { convertNetworksToCAIP, SOLANA_CAIP_IDS } from './networks';\nimport type {\n SolanaClient,\n SolanaConnectOptions,\n SolanaSupportedNetworks,\n} from './types';\n\n// Value substitued by tsup at build time\ndeclare const __PACKAGE_VERSION__: string | undefined;\n\n/**\n * Creates a new Solana client for connecting to MetaMask via wallet-standard.\n *\n * This function initializes the MultichainSDK and provides methods to get or register\n * a wallet-standard compatible wallet. The wallet handles session creation internally\n * when users connect through the Solana wallet adapter UI.\n *\n * @param options - Configuration options for the Solana client\n * @param options.dapp - Dapp identification and branding settings\n * @param options.api - Optional API configuration with supported networks\n * @param options.api.supportedNetworks - Record mapping network names (mainnet, devnet, testnet) to RPC URLs\n * @param options.debug - Enable debug logging\n * @param options.skipAutoRegister - Skip auto-registering the wallet during creation (defaults to false)\n * @returns A promise that resolves to the Solana client instance\n *\n * @example\n * ```typescript\n * import { createSolanaClient } from '@metamask/connect-solana';\n *\n * // Wallet is auto-registered and ready to use\n * const client = await createSolanaClient({\n * dapp: {\n * name: 'My Solana DApp',\n * url: 'https://mydapp.com',\n * },\n * api: {\n * supportedNetworks: {\n * mainnet: 'https://api.mainnet-beta.solana.com',\n * devnet: 'https://api.devnet.solana.com',\n * },\n * },\n * });\n *\n * // Get the wallet instance directly\n * const wallet = client.getWallet();\n * ```\n */\nexport async function createSolanaClient(\n options: SolanaConnectOptions,\n): Promise<SolanaClient> {\n const defaultNetworks: SolanaSupportedNetworks = {\n mainnet: 'https://api.mainnet-beta.solana.com',\n };\n\n const skipAutoRegister = options.skipAutoRegister ?? false;\n\n const supportedNetworks = convertNetworksToCAIP(\n options.api?.supportedNetworks ?? defaultNetworks,\n );\n\n const core = await createMultichainClient({\n dapp: options.dapp,\n api: {\n supportedNetworks,\n },\n versions: {\n // typeof guard needed: Metro (React Native) bundles TS source directly,\n // bypassing the tsup build that substitutes __PACKAGE_VERSION__.\n 'connect-solana':\n typeof __PACKAGE_VERSION__ === 'undefined'\n ? 'unknown'\n : __PACKAGE_VERSION__,\n },\n });\n\n const client = core.provider;\n\n const walletName = 'MetaMask Connect';\n\n if (!skipAutoRegister) {\n await registerSolanaWalletStandard({ client, walletName });\n }\n\n return {\n core,\n getWallet: () => getWalletStandard({ client, walletName }),\n registerWallet: async (): Promise<void> => {\n if (!skipAutoRegister) {\n return;\n }\n await registerSolanaWalletStandard({ client, walletName });\n },\n disconnect: async () =>\n await core.disconnect(Object.values(SOLANA_CAIP_IDS) as Scope[]),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,oBAAoB,kCAAkC;;;ACMxD,IAAM,kBAAiD;AAAA,EAC5D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AACX;AAQO,SAAS,sBACd,UACwB;AACxB,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM;AAC1B,YAAM,SAAS,gBAAgB,OAAwB;AACvD,UAAI,UAAU,QAAQ;AACpB,YAAI,MAAM,IAAI;AAAA,MAChB;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;;;ADfO,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAG+B;AAC7B,QAAM,eAAe,SAAS;AAAA,IAC5B,CAAC,YAAY,gBAAgB,OAAO;AAAA,EACtC;AACA,QAAM,UAAU,2BAA2B;AAAA,IACzC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,SAAS,OAAgC,CAAC,KAAK,YAAY;AAChE,UAAM,SAAS,gBAAgB,OAAO;AACtC,UAAM,SAAS,QAAQ,MAAM;AAC7B,QAAI,QAAQ;AACV,UAAI,OAAO,IAAI;AAAA,IACjB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;;;AEtCA;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAiDP,SAAsB,mBACpB,SACuB;AAAA;AA3DzB;AA4DE,UAAM,kBAA2C;AAAA,MAC/C,SAAS;AAAA,IACX;AAEA,UAAM,oBAAmB,aAAQ,qBAAR,YAA4B;AAErD,UAAM,oBAAoB;AAAA,OACxB,mBAAQ,QAAR,mBAAa,sBAAb,YAAkC;AAAA,IACpC;AAEA,UAAM,OAAO,MAAM,uBAAuB;AAAA,MACxC,MAAM,QAAQ;AAAA,MACd,KAAK;AAAA,QACH;AAAA,MACF;AAAA,MACA,UAAU;AAAA;AAAA;AAAA,QAGR,kBACE,QACI,YACA;AAAA,MACR;AAAA,IACF,CAAC;AAED,UAAM,SAAS,KAAK;AAEpB,UAAM,aAAa;AAEnB,QAAI,CAAC,kBAAkB;AACrB,YAAM,6BAA6B,EAAE,QAAQ,WAAW,CAAC;AAAA,IAC3D;AAEA,WAAO;AAAA,MACL;AAAA,MACA,WAAW,MAAM,kBAAkB,EAAE,QAAQ,WAAW,CAAC;AAAA,MACzD,gBAAgB,MAA2B;AACzC,YAAI,CAAC,kBAAkB;AACrB;AAAA,QACF;AACA,cAAM,6BAA6B,EAAE,QAAQ,WAAW,CAAC;AAAA,MAC3D;AAAA,MACA,YAAY,MAAS;AACnB,qBAAM,KAAK,WAAW,OAAO,OAAO,eAAe,CAAY;AAAA;AAAA,IACnE;AAAA,EACF;AAAA;","names":[]}
|
|
@@ -41,13 +41,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
41
41
|
// src/index.ts
|
|
42
42
|
var src_exports = {};
|
|
43
43
|
__export(src_exports, {
|
|
44
|
-
createSolanaClient: () => createSolanaClient
|
|
44
|
+
createSolanaClient: () => createSolanaClient,
|
|
45
|
+
getInfuraRpcUrls: () => getInfuraRpcUrls
|
|
45
46
|
});
|
|
46
47
|
module.exports = __toCommonJS(src_exports);
|
|
47
48
|
|
|
48
|
-
// src/
|
|
49
|
+
// src/infura.ts
|
|
49
50
|
var import_connect_multichain = require("@metamask/connect-multichain");
|
|
50
|
-
var import_solana_wallet_standard = require("@metamask/solana-wallet-standard");
|
|
51
51
|
|
|
52
52
|
// src/networks.ts
|
|
53
53
|
var SOLANA_CAIP_IDS = {
|
|
@@ -68,7 +68,31 @@ function convertNetworksToCAIP(networks) {
|
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
// src/infura.ts
|
|
72
|
+
var getInfuraRpcUrls = ({
|
|
73
|
+
infuraApiKey,
|
|
74
|
+
networks
|
|
75
|
+
}) => {
|
|
76
|
+
const caipChainIds = networks.map(
|
|
77
|
+
(network) => SOLANA_CAIP_IDS[network]
|
|
78
|
+
);
|
|
79
|
+
const caipMap = (0, import_connect_multichain.getInfuraRpcUrls)({
|
|
80
|
+
infuraApiKey,
|
|
81
|
+
caipChainIds
|
|
82
|
+
});
|
|
83
|
+
return networks.reduce((acc, network) => {
|
|
84
|
+
const caipId = SOLANA_CAIP_IDS[network];
|
|
85
|
+
const rpcUrl = caipMap[caipId];
|
|
86
|
+
if (rpcUrl) {
|
|
87
|
+
acc[network] = rpcUrl;
|
|
88
|
+
}
|
|
89
|
+
return acc;
|
|
90
|
+
}, {});
|
|
91
|
+
};
|
|
92
|
+
|
|
71
93
|
// src/connect.ts
|
|
94
|
+
var import_connect_multichain2 = require("@metamask/connect-multichain");
|
|
95
|
+
var import_solana_wallet_standard = require("@metamask/solana-wallet-standard");
|
|
72
96
|
function createSolanaClient(options) {
|
|
73
97
|
return __async(this, null, function* () {
|
|
74
98
|
var _a, _b, _c;
|
|
@@ -79,12 +103,16 @@ function createSolanaClient(options) {
|
|
|
79
103
|
const supportedNetworks = convertNetworksToCAIP(
|
|
80
104
|
(_c = (_b = options.api) == null ? void 0 : _b.supportedNetworks) != null ? _c : defaultNetworks
|
|
81
105
|
);
|
|
82
|
-
const core = yield (0,
|
|
106
|
+
const core = yield (0, import_connect_multichain2.createMultichainClient)({
|
|
83
107
|
dapp: options.dapp,
|
|
84
108
|
api: {
|
|
85
109
|
supportedNetworks
|
|
86
110
|
},
|
|
87
|
-
versions: {
|
|
111
|
+
versions: {
|
|
112
|
+
// typeof guard needed: Metro (React Native) bundles TS source directly,
|
|
113
|
+
// bypassing the tsup build that substitutes __PACKAGE_VERSION__.
|
|
114
|
+
"connect-solana": false ? "unknown" : "0.7.0"
|
|
115
|
+
}
|
|
88
116
|
});
|
|
89
117
|
const client = core.provider;
|
|
90
118
|
const walletName = "MetaMask Connect";
|
|
@@ -108,6 +136,7 @@ function createSolanaClient(options) {
|
|
|
108
136
|
}
|
|
109
137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
110
138
|
0 && (module.exports = {
|
|
111
|
-
createSolanaClient
|
|
139
|
+
createSolanaClient,
|
|
140
|
+
getInfuraRpcUrls
|
|
112
141
|
});
|
|
113
142
|
//# sourceMappingURL=connect-solana.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/index.ts","../../../src/
|
|
1
|
+
{"version":3,"sources":["../../../src/index.ts","../../../src/infura.ts","../../../src/networks.ts","../../../src/connect.ts"],"sourcesContent":["export { getInfuraRpcUrls } from './infura';\nexport { createSolanaClient } from './connect';\nexport type {\n SolanaClient,\n SolanaConnectOptions,\n SolanaNetwork,\n SolanaSupportedNetworks,\n} from './types';\n","import { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from '@metamask/connect-multichain';\nimport type { CaipChainId } from '@metamask/utils';\n\nimport { SOLANA_CAIP_IDS } from './networks';\nimport type { SolanaNetwork, SolanaSupportedNetworks } from './types';\n\n/**\n * Generates Infura RPC URLs for Solana networks keyed by Solana network name.\n *\n * The returned map is intended for `createSolanaClient({ api: { supportedNetworks } })`.\n *\n * @param options - The options for generating Solana Infura RPC URLs\n * @param options.infuraApiKey - The Infura API key\n * @param options.networks - Solana networks to include in the returned map\n * @returns A map of Solana network names to Infura RPC URLs\n */\nexport const getInfuraRpcUrls = ({\n infuraApiKey,\n networks,\n}: {\n infuraApiKey: string;\n networks: SolanaNetwork[];\n}): SolanaSupportedNetworks => {\n const caipChainIds = networks.map(\n (network) => SOLANA_CAIP_IDS[network] as CaipChainId,\n );\n const caipMap = getInfuraRpcUrlsMultichain({\n infuraApiKey,\n caipChainIds,\n });\n\n return networks.reduce<SolanaSupportedNetworks>((acc, network) => {\n const caipId = SOLANA_CAIP_IDS[network] as CaipChainId;\n const rpcUrl = caipMap[caipId];\n if (rpcUrl) {\n acc[network] = rpcUrl;\n }\n return acc;\n }, {});\n};\n","import type { SolanaNetwork, SolanaSupportedNetworks } from './types';\n\n/**\n * CAIP-2 chain IDs for Solana networks.\n * The reference is the first 32 characters of the Base58-encoded genesis hash.\n */\nexport const SOLANA_CAIP_IDS: Record<SolanaNetwork, string> = {\n mainnet: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n devnet: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n testnet: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n};\n\n/**\n * Converts a record of network names to RPC URLs into a record of CAIP IDs to RPC URLs.\n *\n * @param networks - A record of network names to RPC URLs\n * @returns A record of CAIP IDs to RPC URLs\n */\nexport function convertNetworksToCAIP(\n networks: SolanaSupportedNetworks,\n): Record<string, string> {\n return Object.entries(networks).reduce<Record<string, string>>(\n (acc, [network, rpcUrl]) => {\n const caipId = SOLANA_CAIP_IDS[network as SolanaNetwork];\n if (caipId && rpcUrl) {\n acc[caipId] = rpcUrl;\n }\n return acc;\n },\n {},\n );\n}\n","/* eslint-disable @typescript-eslint/naming-convention -- __PACKAGE_VERSION__ is an esbuild define convention */\nimport {\n createMultichainClient,\n type Scope,\n} from '@metamask/connect-multichain';\nimport {\n getWalletStandard,\n registerSolanaWalletStandard,\n} from '@metamask/solana-wallet-standard';\n\nimport { convertNetworksToCAIP, SOLANA_CAIP_IDS } from './networks';\nimport type {\n SolanaClient,\n SolanaConnectOptions,\n SolanaSupportedNetworks,\n} from './types';\n\n// Value substitued by tsup at build time\ndeclare const __PACKAGE_VERSION__: string | undefined;\n\n/**\n * Creates a new Solana client for connecting to MetaMask via wallet-standard.\n *\n * This function initializes the MultichainSDK and provides methods to get or register\n * a wallet-standard compatible wallet. The wallet handles session creation internally\n * when users connect through the Solana wallet adapter UI.\n *\n * @param options - Configuration options for the Solana client\n * @param options.dapp - Dapp identification and branding settings\n * @param options.api - Optional API configuration with supported networks\n * @param options.api.supportedNetworks - Record mapping network names (mainnet, devnet, testnet) to RPC URLs\n * @param options.debug - Enable debug logging\n * @param options.skipAutoRegister - Skip auto-registering the wallet during creation (defaults to false)\n * @returns A promise that resolves to the Solana client instance\n *\n * @example\n * ```typescript\n * import { createSolanaClient } from '@metamask/connect-solana';\n *\n * // Wallet is auto-registered and ready to use\n * const client = await createSolanaClient({\n * dapp: {\n * name: 'My Solana DApp',\n * url: 'https://mydapp.com',\n * },\n * api: {\n * supportedNetworks: {\n * mainnet: 'https://api.mainnet-beta.solana.com',\n * devnet: 'https://api.devnet.solana.com',\n * },\n * },\n * });\n *\n * // Get the wallet instance directly\n * const wallet = client.getWallet();\n * ```\n */\nexport async function createSolanaClient(\n options: SolanaConnectOptions,\n): Promise<SolanaClient> {\n const defaultNetworks: SolanaSupportedNetworks = {\n mainnet: 'https://api.mainnet-beta.solana.com',\n };\n\n const skipAutoRegister = options.skipAutoRegister ?? false;\n\n const supportedNetworks = convertNetworksToCAIP(\n options.api?.supportedNetworks ?? defaultNetworks,\n );\n\n const core = await createMultichainClient({\n dapp: options.dapp,\n api: {\n supportedNetworks,\n },\n versions: {\n // typeof guard needed: Metro (React Native) bundles TS source directly,\n // bypassing the tsup build that substitutes __PACKAGE_VERSION__.\n 'connect-solana':\n typeof __PACKAGE_VERSION__ === 'undefined'\n ? 'unknown'\n : __PACKAGE_VERSION__,\n },\n });\n\n const client = core.provider;\n\n const walletName = 'MetaMask Connect';\n\n if (!skipAutoRegister) {\n await registerSolanaWalletStandard({ client, walletName });\n }\n\n return {\n core,\n getWallet: () => getWalletStandard({ client, walletName }),\n registerWallet: async (): Promise<void> => {\n if (!skipAutoRegister) {\n return;\n }\n await registerSolanaWalletStandard({ client, walletName });\n },\n disconnect: async () =>\n await core.disconnect(Object.values(SOLANA_CAIP_IDS) as Scope[]),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,gCAA+D;;;ACMxD,IAAM,kBAAiD;AAAA,EAC5D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AACX;AAQO,SAAS,sBACd,UACwB;AACxB,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM;AAC1B,YAAM,SAAS,gBAAgB,OAAwB;AACvD,UAAI,UAAU,QAAQ;AACpB,YAAI,MAAM,IAAI;AAAA,MAChB;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;;;ADfO,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAG+B;AAC7B,QAAM,eAAe,SAAS;AAAA,IAC5B,CAAC,YAAY,gBAAgB,OAAO;AAAA,EACtC;AACA,QAAM,cAAU,0BAAAA,kBAA2B;AAAA,IACzC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,SAAS,OAAgC,CAAC,KAAK,YAAY;AAChE,UAAM,SAAS,gBAAgB,OAAO;AACtC,UAAM,SAAS,QAAQ,MAAM;AAC7B,QAAI,QAAQ;AACV,UAAI,OAAO,IAAI;AAAA,IACjB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;;;AEtCA,IAAAC,6BAGO;AACP,oCAGO;AAiDP,SAAsB,mBACpB,SACuB;AAAA;AA3DzB;AA4DE,UAAM,kBAA2C;AAAA,MAC/C,SAAS;AAAA,IACX;AAEA,UAAM,oBAAmB,aAAQ,qBAAR,YAA4B;AAErD,UAAM,oBAAoB;AAAA,OACxB,mBAAQ,QAAR,mBAAa,sBAAb,YAAkC;AAAA,IACpC;AAEA,UAAM,OAAO,UAAM,mDAAuB;AAAA,MACxC,MAAM,QAAQ;AAAA,MACd,KAAK;AAAA,QACH;AAAA,MACF;AAAA,MACA,UAAU;AAAA;AAAA;AAAA,QAGR,kBACE,QACI,YACA;AAAA,MACR;AAAA,IACF,CAAC;AAED,UAAM,SAAS,KAAK;AAEpB,UAAM,aAAa;AAEnB,QAAI,CAAC,kBAAkB;AACrB,gBAAM,4DAA6B,EAAE,QAAQ,WAAW,CAAC;AAAA,IAC3D;AAEA,WAAO;AAAA,MACL;AAAA,MACA,WAAW,UAAM,iDAAkB,EAAE,QAAQ,WAAW,CAAC;AAAA,MACzD,gBAAgB,MAA2B;AACzC,YAAI,CAAC,kBAAkB;AACrB;AAAA,QACF;AACA,kBAAM,4DAA6B,EAAE,QAAQ,WAAW,CAAC;AAAA,MAC3D;AAAA,MACA,YAAY,MAAS;AACnB,qBAAM,KAAK,WAAW,OAAO,OAAO,eAAe,CAAY;AAAA;AAAA,IACnE;AAAA,EACF;AAAA;","names":["getInfuraRpcUrlsMultichain","import_connect_multichain"]}
|
|
@@ -20,14 +20,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
// src/
|
|
24
|
-
import {
|
|
25
|
-
createMultichainClient
|
|
26
|
-
} from "@metamask/connect-multichain";
|
|
27
|
-
import {
|
|
28
|
-
getWalletStandard,
|
|
29
|
-
registerSolanaWalletStandard
|
|
30
|
-
} from "@metamask/solana-wallet-standard";
|
|
23
|
+
// src/infura.ts
|
|
24
|
+
import { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from "@metamask/connect-multichain";
|
|
31
25
|
|
|
32
26
|
// src/networks.ts
|
|
33
27
|
var SOLANA_CAIP_IDS = {
|
|
@@ -48,7 +42,36 @@ function convertNetworksToCAIP(networks) {
|
|
|
48
42
|
);
|
|
49
43
|
}
|
|
50
44
|
|
|
45
|
+
// src/infura.ts
|
|
46
|
+
var getInfuraRpcUrls = ({
|
|
47
|
+
infuraApiKey,
|
|
48
|
+
networks
|
|
49
|
+
}) => {
|
|
50
|
+
const caipChainIds = networks.map(
|
|
51
|
+
(network) => SOLANA_CAIP_IDS[network]
|
|
52
|
+
);
|
|
53
|
+
const caipMap = getInfuraRpcUrlsMultichain({
|
|
54
|
+
infuraApiKey,
|
|
55
|
+
caipChainIds
|
|
56
|
+
});
|
|
57
|
+
return networks.reduce((acc, network) => {
|
|
58
|
+
const caipId = SOLANA_CAIP_IDS[network];
|
|
59
|
+
const rpcUrl = caipMap[caipId];
|
|
60
|
+
if (rpcUrl) {
|
|
61
|
+
acc[network] = rpcUrl;
|
|
62
|
+
}
|
|
63
|
+
return acc;
|
|
64
|
+
}, {});
|
|
65
|
+
};
|
|
66
|
+
|
|
51
67
|
// src/connect.ts
|
|
68
|
+
import {
|
|
69
|
+
createMultichainClient
|
|
70
|
+
} from "@metamask/connect-multichain";
|
|
71
|
+
import {
|
|
72
|
+
getWalletStandard,
|
|
73
|
+
registerSolanaWalletStandard
|
|
74
|
+
} from "@metamask/solana-wallet-standard";
|
|
52
75
|
function createSolanaClient(options) {
|
|
53
76
|
return __async(this, null, function* () {
|
|
54
77
|
var _a, _b, _c;
|
|
@@ -64,7 +87,11 @@ function createSolanaClient(options) {
|
|
|
64
87
|
api: {
|
|
65
88
|
supportedNetworks
|
|
66
89
|
},
|
|
67
|
-
versions: {
|
|
90
|
+
versions: {
|
|
91
|
+
// typeof guard needed: Metro (React Native) bundles TS source directly,
|
|
92
|
+
// bypassing the tsup build that substitutes __PACKAGE_VERSION__.
|
|
93
|
+
"connect-solana": false ? "unknown" : "0.7.0"
|
|
94
|
+
}
|
|
68
95
|
});
|
|
69
96
|
const client = core.provider;
|
|
70
97
|
const walletName = "MetaMask Connect";
|
|
@@ -87,6 +114,7 @@ function createSolanaClient(options) {
|
|
|
87
114
|
});
|
|
88
115
|
}
|
|
89
116
|
export {
|
|
90
|
-
createSolanaClient
|
|
117
|
+
createSolanaClient,
|
|
118
|
+
getInfuraRpcUrls
|
|
91
119
|
};
|
|
92
120
|
//# sourceMappingURL=connect-solana.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/
|
|
1
|
+
{"version":3,"sources":["../../../src/infura.ts","../../../src/networks.ts","../../../src/connect.ts"],"sourcesContent":["import { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from '@metamask/connect-multichain';\nimport type { CaipChainId } from '@metamask/utils';\n\nimport { SOLANA_CAIP_IDS } from './networks';\nimport type { SolanaNetwork, SolanaSupportedNetworks } from './types';\n\n/**\n * Generates Infura RPC URLs for Solana networks keyed by Solana network name.\n *\n * The returned map is intended for `createSolanaClient({ api: { supportedNetworks } })`.\n *\n * @param options - The options for generating Solana Infura RPC URLs\n * @param options.infuraApiKey - The Infura API key\n * @param options.networks - Solana networks to include in the returned map\n * @returns A map of Solana network names to Infura RPC URLs\n */\nexport const getInfuraRpcUrls = ({\n infuraApiKey,\n networks,\n}: {\n infuraApiKey: string;\n networks: SolanaNetwork[];\n}): SolanaSupportedNetworks => {\n const caipChainIds = networks.map(\n (network) => SOLANA_CAIP_IDS[network] as CaipChainId,\n );\n const caipMap = getInfuraRpcUrlsMultichain({\n infuraApiKey,\n caipChainIds,\n });\n\n return networks.reduce<SolanaSupportedNetworks>((acc, network) => {\n const caipId = SOLANA_CAIP_IDS[network] as CaipChainId;\n const rpcUrl = caipMap[caipId];\n if (rpcUrl) {\n acc[network] = rpcUrl;\n }\n return acc;\n }, {});\n};\n","import type { SolanaNetwork, SolanaSupportedNetworks } from './types';\n\n/**\n * CAIP-2 chain IDs for Solana networks.\n * The reference is the first 32 characters of the Base58-encoded genesis hash.\n */\nexport const SOLANA_CAIP_IDS: Record<SolanaNetwork, string> = {\n mainnet: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n devnet: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n testnet: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n};\n\n/**\n * Converts a record of network names to RPC URLs into a record of CAIP IDs to RPC URLs.\n *\n * @param networks - A record of network names to RPC URLs\n * @returns A record of CAIP IDs to RPC URLs\n */\nexport function convertNetworksToCAIP(\n networks: SolanaSupportedNetworks,\n): Record<string, string> {\n return Object.entries(networks).reduce<Record<string, string>>(\n (acc, [network, rpcUrl]) => {\n const caipId = SOLANA_CAIP_IDS[network as SolanaNetwork];\n if (caipId && rpcUrl) {\n acc[caipId] = rpcUrl;\n }\n return acc;\n },\n {},\n );\n}\n","/* eslint-disable @typescript-eslint/naming-convention -- __PACKAGE_VERSION__ is an esbuild define convention */\nimport {\n createMultichainClient,\n type Scope,\n} from '@metamask/connect-multichain';\nimport {\n getWalletStandard,\n registerSolanaWalletStandard,\n} from '@metamask/solana-wallet-standard';\n\nimport { convertNetworksToCAIP, SOLANA_CAIP_IDS } from './networks';\nimport type {\n SolanaClient,\n SolanaConnectOptions,\n SolanaSupportedNetworks,\n} from './types';\n\n// Value substitued by tsup at build time\ndeclare const __PACKAGE_VERSION__: string | undefined;\n\n/**\n * Creates a new Solana client for connecting to MetaMask via wallet-standard.\n *\n * This function initializes the MultichainSDK and provides methods to get or register\n * a wallet-standard compatible wallet. The wallet handles session creation internally\n * when users connect through the Solana wallet adapter UI.\n *\n * @param options - Configuration options for the Solana client\n * @param options.dapp - Dapp identification and branding settings\n * @param options.api - Optional API configuration with supported networks\n * @param options.api.supportedNetworks - Record mapping network names (mainnet, devnet, testnet) to RPC URLs\n * @param options.debug - Enable debug logging\n * @param options.skipAutoRegister - Skip auto-registering the wallet during creation (defaults to false)\n * @returns A promise that resolves to the Solana client instance\n *\n * @example\n * ```typescript\n * import { createSolanaClient } from '@metamask/connect-solana';\n *\n * // Wallet is auto-registered and ready to use\n * const client = await createSolanaClient({\n * dapp: {\n * name: 'My Solana DApp',\n * url: 'https://mydapp.com',\n * },\n * api: {\n * supportedNetworks: {\n * mainnet: 'https://api.mainnet-beta.solana.com',\n * devnet: 'https://api.devnet.solana.com',\n * },\n * },\n * });\n *\n * // Get the wallet instance directly\n * const wallet = client.getWallet();\n * ```\n */\nexport async function createSolanaClient(\n options: SolanaConnectOptions,\n): Promise<SolanaClient> {\n const defaultNetworks: SolanaSupportedNetworks = {\n mainnet: 'https://api.mainnet-beta.solana.com',\n };\n\n const skipAutoRegister = options.skipAutoRegister ?? false;\n\n const supportedNetworks = convertNetworksToCAIP(\n options.api?.supportedNetworks ?? defaultNetworks,\n );\n\n const core = await createMultichainClient({\n dapp: options.dapp,\n api: {\n supportedNetworks,\n },\n versions: {\n // typeof guard needed: Metro (React Native) bundles TS source directly,\n // bypassing the tsup build that substitutes __PACKAGE_VERSION__.\n 'connect-solana':\n typeof __PACKAGE_VERSION__ === 'undefined'\n ? 'unknown'\n : __PACKAGE_VERSION__,\n },\n });\n\n const client = core.provider;\n\n const walletName = 'MetaMask Connect';\n\n if (!skipAutoRegister) {\n await registerSolanaWalletStandard({ client, walletName });\n }\n\n return {\n core,\n getWallet: () => getWalletStandard({ client, walletName }),\n registerWallet: async (): Promise<void> => {\n if (!skipAutoRegister) {\n return;\n }\n await registerSolanaWalletStandard({ client, walletName });\n },\n disconnect: async () =>\n await core.disconnect(Object.values(SOLANA_CAIP_IDS) as Scope[]),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,oBAAoB,kCAAkC;;;ACMxD,IAAM,kBAAiD;AAAA,EAC5D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AACX;AAQO,SAAS,sBACd,UACwB;AACxB,SAAO,OAAO,QAAQ,QAAQ,EAAE;AAAA,IAC9B,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM;AAC1B,YAAM,SAAS,gBAAgB,OAAwB;AACvD,UAAI,UAAU,QAAQ;AACpB,YAAI,MAAM,IAAI;AAAA,MAChB;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;;;ADfO,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAG+B;AAC7B,QAAM,eAAe,SAAS;AAAA,IAC5B,CAAC,YAAY,gBAAgB,OAAO;AAAA,EACtC;AACA,QAAM,UAAU,2BAA2B;AAAA,IACzC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,SAAS,OAAgC,CAAC,KAAK,YAAY;AAChE,UAAM,SAAS,gBAAgB,OAAO;AACtC,UAAM,SAAS,QAAQ,MAAM;AAC7B,QAAI,QAAQ;AACV,UAAI,OAAO,IAAI;AAAA,IACjB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;;;AEtCA;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAiDP,SAAsB,mBACpB,SACuB;AAAA;AA3DzB;AA4DE,UAAM,kBAA2C;AAAA,MAC/C,SAAS;AAAA,IACX;AAEA,UAAM,oBAAmB,aAAQ,qBAAR,YAA4B;AAErD,UAAM,oBAAoB;AAAA,OACxB,mBAAQ,QAAR,mBAAa,sBAAb,YAAkC;AAAA,IACpC;AAEA,UAAM,OAAO,MAAM,uBAAuB;AAAA,MACxC,MAAM,QAAQ;AAAA,MACd,KAAK;AAAA,QACH;AAAA,MACF;AAAA,MACA,UAAU;AAAA;AAAA;AAAA,QAGR,kBACE,QACI,YACA;AAAA,MACR;AAAA,IACF,CAAC;AAED,UAAM,SAAS,KAAK;AAEpB,UAAM,aAAa;AAEnB,QAAI,CAAC,kBAAkB;AACrB,YAAM,6BAA6B,EAAE,QAAQ,WAAW,CAAC;AAAA,IAC3D;AAEA,WAAO;AAAA,MACL;AAAA,MACA,WAAW,MAAM,kBAAkB,EAAE,QAAQ,WAAW,CAAC;AAAA,MACzD,gBAAgB,MAA2B;AACzC,YAAI,CAAC,kBAAkB;AACrB;AAAA,QACF;AACA,cAAM,6BAA6B,EAAE,QAAQ,WAAW,CAAC;AAAA,MAC3D;AAAA,MACA,YAAY,MAAS;AACnB,qBAAM,KAAK,WAAW,OAAO,OAAO,eAAe,CAAY;AAAA;AAAA,IACnE;AAAA,EACF;AAAA;","names":[]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,6 +58,21 @@ type SolanaClient = {
|
|
|
58
58
|
disconnect: () => Promise<void>;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Generates Infura RPC URLs for Solana networks keyed by Solana network name.
|
|
63
|
+
*
|
|
64
|
+
* The returned map is intended for `createSolanaClient({ api: { supportedNetworks } })`.
|
|
65
|
+
*
|
|
66
|
+
* @param options - The options for generating Solana Infura RPC URLs
|
|
67
|
+
* @param options.infuraApiKey - The Infura API key
|
|
68
|
+
* @param options.networks - Solana networks to include in the returned map
|
|
69
|
+
* @returns A map of Solana network names to Infura RPC URLs
|
|
70
|
+
*/
|
|
71
|
+
declare const getInfuraRpcUrls: ({ infuraApiKey, networks, }: {
|
|
72
|
+
infuraApiKey: string;
|
|
73
|
+
networks: SolanaNetwork[];
|
|
74
|
+
}) => SolanaSupportedNetworks;
|
|
75
|
+
|
|
61
76
|
/**
|
|
62
77
|
* Creates a new Solana client for connecting to MetaMask via wallet-standard.
|
|
63
78
|
*
|
|
@@ -97,4 +112,4 @@ type SolanaClient = {
|
|
|
97
112
|
*/
|
|
98
113
|
declare function createSolanaClient(options: SolanaConnectOptions): Promise<SolanaClient>;
|
|
99
114
|
|
|
100
|
-
export { type SolanaClient, type SolanaConnectOptions, type SolanaNetwork, type SolanaSupportedNetworks, createSolanaClient };
|
|
115
|
+
export { type SolanaClient, type SolanaConnectOptions, type SolanaNetwork, type SolanaSupportedNetworks, createSolanaClient, getInfuraRpcUrls };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/connect-solana",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Solana Layer for MetaMask Connect",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"test:watch": "vitest watch"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@metamask/connect-multichain": "^0.
|
|
61
|
+
"@metamask/connect-multichain": "^0.11.0",
|
|
62
62
|
"@metamask/solana-wallet-standard": "^0.6.0",
|
|
63
63
|
"@wallet-standard/base": "^1.1.0"
|
|
64
64
|
},
|