See the canonical spec:
.TypeScriptimport { Client, Wallet } from 'xrpl'; async function setTrustLine(): Promise<void> { const client = new Client('wss://honeycluster.dev'); await client.connect(); const wallet = Wallet.fromSeed('s...'); const prepared = await client.autofill({ TransactionType: 'TrustSet', Account: wallet.address, LimitAmount: { currency: 'USD', issuer: 'r...issuer', value: '1000' }, Flags: 0, }); const signed = wallet.sign(prepared); const res = await client.submitAndWait(signed.tx_blob); console.log(res); await client.disconnect(); } setTrustLine().catch(console.error);
| Field | Type | Required | Description |
|---|---|---|---|
Account | String | Yes | The address of the account setting the trust line |
LimitAmount | Object | Yes | The currency and amount to trust from the issuer |
Flags | Number | No | Flags to enable/disable certain trust line features |
QualityIn | Number | No | Exchange rate for incoming payments on this trust line |
QualityOut | Number | No | Exchange rate for outgoing payments on this trust line |
LimitAmount Object:
Json{ "currency": "USD", "issuer": "r...issuer", "value": "1000" }
Flags:
0x00010000 (tfSetFreeze): Freeze the trust line
0x00020000 (tfClearFreeze): Unfreeze the trust line
0x00080000 (tfSetNoRipple): Enable NoRipple on the trust line
0x00100000 (tfClearNoRipple): Disable NoRipple on the trust line
QualityIn/QualityOut:
Represent exchange rates as ratios
Default: 1,000,000 (1:1 ratio)
Higher values = better rates for the account
Establishes a trust line for holding issued currencies
LimitAmount specifies the maximum amount you trust from this issuer
QualityIn and QualityOut control exchange rates
Flags can freeze the trust line or set other restrictions
Always use autofill to set fees and sequence safely when using the XRPL client library