Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private mapPathPayment(): IPathPaymentOperation {
const destinationAsset =
this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
const sourceAsset =
this.data.source_asset_type === "native"
? Asset.native()
: new Asset(this.data.source_asset_code, this.data.source_asset_issuer);
return {
...this.baseData,
...{
sendMax: this.data.source_max,
amountSent: this.data.source_amount,
amountReceived: this.data.amount,
destinationAccount: this.data.to,
destinationAsset,
sourceAccount: this.data.from,
sourceAsset
}
private mapPayment(): IPaymentOperation {
const asset =
this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
return {
...this.baseData,
...{
destination: this.data.to,
source: this.data.from,
amount: this.data.amount,
asset
}
};
}
private mapManageOffer(): IManageSellOfferOperation | IManageBuyOfferOperation {
const assetBuying =
this.data.buying_asset_type === "native"
? Asset.native()
: new Asset(this.data.buying_asset_code, this.data.buying_asset_issuer);
const assetSelling =
this.data.selling_asset_type === "native"
? Asset.native()
: new Asset(this.data.selling_asset_code, this.data.selling_asset_issuer);
return {
...this.baseData,
...{
offerId: this.data.offer_id.toString(),
amount: this.data.amount,
price: this.data.price,
priceComponents: {
n: this.data.price_r.n,
d: this.data.price_r.d
},
assetBuying,
assetSelling
}
};
private mapManageOffer(): IManageSellOfferOperation | IManageBuyOfferOperation {
const assetBuying =
this.data.buying_asset_type === "native"
? Asset.native()
: new Asset(this.data.buying_asset_code, this.data.buying_asset_issuer);
const assetSelling =
this.data.selling_asset_type === "native"
? Asset.native()
: new Asset(this.data.selling_asset_code, this.data.selling_asset_issuer);
return {
...this.baseData,
...{
offerId: this.data.offer_id.toString(),
amount: this.data.amount,
price: this.data.price,
priceComponents: {
n: this.data.price_r.n,
d: this.data.price_r.d
private mapPathPayment(): IPathPaymentOperation {
const destinationAsset =
this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
const sourceAsset =
this.data.source_asset_type === "native"
? Asset.native()
: new Asset(this.data.source_asset_code, this.data.source_asset_issuer);
return {
...this.baseData,
...{
sendMax: this.data.source_max,
amountSent: this.data.source_amount,
amountReceived: this.data.amount,
destinationAccount: this.data.to,
destinationAsset,
sourceAccount: this.data.from,
sourceAsset
}
};
}
private mapPathPaymentStrictSend(): IPathPaymentStrictSendOperation {
const destinationAsset =
this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
const sourceAsset =
this.data.source_asset_type === "native"
? Asset.native()
: new Asset(this.data.source_asset_code, this.data.source_asset_issuer);
return {
...this.baseData,
...{
destinationMin: this.data.destination_min,
amountSent: this.data.source_amount,
amountReceived: this.data.amount,
destinationAccount: this.data.to,
destinationAsset,
sourceAccount: this.data.from,
sourceAsset
}
private mapCreatePassiveOffer(): ICreatePassiveSellOfferOperation {
const assetBuying =
this.data.buying_asset_type === "native"
? Asset.native()
: new Asset(this.data.buying_asset_code, this.data.buying_asset_issuer);
const assetSelling =
this.data.selling_asset_type === "native"
? Asset.native()
: new Asset(this.data.selling_asset_code, this.data.selling_asset_issuer);
return {
...this.baseData,
...{
amount: this.data.amount,
price: this.data.price,
priceComponents: {
n: this.data.price_r.n,
d: this.data.price_r.d
},
assetBuying,
assetSelling
}
};
}