@glitterprotocol/glitter-sdk
Version:
The JavaScript SDK for Glitter
43 lines (42 loc) • 1.99 kB
TypeScript
/// <reference types="node" />
import { JSONSerializable } from './json';
import { Dec, Numeric } from '../core/numeric';
import { Buffer } from 'buffer';
import { Argument } from '@glitterprotocol/glitter.proto/index/sql_engine';
export declare const stripHexPrefix: (str: string) => string;
export declare const toChecksumAddress: (address: string, chainId?: number | null) => string;
export declare function isValidChecksumAddress(address: string, chainId: number | null): boolean;
export declare namespace Convert {
const id: (c: any) => any;
const toDec: (c: Numeric.Input) => Dec;
const toString: (c: any) => string;
const toFixed: (c: number) => string;
const toNumber: (string: string, radix?: number | undefined) => number;
const toData: (c: JSONSerializable<any, any, any>) => any;
}
export declare const ETH: {
decoder: (data: string) => Buffer;
encoder: (data: Buffer) => string;
name: string;
};
export declare const Glitter: {
decoder: (data: string) => Buffer;
encoder: (data: Buffer) => string;
name: string;
};
export declare const ethToGlitter: (ethAddress: string) => string;
export declare const glitterToEth: (glitterAddress: string) => string;
export declare const toGlitterArguments: (args: (string | number | boolean)[]) => Argument[];
export declare function buildBatchInsertStatement(database: string, table: string, columns: string[], rowValues: (string | number | boolean)[][]): {
sql: string;
values: Argument[];
};
export declare function buildUpdateStatement(database: string, table: string, columns: Record<string, any> | null, whereEqual: Record<string, any> | null): {
sql: string;
values: Argument[];
};
export declare function buildDeleteStatement(database: string, table: string, where: Record<string, any>, orderBy?: string, asc?: boolean, limit?: number): {
sql: string;
values: Argument[];
};
export declare function verifySign(addr: string, msg: string, signHex: string): boolean;