PHP WebShell

Текущая директория: /opt/BitGoJS/modules/sdk-coin-trx/dist/src/lib

Просмотр файла: utils.d.ts

import { TransferContract, RawData, AccountPermissionUpdateContract, TransactionReceipt, TriggerSmartContract } from './iface';
export declare const tokenMainnetContractAddresses: string[];
export declare const tokenTestnetContractAddresses: string[];
/**
 * Tron-specific helper functions
 */
export type TronBinaryLike = ByteArray | Buffer | Uint8Array | string;
export type ByteArray = number[];
/**
 * @param address
 */
export declare function isBase58Address(address: string): boolean;
/**
 * @param str
 */
export declare function getByteArrayFromHexAddress(str: string): ByteArray;
/**
 * @param arr
 */
export declare function getHexAddressFromByteArray(arr: ByteArray): string;
/**
 * @param messageToVerify
 * @param base58Address
 * @param sigHex
 * @param useTronHeader
 */
export declare function verifySignature(messageToVerify: string, base58Address: string, sigHex: string, useTronHeader?: boolean): boolean;
/**
 * @param base58
 */
export declare function getHexAddressFromBase58Address(base58: string): string;
/**
 * @param privateKey
 */
export declare function getPubKeyFromPriKey(privateKey: TronBinaryLike): ByteArray;
/**
 * @param privateKey
 */
export declare function getAddressFromPriKey(privateKey: TronBinaryLike): ByteArray;
/**
 * @param address
 */
export declare function getBase58AddressFromByteArray(address: ByteArray): string;
/**
 * @param hex
 */
export declare function getBase58AddressFromHex(hex: string): string;
/**
 * @param privateKey
 * @param transaction
 */
export declare function signTransaction(privateKey: string | ByteArray, transaction: TransactionReceipt): TransactionReceipt;
/**
 * @param message
 * @param privateKey
 * @param useTronHeader
 */
export declare function signString(message: string, privateKey: string | ByteArray, useTronHeader?: boolean): string;
/**
 * @param pubBytes
 */
export declare function getRawAddressFromPubKey(pubBytes: TronBinaryLike): ByteArray;
/**
 * Decodes a hex encoded transaction in its protobuf representation.
 *
 * @param hexString raw_data_hex field from tron transactions
 */
export declare function decodeTransaction(hexString: string): RawData;
/**
 * Decodes a transaction's raw field from a base64 encoded string. This is a protobuf representation.
 *
 * @param hexString this is the raw hexadecimal encoded string. Doc found in the following link.
 * @example
 * @see {@link https://github.com/BitGo/bitgo-account-lib/blob/5f282588701778a4421c75fa61f42713f56e95b9/resources/protobuf/tron.proto#L319}
 */
export declare function decodeRawTransaction(hexString: string): {
    expiration: number;
    timestamp: number;
    contracts: Array<any>;
    blockBytes: string;
    blockHash: string;
    feeLimit: string;
};
/**
 * Indicates whether the passed string is a safe hex string for tron's purposes.
 *
 * @param hex A valid hex string must be a string made of numbers and characters and has an even length.
 */
export declare function isValidHex(hex: string): boolean;
/** Deserialize the segment of the txHex which corresponds with the details of the transfer
 *
 * @param transferHex is the value property of the "parameter" field of contractList[0]
 * */
export declare function decodeTransferContract(transferHex: string): TransferContract[];
/**
 * Deserialize the segment of the txHex corresponding with trigger smart contract
 *
 * @param {string} base64
 * @returns {AccountPermissionUpdateContract}
 */
export declare function decodeTriggerSmartContract(base64: string): TriggerSmartContract[];
/**
 * Deserialize the segment of the txHex corresponding with the details of the contract which updates
 * account permission
 *
 * @param {string} base64
 * @returns {AccountPermissionUpdateContract}
 */
export declare function decodeAccountPermissionUpdateContract(base64: string): AccountPermissionUpdateContract;
/**
 * @param rawTransaction
 */
export declare function isValidTxJsonString(rawTransaction: string): boolean;
/**
 * Returns whether the provided raw transaction accommodates to bitgo's preferred format
 *
 * @param {any} rawTransaction - The raw transaction to be checked
 * @returns {boolean} the validation result
 */
export declare function isValidRawTransactionFormat(rawTransaction: any): boolean;
/**
 * Returns an hex string of the given buffer
 *
 * @param {Buffer | Uint8Array} buffer - the buffer to be converted to hex
 * @returns {string} - the hex value
 */
export declare function toHex(buffer: Buffer | Uint8Array): string;
/**
 * Returns a Keccak-256 encoded string of the parameters
 *
 * @param types - strings describing the types of the values
 * @param values - value to encode
 * @param methodId - the first 4 bytes of the function selector
 */
export declare function encodeDataParams(types: string[], values: any[], methodId?: string): string;
/**
 * Returns the decoded values according to the array of types
 *
 * @param types - strings describing the types of the values
 * @param data - encoded string
 */
export declare function decodeDataParams(types: string[], data: string): any[];
//# sourceMappingURL=utils.d.ts.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!