Skip to content

Commit 7f12c23

Browse files
fazzattiCopilotAquiGorka
authored
Release core v0.16.1 (#58)
* fix(types): update isEd25519PublicKey to use type guard for Ed25519PublicKey * fix(types): update isMuxedAddress to use type predicate for MuxedAddress * feat: add isTransaction type guard for Transaction and FeeBumpTransaction * feat: implement isFeeBumpTransaction type guard for FeeBumpTransaction validation * feat: add verifiers export for transaction validation utilities * fix(types): enhance SignatureRequirement to include signer field * feat(tests): add unit tests for isTransaction and isFeeBumpTransaction validation * fix(types): update SignatureRequirement type to SignatureRequirementRaw for consistency * feat: implement envelope signing requirements processing and error handling * fix(tests): update test command to include coverage report generation * feat: add coverage report generation task to deno.json * test: add mock for MuxedAccount to simulate account ID retrieval failure * test: add unit tests for ColibriError minimal info handling * fix: update error details message for UNEXPECTED_ERROR and add unit test for untracked errors * test: add unit tests for handling UNEXPECTED_ERROR in BuildTransaction * test: enhance unit tests for error handling in getRequiredOperationThresholdForClassicOperation * fix: update details message in UNEXPECTED_ERROR for clarity * fix: simplify details and diagnostic assignment in ProcessError constructor * fix: update details message in UNEXPECTED_ERROR for clarity and add unit test for untracked errors * refactor: remove unused imports in index.unit.test.ts * refactor: remove unused import from index.unit.test.ts * feat: add boolean and string helper functions with error handling * feat: implement SignEnvelope process with error handling and unit tests * docs: add comments to assert function for clarity * feat: add assertRequiredArgs function to validate non-null arguments * refactor: consolidate baseErrorSource for consistent error reporting in string helper functions * feat: implement getAddressTypeFromAuthEntry and getAddressSignerFromAuthEntry functions for SorobanAuthorizationEntry handling * feat: enhance ProcessError with DeferredInputError type and improve details handling * feat: implement SignAuthEntries process and associated error handling * fix: change xdr import to type import for better type safety * refactor: reorganize SignAuthEntries test structure for improved readability * feat: re-add xdr export to helpers for improved module accessibility * feat: add ResultOrError class for improved error handling and input management * feat: add softTryToXDR and parse functions for improved error handling and event parsing * feat: add transaction helper for calculating transaction timeout * feat: refactor getValidUntilLedgerSeq to use ResultOrError for improved error handling * feat: implement SendTransaction process with error handling and transaction status management * feat: update convee dependency to version 0.7.1 and enhance test task commands for improved coverage reporting * feat: add buildToSimulate transformer for transaction simulation * feat: implement simulateToRetval transformer with error handling for missing return values * feat: add TransactionConfig and BaseFee types for transaction configuration * feat: implement PipelineError class for structured error handling in pipelines * feat: implement SignEnvelope process with error handling and types * feat: implement ReadFromContract pipeline with error handling and input/output types * feat: add unit tests for createReadFromContractPipeline with error handling * feat: add integration tests for ReadFromContract pipeline functionality * refactor: update error details and refine CreateReadFromContractPipelineArgs type * feat: enhance AssembleTransaction with new error handling and input types * feat: implement isSmartContractTransaction verifier for smart contract operations * feat: add operations retrieval functions for Transaction handling * feat: enhance parseErrorResult to handle unexpected TransactionResult formats * feat: add disableSanitizeConfig for testing and update deno.json for dependency version * feat: implement error handling for Friendbot operations with custom error types * fix: correct argument check in assertRequiredArgs and update TransactionSigner method name * feat: add "tools" to ErrorDomain type for enhanced error categorization * feat: update TestNet function to return TestNetConfig type for improved type safety * feat: add MISSING_ARG error class and enhance AssembleTransaction with resourceFee handling * feat: update SignEnvelope to use TransactionSigner and improve error handling * fix: rename getPublicKey to publicKey in MockSigner for consistency * refactor: rename tx to transaction in SendTransactionInput for clarity * feat: add assembleToEnvelopeSigningRequirements transformer for transaction processing * fix: add disableSanitizeConfig to ReadFromContract Pipeline tests and clean up error handling * feat: implement InvokeContract pipeline with error handling and transaction processing * fix: remove unused import assertRejects from ReadFromContract pipeline tests * feat: add unit tests for createInvokeContractPipeline with error handling * fix: remove inclusionFee conditional to zero when parsing transaction fee * feat: add assembleToEnvelopeSigningRequirements and buildToEnvelopeSigningRequirements transformers * fix: add missing file extension for assembleToEnvelopeSigningRequirements import * feat: implement ClassicTransaction pipeline with error handling and connectors * fix: update import paths for disableSanitizeConfig in test files * feat: refactor StrKey handling with new regex and type guards - Introduced a new StrKey module to handle various StrKey types and their validation. - Added regex patterns for Ed25519 public/secret keys, muxed addresses, and other StrKey types. - Implemented type guards for validating StrKey formats and checksums. - Removed old verifiers for Ed25519 public keys and muxed addresses, replacing them with StrKey methods. - Updated unit tests to cover new StrKey functionalities and validation logic. * feat: update import paths and refactor types for signer and transaction handling * feat: implement NativeAccount error handling and types for account operations * feat: enhance StrKey validation tests for PreAuthTx and Sha256Hash prefixes * feat: implement unit tests for LocalSigner functionality and security * feat: refactor error handling in NativeAccount and add unit tests for account methods * feat: reorganize type exports and update imports for consistency across modules * feat: update version to 0.1.0 and enhance README with simple architecture and error handling information * feat: simplify nonBlankString function by removing unused parameter * refactor: update imports to use type keyword for consistency across modules * refactor: remove unused Keypair import from sign-envelope process * feat: add delay before retrying transaction retrieval in getTransactionRecursively * fix: update test command in Deno workflow to run all tests * Test/increase coverage (#9) * fix: correct details assignment in ToolsError constructor * test: add unit tests for initializeWithFriendbot function * fix: restore revokeSponsorship case in getRequiredOperationThresholdForClassicOperation test: add unit tests for pipeline connectors * test: add unit tests for inputToBuild connector function * test: add unit tests for inputToBuild and related connectors in createInvokeContractPipeline * test: add unit tests for connectors in createClassicTransactionPipeline * fix: update isSigningThreshold function to include zero as a valid threshold and verify against non-integers * test: add unit tests for isSigningThreshold and isSmartContractTransaction functions * fix: ensure maxTime is correctly parsed as a number in getTransactionTimeout function * test: add unit tests for boolean and string helper functions * test: add unit tests for transaction helper functions * test: add unit tests for XDR helper functions * chore: update Deno workflow to include dev branch for push and pull requests * fix: change details property in ToolsErrorShape to be required * fix: make details property in TransformerErrorShape required * fix: remove coverage threshold check from Deno workflow * feat: Add WrapFeeBump process with error handling and unit tests (#12) * chore: Update core version to 0.2.0 in deno.json * chore: Update fee bump plugin's core dependency version to 0.2.0 in deno.json * Update plugins/fee-bump/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: Add Contract class (#14) * fix: Update error domain from "plugins" to "contract" in ContractError class * feat(test): add fungible token contract with initial implementation - Created Cargo.toml for the fungible token contract. - Added Makefile for building, deploying, and generating TypeScript bindings. - Added README.md with project overview and installation instructions. - Implemented the main contract logic in src/contract.rs, including minting, transferring, and burning tokens. - Set up the contract library in src/lib.rs. - Added initial tests in src/test.rs to verify contract functionality. - Compiled the contract to WASM format. - Created TypeScript specifications for the fungible token contract. - Updated workspace dependencies in cargo.toml to align with the new contract. * feat(test): add VOID type to TYPES_HARNESS_METHOD enum * refactor: comment out unused UNEXPECTED_ERROR class and update methodArgs to be optional in Contract class * chore: add test_snapshots directory to .gitignore * chore: update version to 0.3.1 in deno.json * Feat/auth entry parser (#17) * fix: correct signature handling in paramsToAuthEntry function * fix: import SIM_ERRORS for error handling in simulate-transaction tests * feat: enhance network configuration types and add type guard helpers * feat: refactor network passphrase handling to use enum for consistency * feat: reorganize exports in mod.ts and add tools module for better structure * chore: update version to 0.4.1 in deno.json * refactor: remove unused import of SIM_ERRORS in unit tests * refactor: update TransactionSigner interface and related implementations * feat: add isTransactionSigner verifier function * chore: update version to 0.5.0 in deno.json * chore: update @colibri/core import version to ^0.5.0 in deno.json * refactor: change Buffer import to type import in index.unit.test.ts * fix: add auth parameter to invoke method for authorization support * chore: update version to 0.5.1 in deno.json * feat: add invokeRaw method for contract invocation with optional auth * chore: update version to 0.5.2 in deno.json * fix: authorization entry processing by separating signed and unsigned entries * chore: update version to 0.5.3 in deno.json * refactor: simplify error handling in contract deployment and pipeline execution * feat: add verifySignature method to LocalSigner and TransactionSigner types * chore: update version to 0.6.0 in deno.json * refactor: separate LocalSigner type and implement verifySignature method * feat: enhance network configuration types and add type guard for NetworkConfig * refactor: update import paths to use alias for improved readability * refactor: update import paths to use alias for consistency * refactor: update import paths to use absolute paths for consistency and clarity * refactor: update import paths to use alias for consistency and improved readability * refactor: update import paths to use absolute paths for consistency and clarity * refactor: update import paths to use aliases for consistency and improved readability * refactor: update import paths to use absolute paths for consistency and clarity * refactor: update import paths to use absolute paths for consistency and clarity * refactor: update import paths to use aliases for consistency and improved readability * refactor: update import paths to use absolute paths for consistency and clarity * refactor: update import paths to use aliases for consistency and improved readability * chore: update version to 0.7.0 in deno.json * chore: update version to 0.2.0 and core dependency to ^0.7.0 in deno.json * chore: update version of convee to ^0.9.2 in deno.json * fix: convee plugin create payload * fix: update import paths for error handling consistency * fix: correct import path for error handling * feat: enhance README with detailed project overview and add logo * fix: update README to reflect current beta status instead of stable release * feat: Implement NetworkConfig class (#27) * feat: event streamer (#29) * feat: Implement Events, Standards and more (#32) * feat: topic filter conversion (#34) * Fix: toTopicFilter args type (#36) * fix: support for muxed transfer events in SAC/SEP41 Mint and Transfer schemas * fix: update version to 0.10.3 in deno.json * fix: mark core releases as latest in GitHub release workflow * docs: add documentation links to README files for better accessibility * docs: add examples links to README files for better guidance * docs: remove outdated processes documentation * Feat/add sac asset (#41) * feat(wip) add sac client * feat(wip): implement SAC error handling and contract methods * feat: rename SEP-11 asset functions and types to StellarAssetCanonicalString * feat: add unit tests for StellarAssetContract deployment error handling - Implement unit tests for StellarAssetContract's deploy method to ensure proper error handling for various scenarios, including non-SIMULATION_FAILED errors and malformed simulation responses. - Refactor asset-related imports to use StellarAssetCanonicalString instead of SEP11Asset across multiple event standards. - Update contract integration tests to instantiate Contract using the new constructor method. - Remove unused Asset import from contract error handling. - Clean up commented-out code related to asset wrapping in contract integration tests. * fix: correct import paths in unit tests for StellarAsset and ScVal * test: add missing tests for MintEvent and TransferEvent validation scenarios * chore: update version to 0.11.0 in deno.json * refactor: remove unused static create method from Contract class * fix: export SAC asset modules and error types * chore: update version to 0.11.1 in deno.json * fix: enhance StellarAssetContract to support missing native XLM and add related tests * chore: update version to 0.11.2 in deno.json * docs: update core/asset/sac/index.ts tsdocs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: add calculateContractId function to derive contract ID from add… (#45) * feat: rework signer and enable indirect signing (#47) * fix: missing contract signing flow * chore: bump version to 0.13.1 * standardize account interfaces * add UNSUPPORTED_ADDRESS_TYPE error and update NativeAccount to handle unsupported address types * feat: implement format-units helper functions and error handling * chore: update package versions to 0.14.0 for core, 0.5.0 for event-streamer, and 0.6.0 for fee-bump * fix: specify generic constraint for WithSigner and WithMultiSig types * fix: clarify error message for INVALID_SCIENTIFIC_EXPONENT regarding integer range * feat: add SEP10 and SEP1 support (#51) * refactor: simplify Sep10Client creation by using StellarToml instance * fix: change import of StellarToml to type import * chore: bump version to 0.1.1 in deno.json * fix: ensure valid URL for WEB_AUTH_ENDPOINT in Sep10Client and add corresponding unit test * test: rename SEP-10 Client E2E integration tests for authentication flow * feat: add static utility methods for SEP-10 challenge validation and parsing * style: format assertions for better readability in SEP10Challenge static utilities tests * chore: update version to 0.2.0 in deno.json * test: refactor challenge transaction tests to use mock transactions * feat: add time tolerance and skip validation options for challenge verification * chore: update version to 0.3.0 in deno.json * test: update comment for time tolerance verification in SEP10Challenge tests * test: remove redundant timeTolerance and skipTimeValidation tests from Sep10Client * feat: add memoize decorator with unit tests and type definitions * feat: add active eviction option to memoize decorator with comprehensive tests * chore: update stellar-sdk version to ^14.4.3 and add @std/expect import * add fixtures for getLedgers * test: add deno coverage ignore comments to test files * refactor: standardize string quotes and clean up whitespace in memoize unit tests * feat(xdr): Refactor and restructure ScVal parser and utility functions - Add `parseScVal` function to convert XDR ScVal to TypeScript-friendly values. - Introduce utility functions: `getScValTypeName`, `isScValRecord`, `isScValMap`, and `asUnion` for type checking and parsing. - Implement `parseScVals` for batch parsing of ScVal arrays. - Create `softTryToXDR` utility to safely convert values to XDR format. - Add comprehensive unit tests for ScVal parsing and utility functions. - Remove redundant ScVal types from `core/common/scval/types.ts` and consolidate in `core/common/helpers/xdr/types.ts`. * refactor: remove deprecated general.ts helper functions * refactor: update import paths for ScVal types and utilities * feat: remove lobstr from providers as they only offer horizon as of now * feat: implement ledger-parser with lazy operation parsing - Added Transaction class to handle transaction metadata and operations parsing. - Implemented factory methods for creating Transaction instances from metadata. - Introduced memoization for performance optimization on frequently accessed properties. - Added comprehensive unit tests for Transaction class covering various scenarios and envelope types. - Created types for Ledger, Transaction, and Operation for better type safety and clarity. - Updated module exports to include new ledger-parser functionalities. * feat: add LedgerStreamer class for streaming Stellar ledger data - Implemented LedgerStreamer class to support live and historical ingestion of Stellar ledgers. - Added methods for starting live, archive, and automatic streaming modes. - Introduced configuration options for batch size, wait intervals, and error handling. - Created type definitions for handlers and options related to ledger streaming. * refactor: format workspace array in deno.json for improved readability * feat: add environment loading utilities and update deno.json for improved testing * feat: enhance Lightsail provider to support API key for dynamic RPC URLs and add health check for MainNet PRO * chore: update import paths and add coverage ignore for environment loading files * chore: update comments to clarify future changes for API key usage in headers * feat: integrate QUASAR_API_KEY into network configuration for Lightsail provider * feat: implement rpc-streamer package feat: add Event Streamer variant with type definitions - Introduced `EventStreamerOptions` and `EventStreamerConfig` interfaces for event streaming configuration. - Created a new file `types.ts` under `rpc-streamer/src/variants/event/`. feat: implement Ledger Streamer variant with integration and unit tests - Added `createLedgerStreamer` function to handle live and archive ingestion of ledgers. - Implemented integration tests for the Ledger Streamer in `index.integration.test.ts`. - Created unit tests for the Ledger Streamer ingestors in `index.unit.test.ts`. - Defined `LedgerStreamerOptions` and `LedgerStreamerConfig` interfaces for ledger streaming configuration. - Added necessary mock helpers and test cases to ensure proper functionality and error handling. * Remove LedgerStreamer and EventStreamer packages and associated references * chore: add QUASAR_API_KEY environment variable to test step in Deno workflow * chore: update package versions and core dependency references to 0.16.0 * refactor: remove unused Api type imports and simplify handler function in integration tests * refactor: use isDefined utility for better null/undefined checks in event filter and transaction classes * refactor: remove any casting * refactor: comments * chore: update stellar-sdk version to 14.6.1 * fix: update resource fee calculation in AssembleTransaction tests * fix: forward allowHttp when creating fallback RPC server in Contract (#57) The Contract constructor creates a fallback RPC server when no `rpc` is passed, but ignores `networkConfig.allowHttp`. This causes all HTTP RPC URLs (e.g. local development) to fail with "Cannot connect to insecure Soroban RPC server". * fix: update version to 0.16.1 in deno.json * fix: update @colibri/core version to ^0.16.1 in deno.json files * fix: update version to 0.8.1 in @colibri/plugin-fee-bump and 0.1.1 in @colibri/rpc-streamer * fix: add wait function to handle RPC delays in Stellar Asset Contract tests --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Gorka Ludlow <gorka@aquigorka.com>
1 parent e8e9d20 commit 7f12c23

14 files changed

Lines changed: 85 additions & 78 deletions

File tree

core/asset/sac/index.integration.test.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ import * as SACError from "@/asset/sac/error.ts";
2525
describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
2626
const networkConfig = NetworkConfig.TestNet();
2727

28+
// The RPC may sometimes take a while to reflect changes, so we use a longer timeout for the integration tests
29+
// This seems to be specific to testnet.
30+
const wait = (ms = 500) => new Promise((resolve) => setTimeout(resolve, ms));
31+
2832
const setupIssuerFlags = async (
2933
publicKey: Ed25519PublicKey,
3034
networkConfig: NetworkConfig,
31-
config: TransactionConfig
35+
config: TransactionConfig,
3236
) => {
3337
const pipe = PIPE_ClassicTransaction.create({ networkConfig });
3438
const op = Operation.setOptions({
@@ -43,7 +47,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
4347
users: Signer[],
4448
asset: Asset,
4549
networkConfig: NetworkConfig,
46-
config: TransactionConfig
50+
config: TransactionConfig,
4751
) => {
4852
const pipe = PIPE_ClassicTransaction.create({ networkConfig });
4953
const operations: xdr.Operation[] = [];
@@ -53,7 +57,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
5357
Operation.changeTrust({
5458
asset: asset,
5559
source: user.publicKey(),
56-
})
60+
}),
5761
);
5862
}
5963

@@ -113,7 +117,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
113117

114118
// Verify the contract ID matches the native asset contract ID
115119
const expectedContractId = Asset.native().contractId(
116-
networkConfig.networkPassphrase
120+
networkConfig.networkPassphrase,
117121
);
118122
assertEquals(nativeSAC.contractId, expectedContractId);
119123
});
@@ -155,7 +159,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
155159

