Skip to main content
Available from @trusset/sdk 0.8.0.
This page is for two parties: the deployer that names the asset register of a collateral token, and the register provider that takes the market into its own instance. After reading it each of them can run its side from TypeScript. The asset register is not one of the ten roles of a lending market. It is a record Trusset keeps beside the market: which register provider the deployer named for the collateral token. trusset.assetRegisters reads and writes that record. Nothing is signed and nothing goes on chain, so none of these methods takes a signer. The register entry itself stays the register provider’s act in its own register, and no SDK method writes one.

Name the register

The deployer is the instance that imported the token and deployed the market. Only its key can name or clear the register, and the instance needs a verified wallet that deployed the market or was named its issuer at deployment.
directory lists the register providers that published a profile on the network and environment of the instance. registerKind is ON_CHAIN or OFF_CHAIN, as the provider declared it for its own register. The assignment is stored per collateral token. It covers every market the instance deployed on that token, also markets deployed later. assign with another register replaces it, and clear removes it:
A register that loses the assignment loses its import of the market, its access to the pledge record and further webhook events.

Read the register and its answer

get answers for every instance that holds a record of the market: the deployer and the lender of record.
canEdit is true for the deployer. A lender of record reads the same record, and its assign or clear is refused with REGISTER_ISSUER_ONLY. response is PENDING until the register answers for this market, IMPORTED once it imported the market and DECLINED when it declined it. IMPORTED does not say that a register entry exists.

Work the register’s side

These four methods need an account Trusset approved as an asset register. Any other account is refused with REGISTER_NOT_APPROVED.
queue returns the markets that name the instance and still wait for an answer. importMarket takes one into the instance, read-only. declineMarket takes one off the queue, and a later importMarket on the same address turns the decline into an import. importMarket also takes an address the deployer passed on directly. It succeeds only when the deployer has named the instance for the token behind the market. Until then it throws REGISTER_NOT_NAMED:

Read the pledges of an imported market

An imported market opens lending.pledges.list for the register’s key.
A register account works without the lending service. Its key reads lending.pledges.list for the markets it imported, the vault reads, lending.markets.list for its own instance and lending.markets.borrowAssets. Every other lending method is refused with SERVICE_NOT_ENABLED. Pledge webhooks deliver each change as it is indexed, so the list is the record to reconcile against, not a feed to poll.

Methods and endpoints