Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
fazzatti authored Apr 25, 2024
2 parents 20abb09 + a1b3158 commit 158165a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/stellar-plus/core/contract-engine/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const contractCodeMissingLiveUntilLedgerSeq = (
})
}


const contractEngineClassFailedToInitialize = (): StellarPlusError => {
return new StellarPlusError({
code: ContractEngineErrorCodes.CE009,
Expand Down
1 change: 1 addition & 0 deletions src/stellar-plus/core/contract-engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class ContractEngine {
this.wasm = contractParameters.wasm
this.wasmHash = contractParameters.wasmHash


this.options = { ...options }

this.sorobanTransactionPipeline = new SorobanTransactionPipeline(networkConfig, {
Expand Down
5 changes: 5 additions & 0 deletions src/stellar-plus/core/contract-engine/index.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}))
Expand All @@ -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: {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 158165a

Please sign in to comment.