@debridge-finance/solana-utils
Version:
Common utils package to power communication with Solana contracts at deBridge
38 lines • 1.56 kB
TypeScript
import { Buffer } from "buffer";
import BN from "bn.js";
import { AutoParamsType, BNable, HashDeployInfoParams, HexString, SolanaPubkey } from "./interfaces";
export declare const keccak256: (data: Uint8Array) => string;
export declare const solidityKeccak256: (types: string[], values: unknown[]) => string;
export declare function denormalizeAmount(amount: BN, denominator: number): Buffer;
export declare function normalizeChainId(chainId: BNable): Buffer;
/**
* Hashes deploy info
* @param params {@link HashDeployInfoParams}
* @returns keccak256 of deployInfo structure
*/
export declare function hashDeployInfo(params: HashDeployInfoParams): HexString;
/**
* Returns bridgeid hash
* @param nativeChainId chain id where token originates
* @param nativeTokenAddress address of token in native chain in format "0x<HEX STRING>"
* @returns bridge id in deBridge network
*/
export declare function hashDebridgeId(nativeChainId: BNable, nativeTokenAddress: HexString | Buffer): HexString;
export declare function hashExternalCallBytes(data?: Buffer | string): Buffer;
type HashSubmissionIdParams = {
receiver: SolanaPubkey | Buffer;
debridgeId: HexString | Buffer;
sourceChainId: BNable;
targetChainId: BNable;
amount: BNable;
nonce: number;
autoParams?: AutoParamsType;
};
/**
* Hashes submission for provided data
* @param params data to hash
* @returns submissionId from provided params
*/
export declare function hashSubmissionIdRaw(params: HashSubmissionIdParams): string;
export {};
//# sourceMappingURL=crypto.d.ts.map