@solana/client 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +108 -19
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +106 -20
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +106 -20
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +108 -19
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +106 -20
- package/dist/index.node.mjs.map +1 -1
- package/dist/server/index.node.cjs +168 -0
- package/dist/server/index.node.cjs.map +1 -0
- package/dist/server/index.node.mjs +155 -0
- package/dist/server/index.node.mjs.map +1 -0
- package/dist/types/client/actions.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/serialization/state.d.ts +13 -0
- package/dist/types/serialization/state.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +3 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/signers.d.ts +25 -0
- package/dist/types/server/signers.d.ts.map +1 -0
- package/dist/types/types.d.ts +11 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/cluster.d.ts +14 -0
- package/dist/types/utils/cluster.d.ts.map +1 -0
- package/dist/types/wallet/standard.d.ts +1 -0
- package/dist/types/wallet/standard.d.ts.map +1 -1
- package/package.json +24 -17
package/dist/index.native.mjs
CHANGED
|
@@ -531,24 +531,30 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
531
531
|
}
|
|
532
532
|
__name(sendTransaction, "sendTransaction");
|
|
533
533
|
async function requestAirdrop(address4, lamports2) {
|
|
534
|
-
|
|
535
|
-
|
|
534
|
+
try {
|
|
535
|
+
const factory = airdropFactory({
|
|
536
|
+
rpc: runtime.rpc,
|
|
537
|
+
rpcSubscriptions: runtime.rpcSubscriptions
|
|
538
|
+
});
|
|
539
|
+
const signature4 = await factory({
|
|
540
|
+
commitment: getCommitment("confirmed"),
|
|
541
|
+
lamports: lamports2,
|
|
542
|
+
recipientAddress: address4
|
|
543
|
+
});
|
|
544
|
+
logger({
|
|
545
|
+
data: { address: address4.toString(), lamports: lamports2.toString(), signature: signature4 },
|
|
546
|
+
level: "info",
|
|
547
|
+
message: "airdrop requested"
|
|
548
|
+
});
|
|
549
|
+
return signature4;
|
|
550
|
+
} catch (error) {
|
|
551
|
+
logger({
|
|
552
|
+
data: { address: address4.toString(), lamports: lamports2.toString(), ...formatError(error) },
|
|
553
|
+
level: "error",
|
|
554
|
+
message: "airdrop request failed"
|
|
555
|
+
});
|
|
556
|
+
throw error;
|
|
536
557
|
}
|
|
537
|
-
const factory = airdropFactory({
|
|
538
|
-
rpc: runtime.rpc,
|
|
539
|
-
rpcSubscriptions: runtime.rpcSubscriptions
|
|
540
|
-
});
|
|
541
|
-
const signature4 = await factory({
|
|
542
|
-
commitment: getCommitment("confirmed"),
|
|
543
|
-
lamports: lamports2,
|
|
544
|
-
recipientAddress: address4
|
|
545
|
-
});
|
|
546
|
-
logger({
|
|
547
|
-
data: { address: address4.toString(), lamports: lamports2.toString(), signature: signature4 },
|
|
548
|
-
level: "info",
|
|
549
|
-
message: "airdrop requested"
|
|
550
|
-
});
|
|
551
|
-
return signature4;
|
|
552
558
|
}
|
|
553
559
|
__name(requestAirdrop, "requestAirdrop");
|
|
554
560
|
return {
|
|
@@ -2238,6 +2244,33 @@ function lamportsFromJson(value) {
|
|
|
2238
2244
|
return lamports(value, "lamports");
|
|
2239
2245
|
}
|
|
2240
2246
|
__name(lamportsFromJson, "lamportsFromJson");
|
|
2247
|
+
|
|
2248
|
+
// src/serialization/state.ts
|
|
2249
|
+
var SERIALIZABLE_STATE_VERSION = 1;
|
|
2250
|
+
function getInitialSerializableState(config) {
|
|
2251
|
+
return {
|
|
2252
|
+
autoconnect: false,
|
|
2253
|
+
commitment: config.commitment,
|
|
2254
|
+
endpoint: config.endpoint,
|
|
2255
|
+
lastConnectorId: null,
|
|
2256
|
+
lastPublicKey: null,
|
|
2257
|
+
version: SERIALIZABLE_STATE_VERSION,
|
|
2258
|
+
websocketEndpoint: config.websocketEndpoint
|
|
2259
|
+
};
|
|
2260
|
+
}
|
|
2261
|
+
__name(getInitialSerializableState, "getInitialSerializableState");
|
|
2262
|
+
function applySerializableState(config, state) {
|
|
2263
|
+
if (!state) {
|
|
2264
|
+
return config;
|
|
2265
|
+
}
|
|
2266
|
+
return {
|
|
2267
|
+
...config,
|
|
2268
|
+
commitment: state.commitment ?? config.commitment,
|
|
2269
|
+
endpoint: state.endpoint ?? config.endpoint,
|
|
2270
|
+
websocketEndpoint: state.websocketEndpoint ?? config.websocketEndpoint
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
__name(applySerializableState, "applySerializableState");
|
|
2241
2274
|
var COMMITMENT_PRIORITY = {
|
|
2242
2275
|
processed: 0,
|
|
2243
2276
|
confirmed: 1,
|
|
@@ -2550,6 +2583,56 @@ function toAddressString(addressLike) {
|
|
|
2550
2583
|
}
|
|
2551
2584
|
__name(toAddressString, "toAddressString");
|
|
2552
2585
|
|
|
2586
|
+
// src/utils/cluster.ts
|
|
2587
|
+
var MONIKER_ENDPOINTS = {
|
|
2588
|
+
devnet: {
|
|
2589
|
+
endpoint: "https://api.devnet.solana.com",
|
|
2590
|
+
websocketEndpoint: "wss://api.devnet.solana.com"
|
|
2591
|
+
},
|
|
2592
|
+
localhost: {
|
|
2593
|
+
endpoint: "http://127.0.0.1:8899",
|
|
2594
|
+
websocketEndpoint: "ws://127.0.0.1:8900"
|
|
2595
|
+
},
|
|
2596
|
+
localnet: {
|
|
2597
|
+
endpoint: "http://127.0.0.1:8899",
|
|
2598
|
+
websocketEndpoint: "ws://127.0.0.1:8900"
|
|
2599
|
+
},
|
|
2600
|
+
"mainnet-beta": {
|
|
2601
|
+
endpoint: "https://api.mainnet-beta.solana.com",
|
|
2602
|
+
websocketEndpoint: "wss://api.mainnet-beta.solana.com"
|
|
2603
|
+
},
|
|
2604
|
+
mainnet: {
|
|
2605
|
+
endpoint: "https://api.mainnet-beta.solana.com",
|
|
2606
|
+
websocketEndpoint: "wss://api.mainnet-beta.solana.com"
|
|
2607
|
+
},
|
|
2608
|
+
testnet: {
|
|
2609
|
+
endpoint: "https://api.testnet.solana.com",
|
|
2610
|
+
websocketEndpoint: "wss://api.testnet.solana.com"
|
|
2611
|
+
}
|
|
2612
|
+
};
|
|
2613
|
+
function inferWebsocketEndpoint(endpoint) {
|
|
2614
|
+
if (endpoint.startsWith("https://")) {
|
|
2615
|
+
return endpoint.replace("https://", "wss://");
|
|
2616
|
+
}
|
|
2617
|
+
if (endpoint.startsWith("http://")) {
|
|
2618
|
+
return endpoint.replace("http://", "ws://");
|
|
2619
|
+
}
|
|
2620
|
+
return endpoint;
|
|
2621
|
+
}
|
|
2622
|
+
__name(inferWebsocketEndpoint, "inferWebsocketEndpoint");
|
|
2623
|
+
function resolveCluster(config) {
|
|
2624
|
+
const moniker = config.moniker ?? (config.endpoint ? "custom" : "devnet");
|
|
2625
|
+
const mapped = moniker === "custom" ? void 0 : MONIKER_ENDPOINTS[moniker];
|
|
2626
|
+
const endpoint = config.endpoint ?? mapped?.endpoint;
|
|
2627
|
+
const websocketEndpoint = config.websocketEndpoint ?? mapped?.websocketEndpoint ?? inferWebsocketEndpoint(endpoint);
|
|
2628
|
+
return {
|
|
2629
|
+
endpoint,
|
|
2630
|
+
moniker,
|
|
2631
|
+
websocketEndpoint
|
|
2632
|
+
};
|
|
2633
|
+
}
|
|
2634
|
+
__name(resolveCluster, "resolveCluster");
|
|
2635
|
+
|
|
2553
2636
|
// src/utils/stableStringify.ts
|
|
2554
2637
|
function stableStringify(value) {
|
|
2555
2638
|
const result = JSON.stringify(value, (_key, candidate) => {
|
|
@@ -2568,7 +2651,8 @@ var base58Decoder = getBase58Decoder();
|
|
|
2568
2651
|
var transactionDecoder = getTransactionDecoder();
|
|
2569
2652
|
var transactionEncoder = getTransactionEncoder();
|
|
2570
2653
|
function deriveConnectorId(wallet) {
|
|
2571
|
-
|
|
2654
|
+
const kebab = wallet.name.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
2655
|
+
return `wallet-standard:${kebab}`;
|
|
2572
2656
|
}
|
|
2573
2657
|
__name(deriveConnectorId, "deriveConnectorId");
|
|
2574
2658
|
function getPrimaryAccount(accounts) {
|
|
@@ -2611,7 +2695,9 @@ function createWalletStandardConnector(wallet, options = {}) {
|
|
|
2611
2695
|
canAutoConnect: options.canAutoConnect ?? Boolean(wallet.features[StandardConnect]),
|
|
2612
2696
|
icon: options.icon ?? wallet.icon,
|
|
2613
2697
|
id: options.id ?? deriveConnectorId(wallet),
|
|
2614
|
-
|
|
2698
|
+
kind: options.kind ?? "wallet-standard",
|
|
2699
|
+
name: options.name ?? wallet.name,
|
|
2700
|
+
ready: typeof window !== "undefined"
|
|
2615
2701
|
};
|
|
2616
2702
|
async function connect(connectionOptions = {}) {
|
|
2617
2703
|
const connectFeature = wallet.features[StandardConnect];
|
|
@@ -2735,6 +2821,6 @@ function watchWalletStandardConnectors(onChange, options = {}) {
|
|
|
2735
2821
|
}
|
|
2736
2822
|
__name(watchWalletStandardConnectors, "watchWalletStandardConnectors");
|
|
2737
2823
|
|
|
2738
|
-
export { LAMPORTS_PER_SOL, SIGNATURE_STATUS_TIMEOUT_MS, applyRatio, assertDecimals, assertNonNegative, bigintFromJson, bigintToJson, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, confirmationMeetsCommitment, createAsyncState, createClient, createClientStore, createDefaultClientStore, createInitialAsyncState, createInitialClientState, createRatio, createSolTransferController, createSolTransferHelper, createSolanaRpcClient, createSplTokenHelper, createSplTransferController, createTokenAmount, createTransactionHelper, createTransactionPoolController, createTransactionRecipe, createWalletRegistry, createWalletStandardConnector, deriveConfirmationStatus, getWalletStandardConnectors, insertReferenceKey, insertReferenceKeys, lamports, lamportsFromJson, lamportsFromSol, lamportsMath, lamportsToJson, lamportsToSolString, normalizeSignature, pow10, prepareTransaction, stableStringify, toAddress2 as toAddress, toAddressString, toBigint2 as toBigint, transactionToBase64, transactionToBase64WithSigners, watchWalletStandardConnectors };
|
|
2824
|
+
export { LAMPORTS_PER_SOL, SIGNATURE_STATUS_TIMEOUT_MS, applyRatio, applySerializableState, assertDecimals, assertNonNegative, bigintFromJson, bigintToJson, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, confirmationMeetsCommitment, createAsyncState, createClient, createClientStore, createDefaultClientStore, createInitialAsyncState, createInitialClientState, createRatio, createSolTransferController, createSolTransferHelper, createSolanaRpcClient, createSplTokenHelper, createSplTransferController, createTokenAmount, createTransactionHelper, createTransactionPoolController, createTransactionRecipe, createWalletRegistry, createWalletStandardConnector, deriveConfirmationStatus, getInitialSerializableState, getWalletStandardConnectors, insertReferenceKey, insertReferenceKeys, lamports, lamportsFromJson, lamportsFromSol, lamportsMath, lamportsToJson, lamportsToSolString, normalizeSignature, pow10, prepareTransaction, resolveCluster, stableStringify, toAddress2 as toAddress, toAddressString, toBigint2 as toBigint, transactionToBase64, transactionToBase64WithSigners, watchWalletStandardConnectors };
|
|
2739
2825
|
//# sourceMappingURL=index.native.mjs.map
|
|
2740
2826
|
//# sourceMappingURL=index.native.mjs.map
|