@solana/rpc-core
Advanced tools
Comparing version 2.0.0-experimental.274e073 to 2.0.0-experimental.2b0c16d
@@ -0,1 +1,25 @@ | ||
import bs58 from 'bs58'; | ||
// src/blockhash.ts | ||
function assertIsBlockhash(putativeBlockhash) { | ||
try { | ||
if ( | ||
// Lowest value (32 bytes of zeroes) | ||
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255) | ||
putativeBlockhash.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
} | ||
const bytes = bs58.decode(putativeBlockhash); | ||
const numBytes = bytes.byteLength; | ||
if (numBytes !== 32) { | ||
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`); | ||
} | ||
} catch (e) { | ||
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, { | ||
cause: e | ||
}); | ||
} | ||
} | ||
// src/params-patcher.ts | ||
@@ -33,3 +57,26 @@ function visitNode(value, keyPath, onIntegerOverflow) { | ||
var ALLOWED_NUMERIC_KEYPATHS = { | ||
getInflationReward: [[KEYPATH_WILDCARD, "commission"]] | ||
getBlockTime: [[]], | ||
getInflationReward: [[KEYPATH_WILDCARD, "commission"]], | ||
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]], | ||
getTransaction: [ | ||
["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"], | ||
["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"], | ||
["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"], | ||
["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"], | ||
["meta", "rewards", KEYPATH_WILDCARD, "commission"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "index"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD], | ||
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "writableIndexes", KEYPATH_WILDCARD], | ||
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "readonlyIndexes", KEYPATH_WILDCARD], | ||
["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"], | ||
["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD], | ||
["transaction", "message", "header", "numReadonlySignedAccounts"], | ||
["transaction", "message", "header", "numReadonlyUnsignedAccounts"], | ||
["transaction", "message", "header", "numRequiredSignatures"] | ||
], | ||
getVoteAccounts: [ | ||
["current", KEYPATH_WILDCARD, "commission"], | ||
["delinquent", KEYPATH_WILDCARD, "commission"] | ||
] | ||
}; | ||
@@ -67,3 +114,3 @@ | ||
// src/index.ts | ||
// src/rpc-methods/index.ts | ||
function createSolanaRpcApi(config) { | ||
@@ -96,4 +143,4 @@ return new Proxy({}, { | ||
export { createSolanaRpcApi }; | ||
export { assertIsBlockhash, createSolanaRpcApi }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.browser.js.map |
@@ -0,1 +1,25 @@ | ||
import bs58 from 'bs58'; | ||
// src/blockhash.ts | ||
function assertIsBlockhash(putativeBlockhash) { | ||
try { | ||
if ( | ||
// Lowest value (32 bytes of zeroes) | ||
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255) | ||
putativeBlockhash.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
} | ||
const bytes = bs58.decode(putativeBlockhash); | ||
const numBytes = bytes.byteLength; | ||
if (numBytes !== 32) { | ||
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`); | ||
} | ||
} catch (e) { | ||
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, { | ||
cause: e | ||
}); | ||
} | ||
} | ||
// src/params-patcher.ts | ||
@@ -33,3 +57,26 @@ function visitNode(value, keyPath, onIntegerOverflow) { | ||
var ALLOWED_NUMERIC_KEYPATHS = { | ||
getInflationReward: [[KEYPATH_WILDCARD, "commission"]] | ||
getBlockTime: [[]], | ||
getInflationReward: [[KEYPATH_WILDCARD, "commission"]], | ||
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]], | ||
getTransaction: [ | ||
["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"], | ||
["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"], | ||
["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"], | ||
["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"], | ||
["meta", "rewards", KEYPATH_WILDCARD, "commission"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "index"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD], | ||
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "writableIndexes", KEYPATH_WILDCARD], | ||
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "readonlyIndexes", KEYPATH_WILDCARD], | ||
["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"], | ||
["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD], | ||
["transaction", "message", "header", "numReadonlySignedAccounts"], | ||
["transaction", "message", "header", "numReadonlyUnsignedAccounts"], | ||
["transaction", "message", "header", "numRequiredSignatures"] | ||
], | ||
getVoteAccounts: [ | ||
["current", KEYPATH_WILDCARD, "commission"], | ||
["delinquent", KEYPATH_WILDCARD, "commission"] | ||
] | ||
}; | ||
@@ -67,3 +114,3 @@ | ||
// src/index.ts | ||
// src/rpc-methods/index.ts | ||
function createSolanaRpcApi(config) { | ||
@@ -96,4 +143,4 @@ return new Proxy({}, { | ||
export { createSolanaRpcApi }; | ||
export { assertIsBlockhash, createSolanaRpcApi }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.native.js.map |
@@ -0,1 +1,25 @@ | ||
import bs58 from 'bs58'; | ||
// src/blockhash.ts | ||
function assertIsBlockhash(putativeBlockhash) { | ||
try { | ||
if ( | ||
// Lowest value (32 bytes of zeroes) | ||
putativeBlockhash.length < 32 || // Highest value (32 bytes of 255) | ||
putativeBlockhash.length > 44 | ||
) { | ||
throw new Error("Expected input string to decode to a byte array of length 32."); | ||
} | ||
const bytes = bs58.decode(putativeBlockhash); | ||
const numBytes = bytes.byteLength; | ||
if (numBytes !== 32) { | ||
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`); | ||
} | ||
} catch (e) { | ||
throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, { | ||
cause: e | ||
}); | ||
} | ||
} | ||
// src/params-patcher.ts | ||
@@ -33,3 +57,26 @@ function visitNode(value, keyPath, onIntegerOverflow) { | ||
var ALLOWED_NUMERIC_KEYPATHS = { | ||
getInflationReward: [[KEYPATH_WILDCARD, "commission"]] | ||
getBlockTime: [[]], | ||
getInflationReward: [[KEYPATH_WILDCARD, "commission"]], | ||
getRecentPerformanceSamples: [[KEYPATH_WILDCARD, "samplePeriodSecs"]], | ||
getTransaction: [ | ||
["meta", "preTokenBalances", KEYPATH_WILDCARD, "accountIndex"], | ||
["meta", "preTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"], | ||
["meta", "postTokenBalances", KEYPATH_WILDCARD, "accountIndex"], | ||
["meta", "postTokenBalances", KEYPATH_WILDCARD, "uiTokenAmount", "decimals"], | ||
["meta", "rewards", KEYPATH_WILDCARD, "commission"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "index"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "programIdIndex"], | ||
["meta", "innerInstructions", KEYPATH_WILDCARD, "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD], | ||
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "writableIndexes", KEYPATH_WILDCARD], | ||
["transaction", "message", "addressTableLookups", KEYPATH_WILDCARD, "readonlyIndexes", KEYPATH_WILDCARD], | ||
["transaction", "message", "instructions", KEYPATH_WILDCARD, "programIdIndex"], | ||
["transaction", "message", "instructions", KEYPATH_WILDCARD, "accounts", KEYPATH_WILDCARD], | ||
["transaction", "message", "header", "numReadonlySignedAccounts"], | ||
["transaction", "message", "header", "numReadonlyUnsignedAccounts"], | ||
["transaction", "message", "header", "numRequiredSignatures"] | ||
], | ||
getVoteAccounts: [ | ||
["current", KEYPATH_WILDCARD, "commission"], | ||
["delinquent", KEYPATH_WILDCARD, "commission"] | ||
] | ||
}; | ||
@@ -67,3 +114,3 @@ | ||
// src/index.ts | ||
// src/rpc-methods/index.ts | ||
function createSolanaRpcApi(config) { | ||
@@ -96,4 +143,4 @@ return new Proxy({}, { | ||
export { createSolanaRpcApi }; | ||
export { assertIsBlockhash, createSolanaRpcApi }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
@@ -1,13 +0,3 @@ | ||
import { IRpcApi } from '@solana/rpc-transport/dist/types/json-rpc-types'; | ||
import { GetAccountInfoApi } from './rpc-methods/getAccountInfo'; | ||
import { GetBlockHeightApi } from './rpc-methods/getBlockHeight'; | ||
import { GetBlocksApi } from './rpc-methods/getBlocks'; | ||
import { GetInflationRewardApi } from './rpc-methods/getInflationReward'; | ||
import { GetBalanceApi } from './rpc-methods/getBalance'; | ||
type Config = Readonly<{ | ||
onIntegerOverflow?: (methodName: string, keyPath: (number | string)[], value: bigint) => void; | ||
}>; | ||
export type SolanaRpcMethods = GetAccountInfoApi & GetBalanceApi & GetBlockHeightApi & GetBlocksApi & GetInflationRewardApi; | ||
export declare function createSolanaRpcApi(config?: Config): IRpcApi<SolanaRpcMethods>; | ||
export {}; | ||
export * from './blockhash'; | ||
export * from './rpc-methods'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { createSolanaRpcApi } from './index'; | ||
import { KeyPath } from './response-patcher'; | ||
import { createSolanaRpcApi } from './rpc-methods'; | ||
/** | ||
@@ -4,0 +4,0 @@ * These are keypaths at the end of which you will find a numeric value that should *not* be upcast |
@@ -1,5 +0,5 @@ | ||
import { createSolanaRpcApi } from './index'; | ||
import { KeyPathWildcard } from './response-patcher-types'; | ||
import { createSolanaRpcApi } from './rpc-methods'; | ||
export type KeyPath = ReadonlyArray<KeyPathWildcard | number | string | KeyPath>; | ||
export declare function patchResponseForSolanaLabsRpc<T>(rawResponse: unknown, methodName?: keyof ReturnType<typeof createSolanaRpcApi>): T; | ||
//# sourceMappingURL=response-patcher.d.ts.map |
@@ -6,2 +6,5 @@ export type Commitment = 'confirmed' | 'finalized' | 'processed'; | ||
}>; | ||
export type LamportsUnsafeBeyond2Pow53Minus1 = bigint & { | ||
readonly __lamports: unique symbol; | ||
}; | ||
export type Slot = U64UnsafeBeyond2Pow53Minus1; | ||
@@ -15,2 +18,15 @@ export type U64UnsafeBeyond2Pow53Minus1 = bigint; | ||
}>; | ||
export type TransactionVersion = 'legacy' | 0; | ||
export type Base58EncodedBytes = string & { | ||
readonly __base58EncodedBytes: unique symbol; | ||
}; | ||
export type Base64EncodedBytes = string & { | ||
readonly __base64EncodedBytes: unique symbol; | ||
}; | ||
export type Base64EncodedZStdCompressedBytes = string & { | ||
readonly __base64EncodedZStdCompressedBytes: unique symbol; | ||
}; | ||
export type Base58EncodedDataResponse = [Base58EncodedBytes, 'base58']; | ||
export type Base64EncodedDataResponse = [Base64EncodedBytes, 'base64']; | ||
export type Base64EncodedZStdCompressedDataResponse = [Base64EncodedZStdCompressedBytes, 'base64+zstd']; | ||
//# sourceMappingURL=common.d.ts.map |
import { Base58EncodedAddress } from '@solana/keys'; | ||
import { Commitment, DataSlice, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
type Base58EncodedBytes = string & { | ||
readonly __base58EncodedBytes: unique symbol; | ||
}; | ||
type Base64EncodedBytes = string & { | ||
readonly __base64EncodedBytes: unique symbol; | ||
}; | ||
type Base64EncodedZStdCompressedBytes = string & { | ||
readonly __base64EncodedZStdCompressedBytes: unique symbol; | ||
}; | ||
type Base58EncodedDataResponse = [Base58EncodedBytes, 'base58']; | ||
type Base64EncodedDataResponse = [Base64EncodedBytes, 'base64']; | ||
type Base64EncodedZStdCompressedDataResponse = [Base64EncodedZStdCompressedBytes, 'base64+zstd']; | ||
import { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, Base64EncodedZStdCompressedDataResponse, Commitment, DataSlice, LamportsUnsafeBeyond2Pow53Minus1, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
type GetAccountInfoApiResponseBase = Readonly<{ | ||
@@ -21,3 +9,3 @@ context: Readonly<{ | ||
executable: boolean; | ||
lamports: U64UnsafeBeyond2Pow53Minus1; | ||
lamports: LamportsUnsafeBeyond2Pow53Minus1; | ||
owner: Base58EncodedAddress; | ||
@@ -24,0 +12,0 @@ rentEpoch: U64UnsafeBeyond2Pow53Minus1; |
import { Base58EncodedAddress } from '@solana/keys'; | ||
import { Commitment, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
type GetBalanceApiResponse = RpcResponse<U64UnsafeBeyond2Pow53Minus1>; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1, RpcResponse, Slot } from './common'; | ||
type GetBalanceApiResponse = RpcResponse<LamportsUnsafeBeyond2Pow53Minus1>; | ||
export interface GetBalanceApi { | ||
@@ -5,0 +5,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { U64UnsafeBeyond2Pow53Minus1, Commitment, Slot } from './common'; | ||
import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
type GetBlockHeightApiResponse = U64UnsafeBeyond2Pow53Minus1; | ||
@@ -3,0 +3,0 @@ export interface GetBlockHeightApi { |
@@ -1,2 +0,2 @@ | ||
import { Slot, Commitment } from './common'; | ||
import { Commitment, Slot } from './common'; | ||
type GetBlocksApiResponse = Slot[]; | ||
@@ -3,0 +3,0 @@ export interface GetBlocksApi { |
import { Base58EncodedAddress } from '@solana/keys'; | ||
import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
import { Commitment, LamportsUnsafeBeyond2Pow53Minus1, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
type GetInflationRewardApiResponse = Readonly<{ | ||
amount: U64UnsafeBeyond2Pow53Minus1; | ||
amount: LamportsUnsafeBeyond2Pow53Minus1; | ||
commission: number; | ||
effectiveSlot: U64UnsafeBeyond2Pow53Minus1; | ||
effectiveSlot: Slot; | ||
epoch: U64UnsafeBeyond2Pow53Minus1; | ||
postBalance: U64UnsafeBeyond2Pow53Minus1; | ||
postBalance: LamportsUnsafeBeyond2Pow53Minus1; | ||
}>; | ||
@@ -10,0 +10,0 @@ export interface GetInflationRewardApi { |
{ | ||
"name": "@solana/rpc-core", | ||
"version": "2.0.0-experimental.274e073", | ||
"version": "2.0.0-experimental.2b0c16d", | ||
"description": "A library for making calls to the Solana JSON RPC API", | ||
@@ -49,6 +49,7 @@ "exports": { | ||
"dependencies": { | ||
"@solana/keys": "2.0.0-experimental.274e073" | ||
"bs58": "^5.0.0", | ||
"@solana/keys": "2.0.0-experimental.2b0c16d" | ||
}, | ||
"devDependencies": { | ||
"@solana/eslint-config-solana": "^1.0.0", | ||
"@solana/eslint-config-solana": "^1.0.1", | ||
"@swc/core": "^1.3.18", | ||
@@ -70,3 +71,3 @@ "@swc/jest": "^0.2.23", | ||
"postcss": "^8.4.12", | ||
"prettier": "^2.7.1", | ||
"prettier": "^2.8.8", | ||
"ts-node": "^10.9.1", | ||
@@ -76,3 +77,3 @@ "tsup": "6.7.0", | ||
"version-from-git": "^1.1.1", | ||
"@solana/rpc-transport": "2.0.0-experimental.274e073", | ||
"@solana/rpc-transport": "2.0.0-experimental.2b0c16d", | ||
"build-scripts": "0.0.0", | ||
@@ -79,0 +80,0 @@ "test-config": "0.0.0", |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
178723
78
1580
1
24
0
2
+ Addedbs58@^5.0.0
+ Added@solana/keys@2.0.0-experimental.2b0c16d(transitive)
- Removed@solana/keys@2.0.0-experimental.274e073(transitive)