Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions modules/sdk-coin-iota/src/iota.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,22 @@ export class Iota extends BaseCoin {
fee = new BigNumber(transactionExplanation.fee.fee);
}

// assume 1 sender, who is also the fee payer
const outputAmount = transactionExplanation.sponsor
? new BigNumber(transactionExplanation.outputAmount).toFixed()
: new BigNumber(transactionExplanation.outputAmount).plus(fee).toFixed(); // assume 1 sender, who is also the fee payer

const inputs = [
{
address: senderAddress,
amount: new BigNumber(transactionExplanation.outputAmount).plus(fee).toFixed(),
amount: outputAmount,
},
];
if (transactionExplanation.sponsor) {
inputs.push({
address: transactionExplanation.sponsor,
amount: fee.toFixed(),
});
}

const outputs: {
address: string;
Expand Down
2 changes: 2 additions & 0 deletions modules/sdk-coin-iota/src/lib/iface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {

export interface TransactionExplanation extends BaseTransactionExplanation {
type: BitGoTransactionType;
sender: string;
sponsor?: string;
}

export type TransactionObjectInput = {
Expand Down
2 changes: 2 additions & 0 deletions modules/sdk-coin-iota/src/lib/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ export abstract class Transaction extends BaseTransaction {
changeOutputs: [],
changeAmount: '0',
fee: { fee: this.gasBudget ? this.gasBudget.toString() : '' },
sender: this.sender,
sponsor: this.gasSponsor,
type: this.type,
};

Expand Down