Looking at the definition for the Amount
structure and friends,
export type Amount<T extends Currency = Currency> = {
basisPoints: BigNumber;
currency: T;
};
export type Currency = {
symbol: string;
decimals: number;
namespace?: 'spl-token';
};
export type SplTokenCurrency = {
symbol: string;
decimals: number;
namespace: 'spl-token';
};
export type SplTokenAmount = Amount<SplTokenCurrency>;
export const SOL = {
symbol: 'SOL',
decimals: 9,
} as const;
export type SolCurrency = typeof SOL;
export type SolAmount = Amount<SolCurrency>;
Looks like it's just a wrapper to indicate if you are funding in SOL or with other SPL-tokens (looks like they at least support USDC).
So the correct way of calling the fund function while funding with SOL should be:
const amount: SolAmount = {
basisPoints: new BigNumber(2000),
currency: SOL
};
await (await bundlrStorage.bundlr()).fund(amount);
It should be noted that BigNumber
doesn't come from the bignumber.js
library, which is common, It is instead a type inside the same Metaplex library.