@chromia/ft4
Advanced tools
Changelog
[1.0.0] - 2024-07-04
Amount
's times
and dividedBy
functions now accept Amount
as argument as well.hasCrosschainTransferExpired
to check if a specific pending cross-chain transfer has expired.getEnabledRegistrationStrategies
to Connection
interfacependingTransferStrategies
to check expired or valid transfers only.Filter
type as a generic type to filter in queries.Changelog
[0.8.0] - 2024-05-29
getAssetBySymbol
(replaced with getAssetsBySymbol
).registerCrosschainAsset
to accept asset id instead of asset object.getAssetsBySymbol
to query list of all assets with the same symbol.getAssetDetailsForCrosschainRegistration
, used to fetch asset details when registering a crosschain asset.getTransferStrategyRules
, used to fetch transfer strategy rules configuration.getTransferStrategyRulesGroupedByStrategy
, used to fetch transfer strategy rules configuration grouped by strategies and assets.getEnabledRegistrationStrategies
to Connection
interfaceevmSignatures
, registerAccountMessage
, fetchLoginDetails
.Changelog
[0.7.0] - 2024-04-23
registration.registerAccount
now accepts an IClient instead of a Connection.buildUnsigned
method from TransactionBuilder.registrationStrategy
-object. E.g., registrationStrategy.fee(...)
registerAccount
has been renamed to registerAccountAdmin
crosschainTransfer
methodregisterAccountEvmSignatures
nonce
query function to authDescriptorCounter
and rename all the functions that call the query from getNonce
to getAuthDescriptorCounter
.crosschainTransfer
function returns a TransferRef
, which can be used when resuming, reverting and recalling the transfer.call
and callWithoutNop
in Session
to Web3PromiEvent
AuthenticatedAccount
to Web3PromiEvent
registerAccount
to Web3PromiEvent
Added ttl to crosschainTransfer, which specifies after how much time the transaction should become invalid and must be reverted back to the starting chain.
Possibility to revert uncompleted crosschain transfers after deadline has passed.
Possibility to recall unclaimed register account transfers after timeout has passed.
addWithAnchoring
method in TransactionBuilder
to get callback when transaction is anchored in a specific target
chain.
sign
and signAndSend
methods in Session
to add your signature to an existing transaction.
gtv
object that contains functions for converting objects to/from gtv
, e.g., gtv.authDescriptorFromGtv(...)
equals
and compare
methods to Amount
.
Added deleteAllAuthDescriptorsExceptMain
to AuthenticatedAccount
interface.
Added updateMainAuthDescriptor
function to AuthenticateAccount
interface.
Added getMainAuthDescriptor
to Account
interface.
Added getAuthDescriptorById
to Account
interface.
Added enabledRegistrationStrategies
query.
Added signTransactionWithKeyStores
function.
Added functions to query "lock" accounts and asset balances locked in those accounts
getLockAccounts
getLockAccountsWithNonZeroBalances
getLockedAssetBalance
getLockedAssetAggregatedBalance
getLockedAssetBalances
getLockedAssetAggregatedBalances
Changelog
[0.6.0] - 2024-03-22
Rename FlagsType
to AuthFlag
, and changed it from an enum to an object to allow adding custom flags.
Method buildAndSend
in TransactionBuilder no longer supports OnAnchoredHandler:s, use new method
buildAndSendWithAnchoring
instead.
Removed LoginManager
type and the getLoginManager
method in KeyStoreInteractor
,
added login
method to KeyStoreInteractor
instead.
Removed the Orchestrator from the public API, use new crosschainTransfer
and resumeCrosschainTransfer
methods in AuthenticatedAccount
instead.
Instead of making cross-chain transfer with Orchestrator:
val orchestrator = await createOrchestrator(targetBlockchainRid, recipientId, assetId, amount, senderSession);
orchestrator.onTransferInit(() => { ... });
orchestrator.onTransferHop((brid) => { ... });
orchestrator.onTransferComplete(() => { ... });
orchestrator.onTransferError((error) => { ... });
await orchestrator.transfer();
now it has to be done like this:
await senderSession.account.crosschainTransfer(targetBlockchainRid, recipientId, assetId, amount)
.on("signed", () => { ... })
.on("init", (receipt: TransactionReceipt) => { ... })
.on("hop", (blockchainRid: Buffer) => { ... });
Interrupted cross-chain transfers can be resumed like this:
await senderSession.account.resumeCrosschainTransfer(pendingTransfer)
.on("hop", (blockchainRid: Buffer) => { ... })
Since logout
method was removed from LoginManager
in previous release, there is no longer need for LoginManager
type. Login (adding disposable auth descriptors) can be performed by calling login
on KeyStoreInteractor
. So instead of
const { session } = await keyStoreInteractor.getLoginManager().login({ accountId });
now we login like this:
const { session } = await keyStoreInteractor.login({ accountId });
buildAndSend
and buildAndSendWithAnchoring
in TransactionBuilder return Web3PromiEvent
and emits
events when transaction is built, sent and confirmed (only buildAndSendWithAnchoring
).logout
function returned from KeyStoreInteractor.login()
and registerAccount()
will delete auth descriptors
for disposable key.SigningError
if signing fails for some reason (e.g. is rejected by user).crosschainTransfer
method will throw SigningError
if signing fails for some reason (e.g. is rejected by user).New method buildAndSendWithAnchoring
in TransactionBuilder which will wait for anchoring in cluster and system
anchoring chains before resolving promise.
New event signed
in crosschainTransfer
method which is emitted when the initTransfer
transaction is signed.
getAssetsByType
query function
Include isCrosschain
flag in response from queries getTransferHistory
, getTransferHistoryFromHeight
and getTransferHistoryEntry
.
Include blockchainRid
in response from queries getTransferDetails
and getTransferDetailsByAsset
.
Include auth descriptor config (maxRules
and maxNumberPerAccount
) in Config
.
Added loadOperationFromTransaction
that receives RawGtx
or SignedTransaction
(encoded tx) and returns Operation
at provided index
Added getLastPendingCrosschainTransaction
to Account
interface
Changelog
[0.5.0] - 2024-02-29
postchain-client
version to 1.15.0logout
function from LoginManager
to object returned from LoginManager.login()
and registerAccount()
.loginKeyStore
parameter from KeyStoreInteractor.getLoginManager()
to LoginManager.login(LoginOptions)
.account registration strategies
functions to directly create account with fee and subscription strategies
Changelog
[0.4.0] - 2024-02-15
authenticator.getKeyHandlerForOperation
will not return auth descriptors whose rules don't allow them to be used.AuthDataService.getAllowedAuthDescriptors
now accepts Buffer | string
instead of Buffer
onlyaccount_id
in response.AuthDescriptorValidator
with hasExpired
and isActive
methods to check whether the auth descriptor is expired or active. An inactive auth descriptor is one that will be valid in the future, an expired one was valid in the past.
createAuthDescriptorValidator(authDataService, useCache)
to use the above mentioned validator. If it uses cache, it will cache op_count
of each auth descriptor and block_height
as soon as it needs to query them.
Do not allow TransactionBuilder.build() or TransactionBuilder.buildUnsigned() if there are OnAnchoredHandlers
Default value for paginated queries has been changed from the previous 100, to instead use the value configured as default in the dApp on rell side
Upgrade postchain-client to 1.9.0
Added support for rules or TTL in login manager.
account registration with following strategies
Removed pagination from auth descriptor queries
Change assetData
to asset
in TransferHistoryEntry
.
Update addAuthDescriptor
signature
Old:
addAuthDescriptor(authDescriptor: AnyAuthDescriptorRegistration, newSigner: SignatureProvider | KeyPair)
New:
addAuthDescriptor(authDescriptor: AnyAuthDescriptorRegistration, keyStore: FtKeyStore)
interface LoginKeyStore {
clear(accountId: Buffer);
getKeyPair(accountId: Buffer): Promise<KeyPair | null>;
createKeyPair(accountId: Buffer): Promise<KeyPair>;
}
New:
interface LoginKeyStore {
clear(accountId: Buffer): Promise<void>;
getKeyStore(accountId: Buffer): Promise<FtKeyStore | null>;
generateKey(accountId: Buffer): Promise<FtKeyStore>;
}