/*! Copyright 2022 SecuX Technology Inc Copyright Chen Wei-En Copyright Wu Tsung-Yu Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /// import { ITransport } from "@secux/transport"; import { txDetail } from './interface'; import { communicationData } from "@secux/utility/lib/communication"; export { SecuxXLM }; /** * XLM package for SecuX device */ declare class SecuxXLM { /** * Convert ED25519 publickey to XLM address. * @param {string|Buffer} publickey ed25519 publickey * @returns {string} XLM address */ static addressConvert(publickey: string | Buffer): string; /** * Prepare data for XLM address. * @param {string} path BIP32 path (hardened child key), ex: m/44'/148'/0' * @returns {communicationData} data for sending to device */ static prepareAddress(path: string): communicationData; /** * Generate XLM address from response data. * @param {communicationData} response data from device * @returns {string} XLM address */ static resolveAddress(response: communicationData): string; /** * Prepare data for ed25519 publickey. * @param {string} path BIP32 path (hardened child key), ex: m/44'/148'/0' * @returns {communicationData} data for sending to device */ static preparePublickey(path: string): communicationData; /** * Resove ed25519 publickey from response data. * @param {communicationData} response data from device * @returns {string} ed25519 publickey (hex string) */ static resolvePublickey(response: communicationData): string; /** * Prepare data for signing. * @param {string} path BIP32 path (hardened child key), ex: m/44'/148'/0' * @param {txDetail} content transaction object * @returns {prepared} prepared object */ static prepareSign(path: string, content: txDetail): { commandData: communicationData; serialized: communicationData; }; /** * Resolve signature from response data. * @param {communicationData} response data from device * @returns {string} signature (hex string) */ static resolveSignature(response: communicationData): string; /** * Generate raw transaction for broadcasting. * @param {communicationData} response data from device * @param {communicationData} serialized serialized object * @returns {string} signed raw transaction */ static resolveTransaction(response: communicationData, serialized: communicationData): string; static getAddress(this: ITransport, path: string): Promise; static getPublickey(this: ITransport, path: string): Promise; static getXPublickey(this: ITransport, path: string): Promise; static sign(this: ITransport, path: string, content: txDetail): Promise<{ raw_tx: string; signature: string; }>; } /** * Data type for transmission. * @typedef {string|Buffer} communicationData */ /** * The payment object. * @typedef {object} txDetail * @property {string} from sending address * @property {string} to receiving address * @property {string} amount transfer amount * @property {string | number} sequence * @property {string | number} fee * @property {memoObj} [memo] * @property {string} [networkPassphrase] network for XLM, default is mainnet * @property {boolean} [needCreateAccount] pay for creating new account, default: false */ /** * Memo. * @typedef {object} memoObj * @property {string} Type MemoType * @property {string} Value */ /** * Object for the signing and validation. * @typedef {object} prepared * @property {communicationData} commandData data for sending to device * @property {communicationData} serialized serialized object */