@shapeshiftoss/fiosdk
Version:
The Foundation for Interwallet Operability (FIO) is a consortium of leading blockchain wallets, exchanges and payments providers that seeks to accelerate blockchain adoption by reducing the risk, complexity, and inconvenience of sending and receiving cryp
38 lines (33 loc) • 1.26 kB
text/typescript
import { PublicAddress } from '../../entities/PublicAddress'
import { SignedTransaction } from './SignedTransaction'
import { Constants } from '../../utils/constants'
import { validationRules } from '../../utils/validation'
export class AddPublicAddress extends SignedTransaction {
public ENDPOINT: string = 'chain/add_pub_address'
public ACTION: string = 'addaddress'
public ACCOUNT: string = Constants.defaultAccount
public fioAddress: string
public publicAddresses: PublicAddress[]
public maxFee: number
public technologyProviderId: string
constructor(fioAddress: string, publicAddresses: PublicAddress[], maxFee: number, technologyProviderId: string = '') {
super()
this.fioAddress = fioAddress
this.publicAddresses = publicAddresses
this.maxFee = maxFee
this.technologyProviderId = technologyProviderId
this.validationData = { fioAddress, tpid: technologyProviderId || null }
this.validationRules = validationRules.addPublicAddressRules
}
public async getData() {
const actor = this.getActor()
const data = {
fio_address: this.fioAddress,
public_addresses: this.publicAddresses,
actor,
tpid: this.technologyProviderId,
max_fee: this.maxFee,
}
return data
}
}