Kit
Functions

getBigIntUpcastResponseTransformer

getBigIntUpcastResponseTransformer(allowedNumericKeyPaths): RpcResponseTransformer

Returns a transformer that upcasts all Number values to BigInts unless they match within the provided KeyPaths. In other words, the provided KeyPaths will remain as Number values, any other numeric value will be upcasted to a BigInt.

Note that you can use KEYPATH_WILDCARD to match any key within a KeyPath.

Parameters

ParameterType
allowedNumericKeyPathsreadonly KeyPath[]

Returns

RpcResponseTransformer

Example

import { getBigIntUpcastResponseTransformer } from '@solana/rpc-transformers';
 
const responseTransformer = getBigIntUpcastResponseTransformer([
    ['index'],
    ['instructions', KEYPATH_WILDCARD, 'accounts', KEYPATH_WILDCARD],
    ['instructions', KEYPATH_WILDCARD, 'programIdIndex'],
    ['instructions', KEYPATH_WILDCARD, 'stackHeight'],
]);

On this page