@solana/rpc-core
Advanced tools
Comparing version 2.0.0-experimental.8de8e11 to 2.0.0-experimental.8e39a42
@@ -1,31 +0,186 @@ | ||
// src/params-patcher.ts | ||
function visitNode(value, keyPath, onIntegerOverflow) { | ||
if (Array.isArray(value)) { | ||
return value.map( | ||
(element, ii) => visitNode(element, [...keyPath, ii], onIntegerOverflow) | ||
); | ||
} else if (typeof value === "object" && value !== null) { | ||
const out = {}; | ||
for (const propName in value) { | ||
if (Object.prototype.hasOwnProperty.call(value, propName)) { | ||
out[propName] = visitNode(value[propName], [...keyPath, propName], onIntegerOverflow); | ||
import { createJsonRpcApi, createJsonRpcSubscriptionsApi } from '@solana/rpc-transport'; | ||
// src/rpc-methods/index.ts | ||
// src/default-commitment.ts | ||
function applyDefaultCommitment({ | ||
commitmentPropertyName, | ||
params, | ||
optionsObjectPositionInParams, | ||
overrideCommitment | ||
}) { | ||
const paramInTargetPosition = params[optionsObjectPositionInParams]; | ||
if ( | ||
// There's no config. | ||
paramInTargetPosition === void 0 || // There is a config object. | ||
paramInTargetPosition && typeof paramInTargetPosition === "object" && !Array.isArray(paramInTargetPosition) | ||
) { | ||
if ( | ||
// The config object already has a commitment set. | ||
paramInTargetPosition && commitmentPropertyName in paramInTargetPosition | ||
) { | ||
if (!paramInTargetPosition[commitmentPropertyName] || paramInTargetPosition[commitmentPropertyName] === "finalized") { | ||
const nextParams = [...params]; | ||
const { | ||
[commitmentPropertyName]: _, | ||
// eslint-disable-line @typescript-eslint/no-unused-vars | ||
...rest | ||
} = paramInTargetPosition; | ||
if (Object.keys(rest).length > 0) { | ||
nextParams[optionsObjectPositionInParams] = rest; | ||
} else { | ||
if (optionsObjectPositionInParams === nextParams.length - 1) { | ||
nextParams.length--; | ||
} else { | ||
nextParams[optionsObjectPositionInParams] = void 0; | ||
} | ||
} | ||
return nextParams; | ||
} | ||
} else if (overrideCommitment !== "finalized") { | ||
const nextParams = [...params]; | ||
nextParams[optionsObjectPositionInParams] = { | ||
...paramInTargetPosition, | ||
[commitmentPropertyName]: overrideCommitment | ||
}; | ||
return nextParams; | ||
} | ||
return out; | ||
} else if (typeof value === "bigint") { | ||
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) { | ||
onIntegerOverflow(keyPath, value); | ||
} | ||
return Number(value); | ||
} else { | ||
return value; | ||
} | ||
return params; | ||
} | ||
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) { | ||
return visitNode(params, [], onIntegerOverflow); | ||
// src/params-patcher-bigint-downcast.ts | ||
function downcastNodeToNumberIfBigint(value) { | ||
return typeof value === "bigint" ? ( | ||
// FIXME(solana-labs/solana/issues/30341) Create a data type to represent u64 in the Solana | ||
// JSON RPC implementation so that we can throw away this entire patcher instead of unsafely | ||
// downcasting `bigints` to `numbers`. | ||
Number(value) | ||
) : value; | ||
} | ||
// src/response-patcher-types.ts | ||
// src/params-patcher-integer-overflow.ts | ||
function getIntegerOverflowNodeVisitor(onIntegerOverflow) { | ||
return (value, { keyPath }) => { | ||
if (typeof value === "bigint") { | ||
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) { | ||
onIntegerOverflow(keyPath, value); | ||
} | ||
} | ||
return value; | ||
}; | ||
} | ||
// src/params-patcher-options-object-position-config.ts | ||
var OPTIONS_OBJECT_POSITION_BY_METHOD = { | ||
accountNotifications: 1, | ||
blockNotifications: 1, | ||
getAccountInfo: 1, | ||
getBalance: 1, | ||
getBlock: 1, | ||
getBlockHeight: 0, | ||
getBlockProduction: 0, | ||
getBlocks: 2, | ||
getBlocksWithLimit: 2, | ||
getConfirmedBlock: 1, | ||
getConfirmedBlocks: 1, | ||
getConfirmedBlocksWithLimit: 2, | ||
getConfirmedSignaturesForAddress2: 1, | ||
getConfirmedTransaction: 1, | ||
getEpochInfo: 0, | ||
getFeeCalculatorForBlockhash: 1, | ||
getFeeForMessage: 1, | ||
getFees: 1, | ||
getInflationGovernor: 0, | ||
getInflationReward: 1, | ||
getLargestAccounts: 0, | ||
getLatestBlockhash: 0, | ||
getLeaderSchedule: 1, | ||
getMinimumBalanceForRentExemption: 1, | ||
getMultipleAccounts: 1, | ||
getProgramAccounts: 1, | ||
getRecentBlockhash: 1, | ||
getSignaturesForAddress: 1, | ||
getSlot: 0, | ||
getSlotLeader: 0, | ||
getStakeActivation: 1, | ||
getStakeMinimumDelegation: 0, | ||
getSupply: 0, | ||
getTokenAccountBalance: 1, | ||
getTokenAccountsByDelegate: 2, | ||
getTokenAccountsByOwner: 2, | ||
getTokenLargestAccounts: 1, | ||
getTokenSupply: 1, | ||
getTransaction: 1, | ||
getTransactionCount: 0, | ||
getVoteAccounts: 0, | ||
isBlockhashValid: 1, | ||
logsNotifications: 1, | ||
programNotifications: 1, | ||
requestAirdrop: 2, | ||
sendTransaction: 1, | ||
signatureNotifications: 1, | ||
simulateTransaction: 1 | ||
}; | ||
// src/tree-traversal.ts | ||
var KEYPATH_WILDCARD = {}; | ||
function getTreeWalker(visitors) { | ||
return function traverse(node, state) { | ||
if (Array.isArray(node)) { | ||
return node.map((element, ii) => { | ||
const nextState = { | ||
...state, | ||
keyPath: [...state.keyPath, ii] | ||
}; | ||
return traverse(element, nextState); | ||
}); | ||
} else if (typeof node === "object" && node !== null) { | ||
const out = {}; | ||
for (const propName in node) { | ||
if (!Object.prototype.hasOwnProperty.call(node, propName)) { | ||
continue; | ||
} | ||
const nextState = { | ||
...state, | ||
keyPath: [...state.keyPath, propName] | ||
}; | ||
out[propName] = traverse(node[propName], nextState); | ||
} | ||
return out; | ||
} else { | ||
return visitors.reduce((acc, visitNode) => visitNode(acc, state), node); | ||
} | ||
}; | ||
} | ||
// src/params-patcher.ts | ||
function getParamsPatcherForSolanaLabsRpc(config) { | ||
const defaultCommitment = config?.defaultCommitment; | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
return (rawParams, methodName) => { | ||
const traverse = getTreeWalker([ | ||
...handleIntegerOverflow ? [getIntegerOverflowNodeVisitor((...args) => handleIntegerOverflow(methodName, ...args))] : [], | ||
downcastNodeToNumberIfBigint | ||
]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
const patchedParams = traverse(rawParams, initialState); | ||
if (!Array.isArray(patchedParams)) { | ||
return patchedParams; | ||
} | ||
const optionsObjectPositionInParams = OPTIONS_OBJECT_POSITION_BY_METHOD[methodName]; | ||
if (optionsObjectPositionInParams == null) { | ||
return patchedParams; | ||
} | ||
return applyDefaultCommitment({ | ||
commitmentPropertyName: methodName === "sendTransaction" ? "preflightCommitment" : "commitment", | ||
optionsObjectPositionInParams, | ||
overrideCommitment: defaultCommitment, | ||
params: patchedParams | ||
}); | ||
}; | ||
} | ||
// src/response-patcher-allowed-numeric-values.ts | ||
@@ -420,35 +575,44 @@ var jsonParsedTokenAccountsConfigs = [ | ||
// src/response-patcher.ts | ||
function getNextAllowedKeypaths(keyPaths, property) { | ||
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1)); | ||
// src/response-patcher-bigint-upcast.ts | ||
function keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths) { | ||
return allowedNumericKeyPaths.some((prohibitedKeyPath) => { | ||
if (prohibitedKeyPath.length !== keyPath.length) { | ||
return false; | ||
} | ||
for (let ii = keyPath.length - 1; ii >= 0; ii--) { | ||
const keyPathPart = keyPath[ii]; | ||
const prohibitedKeyPathPart = prohibitedKeyPath[ii]; | ||
if (prohibitedKeyPathPart !== keyPathPart && (prohibitedKeyPathPart !== KEYPATH_WILDCARD || typeof keyPathPart !== "number")) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}); | ||
} | ||
function visitNode2(value, allowedKeypaths) { | ||
if (Array.isArray(value)) { | ||
return value.map((element, ii) => { | ||
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, ii); | ||
return visitNode2(element, nextAllowedKeypaths); | ||
}); | ||
} else if (typeof value === "object" && value !== null) { | ||
const out = {}; | ||
for (const [propName, innerValue] of Object.entries(value)) { | ||
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName); | ||
out[propName] = visitNode2(innerValue, nextAllowedKeypaths); | ||
function getBigIntUpcastVisitor(allowedNumericKeyPaths) { | ||
return function upcastNodeToBigIntIfNumber(value, { keyPath }) { | ||
if (typeof value === "number" && Number.isInteger(value) && !keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths)) { | ||
return BigInt(value); | ||
} else { | ||
return value; | ||
} | ||
return out; | ||
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted; | ||
// Upcast the value to `bigint` unless an allowed keypath is present. | ||
allowedKeypaths.length === 0 && // Only try to upcast an Integer to `bigint` | ||
Number.isInteger(value)) { | ||
return BigInt(value); | ||
} else { | ||
return value; | ||
} | ||
}; | ||
} | ||
// src/response-patcher.ts | ||
function patchResponseForSolanaLabsRpc(rawResponse, methodName) { | ||
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0; | ||
return visitNode2(rawResponse, allowedKeypaths ?? []); | ||
const allowedNumericKeyPaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0; | ||
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths ?? [])]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
return traverse(rawResponse, initialState); | ||
} | ||
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, methodName) { | ||
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForNotification()[methodName] : void 0; | ||
return visitNode2(rawResponse, allowedKeypaths ?? []); | ||
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName) { | ||
const allowedNumericKeyPaths = notificationName ? getAllowedNumericKeypathsForNotification()[notificationName] : void 0; | ||
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths ?? [])]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
return traverse(rawResponse, initialState); | ||
} | ||
@@ -458,62 +622,24 @@ | ||
function createSolanaRpcApi(config) { | ||
return new Proxy({}, { | ||
defineProperty() { | ||
return false; | ||
}, | ||
deleteProperty() { | ||
return false; | ||
}, | ||
get(...args) { | ||
const [_, p] = args; | ||
const methodName = p.toString(); | ||
return function(...rawParams) { | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
const params = patchParamsForSolanaLabsRpc( | ||
rawParams, | ||
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(methodName, keyPath, value) : void 0 | ||
); | ||
return { | ||
methodName, | ||
params, | ||
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpc(rawResponse, methodName) | ||
}; | ||
}; | ||
} | ||
return createJsonRpcApi({ | ||
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config), | ||
responseTransformer: patchResponseForSolanaLabsRpc | ||
}); | ||
} | ||
// src/rpc-subscriptions/index.ts | ||
function createSolanaRpcSubscriptionsApi(config) { | ||
return new Proxy({}, { | ||
defineProperty() { | ||
return false; | ||
}, | ||
deleteProperty() { | ||
return false; | ||
}, | ||
get(...args) { | ||
const [_, p] = args; | ||
const notificationName = p.toString(); | ||
return function(...rawParams) { | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
const params = patchParamsForSolanaLabsRpc( | ||
rawParams, | ||
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(notificationName, keyPath, value) : void 0 | ||
); | ||
return { | ||
params, | ||
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName), | ||
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}; | ||
}; | ||
} | ||
function createSolanaRpcSubscriptionsApi_INTERNAL(config) { | ||
return createJsonRpcSubscriptionsApi({ | ||
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config), | ||
responseTransformer: patchResponseForSolanaLabsRpcSubscriptions, | ||
subscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}); | ||
} | ||
function createSolanaRpcSubscriptionsApi(config) { | ||
return createSolanaRpcSubscriptionsApi_INTERNAL(config); | ||
} | ||
function createSolanaRpcSubscriptionsApi_UNSTABLE(config) { | ||
return createSolanaRpcSubscriptionsApi(config); | ||
return createSolanaRpcSubscriptionsApi_INTERNAL(config); | ||
} | ||
export { createSolanaRpcApi, createSolanaRpcSubscriptionsApi, createSolanaRpcSubscriptionsApi_UNSTABLE }; | ||
export { createSolanaRpcApi, createSolanaRpcSubscriptionsApi, createSolanaRpcSubscriptionsApi_INTERNAL, createSolanaRpcSubscriptionsApi_UNSTABLE }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.browser.js.map |
@@ -1,31 +0,186 @@ | ||
// src/params-patcher.ts | ||
function visitNode(value, keyPath, onIntegerOverflow) { | ||
if (Array.isArray(value)) { | ||
return value.map( | ||
(element, ii) => visitNode(element, [...keyPath, ii], onIntegerOverflow) | ||
); | ||
} else if (typeof value === "object" && value !== null) { | ||
const out = {}; | ||
for (const propName in value) { | ||
if (Object.prototype.hasOwnProperty.call(value, propName)) { | ||
out[propName] = visitNode(value[propName], [...keyPath, propName], onIntegerOverflow); | ||
import { createJsonRpcApi, createJsonRpcSubscriptionsApi } from '@solana/rpc-transport'; | ||
// src/rpc-methods/index.ts | ||
// src/default-commitment.ts | ||
function applyDefaultCommitment({ | ||
commitmentPropertyName, | ||
params, | ||
optionsObjectPositionInParams, | ||
overrideCommitment | ||
}) { | ||
const paramInTargetPosition = params[optionsObjectPositionInParams]; | ||
if ( | ||
// There's no config. | ||
paramInTargetPosition === void 0 || // There is a config object. | ||
paramInTargetPosition && typeof paramInTargetPosition === "object" && !Array.isArray(paramInTargetPosition) | ||
) { | ||
if ( | ||
// The config object already has a commitment set. | ||
paramInTargetPosition && commitmentPropertyName in paramInTargetPosition | ||
) { | ||
if (!paramInTargetPosition[commitmentPropertyName] || paramInTargetPosition[commitmentPropertyName] === "finalized") { | ||
const nextParams = [...params]; | ||
const { | ||
[commitmentPropertyName]: _, | ||
// eslint-disable-line @typescript-eslint/no-unused-vars | ||
...rest | ||
} = paramInTargetPosition; | ||
if (Object.keys(rest).length > 0) { | ||
nextParams[optionsObjectPositionInParams] = rest; | ||
} else { | ||
if (optionsObjectPositionInParams === nextParams.length - 1) { | ||
nextParams.length--; | ||
} else { | ||
nextParams[optionsObjectPositionInParams] = void 0; | ||
} | ||
} | ||
return nextParams; | ||
} | ||
} else if (overrideCommitment !== "finalized") { | ||
const nextParams = [...params]; | ||
nextParams[optionsObjectPositionInParams] = { | ||
...paramInTargetPosition, | ||
[commitmentPropertyName]: overrideCommitment | ||
}; | ||
return nextParams; | ||
} | ||
return out; | ||
} else if (typeof value === "bigint") { | ||
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) { | ||
onIntegerOverflow(keyPath, value); | ||
} | ||
return Number(value); | ||
} else { | ||
return value; | ||
} | ||
return params; | ||
} | ||
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) { | ||
return visitNode(params, [], onIntegerOverflow); | ||
// src/params-patcher-bigint-downcast.ts | ||
function downcastNodeToNumberIfBigint(value) { | ||
return typeof value === "bigint" ? ( | ||
// FIXME(solana-labs/solana/issues/30341) Create a data type to represent u64 in the Solana | ||
// JSON RPC implementation so that we can throw away this entire patcher instead of unsafely | ||
// downcasting `bigints` to `numbers`. | ||
Number(value) | ||
) : value; | ||
} | ||
// src/response-patcher-types.ts | ||
// src/params-patcher-integer-overflow.ts | ||
function getIntegerOverflowNodeVisitor(onIntegerOverflow) { | ||
return (value, { keyPath }) => { | ||
if (typeof value === "bigint") { | ||
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) { | ||
onIntegerOverflow(keyPath, value); | ||
} | ||
} | ||
return value; | ||
}; | ||
} | ||
// src/params-patcher-options-object-position-config.ts | ||
var OPTIONS_OBJECT_POSITION_BY_METHOD = { | ||
accountNotifications: 1, | ||
blockNotifications: 1, | ||
getAccountInfo: 1, | ||
getBalance: 1, | ||
getBlock: 1, | ||
getBlockHeight: 0, | ||
getBlockProduction: 0, | ||
getBlocks: 2, | ||
getBlocksWithLimit: 2, | ||
getConfirmedBlock: 1, | ||
getConfirmedBlocks: 1, | ||
getConfirmedBlocksWithLimit: 2, | ||
getConfirmedSignaturesForAddress2: 1, | ||
getConfirmedTransaction: 1, | ||
getEpochInfo: 0, | ||
getFeeCalculatorForBlockhash: 1, | ||
getFeeForMessage: 1, | ||
getFees: 1, | ||
getInflationGovernor: 0, | ||
getInflationReward: 1, | ||
getLargestAccounts: 0, | ||
getLatestBlockhash: 0, | ||
getLeaderSchedule: 1, | ||
getMinimumBalanceForRentExemption: 1, | ||
getMultipleAccounts: 1, | ||
getProgramAccounts: 1, | ||
getRecentBlockhash: 1, | ||
getSignaturesForAddress: 1, | ||
getSlot: 0, | ||
getSlotLeader: 0, | ||
getStakeActivation: 1, | ||
getStakeMinimumDelegation: 0, | ||
getSupply: 0, | ||
getTokenAccountBalance: 1, | ||
getTokenAccountsByDelegate: 2, | ||
getTokenAccountsByOwner: 2, | ||
getTokenLargestAccounts: 1, | ||
getTokenSupply: 1, | ||
getTransaction: 1, | ||
getTransactionCount: 0, | ||
getVoteAccounts: 0, | ||
isBlockhashValid: 1, | ||
logsNotifications: 1, | ||
programNotifications: 1, | ||
requestAirdrop: 2, | ||
sendTransaction: 1, | ||
signatureNotifications: 1, | ||
simulateTransaction: 1 | ||
}; | ||
// src/tree-traversal.ts | ||
var KEYPATH_WILDCARD = {}; | ||
function getTreeWalker(visitors) { | ||
return function traverse(node, state) { | ||
if (Array.isArray(node)) { | ||
return node.map((element, ii) => { | ||
const nextState = { | ||
...state, | ||
keyPath: [...state.keyPath, ii] | ||
}; | ||
return traverse(element, nextState); | ||
}); | ||
} else if (typeof node === "object" && node !== null) { | ||
const out = {}; | ||
for (const propName in node) { | ||
if (!Object.prototype.hasOwnProperty.call(node, propName)) { | ||
continue; | ||
} | ||
const nextState = { | ||
...state, | ||
keyPath: [...state.keyPath, propName] | ||
}; | ||
out[propName] = traverse(node[propName], nextState); | ||
} | ||
return out; | ||
} else { | ||
return visitors.reduce((acc, visitNode) => visitNode(acc, state), node); | ||
} | ||
}; | ||
} | ||
// src/params-patcher.ts | ||
function getParamsPatcherForSolanaLabsRpc(config) { | ||
const defaultCommitment = config?.defaultCommitment; | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
return (rawParams, methodName) => { | ||
const traverse = getTreeWalker([ | ||
...handleIntegerOverflow ? [getIntegerOverflowNodeVisitor((...args) => handleIntegerOverflow(methodName, ...args))] : [], | ||
downcastNodeToNumberIfBigint | ||
]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
const patchedParams = traverse(rawParams, initialState); | ||
if (!Array.isArray(patchedParams)) { | ||
return patchedParams; | ||
} | ||
const optionsObjectPositionInParams = OPTIONS_OBJECT_POSITION_BY_METHOD[methodName]; | ||
if (optionsObjectPositionInParams == null) { | ||
return patchedParams; | ||
} | ||
return applyDefaultCommitment({ | ||
commitmentPropertyName: methodName === "sendTransaction" ? "preflightCommitment" : "commitment", | ||
optionsObjectPositionInParams, | ||
overrideCommitment: defaultCommitment, | ||
params: patchedParams | ||
}); | ||
}; | ||
} | ||
// src/response-patcher-allowed-numeric-values.ts | ||
@@ -420,35 +575,44 @@ var jsonParsedTokenAccountsConfigs = [ | ||
// src/response-patcher.ts | ||
function getNextAllowedKeypaths(keyPaths, property) { | ||
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1)); | ||
// src/response-patcher-bigint-upcast.ts | ||
function keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths) { | ||
return allowedNumericKeyPaths.some((prohibitedKeyPath) => { | ||
if (prohibitedKeyPath.length !== keyPath.length) { | ||
return false; | ||
} | ||
for (let ii = keyPath.length - 1; ii >= 0; ii--) { | ||
const keyPathPart = keyPath[ii]; | ||
const prohibitedKeyPathPart = prohibitedKeyPath[ii]; | ||
if (prohibitedKeyPathPart !== keyPathPart && (prohibitedKeyPathPart !== KEYPATH_WILDCARD || typeof keyPathPart !== "number")) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}); | ||
} | ||
function visitNode2(value, allowedKeypaths) { | ||
if (Array.isArray(value)) { | ||
return value.map((element, ii) => { | ||
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, ii); | ||
return visitNode2(element, nextAllowedKeypaths); | ||
}); | ||
} else if (typeof value === "object" && value !== null) { | ||
const out = {}; | ||
for (const [propName, innerValue] of Object.entries(value)) { | ||
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName); | ||
out[propName] = visitNode2(innerValue, nextAllowedKeypaths); | ||
function getBigIntUpcastVisitor(allowedNumericKeyPaths) { | ||
return function upcastNodeToBigIntIfNumber(value, { keyPath }) { | ||
if (typeof value === "number" && Number.isInteger(value) && !keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths)) { | ||
return BigInt(value); | ||
} else { | ||
return value; | ||
} | ||
return out; | ||
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted; | ||
// Upcast the value to `bigint` unless an allowed keypath is present. | ||
allowedKeypaths.length === 0 && // Only try to upcast an Integer to `bigint` | ||
Number.isInteger(value)) { | ||
return BigInt(value); | ||
} else { | ||
return value; | ||
} | ||
}; | ||
} | ||
// src/response-patcher.ts | ||
function patchResponseForSolanaLabsRpc(rawResponse, methodName) { | ||
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0; | ||
return visitNode2(rawResponse, allowedKeypaths ?? []); | ||
const allowedNumericKeyPaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0; | ||
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths ?? [])]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
return traverse(rawResponse, initialState); | ||
} | ||
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, methodName) { | ||
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForNotification()[methodName] : void 0; | ||
return visitNode2(rawResponse, allowedKeypaths ?? []); | ||
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName) { | ||
const allowedNumericKeyPaths = notificationName ? getAllowedNumericKeypathsForNotification()[notificationName] : void 0; | ||
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths ?? [])]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
return traverse(rawResponse, initialState); | ||
} | ||
@@ -458,62 +622,24 @@ | ||
function createSolanaRpcApi(config) { | ||
return new Proxy({}, { | ||
defineProperty() { | ||
return false; | ||
}, | ||
deleteProperty() { | ||
return false; | ||
}, | ||
get(...args) { | ||
const [_, p] = args; | ||
const methodName = p.toString(); | ||
return function(...rawParams) { | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
const params = patchParamsForSolanaLabsRpc( | ||
rawParams, | ||
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(methodName, keyPath, value) : void 0 | ||
); | ||
return { | ||
methodName, | ||
params, | ||
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpc(rawResponse, methodName) | ||
}; | ||
}; | ||
} | ||
return createJsonRpcApi({ | ||
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config), | ||
responseTransformer: patchResponseForSolanaLabsRpc | ||
}); | ||
} | ||
// src/rpc-subscriptions/index.ts | ||
function createSolanaRpcSubscriptionsApi(config) { | ||
return new Proxy({}, { | ||
defineProperty() { | ||
return false; | ||
}, | ||
deleteProperty() { | ||
return false; | ||
}, | ||
get(...args) { | ||
const [_, p] = args; | ||
const notificationName = p.toString(); | ||
return function(...rawParams) { | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
const params = patchParamsForSolanaLabsRpc( | ||
rawParams, | ||
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(notificationName, keyPath, value) : void 0 | ||
); | ||
return { | ||
params, | ||
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName), | ||
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}; | ||
}; | ||
} | ||
function createSolanaRpcSubscriptionsApi_INTERNAL(config) { | ||
return createJsonRpcSubscriptionsApi({ | ||
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config), | ||
responseTransformer: patchResponseForSolanaLabsRpcSubscriptions, | ||
subscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}); | ||
} | ||
function createSolanaRpcSubscriptionsApi(config) { | ||
return createSolanaRpcSubscriptionsApi_INTERNAL(config); | ||
} | ||
function createSolanaRpcSubscriptionsApi_UNSTABLE(config) { | ||
return createSolanaRpcSubscriptionsApi(config); | ||
return createSolanaRpcSubscriptionsApi_INTERNAL(config); | ||
} | ||
export { createSolanaRpcApi, createSolanaRpcSubscriptionsApi, createSolanaRpcSubscriptionsApi_UNSTABLE }; | ||
export { createSolanaRpcApi, createSolanaRpcSubscriptionsApi, createSolanaRpcSubscriptionsApi_INTERNAL, createSolanaRpcSubscriptionsApi_UNSTABLE }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.native.js.map |
@@ -1,31 +0,186 @@ | ||
// src/params-patcher.ts | ||
function visitNode(value, keyPath, onIntegerOverflow) { | ||
if (Array.isArray(value)) { | ||
return value.map( | ||
(element, ii) => visitNode(element, [...keyPath, ii], onIntegerOverflow) | ||
); | ||
} else if (typeof value === "object" && value !== null) { | ||
const out = {}; | ||
for (const propName in value) { | ||
if (Object.prototype.hasOwnProperty.call(value, propName)) { | ||
out[propName] = visitNode(value[propName], [...keyPath, propName], onIntegerOverflow); | ||
import { createJsonRpcApi, createJsonRpcSubscriptionsApi } from '@solana/rpc-transport'; | ||
// src/rpc-methods/index.ts | ||
// src/default-commitment.ts | ||
function applyDefaultCommitment({ | ||
commitmentPropertyName, | ||
params, | ||
optionsObjectPositionInParams, | ||
overrideCommitment | ||
}) { | ||
const paramInTargetPosition = params[optionsObjectPositionInParams]; | ||
if ( | ||
// There's no config. | ||
paramInTargetPosition === void 0 || // There is a config object. | ||
paramInTargetPosition && typeof paramInTargetPosition === "object" && !Array.isArray(paramInTargetPosition) | ||
) { | ||
if ( | ||
// The config object already has a commitment set. | ||
paramInTargetPosition && commitmentPropertyName in paramInTargetPosition | ||
) { | ||
if (!paramInTargetPosition[commitmentPropertyName] || paramInTargetPosition[commitmentPropertyName] === "finalized") { | ||
const nextParams = [...params]; | ||
const { | ||
[commitmentPropertyName]: _, | ||
// eslint-disable-line @typescript-eslint/no-unused-vars | ||
...rest | ||
} = paramInTargetPosition; | ||
if (Object.keys(rest).length > 0) { | ||
nextParams[optionsObjectPositionInParams] = rest; | ||
} else { | ||
if (optionsObjectPositionInParams === nextParams.length - 1) { | ||
nextParams.length--; | ||
} else { | ||
nextParams[optionsObjectPositionInParams] = void 0; | ||
} | ||
} | ||
return nextParams; | ||
} | ||
} else if (overrideCommitment !== "finalized") { | ||
const nextParams = [...params]; | ||
nextParams[optionsObjectPositionInParams] = { | ||
...paramInTargetPosition, | ||
[commitmentPropertyName]: overrideCommitment | ||
}; | ||
return nextParams; | ||
} | ||
return out; | ||
} else if (typeof value === "bigint") { | ||
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) { | ||
onIntegerOverflow(keyPath, value); | ||
} | ||
return Number(value); | ||
} else { | ||
return value; | ||
} | ||
return params; | ||
} | ||
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) { | ||
return visitNode(params, [], onIntegerOverflow); | ||
// src/params-patcher-bigint-downcast.ts | ||
function downcastNodeToNumberIfBigint(value) { | ||
return typeof value === "bigint" ? ( | ||
// FIXME(solana-labs/solana/issues/30341) Create a data type to represent u64 in the Solana | ||
// JSON RPC implementation so that we can throw away this entire patcher instead of unsafely | ||
// downcasting `bigints` to `numbers`. | ||
Number(value) | ||
) : value; | ||
} | ||
// src/response-patcher-types.ts | ||
// src/params-patcher-integer-overflow.ts | ||
function getIntegerOverflowNodeVisitor(onIntegerOverflow) { | ||
return (value, { keyPath }) => { | ||
if (typeof value === "bigint") { | ||
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) { | ||
onIntegerOverflow(keyPath, value); | ||
} | ||
} | ||
return value; | ||
}; | ||
} | ||
// src/params-patcher-options-object-position-config.ts | ||
var OPTIONS_OBJECT_POSITION_BY_METHOD = { | ||
accountNotifications: 1, | ||
blockNotifications: 1, | ||
getAccountInfo: 1, | ||
getBalance: 1, | ||
getBlock: 1, | ||
getBlockHeight: 0, | ||
getBlockProduction: 0, | ||
getBlocks: 2, | ||
getBlocksWithLimit: 2, | ||
getConfirmedBlock: 1, | ||
getConfirmedBlocks: 1, | ||
getConfirmedBlocksWithLimit: 2, | ||
getConfirmedSignaturesForAddress2: 1, | ||
getConfirmedTransaction: 1, | ||
getEpochInfo: 0, | ||
getFeeCalculatorForBlockhash: 1, | ||
getFeeForMessage: 1, | ||
getFees: 1, | ||
getInflationGovernor: 0, | ||
getInflationReward: 1, | ||
getLargestAccounts: 0, | ||
getLatestBlockhash: 0, | ||
getLeaderSchedule: 1, | ||
getMinimumBalanceForRentExemption: 1, | ||
getMultipleAccounts: 1, | ||
getProgramAccounts: 1, | ||
getRecentBlockhash: 1, | ||
getSignaturesForAddress: 1, | ||
getSlot: 0, | ||
getSlotLeader: 0, | ||
getStakeActivation: 1, | ||
getStakeMinimumDelegation: 0, | ||
getSupply: 0, | ||
getTokenAccountBalance: 1, | ||
getTokenAccountsByDelegate: 2, | ||
getTokenAccountsByOwner: 2, | ||
getTokenLargestAccounts: 1, | ||
getTokenSupply: 1, | ||
getTransaction: 1, | ||
getTransactionCount: 0, | ||
getVoteAccounts: 0, | ||
isBlockhashValid: 1, | ||
logsNotifications: 1, | ||
programNotifications: 1, | ||
requestAirdrop: 2, | ||
sendTransaction: 1, | ||
signatureNotifications: 1, | ||
simulateTransaction: 1 | ||
}; | ||
// src/tree-traversal.ts | ||
var KEYPATH_WILDCARD = {}; | ||
function getTreeWalker(visitors) { | ||
return function traverse(node, state) { | ||
if (Array.isArray(node)) { | ||
return node.map((element, ii) => { | ||
const nextState = { | ||
...state, | ||
keyPath: [...state.keyPath, ii] | ||
}; | ||
return traverse(element, nextState); | ||
}); | ||
} else if (typeof node === "object" && node !== null) { | ||
const out = {}; | ||
for (const propName in node) { | ||
if (!Object.prototype.hasOwnProperty.call(node, propName)) { | ||
continue; | ||
} | ||
const nextState = { | ||
...state, | ||
keyPath: [...state.keyPath, propName] | ||
}; | ||
out[propName] = traverse(node[propName], nextState); | ||
} | ||
return out; | ||
} else { | ||
return visitors.reduce((acc, visitNode) => visitNode(acc, state), node); | ||
} | ||
}; | ||
} | ||
// src/params-patcher.ts | ||
function getParamsPatcherForSolanaLabsRpc(config) { | ||
const defaultCommitment = config?.defaultCommitment; | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
return (rawParams, methodName) => { | ||
const traverse = getTreeWalker([ | ||
...handleIntegerOverflow ? [getIntegerOverflowNodeVisitor((...args) => handleIntegerOverflow(methodName, ...args))] : [], | ||
downcastNodeToNumberIfBigint | ||
]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
const patchedParams = traverse(rawParams, initialState); | ||
if (!Array.isArray(patchedParams)) { | ||
return patchedParams; | ||
} | ||
const optionsObjectPositionInParams = OPTIONS_OBJECT_POSITION_BY_METHOD[methodName]; | ||
if (optionsObjectPositionInParams == null) { | ||
return patchedParams; | ||
} | ||
return applyDefaultCommitment({ | ||
commitmentPropertyName: methodName === "sendTransaction" ? "preflightCommitment" : "commitment", | ||
optionsObjectPositionInParams, | ||
overrideCommitment: defaultCommitment, | ||
params: patchedParams | ||
}); | ||
}; | ||
} | ||
// src/response-patcher-allowed-numeric-values.ts | ||
@@ -420,35 +575,44 @@ var jsonParsedTokenAccountsConfigs = [ | ||
// src/response-patcher.ts | ||
function getNextAllowedKeypaths(keyPaths, property) { | ||
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1)); | ||
// src/response-patcher-bigint-upcast.ts | ||
function keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths) { | ||
return allowedNumericKeyPaths.some((prohibitedKeyPath) => { | ||
if (prohibitedKeyPath.length !== keyPath.length) { | ||
return false; | ||
} | ||
for (let ii = keyPath.length - 1; ii >= 0; ii--) { | ||
const keyPathPart = keyPath[ii]; | ||
const prohibitedKeyPathPart = prohibitedKeyPath[ii]; | ||
if (prohibitedKeyPathPart !== keyPathPart && (prohibitedKeyPathPart !== KEYPATH_WILDCARD || typeof keyPathPart !== "number")) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}); | ||
} | ||
function visitNode2(value, allowedKeypaths) { | ||
if (Array.isArray(value)) { | ||
return value.map((element, ii) => { | ||
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, ii); | ||
return visitNode2(element, nextAllowedKeypaths); | ||
}); | ||
} else if (typeof value === "object" && value !== null) { | ||
const out = {}; | ||
for (const [propName, innerValue] of Object.entries(value)) { | ||
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName); | ||
out[propName] = visitNode2(innerValue, nextAllowedKeypaths); | ||
function getBigIntUpcastVisitor(allowedNumericKeyPaths) { | ||
return function upcastNodeToBigIntIfNumber(value, { keyPath }) { | ||
if (typeof value === "number" && Number.isInteger(value) && !keyPathIsAllowedToBeNumeric(keyPath, allowedNumericKeyPaths)) { | ||
return BigInt(value); | ||
} else { | ||
return value; | ||
} | ||
return out; | ||
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted; | ||
// Upcast the value to `bigint` unless an allowed keypath is present. | ||
allowedKeypaths.length === 0 && // Only try to upcast an Integer to `bigint` | ||
Number.isInteger(value)) { | ||
return BigInt(value); | ||
} else { | ||
return value; | ||
} | ||
}; | ||
} | ||
// src/response-patcher.ts | ||
function patchResponseForSolanaLabsRpc(rawResponse, methodName) { | ||
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0; | ||
return visitNode2(rawResponse, allowedKeypaths ?? []); | ||
const allowedNumericKeyPaths = methodName ? getAllowedNumericKeypathsForResponse()[methodName] : void 0; | ||
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths ?? [])]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
return traverse(rawResponse, initialState); | ||
} | ||
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, methodName) { | ||
const allowedKeypaths = methodName ? getAllowedNumericKeypathsForNotification()[methodName] : void 0; | ||
return visitNode2(rawResponse, allowedKeypaths ?? []); | ||
function patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName) { | ||
const allowedNumericKeyPaths = notificationName ? getAllowedNumericKeypathsForNotification()[notificationName] : void 0; | ||
const traverse = getTreeWalker([getBigIntUpcastVisitor(allowedNumericKeyPaths ?? [])]); | ||
const initialState = { | ||
keyPath: [] | ||
}; | ||
return traverse(rawResponse, initialState); | ||
} | ||
@@ -458,62 +622,24 @@ | ||
function createSolanaRpcApi(config) { | ||
return new Proxy({}, { | ||
defineProperty() { | ||
return false; | ||
}, | ||
deleteProperty() { | ||
return false; | ||
}, | ||
get(...args) { | ||
const [_, p] = args; | ||
const methodName = p.toString(); | ||
return function(...rawParams) { | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
const params = patchParamsForSolanaLabsRpc( | ||
rawParams, | ||
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(methodName, keyPath, value) : void 0 | ||
); | ||
return { | ||
methodName, | ||
params, | ||
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpc(rawResponse, methodName) | ||
}; | ||
}; | ||
} | ||
return createJsonRpcApi({ | ||
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config), | ||
responseTransformer: patchResponseForSolanaLabsRpc | ||
}); | ||
} | ||
// src/rpc-subscriptions/index.ts | ||
function createSolanaRpcSubscriptionsApi(config) { | ||
return new Proxy({}, { | ||
defineProperty() { | ||
return false; | ||
}, | ||
deleteProperty() { | ||
return false; | ||
}, | ||
get(...args) { | ||
const [_, p] = args; | ||
const notificationName = p.toString(); | ||
return function(...rawParams) { | ||
const handleIntegerOverflow = config?.onIntegerOverflow; | ||
const params = patchParamsForSolanaLabsRpc( | ||
rawParams, | ||
handleIntegerOverflow ? (keyPath, value) => handleIntegerOverflow(notificationName, keyPath, value) : void 0 | ||
); | ||
return { | ||
params, | ||
responseProcessor: (rawResponse) => patchResponseForSolanaLabsRpcSubscriptions(rawResponse, notificationName), | ||
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}; | ||
}; | ||
} | ||
function createSolanaRpcSubscriptionsApi_INTERNAL(config) { | ||
return createJsonRpcSubscriptionsApi({ | ||
parametersTransformer: getParamsPatcherForSolanaLabsRpc(config), | ||
responseTransformer: patchResponseForSolanaLabsRpcSubscriptions, | ||
subscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeNotificationNameTransformer: (notificationName) => notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}); | ||
} | ||
function createSolanaRpcSubscriptionsApi(config) { | ||
return createSolanaRpcSubscriptionsApi_INTERNAL(config); | ||
} | ||
function createSolanaRpcSubscriptionsApi_UNSTABLE(config) { | ||
return createSolanaRpcSubscriptionsApi(config); | ||
return createSolanaRpcSubscriptionsApi_INTERNAL(config); | ||
} | ||
export { createSolanaRpcApi, createSolanaRpcSubscriptionsApi, createSolanaRpcSubscriptionsApi_UNSTABLE }; | ||
export { createSolanaRpcApi, createSolanaRpcSubscriptionsApi, createSolanaRpcSubscriptionsApi_INTERNAL, createSolanaRpcSubscriptionsApi_UNSTABLE }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
export * from './rpc-methods/index.js'; | ||
export * from './rpc-subscriptions/index.js'; | ||
export * from './transaction-error.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,7 +0,8 @@ | ||
type IntegerOverflowHandler = (keyPath: (number | string)[], value: bigint) => void; | ||
type Patched<T> = T extends object ? { | ||
[Property in keyof T]: Patched<T[Property]>; | ||
} : T extends bigint ? number : T; | ||
export declare function patchParamsForSolanaLabsRpc<T>(params: T, onIntegerOverflow?: IntegerOverflowHandler): Patched<T>; | ||
export {}; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { KeyPath } from './tree-traversal.js'; | ||
export type ParamsPatcherConfig = Readonly<{ | ||
defaultCommitment?: Commitment; | ||
onIntegerOverflow?: (methodName: string, keyPath: KeyPath, value: bigint) => void; | ||
}>; | ||
export declare function getParamsPatcherForSolanaLabsRpc(config?: ParamsPatcherConfig): <T>(rawParams: T, methodName: string) => unknown; | ||
//# sourceMappingURL=params-patcher.d.ts.map |
@@ -1,5 +0,5 @@ | ||
import type { IRpcSubscriptionsApi } from '@solana/rpc-transport'; | ||
import { KeyPath } from './response-patcher.js'; | ||
import type { IRpcSubscriptionsApi } from '@solana/rpc-types'; | ||
import { createSolanaRpcApi } from './rpc-methods/index.js'; | ||
import { SolanaRpcSubscriptions, SolanaRpcSubscriptionsUnstable } from './rpc-subscriptions/index.js'; | ||
import { KeyPath } from './tree-traversal.js'; | ||
type AllowedNumericKeypaths<TApi> = Partial<Record<keyof TApi, readonly KeyPath[]>>; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,7 +0,5 @@ | ||
import { KeyPathWildcard } from './response-patcher-types.js'; | ||
import { createSolanaRpcApi } from './rpc-methods/index.js'; | ||
import { createSolanaRpcSubscriptionsApi } from './rpc-subscriptions/index.js'; | ||
export type KeyPath = ReadonlyArray<KeyPathWildcard | number | string | KeyPath>; | ||
export declare function patchResponseForSolanaLabsRpc<T>(rawResponse: unknown, methodName?: keyof ReturnType<typeof createSolanaRpcApi>): T; | ||
export declare function patchResponseForSolanaLabsRpcSubscriptions<T>(rawResponse: unknown, methodName?: keyof ReturnType<typeof createSolanaRpcSubscriptionsApi>): T; | ||
export declare function patchResponseForSolanaLabsRpcSubscriptions<T>(rawResponse: unknown, notificationName?: keyof ReturnType<typeof createSolanaRpcSubscriptionsApi>): T; | ||
//# sourceMappingURL=response-patcher.d.ts.map |
import { Address } from '@solana/addresses'; | ||
import { LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { Blockhash, TransactionVersion } from '@solana/transactions'; | ||
import { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, Blockhash, LamportsUnsafeBeyond2Pow53Minus1, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { TransactionVersion } from '@solana/transactions'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
import { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, SignedLamportsAsI64Unsafe, TokenBalance, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import { SignedLamportsAsI64Unsafe, TokenBalance } from './common.js'; | ||
type AddressTableLookup = Readonly<{ | ||
@@ -7,0 +7,0 @@ /** public key for an address lookup table account. */ |
import { Address } from '@solana/addresses'; | ||
import { LamportsUnsafeBeyond2Pow53Minus1, StringifiedBigInt, StringifiedNumber } from '@solana/rpc-types'; | ||
import type { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, Base64EncodedZStdCompressedDataResponse, LamportsUnsafeBeyond2Pow53Minus1, TokenAmount, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
export type DataSlice = Readonly<{ | ||
@@ -10,24 +10,4 @@ offset: number; | ||
}; | ||
export type Slot = U64UnsafeBeyond2Pow53Minus1; | ||
export type U64UnsafeBeyond2Pow53Minus1 = bigint; | ||
export type SignedLamportsAsI64Unsafe = bigint; | ||
export type F64UnsafeSeeDocumentation = number; | ||
export type RpcResponse<TValue> = Readonly<{ | ||
context: Readonly<{ | ||
slot: Slot; | ||
}>; | ||
value: TValue; | ||
}>; | ||
export type Base58EncodedBytes = string & { | ||
readonly __brand: unique symbol; | ||
}; | ||
export type Base64EncodedBytes = string & { | ||
readonly __brand: unique symbol; | ||
}; | ||
export type Base64EncodedZStdCompressedBytes = string & { | ||
readonly __brand: unique symbol; | ||
}; | ||
export type Base58EncodedDataResponse = [Base58EncodedBytes, 'base58']; | ||
export type Base64EncodedDataResponse = [Base64EncodedBytes, 'base64']; | ||
export type Base64EncodedZStdCompressedDataResponse = [Base64EncodedZStdCompressedBytes, 'base64+zstd']; | ||
export type AccountInfoBase = Readonly<{ | ||
@@ -71,8 +51,2 @@ /** indicates if the account contains a program (and is strictly read-only) */ | ||
}>; | ||
export type TokenAmount = Readonly<{ | ||
amount: StringifiedBigInt; | ||
decimals: number; | ||
uiAmount: number | null; | ||
uiAmountString: StringifiedNumber; | ||
}>; | ||
export type TokenBalance = Readonly<{ | ||
@@ -89,15 +63,2 @@ /** Index of the account in which the token balance is provided for. */ | ||
}>; | ||
type TokenAccountState = 'initialized' | 'uninitialized' | 'frozen'; | ||
export type TokenAccount = Readonly<{ | ||
mint: Address; | ||
owner: Address; | ||
tokenAmount: TokenAmount; | ||
delegate?: Address; | ||
state: TokenAccountState; | ||
isNative: boolean; | ||
rentExemptReserve?: TokenAmount; | ||
delegatedAmount?: TokenAmount; | ||
closeAuthority?: Address; | ||
extensions?: unknown[]; | ||
}>; | ||
export type GetProgramAccountsMemcmpFilter = Readonly<{ | ||
@@ -111,3 +72,2 @@ offset: U64UnsafeBeyond2Pow53Minus1; | ||
}>; | ||
export {}; | ||
//# sourceMappingURL=common.d.ts.map |
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, DataSlice, RpcResponse, Slot } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, DataSlice } from './common.js'; | ||
type GetAccountInfoApiResponseBase = RpcResponse<AccountInfoBase | null>; | ||
@@ -15,3 +15,3 @@ type NestInRpcResponseOrNull<T> = Readonly<{ | ||
}>; | ||
export interface GetAccountInfoApi { | ||
export interface GetAccountInfoApi extends IRpcApiMethods { | ||
/** | ||
@@ -18,0 +18,0 @@ * Returns all information associated with the account of provided public key |
import { Address } from '@solana/addresses'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { RpcResponse, Slot } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, RpcResponse, Slot } from '@solana/rpc-types'; | ||
type GetBalanceApiResponse = RpcResponse<LamportsUnsafeBeyond2Pow53Minus1>; | ||
export interface GetBalanceApi { | ||
export interface GetBalanceApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +6,0 @@ * Returns the balance of the account of provided Pubkey |
@@ -1,4 +0,3 @@ | ||
import { Commitment, UnixTimestamp } from '@solana/rpc-types'; | ||
import { Blockhash, TransactionVersion } from '@solana/transactions'; | ||
import { Base58EncodedBytes, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Base58EncodedBytes, Blockhash, Commitment, IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1, UnixTimestamp } from '@solana/rpc-types'; | ||
import { TransactionVersion } from '@solana/transactions'; | ||
import { Reward, TransactionForAccounts, TransactionForFullBase58, TransactionForFullBase64, TransactionForFullJson, TransactionForFullJsonParsed } from './common-transactions.js'; | ||
@@ -34,3 +33,3 @@ type GetBlockApiResponseBase = Readonly<{ | ||
type GetBlockMaxSupportedTransactionVersion = Exclude<TransactionVersion, 'legacy'>; | ||
export interface GetBlockApi { | ||
export interface GetBlockApi extends IRpcApiMethods { | ||
/** | ||
@@ -37,0 +36,0 @@ * Returns identity and transaction information about a confirmed block in the ledger |
@@ -1,3 +0,2 @@ | ||
import { LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, Slot } from '@solana/rpc-types'; | ||
type GetBlockCommitmentApiResponse = Readonly<{ | ||
@@ -7,3 +6,3 @@ commitment: LamportsUnsafeBeyond2Pow53Minus1[] | null; | ||
}>; | ||
export interface GetBlockCommitmentApi { | ||
export interface GetBlockCommitmentApi extends IRpcApiMethods { | ||
/** | ||
@@ -10,0 +9,0 @@ * Returns the amount of cluster stake in lamports that has voted on |
@@ -1,5 +0,4 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetBlockHeightApiResponse = U64UnsafeBeyond2Pow53Minus1; | ||
export interface GetBlockHeightApi { | ||
export interface GetBlockHeightApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns the current block height of the node |
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type NumberOfLeaderSlots = U64UnsafeBeyond2Pow53Minus1; | ||
@@ -29,3 +28,3 @@ type NumberOfBlocksProduced = U64UnsafeBeyond2Pow53Minus1; | ||
}>; | ||
export interface GetBlockProductionApi { | ||
export interface GetBlockProductionApi extends IRpcApiMethods { | ||
/** | ||
@@ -32,0 +31,0 @@ * Returns recent block production information from the current or previous epoch. |
@@ -1,5 +0,4 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetBlocksApiResponse = Slot[]; | ||
export interface GetBlocksApi { | ||
export interface GetBlocksApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns a list of confirmed blocks between two slots |
@@ -1,5 +0,4 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetBlocksWithLimitApiResponse = Slot[]; | ||
export interface GetBlocksWithLimitApi { | ||
export interface GetBlocksWithLimitApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns a list of confirmed blocks starting at the given slot |
@@ -1,6 +0,5 @@ | ||
import { UnixTimestamp } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, Slot, UnixTimestamp } from '@solana/rpc-types'; | ||
/** Estimated production time, as Unix timestamp (seconds since the Unix epoch) */ | ||
type GetBlockTimeApiResponse = UnixTimestamp; | ||
export interface GetBlockTimeApi { | ||
export interface GetBlockTimeApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +6,0 @@ * Returns the estimated production time of a block. |
import { Address } from '@solana/addresses'; | ||
import type { IRpcApiMethods } from '@solana/rpc-types'; | ||
type GetClusterNodesNode = Readonly<{ | ||
@@ -25,3 +26,3 @@ /** The unique identifier of the node's feature set */ | ||
type GetClusterNodesApiResponse = readonly GetClusterNodesNode[]; | ||
export interface GetClusterNodesApi { | ||
export interface GetClusterNodesApi extends IRpcApiMethods { | ||
/** | ||
@@ -28,0 +29,0 @@ * Returns information about all the nodes participating in the cluster |
@@ -1,3 +0,2 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetEpochInfoApiResponse = Readonly<{ | ||
@@ -17,3 +16,3 @@ /** the current slot */ | ||
}>; | ||
export interface GetEpochInfoApi { | ||
export interface GetEpochInfoApi extends IRpcApiMethods { | ||
/** | ||
@@ -20,0 +19,0 @@ * Returns the balance of the account of provided Pubkey |
@@ -1,2 +0,2 @@ | ||
import { U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { IRpcApiMethods, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetEpochScheduleApiResponse = Readonly<{ | ||
@@ -14,3 +14,3 @@ /** the maximum number of slots in each epoch */ | ||
}>; | ||
export interface GetEpochScheduleApi { | ||
export interface GetEpochScheduleApi extends IRpcApiMethods { | ||
/** | ||
@@ -17,0 +17,0 @@ * Returns the epoch schedule information from this cluster's genesis config |
@@ -1,7 +0,6 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { SerializedMessageBytesBase64 } from '@solana/transactions'; | ||
import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
/** Fee corresponding to the message at the specified blockhash */ | ||
type GetFeeForMessageApiResponse = RpcResponse<U64UnsafeBeyond2Pow53Minus1 | null>; | ||
export interface GetFeeForMessageApi { | ||
export interface GetFeeForMessageApi extends IRpcApiMethods { | ||
/** | ||
@@ -8,0 +7,0 @@ * Returns the fee the network will charge for a particular Message |
@@ -1,4 +0,4 @@ | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetFirstAvailableBlockApiResponse = Slot; | ||
export interface GetFirstAvailableBlockApi { | ||
export interface GetFirstAvailableBlockApi extends IRpcApiMethods { | ||
/** | ||
@@ -5,0 +5,0 @@ * Returns the slot of the lowest confirmed block that has not been purged from the ledger |
@@ -1,4 +0,4 @@ | ||
import { Blockhash } from '@solana/transactions'; | ||
import type { Blockhash, IRpcApiMethods } from '@solana/rpc-types'; | ||
type GetGenesisHashApiResponse = Blockhash; | ||
export interface GetGenesisHashApi { | ||
export interface GetGenesisHashApi extends IRpcApiMethods { | ||
/** | ||
@@ -5,0 +5,0 @@ * Returns the genesis hash |
@@ -0,3 +1,4 @@ | ||
import type { IRpcApiMethods } from '@solana/rpc-types'; | ||
type GetHealthApiResponse = 'ok'; | ||
export interface GetHealthApi { | ||
export interface GetHealthApi extends IRpcApiMethods { | ||
/** | ||
@@ -4,0 +5,0 @@ * Returns the health status of the node ("ok" if healthy). |
@@ -1,2 +0,2 @@ | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetHighestSnapshotSlotApiResponse = Readonly<{ | ||
@@ -6,3 +6,3 @@ full: Slot; | ||
}>; | ||
export interface GetHighestSnapshotSlotApi { | ||
export interface GetHighestSnapshotSlotApi extends IRpcApiMethods { | ||
/** | ||
@@ -9,0 +9,0 @@ * Returns the highest slot information that the node has snapshots for. |
@@ -1,6 +0,7 @@ | ||
import { Address } from '@solana/addresses'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { IRpcApiMethods } from '@solana/rpc-types'; | ||
type GetIdentityApiResponse = Readonly<{ | ||
identity: Address; | ||
}>; | ||
export interface GetIdentityApi { | ||
export interface GetIdentityApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +8,0 @@ * Returns the identity pubkey for the current node |
@@ -1,2 +0,2 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import type { Commitment, IRpcApiMethods } from '@solana/rpc-types'; | ||
import { F64UnsafeSeeDocumentation } from './common.js'; | ||
@@ -19,3 +19,3 @@ type GetInflationGovernorApiResponse = Readonly<{ | ||
}>; | ||
export interface GetInflationGovernorApi { | ||
export interface GetInflationGovernorApi extends IRpcApiMethods { | ||
/** | ||
@@ -22,0 +22,0 @@ * Returns the current inflation governor |
@@ -1,2 +0,3 @@ | ||
import { F64UnsafeSeeDocumentation, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { IRpcApiMethods, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { F64UnsafeSeeDocumentation } from './common.js'; | ||
type GetInflationRateApiResponse = Readonly<{ | ||
@@ -12,3 +13,3 @@ /** Epoch for which these values are valid */ | ||
}>; | ||
export interface GetInflationRateApi { | ||
export interface GetInflationRateApi extends IRpcApiMethods { | ||
/** | ||
@@ -15,0 +16,0 @@ * Returns the current block height of the node |
import { Address } from '@solana/addresses'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetInflationRewardApiResponse = Readonly<{ | ||
@@ -11,3 +10,3 @@ amount: LamportsUnsafeBeyond2Pow53Minus1; | ||
}>; | ||
export interface GetInflationRewardApi { | ||
export interface GetInflationRewardApi extends IRpcApiMethods { | ||
/** | ||
@@ -14,0 +13,0 @@ * Returns the current block height of the node |
import { Address } from '@solana/addresses'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { RpcResponse } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, RpcResponse } from '@solana/rpc-types'; | ||
type GetLargestAccountsResponseItem = Readonly<{ | ||
@@ -11,3 +10,3 @@ /** Base-58 encoded address of the account */ | ||
type GetLargestAccountsApiResponse = RpcResponse<GetLargestAccountsResponseItem[]>; | ||
export interface GetLargestAccountsApi { | ||
export interface GetLargestAccountsApi extends IRpcApiMethods { | ||
/** | ||
@@ -14,0 +13,0 @@ * Returns the 20 largest accounts, by lamport balance |
@@ -1,4 +0,2 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Blockhash } from '@solana/transactions'; | ||
import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Blockhash, Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetLatestBlockhashApiResponse = RpcResponse<{ | ||
@@ -10,3 +8,3 @@ /** a Hash as base-58 encoded string */ | ||
}>; | ||
export interface GetLatestBlockhashApi { | ||
export interface GetLatestBlockhashApi extends IRpcApiMethods { | ||
/** | ||
@@ -13,0 +11,0 @@ * Returns the latest blockhash |
@@ -1,4 +0,3 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
/** | ||
@@ -23,3 +22,3 @@ * This return type is a dictionary of validator identities, as base-58 encoded | ||
}>; | ||
export interface GetLeaderScheduleApi { | ||
export interface GetLeaderScheduleApi extends IRpcApiMethods { | ||
/** | ||
@@ -26,0 +25,0 @@ * Fetch the leader schedule for the epoch that corresponds to the provided slot. |
@@ -1,4 +0,4 @@ | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetMaxRetransmitSlotApiResponse = Slot; | ||
export interface GetMaxRetransmitSlotApi { | ||
export interface GetMaxRetransmitSlotApi extends IRpcApiMethods { | ||
/** | ||
@@ -5,0 +5,0 @@ * Get the max slot seen from retransmit stage. |
@@ -1,4 +0,4 @@ | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetMaxShredInsertSlotApiResponse = Slot; | ||
export interface GetMaxShredInsertSlotApi { | ||
export interface GetMaxShredInsertSlotApi extends IRpcApiMethods { | ||
/** | ||
@@ -5,0 +5,0 @@ * Get the max slot seen from after shred insert. |
@@ -1,5 +0,4 @@ | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetMinimumBalanceForRentExemptionApiResponse = LamportsUnsafeBeyond2Pow53Minus1; | ||
export interface GetMinimumBalanceForRentExemptionApi { | ||
export interface GetMinimumBalanceForRentExemptionApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns the minimum balance to exempt an account of a certain size from rent |
@@ -1,4 +0,4 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, DataSlice, RpcResponse, Slot } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, DataSlice } from './common.js'; | ||
type GetMultipleAccountsApiResponseBase = AccountInfoBase | null; | ||
@@ -15,3 +15,3 @@ type GetMultipleAccountsApiCommonConfig = Readonly<{ | ||
}>; | ||
export interface GetMultipleAccountsApi { | ||
export interface GetMultipleAccountsApi extends IRpcApiMethods { | ||
/** | ||
@@ -18,0 +18,0 @@ * Returns the account information for a list of Pubkeys. |
@@ -1,4 +0,4 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, AccountInfoWithPubkey, DataSlice, GetProgramAccountsDatasizeFilter, GetProgramAccountsMemcmpFilter, RpcResponse, Slot } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, AccountInfoWithPubkey, DataSlice, GetProgramAccountsDatasizeFilter, GetProgramAccountsMemcmpFilter } from './common.js'; | ||
type GetProgramAccountsApiCommonConfig = Readonly<{ | ||
@@ -16,3 +16,3 @@ /** @defaultValue "finalized" */ | ||
}>; | ||
export interface GetProgramAccountsApi { | ||
export interface GetProgramAccountsApi extends IRpcApiMethods { | ||
/** | ||
@@ -19,0 +19,0 @@ * Returns the account information for a list of Pubkeys. |
@@ -1,2 +0,2 @@ | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type PerformanceSample = Readonly<{ | ||
@@ -15,3 +15,3 @@ /** Slot in which sample was taken at */ | ||
type GetRecentPerformanceSamplesApiResponse = readonly PerformanceSample[]; | ||
export interface GetRecentPerformanceSamplesApi { | ||
export interface GetRecentPerformanceSamplesApi extends IRpcApiMethods { | ||
/** | ||
@@ -18,0 +18,0 @@ * Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window. |
@@ -1,3 +0,4 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { MicroLamportsUnsafeBeyond2Pow53Minus1, Slot } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
import { MicroLamportsUnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
type GetRecentPrioritizationFeesApiResponse = Readonly<{ | ||
@@ -13,3 +14,3 @@ /** | ||
}>[]; | ||
export interface GetRecentPrioritizationFeesApi { | ||
export interface GetRecentPrioritizationFeesApi extends IRpcApiMethods { | ||
/** | ||
@@ -16,0 +17,0 @@ * Returns the balance of the account of provided Pubkey |
@@ -1,6 +0,5 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Signature } from '@solana/keys'; | ||
import { Commitment, UnixTimestamp } from '@solana/rpc-types'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Signature } from '@solana/keys'; | ||
import type { Commitment, IRpcApiMethods, Slot, UnixTimestamp } from '@solana/rpc-types'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
import { Slot } from './common.js'; | ||
type GetSignaturesForAddressTransaction = Readonly<{ | ||
@@ -33,3 +32,3 @@ /** transaction signature as base-58 encoded string */ | ||
}>; | ||
export interface GetSignaturesForAddressApi { | ||
export interface GetSignaturesForAddressApi extends IRpcApiMethods { | ||
/** | ||
@@ -36,0 +35,0 @@ * Returns signatures for confirmed transactions that include the given address in their accountKeys list. |
@@ -1,5 +0,4 @@ | ||
import { Signature } from '@solana/keys'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import type { Signature } from '@solana/keys'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
/** @deprecated */ | ||
@@ -35,3 +34,3 @@ type TransactionStatusOk = Readonly<{ | ||
type GetSignatureStatusesApiResponse = RpcResponse<GetSignatureStatusesBase>; | ||
export interface GetSignatureStatusesApi { | ||
export interface GetSignatureStatusesApi extends IRpcApiMethods { | ||
/** | ||
@@ -38,0 +37,0 @@ * Returns the statuses of a list of signatures. |
@@ -1,5 +0,4 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type GetSlotApiResponse = Slot; | ||
export interface GetSlotApi { | ||
export interface GetSlotApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns the slot that has reached the given or default commitment level |
@@ -1,5 +0,4 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot } from './common.js'; | ||
export interface GetSlotLeaderApi { | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
export interface GetSlotLeaderApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns the current slot leader |
@@ -1,6 +0,6 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Slot } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
/** array of Node identity public keys as base-58 encoded strings */ | ||
type GetSlotLeadersApiResponse = Address[]; | ||
export interface GetSlotLeadersApi { | ||
export interface GetSlotLeadersApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +7,0 @@ * Returns the slot leaders for a given slot range |
@@ -1,4 +0,3 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetStakeActivationApiResponse = Readonly<{ | ||
@@ -12,3 +11,3 @@ /** Stake active during the epoch */ | ||
}>; | ||
export interface GetStakeActivationApi { | ||
export interface GetStakeActivationApi extends IRpcApiMethods { | ||
/** | ||
@@ -15,0 +14,0 @@ * Returns epoch activation information for a stake account |
@@ -1,5 +0,4 @@ | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { RpcResponse } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, RpcResponse } from '@solana/rpc-types'; | ||
type GetStakeMinimumDelegationApiResponse = RpcResponse<LamportsUnsafeBeyond2Pow53Minus1>; | ||
export interface GetStakeMinimumDelegationApi { | ||
export interface GetStakeMinimumDelegationApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns the stake minimum delegation, in lamports. |
@@ -1,4 +0,3 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { RpcResponse } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1, RpcResponse } from '@solana/rpc-types'; | ||
type GetSupplyConfig = Readonly<{ | ||
@@ -27,3 +26,3 @@ commitment?: Commitment; | ||
}>; | ||
export interface GetSupplyApi { | ||
export interface GetSupplyApi extends IRpcApiMethods { | ||
/** | ||
@@ -30,0 +29,0 @@ * Returns information about the current supply. |
@@ -1,6 +0,5 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { RpcResponse, TokenAmount } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, TokenAmount } from '@solana/rpc-types'; | ||
type GetTokenAccountBalanceApiResponse = RpcResponse<TokenAmount>; | ||
export interface GetTokenAccountBalanceApi { | ||
export interface GetTokenAccountBalanceApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +6,0 @@ * Returns the token balance of an SPL Token account |
@@ -1,12 +0,13 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithPubkey, DataSlice, RpcResponse, Slot, TokenAccount, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { JsonParsedTokenAccount } from '@solana/rpc-parsed-types'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithPubkey, DataSlice } from './common.js'; | ||
type TokenAccountInfoWithJsonData = Readonly<{ | ||
data: Readonly<{ | ||
/** Name of the program that owns this account. */ | ||
program: { | ||
info: TokenAccount; | ||
program: Address; | ||
parsed: { | ||
info: JsonParsedTokenAccount; | ||
type: 'account'; | ||
}; | ||
parsed: unknown; | ||
space: U64UnsafeBeyond2Pow53Minus1; | ||
@@ -34,3 +35,3 @@ }>; | ||
}>; | ||
export interface GetTokenAccountsByDelegateApi { | ||
export interface GetTokenAccountsByDelegateApi extends IRpcApiMethods { | ||
/** | ||
@@ -37,0 +38,0 @@ * Returns all SPL Token accounts by approved Delegate. |
@@ -1,12 +0,13 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithPubkey, DataSlice, RpcResponse, Slot, TokenAccount, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { JsonParsedTokenAccount } from '@solana/rpc-parsed-types'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithPubkey, DataSlice } from './common.js'; | ||
type TokenAccountInfoWithJsonData = Readonly<{ | ||
data: Readonly<{ | ||
/** Name of the program that owns this account. */ | ||
program: { | ||
info: TokenAccount; | ||
program: Address; | ||
parsed: { | ||
info: JsonParsedTokenAccount; | ||
type: 'account'; | ||
}; | ||
parsed: unknown; | ||
space: U64UnsafeBeyond2Pow53Minus1; | ||
@@ -34,3 +35,3 @@ }>; | ||
}>; | ||
export interface GetTokenAccountsByOwnerApi { | ||
export interface GetTokenAccountsByOwnerApi extends IRpcApiMethods { | ||
/** | ||
@@ -37,0 +38,0 @@ * Returns all SPL Token accounts by token owner. |
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { RpcResponse, TokenAmount } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, TokenAmount } from '@solana/rpc-types'; | ||
type GetTokenLargestAccountsApiResponse = RpcResponse<TokenAmount & { | ||
address: Address; | ||
}[]>; | ||
export interface GetTokenLargestAccountsApi { | ||
export interface GetTokenLargestAccountsApi extends IRpcApiMethods { | ||
/** | ||
@@ -9,0 +8,0 @@ * Returns the 20 largest accounts of a particular SPL Token type. |
@@ -1,6 +0,5 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { RpcResponse, TokenAmount } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, RpcResponse, TokenAmount } from '@solana/rpc-types'; | ||
type GetTokenSupplyApiResponse = RpcResponse<TokenAmount>; | ||
export interface GetTokenSupplyApi { | ||
export interface GetTokenSupplyApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +6,0 @@ * Returns the total supply of an SPL Token mint |
import { Address } from '@solana/addresses'; | ||
import { Signature } from '@solana/keys'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1, UnixTimestamp } from '@solana/rpc-types'; | ||
import { Blockhash, TransactionVersion } from '@solana/transactions'; | ||
import type { IRpcApiMethods } from '@solana/rpc-types'; | ||
import { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, Blockhash, Commitment, LamportsUnsafeBeyond2Pow53Minus1, Slot, U64UnsafeBeyond2Pow53Minus1, UnixTimestamp } from '@solana/rpc-types'; | ||
import { TransactionVersion } from '@solana/transactions'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
import { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, Slot, TokenBalance, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import { TokenBalance } from './common.js'; | ||
import { Reward, TransactionStatus } from './common-transactions.js'; | ||
@@ -128,3 +129,3 @@ type ReturnData = { | ||
}>; | ||
export interface GetTransactionApi { | ||
export interface GetTransactionApi extends IRpcApiMethods { | ||
/** | ||
@@ -131,0 +132,0 @@ * Returns transaction details for a confirmed transaction |
@@ -1,5 +0,4 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Commitment, IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type GetTransactionCountApiResponse = U64UnsafeBeyond2Pow53Minus1; | ||
export interface GetTransactionCountApi { | ||
export interface GetTransactionCountApi extends IRpcApiMethods { | ||
/** | ||
@@ -6,0 +5,0 @@ * Returns the current Transaction count from the ledger |
@@ -0,1 +1,2 @@ | ||
import type { IRpcApiMethods } from '@solana/rpc-types'; | ||
type GetVersionApiResponse = Readonly<{ | ||
@@ -7,3 +8,3 @@ /** Unique identifier of the current software's feature set */ | ||
}>; | ||
export interface GetVersionApi { | ||
export interface GetVersionApi extends IRpcApiMethods { | ||
/** | ||
@@ -10,0 +11,0 @@ * Returns the current Solana version running on the node |
@@ -1,4 +0,3 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Commitment, IRpcApiMethods, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type Epoch = U64UnsafeBeyond2Pow53Minus1; | ||
@@ -39,3 +38,3 @@ type Credits = U64UnsafeBeyond2Pow53Minus1; | ||
}>; | ||
export interface GetVoteAccountsApi { | ||
export interface GetVoteAccountsApi extends IRpcApiMethods { | ||
/** Returns the account info and associated stake for all the voting accounts in the current bank. */ | ||
@@ -42,0 +41,0 @@ getVoteAccounts<TVoteAccount extends Address>(config?: GetVoteAccountsConfig<TVoteAccount>): GetVoteAccountsApiResponse<TVoteAccount>; |
@@ -1,2 +0,3 @@ | ||
import type { IRpcApi } from '@solana/rpc-transport'; | ||
import { IRpcApi } from '@solana/rpc-types'; | ||
import { ParamsPatcherConfig } from '../params-patcher.js'; | ||
import { GetAccountInfoApi } from './getAccountInfo.js'; | ||
@@ -55,9 +56,7 @@ import { GetBalanceApi } from './getBalance.js'; | ||
import { SimulateTransactionApi } from './simulateTransaction.js'; | ||
type Config = Readonly<{ | ||
onIntegerOverflow?: (methodName: string, keyPath: (number | string)[], value: bigint) => void; | ||
}>; | ||
type Config = ParamsPatcherConfig; | ||
export type SolanaRpcMethods = GetAccountInfoApi & GetBalanceApi & GetBlockApi & GetBlockCommitmentApi & GetBlockHeightApi & GetBlockProductionApi & GetBlocksApi & GetBlocksWithLimitApi & GetBlockTimeApi & GetClusterNodesApi & GetEpochInfoApi & GetEpochScheduleApi & GetFeeForMessageApi & GetFirstAvailableBlockApi & GetGenesisHashApi & GetHealthApi & GetHighestSnapshotSlotApi & GetIdentityApi & GetInflationGovernorApi & GetInflationRateApi & GetInflationRewardApi & GetLargestAccountsApi & GetLatestBlockhashApi & GetLeaderScheduleApi & GetMaxRetransmitSlotApi & GetMaxShredInsertSlotApi & GetMinimumBalanceForRentExemptionApi & GetMultipleAccountsApi & GetProgramAccountsApi & GetRecentPerformanceSamplesApi & GetRecentPrioritizationFeesApi & GetSignaturesForAddressApi & GetSignatureStatusesApi & GetSlotApi & GetSlotLeaderApi & GetSlotLeadersApi & GetStakeActivationApi & GetStakeMinimumDelegationApi & GetSupplyApi & GetTokenAccountBalanceApi & GetTokenAccountsByDelegateApi & GetTokenAccountsByOwnerApi & GetTokenLargestAccountsApi & GetTokenSupplyApi & GetTransactionApi & GetTransactionCountApi & GetVersionApi & GetVoteAccountsApi & IsBlockhashValidApi & MinimumLedgerSlotApi & RequestAirdropApi & SendTransactionApi & SimulateTransactionApi; | ||
export declare function createSolanaRpcApi(config?: Config): IRpcApi<SolanaRpcMethods>; | ||
export type { GetAccountInfoApi, GetBlockApi, GetProgramAccountsApi, GetSignatureStatusesApi, GetTransactionApi, RequestAirdropApi, SendTransactionApi, }; | ||
export type { Base64EncodedDataResponse, DataSlice, GetProgramAccountsDatasizeFilter, GetProgramAccountsMemcmpFilter, Slot, } from './common.js'; | ||
export type { GetAccountInfoApi, GetBalanceApi, GetBlockApi, GetBlockCommitmentApi, GetBlockHeightApi, GetBlockProductionApi, GetBlocksApi, GetBlocksWithLimitApi, GetBlockTimeApi, GetClusterNodesApi, GetEpochInfoApi, GetEpochScheduleApi, GetFeeForMessageApi, GetFirstAvailableBlockApi, GetGenesisHashApi, GetHealthApi, GetHighestSnapshotSlotApi, GetIdentityApi, GetInflationGovernorApi, GetInflationRateApi, GetInflationRewardApi, GetLargestAccountsApi, GetLatestBlockhashApi, GetLeaderScheduleApi, GetMaxRetransmitSlotApi, GetMaxShredInsertSlotApi, GetMinimumBalanceForRentExemptionApi, GetMultipleAccountsApi, GetProgramAccountsApi, GetRecentPerformanceSamplesApi, GetRecentPrioritizationFeesApi, GetSignaturesForAddressApi, GetSignatureStatusesApi, GetSlotApi, GetSlotLeaderApi, GetSlotLeadersApi, GetStakeActivationApi, GetStakeMinimumDelegationApi, GetSupplyApi, GetTokenAccountBalanceApi, GetTokenAccountsByDelegateApi, GetTokenAccountsByOwnerApi, GetTokenLargestAccountsApi, GetTokenSupplyApi, GetTransactionApi, GetTransactionCountApi, GetVersionApi, GetVoteAccountsApi, IsBlockhashValidApi, MinimumLedgerSlotApi, RequestAirdropApi, SendTransactionApi, SimulateTransactionApi, }; | ||
export type { DataSlice, GetProgramAccountsDatasizeFilter, GetProgramAccountsMemcmpFilter } from './common.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,6 +0,4 @@ | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Blockhash } from '@solana/transactions'; | ||
import { RpcResponse, Slot } from './common.js'; | ||
import type { Blockhash, Commitment, IRpcApiMethods, RpcResponse, Slot } from '@solana/rpc-types'; | ||
type IsBlockhashValidApiResponse = RpcResponse<boolean>; | ||
export interface IsBlockhashValidApi { | ||
export interface IsBlockhashValidApi extends IRpcApiMethods { | ||
/** | ||
@@ -7,0 +5,0 @@ * Returns whether a blockhash is still valid or not |
@@ -1,4 +0,4 @@ | ||
import { Slot } from './common.js'; | ||
import type { IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
type MinimumLedgerSlotApiResponse = Slot; | ||
export interface MinimumLedgerSlotApi { | ||
export interface MinimumLedgerSlotApi extends IRpcApiMethods { | ||
/** | ||
@@ -5,0 +5,0 @@ * Returns the lowest slot that the node has information about in its ledger. |
@@ -1,4 +0,4 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Signature } from '@solana/keys'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Signature } from '@solana/keys'; | ||
import type { Commitment, IRpcApiMethods, LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type RequestAirdropConfig = Readonly<{ | ||
@@ -8,3 +8,3 @@ commitment?: Commitment; | ||
type RequestAirdropResponse = Signature; | ||
export interface RequestAirdropApi { | ||
export interface RequestAirdropApi extends IRpcApiMethods { | ||
/** | ||
@@ -11,0 +11,0 @@ * Requests an airdrop of lamports to a Pubkey |
@@ -1,5 +0,4 @@ | ||
import { Signature } from '@solana/keys'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Base64EncodedWireTransaction } from '@solana/transactions'; | ||
import { Slot } from './common.js'; | ||
import type { Signature } from '@solana/keys'; | ||
import type { Commitment, IRpcApiMethods, Slot } from '@solana/rpc-types'; | ||
import type { Base64EncodedWireTransaction } from '@solana/transactions'; | ||
type SendTransactionConfig = Readonly<{ | ||
@@ -12,3 +11,3 @@ skipPreflight?: boolean; | ||
type SendTransactionResponse = Signature; | ||
export interface SendTransactionApi { | ||
export interface SendTransactionApi extends IRpcApiMethods { | ||
/** @deprecated Set `encoding` to `'base64'` when calling this method */ | ||
@@ -15,0 +14,0 @@ sendTransaction(base64EncodedWireTransaction: Base64EncodedWireTransaction, config?: SendTransactionConfig & { |
@@ -1,6 +0,6 @@ | ||
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { Base64EncodedWireTransaction } from '@solana/transactions'; | ||
import type { Address } from '@solana/addresses'; | ||
import type { Base58EncodedBytes, Base64EncodedDataResponse, Commitment, IRpcApiMethods, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import type { Base64EncodedWireTransaction } from '@solana/transactions'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
import { AccountInfoBase, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, Base58EncodedBytes, Base64EncodedDataResponse, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common.js'; | ||
import { AccountInfoBase, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData } from './common.js'; | ||
type SimulateTransactionConfigBase = Readonly<{ | ||
@@ -74,3 +74,3 @@ /** | ||
}>; | ||
export interface SimulateTransactionApi { | ||
export interface SimulateTransactionApi extends IRpcApiMethods { | ||
/** @deprecated Set `encoding` to `'base64'` when calling this method */ | ||
@@ -77,0 +77,0 @@ simulateTransaction(base58EncodedWireTransaction: Base58EncodedBytes, config: SimulateTransactionConfigBase & SigVerifyAndReplaceRecentBlockhashConfig & AccountsConfigWithBase64Encoding): SimulateTransactionApiResponseBase & SimulateTransactionApiResponseWithAccounts<AccountInfoBase & AccountInfoWithBase64EncodedData>; |
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, RpcResponse } from '../rpc-methods/common.js'; | ||
import type { Commitment, IRpcApiSubscriptions, RpcResponse } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData } from '../rpc-methods/common.js'; | ||
type AccountNotificationsApiCommonConfig = Readonly<{ | ||
commitment?: Commitment; | ||
}>; | ||
export interface AccountNotificationsApi { | ||
export interface AccountNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -9,0 +9,0 @@ * Subscribe to an account to receive notifications when the lamports or data for |
@@ -1,4 +0,3 @@ | ||
import { Commitment, UnixTimestamp } from '@solana/rpc-types'; | ||
import { Blockhash, TransactionVersion } from '@solana/transactions'; | ||
import { Base58EncodedBytes, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '../rpc-methods/common.js'; | ||
import type { Base58EncodedBytes, Blockhash, Commitment, IRpcApiSubscriptions, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1, UnixTimestamp } from '@solana/rpc-types'; | ||
import { TransactionVersion } from '@solana/transactions'; | ||
import { Reward, TransactionForAccounts, TransactionForFullBase58, TransactionForFullBase64, TransactionForFullJson, TransactionForFullJsonParsed } from '../rpc-methods/common-transactions.js'; | ||
@@ -47,3 +46,3 @@ type BlockNotificationsNotificationBase = Readonly<{ | ||
type BlockNotificationsMaxSupportedTransactionVersion = Exclude<TransactionVersion, 'legacy'>; | ||
export interface BlockNotificationsApi { | ||
export interface BlockNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -50,0 +49,0 @@ * Subscribe to receive notification anytime a new block is Confirmed or Finalized. |
@@ -1,2 +0,3 @@ | ||
import type { IRpcSubscriptionsApi } from '@solana/rpc-transport'; | ||
import { IRpcSubscriptionsApi } from '@solana/rpc-types'; | ||
import { ParamsPatcherConfig } from '../params-patcher.js'; | ||
import { AccountNotificationsApi } from './account-notifications.js'; | ||
@@ -11,10 +12,9 @@ import { BlockNotificationsApi } from './block-notifications.js'; | ||
import { VoteNotificationsApi } from './vote-notifications.js'; | ||
type Config = Readonly<{ | ||
onIntegerOverflow?: (methodName: string, keyPath: (number | string)[], value: bigint) => void; | ||
}>; | ||
type Config = ParamsPatcherConfig; | ||
export type SolanaRpcSubscriptions = AccountNotificationsApi & BlockNotificationsApi & LogsNotificationsApi & ProgramNotificationsApi & RootNotificationsApi & SignatureNotificationsApi & SlotNotificationsApi; | ||
export type SolanaRpcSubscriptionsUnstable = SlotsUpdatesNotificationsApi & VoteNotificationsApi; | ||
export declare function createSolanaRpcSubscriptionsApi(config?: Config): IRpcSubscriptionsApi<SolanaRpcSubscriptions & SolanaRpcSubscriptionsUnstable>; | ||
export declare function createSolanaRpcSubscriptionsApi_INTERNAL(config?: Config): IRpcSubscriptionsApi<SolanaRpcSubscriptions & SolanaRpcSubscriptionsUnstable>; | ||
export declare function createSolanaRpcSubscriptionsApi(config?: Config): IRpcSubscriptionsApi<SolanaRpcSubscriptions>; | ||
export declare function createSolanaRpcSubscriptionsApi_UNSTABLE(config?: Config): IRpcSubscriptionsApi<SolanaRpcSubscriptions & SolanaRpcSubscriptionsUnstable>; | ||
export type { AccountNotificationsApi, SignatureNotificationsApi, SlotNotificationsApi }; | ||
export type { AccountNotificationsApi, BlockNotificationsApi, LogsNotificationsApi, ProgramNotificationsApi, RootNotificationsApi, SignatureNotificationsApi, SlotNotificationsApi, SlotsUpdatesNotificationsApi, VoteNotificationsApi, }; | ||
//# sourceMappingURL=index.d.ts.map |
import { Address } from '@solana/addresses'; | ||
import { Signature } from '@solana/keys'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { RpcResponse } from '../rpc-methods/common.js'; | ||
import type { Commitment, IRpcApiSubscriptions, RpcResponse } from '@solana/rpc-types'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
@@ -17,3 +16,3 @@ type LogsNotificationsApiNotification = RpcResponse<Readonly<{ | ||
}>; | ||
export interface LogsNotificationsApi { | ||
export interface LogsNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -20,0 +19,0 @@ * Subscribe to a transaction logs to receive notification when a given transaction is committed. |
import { Address } from '@solana/addresses'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, Base58EncodedBytes, Base64EncodedBytes, RpcResponse, U64UnsafeBeyond2Pow53Minus1 } from '../rpc-methods/common.js'; | ||
import type { Base58EncodedBytes, Base64EncodedBytes, Commitment, IRpcApiSubscriptions, RpcResponse, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData } from '../rpc-methods/common.js'; | ||
type ProgramNotificationsMemcmpFilterBase58 = Readonly<{ | ||
@@ -25,3 +25,3 @@ offset: U64UnsafeBeyond2Pow53Minus1; | ||
}>; | ||
export interface ProgramNotificationsApi { | ||
export interface ProgramNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -28,0 +28,0 @@ * Subscribe to a program to receive notifications when the lamports or data for an account |
@@ -1,4 +0,4 @@ | ||
import { Slot } from '../rpc-methods/common.js'; | ||
import type { IRpcApiSubscriptions, Slot } from '@solana/rpc-types'; | ||
type RootNotificationsApiNotification = Slot; | ||
export interface RootNotificationsApi { | ||
export interface RootNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -5,0 +5,0 @@ * Subscribe to receive notification anytime a new root is set by the validator |
import { Signature } from '@solana/keys'; | ||
import { Commitment } from '@solana/rpc-types'; | ||
import { RpcResponse } from '../rpc-methods/common.js'; | ||
import type { Commitment, IRpcApiSubscriptions, RpcResponse } from '@solana/rpc-types'; | ||
import { TransactionError } from '../transaction-error.js'; | ||
@@ -12,3 +11,3 @@ type SignatureNotificationsApiNotificationReceived = RpcResponse<Readonly<string>>; | ||
}>; | ||
export interface SignatureNotificationsApi { | ||
export interface SignatureNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -15,0 +14,0 @@ * Subscribe to a transaction signature to receive notification when a given transaction is committed. |
@@ -1,2 +0,2 @@ | ||
import { Slot } from '../rpc-methods/common.js'; | ||
import type { IRpcApiSubscriptions, Slot } from '@solana/rpc-types'; | ||
type SlotNotificationsApiNotification = Readonly<{ | ||
@@ -7,3 +7,3 @@ parent: Slot; | ||
}>; | ||
export interface SlotNotificationsApi { | ||
export interface SlotNotificationsApi extends IRpcApiSubscriptions { | ||
/** | ||
@@ -10,0 +10,0 @@ * Subscribe to receive notification anytime a slot is processed by the validator |
@@ -1,2 +0,2 @@ | ||
import { Slot, U64UnsafeBeyond2Pow53Minus1 } from '../rpc-methods/common.js'; | ||
import type { Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types'; | ||
type SlotsUpdatesNotificationsApiNotificationBase = Readonly<{ | ||
@@ -3,0 +3,0 @@ slot: Slot; |
import { Address } from '@solana/addresses'; | ||
import { Signature } from '@solana/keys'; | ||
import { UnixTimestamp } from '@solana/rpc-types'; | ||
import { Blockhash } from '@solana/transactions'; | ||
import { Slot } from '../rpc-methods/common.js'; | ||
import type { Blockhash, Slot, UnixTimestamp } from '@solana/rpc-types'; | ||
type VoteNotificationsApiNotification = Readonly<{ | ||
@@ -7,0 +5,0 @@ hash: Blockhash; |
{ | ||
"name": "@solana/rpc-core", | ||
"version": "2.0.0-experimental.8de8e11", | ||
"version": "2.0.0-experimental.8e39a42", | ||
"description": "A library for making calls to the Solana JSON RPC API", | ||
@@ -48,2 +48,12 @@ "exports": { | ||
], | ||
"dependencies": { | ||
"@solana/codecs-core": "2.0.0-experimental.8e39a42", | ||
"@solana/codecs-strings": "2.0.0-experimental.8e39a42", | ||
"@solana/addresses": "2.0.0-experimental.8e39a42", | ||
"@solana/keys": "2.0.0-experimental.8e39a42", | ||
"@solana/rpc-parsed-types": "2.0.0-experimental.8e39a42", | ||
"@solana/rpc-transport": "2.0.0-experimental.8e39a42", | ||
"@solana/rpc-types": "2.0.0-experimental.8e39a42", | ||
"@solana/transactions": "2.0.0-experimental.8e39a42" | ||
}, | ||
"devDependencies": { | ||
@@ -53,3 +63,3 @@ "@solana/eslint-config-solana": "^1.0.2", | ||
"@types/jest": "^29.5.11", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/eslint-plugin": "^6.13.2", | ||
"@typescript-eslint/parser": "^6.3.0", | ||
@@ -69,12 +79,5 @@ "agadoo": "^3.0.0", | ||
"version-from-git": "^1.1.1", | ||
"@solana/addresses": "2.0.0-experimental.8de8e11", | ||
"@solana/codecs-core": "2.0.0-experimental.8de8e11", | ||
"@solana/codecs-strings": "2.0.0-experimental.8de8e11", | ||
"@solana/keys": "2.0.0-experimental.8de8e11", | ||
"@solana/rpc-transport": "2.0.0-experimental.8de8e11", | ||
"@solana/rpc-types": "2.0.0-experimental.8de8e11", | ||
"@solana/transactions": "2.0.0-experimental.8de8e11", | ||
"build-scripts": "0.0.0", | ||
"test-config": "0.0.0", | ||
"tsconfig": "0.0.0", | ||
"build-scripts": "0.0.0" | ||
"tsconfig": "0.0.0" | ||
}, | ||
@@ -81,0 +84,0 @@ "bundlewatch": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
601311
21
168
6278
0
8
+ Added@solana/addresses@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/assertions@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/codecs-core@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/codecs-data-structures@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/codecs-numbers@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/codecs-strings@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/functional@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/keys@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/rpc-parsed-types@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/rpc-transport@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/rpc-types@2.0.0-experimental.8e39a42(transitive)
+ Added@solana/transactions@2.0.0-experimental.8e39a42(transitive)
+ Addedfastestsmallesttextencoderdecoder@1.0.22(transitive)
+ Addedws@8.18.0(transitive)