Socket
Book a DemoInstallSign in
Socket

postchain-client

Package Overview
Dependencies
Maintainers
8
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postchain-client - npm Package Versions

2345
8

2.0.2

Diff
f
franz_chromia
published 2.0.2 •
f
franz_chromia
published 2.0.1 •
f
franz_chromia
published 2.0.0 •

Changelog

Source

[2.0.0]

Fixed

  • Fixed a bug of sendTransaction that did not consider status polling assignements through client.config, but instead, did only considering assignements through config

Added

  • Support for response headers X-Transaction-Timestamp
  • Support for contentType application/octet-stream in GET requests
  • An optional attribute transactionTimestamp to the type ResponseObject that is filled through response headers
  • The client function getWaitingTransactions that fetches a list of waiting transaction RIDs from a specified blockchain
  • The client function getWaitingTransaction that fetches a specific waiting transaction's binary data and the transaction's timestamp from the specified blockchain
  • The client function getRejectedTransactions that fetches a list of rejected transactions with their rejection reasons from a specified blockchain
  • The types WaitingTransaction, RejectedTransaction and RejectedTransactionResponse
  • A new zod validation function isRawGtx that parses an unknown value and returns value is RawGtx
  • The zod validation function validateStatusObject that parses an unknown input and returns StatusObject or an error
  • The value Pending in the enum ResponseStatus, that indicates a TransactionReceipt has been created in its initial state, without receiving any confirmation yet from the Dapp or System clusters.
  • A new zod validation function isRawGtx that parses an unknown value and returns value is RawGtx
  • The type GtvExtra

Changed

  • Renamed StatusObject to TransactionStatusReponse
  • The response type of the function getTransactionStatus from Promise<TransactionReceipt | StatusObject> to Promise<StatusObject>
  • Web3EventMap refactored to generic
  • The custom error UnexpectedStatusError constructor argument error type from any to string | undefined
  • The client query function getBlocks argument callback type changed from TransactionInfo[] to BlockInfo[]
  • The client query function getBlocksInfo argument callback type changed from TransactionInfo[] to BlockInfo[]
  • The type QueryObject has now a default type of RawGtv for TReturn and a phantom _returnType field to preserve the return type at compile time, without runtime impact
  • The argument response of the type QueryCallback changed from TReturn to TReturn | null
  • The function callbackPromiseBuilder to use generics <T, U = T> for stronger type safety and replaced all any type usages with typed parameters
  • The property rspBody of the function handlePostResponsePromisified was changed from any to RawGtv | null | undefined
  • Made handlePostResponse generic by adding <T extends RawGtv> and updated its callback type from ClientCallback<RawGtv> to ClientCallback<T>
  • The function convertToPrintable has now return type of string. In addition, the input argument responseObject type was changed from any to unknown
  • The argument value type of the function checkGtvType from any to unknown
  • The argument value type of the function checkGtxType from any to unknown
  • The argument obj type of the function gtvHash from any to RawGtv
  • The custom error UnexpectedArgumentTypeError constructor argument typedArg type from any to ASNValue
  • The gtvExtra type attribute from any to GtvExtra

Removed

  • The function signRawTransaction
  • Moved the function requestWithFailoverStrategy from ./failoverStrategies to ./requestWithFailoverStrategy
  • The deprecated client function getTransactionRid. The function calculateTransactionRid that can be found in src/utils/calculateTransactionRid should be used instead, to calculate the transaction rid
  • The deprecated client function getBlocksInfo. The client function getBlocks should be used instead
  • The deprecated client function encodeTransaction. The function encodeTransaction that can be found in src/utils/encodeTransaction.ts should be used instead
  • The deprecated client function decodeTransactionToGtx. The function decodeTransactionToGtx that can be found in src/utils/encodeTransaction.ts should be used instead
  • The type Web3EventMap that was used to handle the event types of Web3EventEmitter
f
franz_chromia
published 1.22.0 •

Changelog

Source

[1.22.0]

Added

  • The validation functions isTransactionInfo and isTransactionInfoArray
  • The optional input arguments afterTime and signerPubKey to the client function getTransactionsInfo. These input arguments are used as query parameters for the GET api /transactions/{blockchainRid}/

Fixed

  • Merkle hash calculation corrected for big arrays
  • Changed logging to warn instead of error when the feature endpoint /config/{blockchainRid}/features is not available
f
franz_chromia
published 1.21.1 •

Changelog

Source

[1.21.1]

