I am trying to call a payment strict send path:
var server = new StellarSdk.Server("https://horizon.stellar.org", {
allowHttp: false,
appName: "Horizon",
appVersion: "0.23"
});
var sourceAsset = new StellarSdk.Asset(
"USD",
"GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"
);
var sourceAmount = "0.0846227";
var destination = [new StellarSdk.Asset("XLM", "")];
console.log(sourceAsset.isNative());
server
.strictSendPaths(sourceAmount, sourceAsset, destination)
.call()
.then(function(pathResult) {
console.log(pathResult.records);
})
.catch(function(err) {
console.log(err);
});
The error occurs at new StrictSendPathCallBuilder (stellar-sdk.js:45400)
:
45400: if (sourceAsset.isNative()) {
The console.log(sourceAsset.isNative());
in the code above runs well. I wonder what is causing the error in the Sdk.
A counter strict receive path request would be:
var server = new StellarSdk.Server("https://horizon.stellar.org", {
allowHttp: false,
appName: "Horizon",
appVersion: "0.23"
});
var source = [new StellarSdk.Asset("XLM", "")];
var destinationAsset = new StellarSdk.Asset(
"USD",
"GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"
);
console.log(destinationAsset.isNative());
var destinationAmount = "1";
server
.strictReceivePaths(source, destinationAsset, destinationAmount)
.call()
.then(function(pathResult) {
console.log(pathResult);
console.log(pathResult.records);
})
.catch(function(err) {
console.log(err);
});
And that runs well.