UNPKG

@xcapit/shelter-sdk

Version:

SDK for Shelter smart contracts on Stellar

54 lines (53 loc) 1.5 kB
import { rpc, xdr } from "@stellar/stellar-sdk"; export const contractAddressTxReponse = { returnValue: { address: () => { return xdr.ScAddress.scAddressTypeContract(Buffer.from("227ca7b59a114b96adc361d1d5ce76cb1e2ffe6fa797296749638fded54f9550", "hex")); }, }, status: rpc.Api.GetTransactionStatus.SUCCESS, }; export const pollTxReponseSuccess = { status: rpc.Api.GetTransactionStatus.SUCCESS, }; export const pollTxReponseNotFound = { status: rpc.Api.GetTransactionStatus.NOT_FOUND, }; export class FakeStellarRpc { assembleTransaction(raw, simulation) { return { build: () => ({ sign: () => { } }), }; } } export class FakeServer { _pollTransactionReponse; serverURL = "aServerUrl"; constructor(_pollTransactionReponse = {}) { this._pollTransactionReponse = _pollTransactionReponse; } getNetwork() { return Promise.resolve({ passphrase: "aPassphrase" }); } sendTransaction(tx) { return { hash: "aTxHash" }; } pollTransaction(hash) { return this._pollTransactionReponse; } async getLatestLedger() { return { sequence: 1234 }; } async simulateTransaction() { return { transactionData: {}, minResourceFee: '123', result: {}, stateChanges: [], id: '1234', latestLedger: 1234, events: [], _parsed: false }; } }