import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars import * as borsh from "@project-serum/borsh" export interface NoTransferTxInfoFields { token: types.XTokenLocatorFields id: BN amountToReturn: types.U256BorshFields } export interface NoTransferTxInfoJSON { token: types.XTokenLocatorJSON id: string amountToReturn: types.U256BorshJSON } export class NoTransferTxInfo { readonly token: types.XTokenLocator readonly id: BN readonly amountToReturn: types.U256Borsh constructor(fields: NoTransferTxInfoFields) { this.token = new types.XTokenLocator({ ...fields.token }) this.id = fields.id this.amountToReturn = new types.U256Borsh({ ...fields.amountToReturn }) } static layout(property?: string) { return borsh.struct( [ types.XTokenLocator.layout("token"), borsh.u128("id"), types.U256Borsh.layout("amountToReturn"), ], property ) } // eslint-disable-next-line @typescript-eslint/no-explicit-any static fromDecoded(obj: any) { return new NoTransferTxInfo({ token: types.XTokenLocator.fromDecoded(obj.token), id: obj.id, amountToReturn: types.U256Borsh.fromDecoded(obj.amountToReturn), }) } static toEncodable(fields: NoTransferTxInfoFields) { return { token: types.XTokenLocator.toEncodable(fields.token), id: fields.id, amountToReturn: types.U256Borsh.toEncodable(fields.amountToReturn), } } toJSON(): NoTransferTxInfoJSON { return { token: this.token.toJSON(), id: this.id.toString(), amountToReturn: this.amountToReturn.toJSON(), } } static fromJSON(obj: NoTransferTxInfoJSON): NoTransferTxInfo { return new NoTransferTxInfo({ token: types.XTokenLocator.fromJSON(obj.token), id: new BN(obj.id), amountToReturn: types.U256Borsh.fromJSON(obj.amountToReturn), }) } toEncodable() { return NoTransferTxInfo.toEncodable(this) } }