Skip to content

Changetrust Operation #202

Description

@ibousv

Version : 1.9.0

"dependencies": { "@stellar/typescript-wallet-sdk": "^1.9.0", }

Adding a trustline to an account

` static async addAsset(source: UserKeys, defaultLimit: string = "200000"): Promise {
const txBuilder = (await this.HORIZON.transaction({
sourceAddress: SigningKeypair.fromSecret(source.privateKey),
baseFee: 100,
timebounds: 180
}))
const xaf = new Asset("XAF", MASTER_KEY.publicKey)
const tx = txBuilder.addOperation(Operation.changeTrust({
source: source.publicKey,
asset: xaf,
limit: defaultLimit
})
)
.build()
tx.sign(Keypair.fromSecret(source.privateKey))
return this.HORIZON.submitTransaction(tx)

} `

The error

When i try to test this function, it return me this error : throw new Error("Invalid asset type: ".concat(assetXdr["switch"]().name)); [Error: Invalid asset type: assetTypeCreditAlphanum4]
When i do this with the lab, it work properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions