@axelar-network/axelarjs-sdk
Version:
The JavaScript SDK for Axelar Network
24 lines • 1.1 kB
TypeScript
import { PublicKey } from "@solana/web3.js";
/**
* Helper function to validate Solana addresses using PublicKey
* @param address - The address string to validate
* @param fieldName - The name of the field being validated (for error messages)
* @returns The validated PublicKey instance
* @throws Error if the address is invalid
*/
export declare function validateSolanaAddress(address: string, fieldName: string): PublicKey;
/**
* Computes the Anchor instruction discriminator
* Equivalent to:
* let preimage = format!("global:{}", method_name);
* let discriminator = &sha256(preimage.as_bytes())[0..8];
*
* @param methodName Anchor instruction name
* @returns exactly 8 bytes
*/
export declare function anchorInstructionDiscriminator(methodName: string): Buffer;
export declare function encodeU32LE(value: number): Buffer;
export declare function encodeU64LE(value: bigint | number | string): Buffer;
export declare function encodeStringBorsh(value: string): Buffer;
export declare function concatU8(parts: ReadonlyArray<Buffer>): Buffer;
//# sourceMappingURL=solanaHelper.d.ts.map