Breaking

  • The following functions now expect an additional input of merkleHashVersion
    • gtvHash as its second argument
    • newSignatureProvider as its first argument
    • sign as its third argument
    • getDigestToSign as its second argument
    • getSystemAnchoringTransaction as its sixth  argument
    • getBlockchainRidFromIid as its fourth argument
    • chromiaClientProvider as its third argument
    • getDigestToSignFromRawGtxBody as its second argument
    • createClient (gtx client) as its fourth argument
    • calculateBlockRID as its second argument
    • calculateTransactionRid as its second argument

Fixed

  • An issue of the createClient functions sendTransaction and signAndSendUniqueTransaction that did performed a directory chain query to cm_get_blockchain_api_urls and that was causing local integration tests to fail, as well as local development (when running local nodes)

Added

  • The type ClientConfig to have a new parameter merkleHashVersion that can be used to specify the merkle hash version to be used. If not provided, the function will try to get the merkle hash version from the dapp, by using the feature endpoint /config/{blockchainRid}/features.
  • The type NetworkSettings was extended and now contains an optional additional attribute merkleHashVersion
f
franz_chromia
published 1.21.0 •

Changelog

Source

[1.21.0]

Changed

  • Various input types of Buffer or string to BufferId (Buffer | string) for function parameters that expected transaction RIDs or blockchain RIDs. The following functions are affected:
    • getTransaction parameter transactionRid
    • getTransactionStatus parameter transactionRid
    • getTransactionInfo parameter transactionRid
    • getTransactionConfirmationLevel parameter transactionRid
    • getConfirmationProof parameter txRID
    • getClusterAnchoringTransactionConfirmation parameter transactionRid
    • getSystemAnchoringTransactionConfirmation parameter anchoredTxRid
    • getGTXFromBufferOrTransactionOrOperation parameter blockchainRid
    • ConfirmationProofException constructor parameter transactionRid
    • createIccfProofTx parameters txToProveRid, sourceBlockchainRid and targetBlockchainRid
    • getBlockAnchoringTransaction parameter txRid
    • isBlockAnchored parameter txRid
    • getAnchoringClient parameter dappBlockchainRid
    • fetchAndVerifyTransaction parameter txToProveRID
    • composeProofTransactionObject parameter sourceBlockchainRid
  • The client function getClusterAnchoringTransactionConfirmation now takes an additional input argument of anchoringClient
  • The client function getSystemAnchoringTransactionConfirmation now takes two additional input arguments of anchoringClient and systemAnchoringChainRid
  • Changed the response type of the function getSystemAnchoringChain to now return Buffer instead of Buffer | null. The function will instead throw a SystemChainException instead if null is returned from the query, informing the user an invalid client was provided.
  • The client function getClusterAnchoringTransactionConfirmation now takes an additional input argument of anchoringClient
  • The client function getSystemAnchoringTransactionConfirmation now takes two additional input arguments of anchoringClient and systemAnchoringChainRid
  • Changed the response type of the function getSystemAnchoringChain to now return Buffer instead of Buffer | null. The function will instead throw a SystemChainException instead if null is returned from the query, informing the user an invalid client was provided.
  • Updated the types ClientConfig and NetworkSettings to contain separate status polling configurations (interval and count), allowing for different polling setups for dapp, cluster and system requests
  • Updated the polling functions getBlockAnchoringTransaction and awaitGetAnchoringTransactionForBlockRid to receive the correct status polling properties
  • The function checkDigestSignature to expect a Buffer signature instead of Buffer or undefined.

Added

  • The function ensureString that receives a BufferId and returns a hex string in upper case
  • Updated the interface TransactionReceipt to contain the optional parameters clusterAnchoringClientBrid and systemAnchoringClientBrid that are populated once a transaction is anchored in Cluster Anchoring Chain and System Anchoring Chain
  • The utility function getAnchoringClientAndSystemChainRid that returns the type AnchoringClientAndSystemBrid providing it with a dapp client. This utility function should be used to provide the correct inputs for the client functions clusterAnchoringClientBrid and systemAnchoringClientBrid
  • The type AnchoringClientAndSystemBrid that returns an anchoringClient and the systemAnchoringChainBridString
  • The types TransactionsCount and TransactionConfirmationProof
  • Several zod validation functions, to be used for the api responses under the type ResponseObject and property rspBody
  • The function getSystemAnchoringTransaction that returns a system anchored transaction or null if the cluster anchoring transaction is not anchored in the system anchoring chain
  • The client function getAnchoringStatusForBlockRid that returns BlockAnchoringState
  • The type BlockAnchoringState to be used as return type for getAnchoringStatusForBlockRid
  • Created the utility function setStatusPolling that can be used to initialize default status polling properties if not specified
  • The type StatusPolling to be used for the dapp, cluster and system polling config in the types ClientConfig and NetworkSettings
  • Promi event enums TransactionEvent with values ClusterAnchorConfirmed, SystemAnchorConfirmed, DappConfirmed, DappReceived, Signed
  • Promi events are emitted in the order of the transaction lifecycle/confirmation steps

