Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
ed5b3b3
fix(types): update isEd25519PublicKey to use type guard for Ed25519Pu…
fazzatti Sep 4, 2025
0cc479f
fix(types): update isMuxedAddress to use type predicate for MuxedAddress
fazzatti Sep 4, 2025
5f58f12
feat: add isTransaction type guard for Transaction and FeeBumpTransac…
fazzatti Sep 4, 2025
646d34d
feat: implement isFeeBumpTransaction type guard for FeeBumpTransactio…
fazzatti Sep 4, 2025
f2e2717
feat: add verifiers export for transaction validation utilities
fazzatti Sep 4, 2025
d0af743
fix(types): enhance SignatureRequirement to include signer field
fazzatti Sep 4, 2025
addd231
feat(tests): add unit tests for isTransaction and isFeeBumpTransactio…
fazzatti Sep 4, 2025
b36e849
fix(types): update SignatureRequirement type to SignatureRequirementR…
fazzatti Sep 4, 2025
11d6069
feat: implement envelope signing requirements processing and error ha…
fazzatti Sep 4, 2025
d087a9e
fix(tests): update test command to include coverage report generation
fazzatti Sep 4, 2025
8c35e29
feat: add coverage report generation task to deno.json
fazzatti Sep 4, 2025
0e49e54
test: add mock for MuxedAccount to simulate account ID retrieval failure
fazzatti Sep 4, 2025
a1daa0a
test: add unit tests for ColibriError minimal info handling
fazzatti Sep 5, 2025
8c85aa1
fix: update error details message for UNEXPECTED_ERROR and add unit t…
fazzatti Sep 5, 2025
06a7479
test: add unit tests for handling UNEXPECTED_ERROR in BuildTransaction
fazzatti Sep 5, 2025
384581e
test: enhance unit tests for error handling in getRequiredOperationTh…
fazzatti Sep 5, 2025
95ee326
fix: update details message in UNEXPECTED_ERROR for clarity
fazzatti Sep 5, 2025
b0bb7b0
fix: simplify details and diagnostic assignment in ProcessError const…
fazzatti Sep 5, 2025
253f141
fix: update details message in UNEXPECTED_ERROR for clarity and add u…
fazzatti Sep 5, 2025
00829c7
refactor: remove unused imports in index.unit.test.ts
fazzatti Sep 5, 2025
d4d74c9
refactor: remove unused import from index.unit.test.ts
fazzatti Sep 5, 2025
45737e8
feat: add boolean and string helper functions with error handling
fazzatti Sep 6, 2025
2b8aafc
feat: implement SignEnvelope process with error handling and unit tests
fazzatti Oct 1, 2025
2d42eda
docs: add comments to assert function for clarity
fazzatti Oct 2, 2025
ee98414
feat: add assertRequiredArgs function to validate non-null arguments
fazzatti Oct 2, 2025
51d7149
refactor: consolidate baseErrorSource for consistent error reporting …
fazzatti Oct 2, 2025
d1e29a0
feat: implement getAddressTypeFromAuthEntry and getAddressSignerFromA…
fazzatti Oct 2, 2025
a46d6cc
feat: enhance ProcessError with DeferredInputError type and improve d…
fazzatti Oct 2, 2025
104a048
feat: implement SignAuthEntries process and associated error handling
fazzatti Oct 2, 2025
e3fa26b
fix: change xdr import to type import for better type safety
fazzatti Oct 2, 2025
6101339
refactor: reorganize SignAuthEntries test structure for improved read…
fazzatti Oct 2, 2025
2ae7fc6
feat: re-add xdr export to helpers for improved module accessibility
fazzatti Oct 2, 2025
cee7e6c
feat: add ResultOrError class for improved error handling and input m…
fazzatti Oct 3, 2025
d192309
feat: add softTryToXDR and parse functions for improved error handlin…
fazzatti Oct 3, 2025
8b8068e
feat: add transaction helper for calculating transaction timeout
fazzatti Oct 3, 2025
71ec7ad
feat: refactor getValidUntilLedgerSeq to use ResultOrError for improv…
fazzatti Oct 3, 2025
342e9b8
feat: implement SendTransaction process with error handling and trans…
fazzatti Oct 3, 2025
7fb6671
feat: update convee dependency to version 0.7.1 and enhance test task…
fazzatti Oct 7, 2025
43c9db2
feat: add buildToSimulate transformer for transaction simulation
fazzatti Oct 7, 2025
3caa7c4
feat: implement simulateToRetval transformer with error handling for …
fazzatti Oct 7, 2025
b869f7c
feat: add TransactionConfig and BaseFee types for transaction configu…
fazzatti Oct 7, 2025
432b735
feat: implement PipelineError class for structured error handling in …
fazzatti Oct 7, 2025
5112ea0
feat: implement SignEnvelope process with error handling and types
fazzatti Oct 7, 2025
ecf3007
feat: implement ReadFromContract pipeline with error handling and inp…
fazzatti Oct 7, 2025
0dc5025
feat: add unit tests for createReadFromContractPipeline with error ha…
fazzatti Oct 7, 2025
7fcb00a
feat: add integration tests for ReadFromContract pipeline functionality
fazzatti Oct 7, 2025
0d454bc
refactor: update error details and refine CreateReadFromContractPipel…
fazzatti Oct 7, 2025
13583cc
feat: enhance AssembleTransaction with new error handling and input t…
fazzatti Oct 8, 2025
d242872
feat: implement isSmartContractTransaction verifier for smart contrac…
fazzatti Oct 8, 2025
7b9219f
feat: add operations retrieval functions for Transaction handling
fazzatti Oct 8, 2025
dce17ca
feat: enhance parseErrorResult to handle unexpected TransactionResult…
fazzatti Oct 8, 2025
d6fa45c
feat: add disableSanitizeConfig for testing and update deno.json for …
fazzatti Oct 8, 2025
1da3ada
feat: implement error handling for Friendbot operations with custom e…
fazzatti Oct 8, 2025
2d59ebf
fix: correct argument check in assertRequiredArgs and update Transact…
fazzatti Oct 8, 2025
382b1f2
feat: add "tools" to ErrorDomain type for enhanced error categorization
fazzatti Oct 8, 2025
5a80528
feat: update TestNet function to return TestNetConfig type for improv…
fazzatti Oct 8, 2025
dcb5e9d
feat: add MISSING_ARG error class and enhance AssembleTransaction wit…
fazzatti Oct 8, 2025
a82916e
feat: update SignEnvelope to use TransactionSigner and improve error …
fazzatti Oct 8, 2025
e3c6990
fix: rename getPublicKey to publicKey in MockSigner for consistency
fazzatti Oct 8, 2025
e0500cd
refactor: rename tx to transaction in SendTransactionInput for clarity
fazzatti Oct 8, 2025
58b369a
feat: add assembleToEnvelopeSigningRequirements transformer for trans…
fazzatti Oct 8, 2025
776f7b2
fix: add disableSanitizeConfig to ReadFromContract Pipeline tests and…
fazzatti Oct 8, 2025
6ff3d11
feat: implement InvokeContract pipeline with error handling and trans…
fazzatti Oct 8, 2025
454bd1f
fix: remove unused import assertRejects from ReadFromContract pipelin…
fazzatti Oct 8, 2025
f47d098
feat: add unit tests for createInvokeContractPipeline with error hand…
fazzatti Oct 8, 2025
d0e66b1
fix: remove inclusionFee conditional to zero when parsing transaction…
fazzatti Oct 8, 2025
4a23a31
feat: add assembleToEnvelopeSigningRequirements and buildToEnvelopeSi…
fazzatti Oct 9, 2025
62f139d
fix: add missing file extension for assembleToEnvelopeSigningRequirem…
fazzatti Oct 9, 2025
18fbd32
feat: implement ClassicTransaction pipeline with error handling and c…
fazzatti Oct 9, 2025
50fe0f7
fix: update import paths for disableSanitizeConfig in test files
fazzatti Oct 9, 2025
436543f
feat: refactor StrKey handling with new regex and type guards
fazzatti Oct 11, 2025
a0f2ef2
feat: update import paths and refactor types for signer and transacti…
fazzatti Oct 11, 2025
14462e8
feat: implement NativeAccount error handling and types for account op…
fazzatti Oct 11, 2025
2874001
feat: enhance StrKey validation tests for PreAuthTx and Sha256Hash pr…
fazzatti Oct 11, 2025
b74c72c
feat: implement unit tests for LocalSigner functionality and security
fazzatti Oct 11, 2025
1439ce8
feat: refactor error handling in NativeAccount and add unit tests for…
fazzatti Oct 11, 2025
ef9c72b
feat: reorganize type exports and update imports for consistency acro…
fazzatti Oct 11, 2025
d0b0b9e
feat: update version to 0.1.0 and enhance README with simple architec…
fazzatti Oct 11, 2025
2494b4b
feat: simplify nonBlankString function by removing unused parameter
fazzatti Oct 11, 2025
767a1f2
refactor: update imports to use type keyword for consistency across m…
fazzatti Oct 11, 2025
c618c3d
refactor: remove unused Keypair import from sign-envelope process
fazzatti Oct 11, 2025
108262b
feat: add delay before retrying transaction retrieval in getTransacti…
fazzatti Oct 11, 2025
43fb3b8
fix: update test command in Deno workflow to run all tests
fazzatti Oct 11, 2025
e924062
Test/increase coverage (#9)
fazzatti Oct 12, 2025
dc17422
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 12, 2025
2c9a1e1
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 12, 2025
52a17a4
feat: Add WrapFeeBump process with error handling and unit tests (#12)
fazzatti Oct 14, 2025
e1a655d
chore: Update core version to 0.2.0 in deno.json
fazzatti Oct 14, 2025
d0577b4
chore: Update fee bump plugin's core dependency version to 0.2.0 in d…
fazzatti Oct 14, 2025
0dfcf4e
Update plugins/fee-bump/README.md
fazzatti Oct 14, 2025
778f3a0
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 14, 2025
48fb212
feat: Add Contract class (#14)
fazzatti Oct 15, 2025
3042325
fix: Update error domain from "plugins" to "contract" in ContractErro…
fazzatti Oct 15, 2025
0b6ef7d
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 15, 2025
6bf9326
feat(test): add fungible token contract with initial implementation
fazzatti Oct 15, 2025
68ebd65
feat(test): add VOID type to TYPES_HARNESS_METHOD enum
fazzatti Oct 15, 2025
d10da4d
refactor: comment out unused UNEXPECTED_ERROR class and update method…
fazzatti Oct 15, 2025
be3febc
chore: add test_snapshots directory to .gitignore
fazzatti Oct 15, 2025
fab206c
chore: update version to 0.3.1 in deno.json
fazzatti Oct 15, 2025
cae798f
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 15, 2025
e5f4766
Feat/auth entry parser (#17)
fazzatti Oct 15, 2025
95d9bc6
fix: correct signature handling in paramsToAuthEntry function
fazzatti Oct 15, 2025
10e1045
fix: import SIM_ERRORS for error handling in simulate-transaction tests
fazzatti Oct 16, 2025
226f18a
feat: enhance network configuration types and add type guard helpers
fazzatti Oct 16, 2025
59b881b
feat: refactor network passphrase handling to use enum for consistency
fazzatti Oct 16, 2025
faaf2f1
feat: reorganize exports in mod.ts and add tools module for better st…
fazzatti Oct 16, 2025
5e6483a
chore: update version to 0.4.1 in deno.json
fazzatti Oct 16, 2025
9873846
Merge branch 'main' into dev
fazzatti Oct 16, 2025
13ad5c5
refactor: remove unused import of SIM_ERRORS in unit tests
fazzatti Oct 16, 2025
8416b55
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 16, 2025
a941029
refactor: update TransactionSigner interface and related implementations
fazzatti Oct 20, 2025
5614054
feat: add isTransactionSigner verifier function
fazzatti Oct 20, 2025
d025eba
chore: update version to 0.5.0 in deno.json
fazzatti Oct 20, 2025
8f420eb
chore: update @colibri/core import version to ^0.5.0 in deno.json
fazzatti Oct 20, 2025
d5678d9
refactor: change Buffer import to type import in index.unit.test.ts
fazzatti Oct 20, 2025
a3997ce
fix: add auth parameter to invoke method for authorization support
fazzatti Oct 20, 2025
1e8d99b
chore: update version to 0.5.1 in deno.json
fazzatti Oct 20, 2025
f65c478
Merge branch 'main' into dev
fazzatti Oct 20, 2025
a12253a
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 20, 2025
a0670df
feat: add invokeRaw method for contract invocation with optional auth
fazzatti Oct 20, 2025
0a31abf
chore: update version to 0.5.2 in deno.json
fazzatti Oct 20, 2025
9d66edb
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 20, 2025
aaa92cf
fix: authorization entry processing by separating signed and unsigned…
fazzatti Oct 20, 2025
b930f13
chore: update version to 0.5.3 in deno.json
fazzatti Oct 20, 2025
12c5939
refactor: simplify error handling in contract deployment and pipeline…
fazzatti Oct 20, 2025
99d6615
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 22, 2025
3852598
feat: add verifySignature method to LocalSigner and TransactionSigner…
fazzatti Oct 22, 2025
13dce30
chore: update version to 0.6.0 in deno.json
fazzatti Oct 22, 2025
a9ad0e1
refactor: separate LocalSigner type and implement verifySignature method
fazzatti Oct 22, 2025
1276b82
Merge remote-tracking branch 'origin/main' into dev
fazzatti Oct 22, 2025
19728a4
feat: enhance network configuration types and add type guard for Netw…
fazzatti Nov 20, 2025
a766f6c
refactor: update import paths to use alias for improved readability
fazzatti Nov 20, 2025
5ad9058
refactor: update import paths to use alias for consistency
fazzatti Nov 20, 2025
a37e8f8
refactor: update import paths to use absolute paths for consistency a…
fazzatti Nov 20, 2025
6ffc4e3
refactor: update import paths to use alias for consistency and improv…
fazzatti Nov 20, 2025
f466c6c
refactor: update import paths to use absolute paths for consistency a…
fazzatti Nov 20, 2025
ca13b70
refactor: update import paths to use aliases for consistency and impr…
fazzatti Nov 20, 2025
dca5171
refactor: update import paths to use absolute paths for consistency a…
fazzatti Nov 20, 2025
1a385d4
refactor: update import paths to use absolute paths for consistency a…
fazzatti Nov 20, 2025
b945987
refactor: update import paths to use aliases for consistency and impr…
fazzatti Nov 20, 2025
c787aa3
refactor: update import paths to use absolute paths for consistency a…
fazzatti Nov 20, 2025
046b2bf
refactor: update import paths to use aliases for consistency and impr…
fazzatti Nov 20, 2025
f52463e
chore: update version to 0.7.0 in deno.json
fazzatti Nov 20, 2025
dff3038
chore: update version to 0.2.0 and core dependency to ^0.7.0 in deno.…
fazzatti Nov 20, 2025
8ccd799
chore: update version of convee to ^0.9.2 in deno.json
fazzatti Nov 20, 2025
16e4985
fix: convee plugin create payload
fazzatti Nov 20, 2025
da0685c
fix: update import paths for error handling consistency
fazzatti Nov 20, 2025
c76a039
fix: correct import path for error handling
fazzatti Nov 20, 2025
32964ee
feat: enhance README with detailed project overview and add logo
fazzatti Nov 20, 2025
732f244
Merge branch 'main' into dev
fazzatti Nov 20, 2025
5bf2feb
fix: update README to reflect current beta status instead of stable r…
fazzatti Nov 20, 2025
b0981d7
feat: Implement NetworkConfig class (#27)
fazzatti Nov 22, 2025
3e5ef38
Merge branch 'main' into dev
fazzatti Nov 22, 2025
14647c7
feat: event streamer (#29)
fazzatti Nov 26, 2025
078514b
Merge branch 'main' into dev
fazzatti Nov 26, 2025
a1974bf
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 26, 2025
47d3579
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 26, 2025
6570f59
feat: Implement Events, Standards and more (#32)
fazzatti Nov 27, 2025
de3783a
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 27, 2025
bb08367
feat: topic filter conversion (#34)
fazzatti Nov 27, 2025
b320d75
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 27, 2025
dcce4d3
Fix: toTopicFilter args type (#36)
fazzatti Nov 27, 2025
516a9f7
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 27, 2025
ea66cb8
fix: support for muxed transfer events in SAC/SEP41 Mint and Transfe…
fazzatti Nov 27, 2025
68a9822
fix: update version to 0.10.3 in deno.json
fazzatti Nov 27, 2025
8afbee2
fix: mark core releases as latest in GitHub release workflow
fazzatti Nov 27, 2025
5b65b26
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 27, 2025
60d9e88
docs: add documentation links to README files for better accessibility
fazzatti Nov 28, 2025
0199000
docs: add examples links to README files for better guidance
fazzatti Nov 28, 2025
5a6f277
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 28, 2025
60dc1de
docs: remove outdated processes documentation
fazzatti Nov 28, 2025
416e98f
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 28, 2025
2cc2ffb
Feat/add sac asset (#41)
fazzatti Nov 30, 2025
112fa68
refactor: remove unused static create method from Contract class
fazzatti Nov 30, 2025
ebf701d
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 30, 2025
eae3b9f
fix: export SAC asset modules and error types
fazzatti Nov 30, 2025
1bfd42e
chore: update version to 0.11.1 in deno.json
fazzatti Nov 30, 2025
ba15fd6
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 30, 2025
76884f4
fix: enhance StellarAssetContract to support missing native XLM and a…
fazzatti Nov 30, 2025
256302e
chore: update version to 0.11.2 in deno.json
fazzatti Nov 30, 2025
e98ed25
docs: update core/asset/sac/index.ts tsdocs
fazzatti Nov 30, 2025
25487b5
Merge remote-tracking branch 'origin/main' into dev
fazzatti Nov 30, 2025
caddb72
feat: add calculateContractId function to derive contract ID from add…
fazzatti Dec 5, 2025
45f4a1d
Merge remote-tracking branch 'origin/main' into dev
fazzatti Dec 5, 2025
0777adb
feat: rework signer and enable indirect signing (#47)
fazzatti Dec 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/account/native/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Account, type Asset, Keypair, MuxedAccount, xdr } from "stellar-sdk";
import { assert } from "@/common/assert/assert.ts";
import { StrKey } from "@/strkeys/index.ts";
import { isMuxedId } from "@/common/verifiers/is-muxed-id.ts";
import { isMuxedId } from "@/common/type-guards/is-muxed-id.ts";
import type { Ed25519PublicKey, MuxedAddress } from "@/strkeys/types.ts";
import type { TransactionSigner } from "@/signer/types.ts";
import type { Signer } from "@/signer/types.ts";
import * as E from "@/account/native/error.ts";
import type {
WithSigner,
Expand All @@ -14,7 +14,7 @@ import type {

export class NativeAccount implements NativeAccountType {
protected _address: Ed25519PublicKey;
protected _masterSigner?: TransactionSigner;
protected _masterSigner?: Signer;

private constructor(address: Ed25519PublicKey) {
assert(
Expand Down Expand Up @@ -77,18 +77,18 @@ export class NativeAccount implements NativeAccountType {
// WithSigner methods
// ----------------

static fromMasterSigner(signer: TransactionSigner) {
static fromMasterSigner(signer: Signer) {
return NativeAccount.fromAddress(signer.publicKey()).withMasterSigner(
signer
);
}

withMasterSigner(signer: TransactionSigner): WithSigner<this> {
withMasterSigner(signer: Signer): WithSigner<this> {
this._masterSigner = signer;
return this as WithSigner<this>;
}

signer(): TransactionSigner {
signer(): Signer {
assert(this._masterSigner, new E.MISSING_MASTER_SIGNER(this._address));
return this._masterSigner;
}
Expand Down
6 changes: 3 additions & 3 deletions core/account/native/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Asset, xdr } from "stellar-sdk";
import type { Ed25519PublicKey, MuxedAddress } from "@/strkeys/types.ts";
import type { MultiSigSchema, TransactionSigner } from "@/signer/types.ts";
import type { MultiSigSchema, Signer } from "@/signer/types.ts";

export type MuxedId = `${number}`;

Expand All @@ -12,11 +12,11 @@ export type NativeAccountType = {
};

export type WithoutSigner<AccountType> = AccountType & {
withMasterSigner(signer: TransactionSigner): WithSigner<NativeAccountType>;
withMasterSigner(signer: Signer): WithSigner<NativeAccountType>;
};

export type WithSigner<AccountType> = AccountType & {
signer(): TransactionSigner;
signer(): Signer;
};

export type WithMultiSig<AccountType> = AccountType & {
Expand Down
4 changes: 2 additions & 2 deletions core/asset/sac/index.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { Server } from "stellar-sdk/rpc";
import { toStellarAssetCanonicalString } from "@/asset/sep11/index.ts";
import { PIPE_ClassicTransaction } from "@/pipelines/classic-transaction/index.ts";
import type { TransactionSigner } from "@/signer/types.ts";
import type { Signer } from "@/signer/types.ts";
import type { Ed25519PublicKey } from "@/strkeys/types.ts";
import * as SACError from "@/asset/sac/error.ts";

Expand All @@ -40,7 +40,7 @@ describe("[Testnet] Stellar Asset Contract", disableSanitizeConfig, () => {
};

const addTrustline = async (
users: TransactionSigner[],
users: Signer[],
asset: Asset,
networkConfig: NetworkConfig,
config: TransactionConfig
Expand Down
2 changes: 1 addition & 1 deletion core/asset/sac/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
type BaseInvocation,
type ContractInput,
} from "@/asset/sac/types.ts";
import { isDefined } from "@/common/verifiers/is-defined.ts";
import { isDefined } from "@/common/type-guards/is-defined.ts";

/**
* Client class for interacting with Stellar Asset Contracts (SAC).
Expand Down
2 changes: 1 addition & 1 deletion core/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { regex } from "@/common/regex/index.ts";
export * from "@/common/assert/index.ts";
export * from "@/common/verifiers/index.ts";
export * from "@/common/type-guards/index.ts";
export * from "@/common/helpers/index.ts";
export * from "@/common/scval/index.ts";
export type * from "@/common/types/index.ts";
10 changes: 10 additions & 0 deletions core/common/type-guards/has-function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const hasFunction = <T>(
obj: NonNullable<T>,
key: PropertyKey
): key is keyof T & string => {
return (
typeof obj === "object" &&
key in obj &&
typeof (obj as Record<PropertyKey, unknown>)[key] === "function"
);
};
7 changes: 7 additions & 0 deletions core/common/type-guards/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from "@/common/type-guards/is-defined.ts";
export * from "@/common/type-guards/is-fee-bump-transaction.ts";
export * from "@/common/type-guards/is-muxed-id.ts";
export * from "@/common/type-guards/is-signing-threshold.ts";
export * from "@/common/type-guards/is-smart-contract-transaction.ts";
export * from "@/common/type-guards/is-transaction.ts";
export * from "./is-signer.ts";
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
} from "stellar-sdk";
import { NetworkConfig } from "@/network/index.ts";
import { StrKey } from "@/strkeys/index.ts";
import { isTransaction } from "@/common/verifiers/is-transaction.ts";
import { isFeeBumpTransaction } from "@/common/verifiers/is-fee-bump-transaction.ts";
import { isSigningThreshold } from "@/common/verifiers/is-signing-threshold.ts";
import { isSmartContractTransaction } from "@/common/verifiers/is-smart-contract-transaction.ts";
import { isTransaction } from "@/common/type-guards/is-transaction.ts";
import { isFeeBumpTransaction } from "@/common/type-guards/is-fee-bump-transaction.ts";
import { isSigningThreshold } from "@/common/type-guards/is-signing-threshold.ts";
import { isSmartContractTransaction } from "@/common/type-guards/is-smart-contract-transaction.ts";

describe("Verifiers", () => {
describe("isEd25519PublicKey", () => {
Expand Down
3 changes: 3 additions & 0 deletions core/common/type-guards/is-defined.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const isDefined = <T>(value: T): value is NonNullable<T> => {
return value !== undefined && value !== null;
};
14 changes: 14 additions & 0 deletions core/common/type-guards/is-signer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Signer } from "@/signer/types.ts";
import { isDefined } from "@/common/index.ts";
import { hasFunction } from "@/common/type-guards/has-function.ts";

export const isSigner = (signer: unknown): signer is Signer => {
return (
isDefined(signer) &&
hasFunction(signer, "publicKey") &&
hasFunction(signer, "sign") &&
hasFunction(signer, "signTransaction") &&
hasFunction(signer, "signSorobanAuthEntry") &&
hasFunction(signer, "signsFor")
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FeeBumpTransaction, Transaction } from "stellar-sdk";
import { getOperationsFromTransaction } from "@/common/helpers/transaction.ts";
import { isTransaction } from "@/common/verifiers/is-transaction.ts";
import { isFeeBumpTransaction } from "@/common/verifiers/is-fee-bump-transaction.ts";
import { isTransaction } from "@/common/type-guards/is-transaction.ts";
import { isFeeBumpTransaction } from "@/common/type-guards/is-fee-bump-transaction.ts";

export const SMART_CONTRACT_OPERATIONS = [
"invokeHostFunction",
Expand Down
4 changes: 2 additions & 2 deletions core/common/types/transaction-config/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TransactionSigner } from "@/signer/types.ts";
import type { Signer } from "@/signer/types.ts";
import type {
ContractId,
Ed25519PublicKey,
Expand All @@ -9,7 +9,7 @@ export type TransactionConfig = {
fee: BaseFee;
source: Ed25519PublicKey;
timeout: number;
signers: TransactionSigner[];
signers: Signer[];
};

export type BaseFee = `${number}`;
Expand Down
7 changes: 0 additions & 7 deletions core/common/verifiers/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions core/common/verifiers/is-defined.ts

This file was deleted.

20 changes: 0 additions & 20 deletions core/common/verifiers/is-transaction-signer.ts

This file was deleted.

2 changes: 1 addition & 1 deletion core/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@colibri/core",
"version": "0.12.0",
"version": "0.13.0",
"license": "MIT",
"exports": {
".": "./mod.ts"
Expand Down
16 changes: 8 additions & 8 deletions core/error/index.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe("ColibriError", () => {
};
const meta: BaseMeta = { data: { accountId: "GABC" } };
const shape: ColibriErrorShape<"ACC_001", BaseMeta> = {
domain: "accounts",
source: "@colibri/accounts",
domain: "account",
source: "@colibri/account",
code: "ACC_001",
message: "Invalid account key",
details: "malformed key",
Expand All @@ -31,8 +31,8 @@ describe("ColibriError", () => {
assert(e instanceof Error);
assert(e instanceof ColibriError);
assertStrictEquals(e.name, "ColibriError ACC_001");
assertStrictEquals(e.domain, "accounts");
assertStrictEquals(e.source, "@colibri/accounts");
assertStrictEquals(e.domain, "account");
assertStrictEquals(e.source, "@colibri/account");
assertStrictEquals(e.code, "ACC_001");
assertStrictEquals(e.message, "Invalid account key");
assertStrictEquals(e.details, "malformed key");
Expand Down Expand Up @@ -145,14 +145,14 @@ describe("ColibriError", () => {
it("wraps native Error and keeps stack in details and cause in meta", () => {
const native = new Error("boom");
const wrapped = ColibriError.fromUnknown(native, {
domain: "accounts",
source: "@colibri/accounts",
domain: "account",
source: "@colibri/account",
code: "ACC_999",
});

assert(wrapped instanceof ColibriError);
assertEquals(wrapped.domain, "accounts");
assertEquals(wrapped.source, "@colibri/accounts");
assertEquals(wrapped.domain, "account");
assertEquals(wrapped.source, "@colibri/account");
assertEquals(wrapped.code, "ACC_999");
assertEquals(wrapped.message, "boom");
assert(typeof wrapped.details === "string"); // stack string
Expand Down
2 changes: 1 addition & 1 deletion core/error/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type ErrorDomain =
| "verifiers"
| "helpers"
| "core"
| "accounts"
| "signer"
| "pipelines"
| "plugins"
| "rpc"
Expand Down
2 changes: 1 addition & 1 deletion core/event/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ScValParsed } from "@/common/scval/types.ts";
import { isEventId, type EventId } from "@/event/event-id/index.ts";
import { EventType, type IEvent } from "@/event/types.ts";
import type { ContractId } from "@/strkeys/types.ts";
import { isDefined } from "@/common/verifiers/is-defined.ts";
import { isDefined } from "@/common/type-guards/is-defined.ts";
import { StrKey } from "@/strkeys/index.ts";

export class Event implements IEvent {
Expand Down
2 changes: 1 addition & 1 deletion core/event/parsing/ledger-close-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { EventFilter } from "@/event/event-filter/index.ts";
import type { EventHandler } from "@/event/types.ts";
import * as E from "@/event/parsing/error.ts";
import { assert } from "@/common/assert/assert.ts";
import { isDefined } from "@/common/verifiers/is-defined.ts";
import { isDefined } from "@/common/type-guards/is-defined.ts";

export const isLedgerCloseMetaV1 = (
metadataXdr: xdr.LedgerCloseMeta
Expand Down
2 changes: 1 addition & 1 deletion core/network/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
FutureNetCustomConfig,
TestNetNetCustomConfig,
} from "@/network/types.ts";
import { isDefined } from "@/common/verifiers/is-defined.ts";
import { isDefined } from "@/common/type-guards/is-defined.ts";

export * as NetworkProviders from "@/network/providers/index.ts";

Expand Down
2 changes: 1 addition & 1 deletion core/processes/assemble-transaction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
import * as E from "@/processes/assemble-transaction/error.ts";

import { assert } from "@/common/assert/assert.ts";
import { isSmartContractTransaction } from "@/common/verifiers/is-smart-contract-transaction.ts";
import { isSmartContractTransaction } from "@/common/type-guards/is-smart-contract-transaction.ts";
import {
getOperationsFromTransaction,
getOperationType,
Expand Down
4 changes: 2 additions & 2 deletions core/processes/envelope-signing-requirements/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
EnvelopeSigningRequirementsOutput,
} from "@/processes/envelope-signing-requirements/types.ts";
import * as E from "@/processes/envelope-signing-requirements/error.ts";
import { isFeeBumpTransaction } from "@/common/verifiers/is-fee-bump-transaction.ts";
import { isTransaction } from "@/common/verifiers/is-transaction.ts";
import { isFeeBumpTransaction } from "@/common/type-guards/is-fee-bump-transaction.ts";
import { isTransaction } from "@/common/type-guards/is-transaction.ts";
import { muxedAddressToBaseAccount } from "@/transformers/address/index.ts";
import { ColibriError } from "@/error/index.ts";
import { getRequiredOperationThresholdForClassicOperation } from "@/transformers/auth/index.ts";
Expand Down
17 changes: 8 additions & 9 deletions core/processes/sign-auth-entries/error.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { P_SignAuthEntries } from "@/processes/sign-auth-entries/index.ts";
import * as E from "@/processes/sign-auth-entries/error.ts";
import type { SignAuthEntriesInput } from "@/processes/sign-auth-entries/types.ts";
import { NetworkConfig } from "@/network/index.ts";
import type { TransactionSigner } from "@/signer/types.ts";
import type { Signer } from "@/signer/types.ts";
import type { Ed25519PublicKey } from "@/strkeys/types.ts";

describe("SignAuthEntries", () => {
const { networkPassphrase } = NetworkConfig.TestNet();

type MockSigner = TransactionSigner & {
type MockSigner = Signer & {
calls: number;
lastEntry?: xdr.SorobanAuthorizationEntry;
lastValidUntil?: number;
Expand Down Expand Up @@ -53,16 +53,14 @@ describe("SignAuthEntries", () => {
passphrase: string
) => Promise<xdr.SorobanAuthorizationEntry>
): MockSigner => {
const signTransaction: TransactionSigner["signTransaction"] = async (
..._args: Parameters<TransactionSigner["signTransaction"]>
const signTransaction: Signer["signTransaction"] = async (
..._args: Parameters<Signer["signTransaction"]>
) => {
return await Promise.resolve(
undefined as unknown as Awaited<
ReturnType<TransactionSigner["signTransaction"]>
>
undefined as unknown as Awaited<ReturnType<Signer["signTransaction"]>>
);
};
const sign: TransactionSigner["sign"] = (b: Buffer): Buffer => {
const sign: Signer["sign"] = (b: Buffer): Buffer => {
return b;
};

Expand All @@ -71,6 +69,7 @@ describe("SignAuthEntries", () => {
publicKey: () => publicKey as Ed25519PublicKey,
sign,
signTransaction,
signsFor: (target: Ed25519PublicKey | string) => target === publicKey,
async signSorobanAuthEntry(entry, validUntil, passphrase) {
signer.calls++;
signer.lastEntry = entry;
Expand Down Expand Up @@ -138,7 +137,7 @@ describe("SignAuthEntries", () => {
() =>
P_SignAuthEntries().run({
auth: [entry],
signers: undefined as unknown as TransactionSigner[],
signers: undefined as unknown as Signer[],
rpc: makeRpc(),
networkPassphrase,
}),
Expand Down
5 changes: 1 addition & 4 deletions core/processes/sign-auth-entries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
getAddressTypeFromAuthEntry,
} from "@/common/helpers/xdr/general.ts";
import { ResultOrError } from "@/common/deferred/result-or-error.ts";
import type { TransactionSigner } from "@/signer/types.ts";

const signAuthEntriesProcess = async (
input: SignAuthEntriesInput
Expand Down Expand Up @@ -70,9 +69,7 @@ const signAuthEntriesProcess = async (
if (addressType === "scAddressTypeAccount") {
const requiredSigner = getAddressSignerFromAuthEntry(authEntry);

const signer = signers.find(
(s) => s.publicKey() === requiredSigner
) as TransactionSigner;
const signer = signers.find((s) => s.signsFor(requiredSigner));

assert(signer, new E.MISSING_SIGNER(input, requiredSigner, authEntry));

Expand Down
Loading