156160
await initializeWithFriendbot(
157161
networkConfig.friendbotUrl,
158-
newAdminAccount.publicKey()
162+
newAdminAccount.publicKey(),
159163
);
160164
});
161165

@@ -167,6 +171,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
167171
newAdmin: newAdminAccount.publicKey(),
168172
config: txConfig,
169173
});
174+
await wait();
170175
currentAdmin = await colibriSAC.admin();
171176
assertEquals(currentAdmin, newAdminAccount.publicKey());
172177

@@ -177,6 +182,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
177182
signers: [newAdminAccount, issuer.signer()],
178183
},
179184
});
185+
await wait();
180186
currentAdmin = await colibriSAC.admin();
181187
assertEquals(currentAdmin, issuer.address());
182188
});
@@ -192,6 +198,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
192198
amount: 1_000_000_0000000n, // 1M COLIBRI
193199
config: txConfig,
194200
});
201+
await wait();
195202

196203
userACurrentBalance = await colibriSAC.balance({
197204
id: userA.address(),
@@ -206,6 +213,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
206213
signers: [userA.signer(), issuer.signer()],
207214
},
208215
});
216+
await wait();
209217

210218
userACurrentBalance = await colibriSAC.balance({
211219
id: userA.address(),
@@ -224,6 +232,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
224232
authorize: false,
225233
config: txConfig,
226234
});
235+
await wait();
227236