Fixed

  • The client function getClusterAnchoringTransactionConfirmation now takes an additional input argument of anchoringClient
  • The client function getSystemAnchoringTransactionConfirmation now takes two additional input arguments of anchoringClient and systemAnchoringChainRid
  • Changed the response type of the function getSystemAnchoringChain to now return Buffer instead of Buffer | null. The function will instead throw a SystemChainException instead if null is returned from the query, informing the user an invalid client was provided.
  • Changed the generic ResponseObject to a strict type. The property rspBody is of type unknown and it is validated for each different case using zod validation functions for the expected type
  • An issue in the function checkGTXSignatures that will now return false if the gtx.signatures array is empty or not an array

Removed

  • The types GetBlocksResponse and GetBlockResponse
  • The promi event "sent" is no longer emitted
f
franz_chromia
published 1.20.2 •

Changelog

Source

[1.20.2]

Fixed

  • Resolved an issue where retrieving an anchoring transaction and its ICCF proof could result in mismatch if the queries were made against unsynchronized nodes
m
mimmicromsjo
published 1.20.1 •

Changelog

Source

[1.20.1]

Fixed

  • An issue with the escaping of characters in the generated package.json content of the esm build
  • Added @types/bn.js as runtime dependencies to fix the missing decleration one gets after installing postchain-client and trying to transpile from typescript to javascript
m
mimmicromsjo
published 1.20.0 •

Changelog

Source

[1.20.0]

Added

  • The function nullable getTransactionConfirmationLevel in createClient that expects a transactionRid and returns a TransactionReceipt that indicates the last successful confirmation of a transaction, as well as an anchoring transaction if the transaction is added in a block (Cluster Anchoring Confirmation).
  • The function getClusterAnchoringTransactionConfirmation in createClient, that given a transactionRid will return an anchoring transaction
  • Added rollup-plugin-visualizer to the Rollup configuration for bundle analysis.
  • Added tests coverage scripts in package.json
  • Created the client function getSystemAnchoringTransactionConfirmation that returns a system anchored transaction based on the provided anchored transaction rid
  • Added the util function getSystemAnchoringChain that queries the directory client and returns the system anchoring chain rid
  • Extended the logic of the function sendTransaction, signAndSendUniqueTransaction and getTransactionConfirmationLevel to also include system anchoring cluster confirmation
  • Added the type BufferId = string | Buffer that also supports ensureBuffer

Fixed

  • A bug in the function getAnchoringTransactionForBlockRid that was not handling nullable response, given the query get_anchoring_transaction_for_block_rid can return null
  • Moved validation tests from the src/blockchainClient/validation to test/unit/validation
  • Fixed a bug in the function getAnchoringClient that did not set the created client network settings to the one provided as input argument to the function

Changed

  • Extended the createClient functions sendTransaction and signAndSendUniqueTransaction to accept a new input parameter confirmationLevel that will resolve the promise based on the configurable confirmation selection and will emit a “sent” promiEvent with the confirmation status in each confirmation step
  • Extended the parameters of the types ClientConfig and NetworkSettings to contain directoryChainRid
  • Extended the function getBlockAnchoringTransaction to retrieve an anchoring transaction with polling
  • Updated the callback type of getTransactionStatus to RestClientCallback<TransactionReceipt> | RestClientCallback<StatusObject>
  • Updated the callback type of getTransactionConfirmationLevel to RestClientCallback<StatusObject | TransactionReceipt>
  • Updated the callback type of getClusterAnchoringTransactionConfirmation to RestClientCallback<TransactionReceipt>
  • Updated the rest client postTransaction function, to support binary formatted transactions
m
mimmicromsjo
published 1.19.1 •

Changelog

Source

[1.19.1]

Fixed

  • bumped secp256k1 dependency to 4.0.4, to fix vulnerability
2345
8
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.