-
Notifications
You must be signed in to change notification settings - Fork 13
Description
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.