@rarible/types
Version:
`@rarible/types` is a TypeScript library that provides type definitions and interfaces for the Rarible ecosystem. This package is designed to facilitate seamless integration with Rarible's APIs and services, ensuring type safety and improved developer exp
20 lines (19 loc) • 867 B
JavaScript
import { randomEVMAddress } from "../../evm/address/index.js";
import { randomFlowAddress } from "../../flow/address/index.js";
import { randomSolanaAddress } from "../../solana/address/index.js";
import { randomTezosAddress } from "../../tezos/address/index.js";
import { randomAptosAddress } from "../../aptos/address/index.js";
import { BlockchainLayer1Enum } from "../enum/domain.js";
const dictionary = {
[BlockchainLayer1Enum.ETHEREUM]: randomEVMAddress,
[BlockchainLayer1Enum.FLOW]: randomFlowAddress,
[BlockchainLayer1Enum.SOLANA]: randomSolanaAddress,
[BlockchainLayer1Enum.TEZOS]: randomTezosAddress,
[BlockchainLayer1Enum.APTOS]: randomAptosAddress,
};
export function getRandomAddress(blockchain) {
const fn = dictionary[blockchain];
if (!fn)
throw new Error(`Unhandled blockchain - ${blockchain}`);
return fn();
}