|
1 | 1 | import BigNumber from 'bignumber.js'; |
2 | 2 |
|
3 | | -import { TransactionBuilder, Transaction, Interface, Schema } from '@bitgo/abstract-substrate'; |
| 3 | +import { Interface, Schema } from '@bitgo/abstract-substrate'; |
| 4 | +import { Transaction } from './transaction'; |
| 5 | +import { TxMethod } from './iface'; |
| 6 | +import { PolyxBaseBuilder } from './baseBuilder'; |
4 | 7 | import { DecodedSignedTx, DecodedSigningPayload, defineMethod, UnsignedTransaction } from '@substrate/txwrapper-core'; |
5 | 8 | import { BaseCoin as CoinConfig } from '@bitgo/statics'; |
6 | 9 | import { BaseAddress, InvalidTransactionError, TransactionType } from '@bitgo/sdk-core'; |
7 | 10 |
|
8 | 11 | import utils from './utils'; |
9 | 12 |
|
10 | | -export class TransferBuilder extends TransactionBuilder { |
| 13 | +export class TransferBuilder extends PolyxBaseBuilder<TxMethod, Transaction> { |
11 | 14 | protected _amount: string; |
12 | 15 | protected _to: string; |
13 | 16 | protected _memo: string; |
@@ -98,7 +101,9 @@ export class TransferBuilder extends TransactionBuilder { |
98 | 101 | if (this._method?.name === Interface.MethodNames.TransferWithMemo) { |
99 | 102 | const txMethod = this._method.args as Interface.TransferWithMemoArgs; |
100 | 103 | this.amount(txMethod.value); |
101 | | - this.to({ address: utils.decodeSubstrateAddress(txMethod.dest.id, this.getAddressFormat()) }); |
| 104 | + this.to({ |
| 105 | + address: utils.decodeSubstrateAddress(txMethod.dest.id, utils.getAddressFormat(this._coinConfig.name)), |
| 106 | + }); |
102 | 107 | this.memo(txMethod.memo); |
103 | 108 | } else { |
104 | 109 | throw new InvalidTransactionError(`Invalid Transaction Type: ${this._method?.name}. Expected transferWithMemo`); |
|
0 commit comments