228237
isAuthorized = await colibriSAC.authorized({
229238
id: userB.address(),
@@ -235,6 +244,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
235244
authorize: true,
236245
config: txConfig,
237246
});
247+
await wait();
238248

239249
isAuthorized = await colibriSAC.authorized({
240250
id: userB.address(),
@@ -249,6 +259,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
249259
amount: 100_0000000n, // 100 COLIBRI
250260
config: txConfig,
251261
});
262+
await wait();
252263

253264
let userBBalance = await colibriSAC.balance({
254265
id: userB.address(),
@@ -261,6 +272,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
261272
amount: 50_0000000n,
262273
config: txConfig,
263274
});
275+
await wait();
264276

265277
userBBalance = await colibriSAC.balance({
266278
id: userB.address(),
@@ -289,6 +301,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
289301
signers: [userA.signer(), issuer.signer()],
290302
},
291303
});
304+
await wait();
292305

293306
const userABalanceAfter = await colibriSAC.balance({
294307
id: userA.address(),
@@ -327,6 +340,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
327340
signers: [userA.signer(), issuer.signer()],
328341
},
329342
});
343+
await wait();
330344

331345
// Check allowance is now set
332346
allowance = await colibriSAC.allowance({
@@ -364,6 +378,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
364378
signers: [userB.signer(), issuer.signer()],
365379
},
366380
});
381+
await wait();
367382

368383
const userABalanceAfter = await colibriSAC.balance({
369384
id: userA.address(),
@@ -401,6 +416,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
401416
signers: [userA.signer(), issuer.signer()],
402417
},
403418
});
419+
await wait();
404420

405421
const userABalanceBefore = await colibriSAC.balance({
406422
id: userA.address(),
@@ -418,6 +434,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
418434
signers: [userB.signer(), issuer.signer()],
419435
},
420436
});
437+
await wait();
421438

422439
const userABalanceAfter = await colibriSAC.balance({
423440
id: userA.address(),

core/contract/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class Contract {
5757
this.networkConfig = networkConfig;
5858
if (!rpc) {
5959
assert(networkConfig && networkConfig.rpcUrl, new E.MISSING_RPC_URL());
60-
rpc = new Server(networkConfig.rpcUrl);
60+
rpc = new Server(networkConfig.rpcUrl, { allowHttp: networkConfig.allowHttp });
6161
}
6262

6363
this.rpc = rpc;

core/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@colibri/core",
3-
"version": "0.16.0",
3+
"version": "0.16.1",
44
"license": "MIT",
55
"exports": {
66
".": "./mod.ts"

core/event/event-filter/index.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { BoundedArray } from "@/common/helpers/bounded-array.ts";
99
import type { ContractId } from "@/strkeys/types.ts";
1010
import { assert } from "@/common/assert/assert.ts";
1111
import * as E from "@/event/event-filter/error.ts";
12+
import { isDefined } from "@/common/type-guards/is-defined.ts";
1213
export class EventFilter {
1314
private _type?: EventType;
1415
private _contractIds?: BoundedArray<ContractId, 0, 5>;
@@ -36,14 +37,9 @@ export class EventFilter {
3637
return {
3738
type: this._type,
3839
contractIds: this._contractIds,
39-
topics:
40-
this._topics === undefined
41-
? undefined
42-
: [
43-
...this._topics.map((topicFilter) =>
44-
this.encodeTopics(topicFilter)
45-
),
46-
],
40+
topics: isDefined(this._topics)
41+
? [...this._topics.map((topicFilter) => this.encodeTopics(topicFilter))]
42+
: undefined,
4743
};
4844
}
4945

@@ -77,7 +73,7 @@ export class EventFilter {
7773
}
7874
const eventTopicsMatchFilterTopic = (
7975
topicFilter: TopicFilter,
80-
eventTopics: xdr.ScVal[]
76+
eventTopics: xdr.ScVal[],
8177
): boolean => {
8278
assert(eventTopics.length > 0, new E.EVENT_HAS_NO_TOPICS());
8379

@@ -101,7 +97,7 @@ const eventTopicsMatchFilterTopic = (
10197
throw new E.FAILED_TO_CHECK_FILTER_SEGMENT(
10298
filterSegment,
10399
eventSegment,
104-
e as Error
100+
e as Error,
105101
);
106102
}
107103
return false; // No match for this segment

core/event/parsing/ledger-close-meta.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ import { assert } from "@/common/assert/assert.ts";
1010
import { isDefined } from "@/common/type-guards/is-defined.ts";
1111

1212
export const isLedgerCloseMetaV1 = (
13-
metadataXdr: xdr.LedgerCloseMeta
13+
metadataXdr: xdr.LedgerCloseMeta,
1414
): boolean => {
1515
return metadataXdr.switch() === 1;
1616
};
1717

1818
export const isLedgerCloseMetaV2 = (
19-
metadataXdr: xdr.LedgerCloseMeta
19+
metadataXdr: xdr.LedgerCloseMeta,
2020
): boolean => {
2121
return metadataXdr.switch() === 2;
2222
};
2323

2424
export const parseEventsFromLedgerCloseMeta = async (
2525
metadataXdr: xdr.LedgerCloseMeta,
2626
onEvent: EventHandler,
27-
filters?: EventFilter[]
27+
filters?: EventFilter[],
2828
): Promise<void> => {
2929
assert(
3030
xdr.LedgerCloseMeta.isValid(metadataXdr),
31-
new E.INVALID_LEDGER_CLOSE_META_XDR()
31+
new E.INVALID_LEDGER_CLOSE_META_XDR(),
3232
);
3333

3434
let ledgerCloseMeta:
@@ -46,7 +46,7 @@ export const parseEventsFromLedgerCloseMeta = async (
4646

4747
assert(
4848
isDefined(ledgerCloseMeta),
49-
new E.UNSUPPORTED_LEDGER_CLOSE_META_VERSION(metadataXdr.switch())
49+
new E.UNSUPPORTED_LEDGER_CLOSE_META_VERSION(metadataXdr.switch()),
5050
);
5151

5252
const ledgerSequence = ledgerCloseMeta.ledgerHeader().header().ledgerSeq();
@@ -84,7 +84,7 @@ export const parseEventsFromLedgerCloseMeta = async (
8484
const contractId =
8585
contractIdXdr !== null
8686
? (Address.fromScAddress(
87-
xdr.ScAddress.scAddressTypeContract(contractIdXdr)
87+
xdr.ScAddress.scAddressTypeContract(contractIdXdr),
8888
).toString() as ContractId)
8989
: undefined;
9090

@@ -100,7 +100,7 @@ export const parseEventsFromLedgerCloseMeta = async (
100100
ledgerSequence,
101101
transactionIndex,
102102
operationIndex,
103-
eventIndex
103+
eventIndex,
104104
);
105105

106106
await onEvent(
@@ -116,7 +116,7 @@ export const parseEventsFromLedgerCloseMeta = async (
116116
topic: topic,
117117
value: value,
118118
inSuccessfulContractCall: inSuccessfulContractCall,
119-
})
119+
}),
120120
);
121121
}
122122
}
@@ -135,7 +135,7 @@ export const isIncludedInFilters = ({
135135
type?: EventType;
136136
topics?: xdr.ScVal[];
137137
}): boolean => {
138-
if (filters === undefined || filters.length === 0) return true;
138+
if (!isDefined(filters) || filters.length === 0) return true;
139139

140140
for (const filter of filters) {
141141
if (type !== undefined && !filter.matchesType(type)) continue;

core/ledger-parser/ledger/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import {
2525
* - TransactionMeta: v4 only (archive normalizes all to v4)
2626
*
2727
* Envelope availability:
28-
* - v2: Available from txSet.phases
29-
* - v0/v1: Not available (v4 meta doesn't include envelope)
28+
* - v2: Available from txSet.phases
29+
* - v0/v1: Not available (v4 meta doesn't include envelope)
3030
*
3131
* Uses @memoize() to cache expensive parsing operations.
3232
*
@@ -60,7 +60,7 @@ export class Ledger {
6060
// Validate required fields
6161
if (!entry.sequence || !entry.hash || !entry.ledgerCloseTime) {
6262
throw new INVALID_LEDGER_ENTRY(
63-
JSON.stringify({ sequence: entry.sequence, hash: entry.hash })
63+
JSON.stringify({ sequence: entry.sequence, hash: entry.hash }),
6464
);
6565
}
6666

@@ -91,7 +91,7 @@ export class Ledger {
9191
// RPC returns base64-encoded LedgerHeaderHistoryEntry
9292
const historyEntry = ensureXdrType(
9393
this.headerXdr,
94-
xdr.LedgerHeaderHistoryEntry
94+
xdr.LedgerHeaderHistoryEntry,
9595
);
9696
return historyEntry.header();
9797
} catch (error) {
@@ -198,7 +198,7 @@ export class Ledger {
198198
this,
199199
resultMeta,
200200
envelope,
201-
index
201+
index,
202202
);
203203
} else {
204204
return Transaction.fromMeta(this, resultMeta, index);
@@ -219,7 +219,7 @@ export class Ledger {
219219
this,
220220
resultMeta,
221221
envelope,
222-
index
222+
index,
223223
);
224224
} else {
225225
return Transaction.fromMeta(this, resultMeta, index);
@@ -241,7 +241,7 @@ export class Ledger {
241241
this,
242242
resultMeta,
243243
envelope,
244-
index
244+
index,
245245
);
246246
} else {
247247
// Fallback to fromMeta if envelope not found (shouldn't happen normally)
@@ -264,7 +264,7 @@ export class Ledger {
264264
* - parallelTxsComponent: Soroban transactions (ParallelTxExecutionStage[][])
265265
*/
266266
private extractEnvelopesFromGeneralizedTxSet(
267-
txSet: xdr.GeneralizedTransactionSet
267+
txSet: xdr.GeneralizedTransactionSet,
268268
): xdr.TransactionEnvelope[] {
269269
const txSetV1 = txSet.v1TxSet();
270270
const phases = txSetV1.phases();

0 commit comments

Comments
 (0)