diff --git a/src/stellar-plus/core/contract-engine/errors.ts b/src/stellar-plus/core/contract-engine/errors.ts index 40c03a2..e06a612 100644 --- a/src/stellar-plus/core/contract-engine/errors.ts +++ b/src/stellar-plus/core/contract-engine/errors.ts @@ -108,6 +108,7 @@ const contractCodeMissingLiveUntilLedgerSeq = ( }) } + const contractEngineClassFailedToInitialize = (): StellarPlusError => { return new StellarPlusError({ code: ContractEngineErrorCodes.CE009, diff --git a/src/stellar-plus/core/contract-engine/index.ts b/src/stellar-plus/core/contract-engine/index.ts index 3bed6d3..fd91632 100644 --- a/src/stellar-plus/core/contract-engine/index.ts +++ b/src/stellar-plus/core/contract-engine/index.ts @@ -105,6 +105,7 @@ export class ContractEngine { this.wasm = contractParameters.wasm this.wasmHash = contractParameters.wasmHash + this.options = { ...options } this.sorobanTransactionPipeline = new SorobanTransactionPipeline(networkConfig, { diff --git a/src/stellar-plus/core/contract-engine/index.unit.test.ts b/src/stellar-plus/core/contract-engine/index.unit.test.ts index ece57f7..3842f90 100644 --- a/src/stellar-plus/core/contract-engine/index.unit.test.ts +++ b/src/stellar-plus/core/contract-engine/index.unit.test.ts @@ -12,6 +12,7 @@ import { SorobanInvokeArgs } from './types' import { ContractEngine } from '../contract-engine' import { ContractIdOutput, ContractWasmHashOutput } from '../pipelines/soroban-get-transaction/types' + jest.mock('stellar-plus/core/pipelines/soroban-transaction', () => ({ SorobanTransactionPipeline: jest.fn(), })) @@ -32,6 +33,7 @@ const MOCKED_STELLAR_ASSET = Asset.native() const MOCKED_CONTRACT_CODE_KEY = new xdr.LedgerKeyContractCode({ hash: Buffer.from(MOCKED_WASM_HASH, 'hex'), }) + const NETWORK_CONFIG = TestNet() const MOCKED_TX_INVOCATION: TransactionInvocation = { header: { @@ -92,6 +94,7 @@ describe('ContractEngine', () => { }) describe('Initialization Errors', () => { + it('should throw error if wasm file is required but is not present', async () => { const contractEngine = new ContractEngine({ networkConfig: NETWORK_CONFIG, @@ -258,7 +261,9 @@ describe('ContractEngine', () => { getLedgerEntries: jest.fn().mockResolvedValue({ entries: [ { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + key: Object.assign(xdr.LedgerKey.contractCode(MOCKED_CONTRACT_CODE_KEY)), xdr: 'xdr', liveUntilLedgerSeq: 1, diff --git a/src/stellar-plus/core/pipelines/submit-transaction/index.ts b/src/stellar-plus/core/pipelines/submit-transaction/index.ts index 1c6bde7..288cde2 100644 --- a/src/stellar-plus/core/pipelines/submit-transaction/index.ts +++ b/src/stellar-plus/core/pipelines/submit-transaction/index.ts @@ -13,6 +13,7 @@ import { RpcHandler } from 'stellar-plus/rpc/types' import { ConveyorBelt } from 'stellar-plus/utils/pipeline/conveyor-belts' import { PSUError } from './errors' +import { HorizonHandlerClient } from 'stellar-plus/horizon' export class SubmitTransactionPipeline extends ConveyorBelt< SubmitTransactionPipelineInput,