# ExtendedAsset
An extended asset is a representation of a token's amount, symbol, precision and a contract name.
# Constructors
constructor( public quantity: Asset, public contract: Name )quantity- TheAssetobject.Example:
Asset.fromString("1.0000 XPR")contract- TheNameobject with for the contractExample:
Name.fromString('mycontract')Example:
import { ExtendedAsset, Asset, Name } from 'proton-tsc' const asset = Asset.fromString("1.0000 XPR"); const contract = Name.fromString('mycontract'); const extendedAsset = new ExtendedAsset(asset, contract)
static fromInteger(v: i64, s: ExtendedSymbol): ExtendedAssetCreates new symbol from i64 number and
ExtendedSymbolExample:
const symbol = new Symbol("XPR", 4); const contract = Name.fromString('mycontract'); const extendedSymbol = new ExtendedSymbol(symbol, contract); const extendedAsset = ExtendedAsset.fromInteger(1000, extendedSymbol);
# Instance Methods
function getExtendedSymbol(): ExtendedSymbolReturns the
ExtendedSymbolobject based on the current assetfunction toString(): stringReturns the extended asset as a string in format
quantity sign@contract. UsestoStringmethod onAssetobject for the part before@sign.Example:
const symbol = new Symbol(6, "XUSDC"); const asset = new Asset(1000000, symbol); const contract = Name.fromString('mycontract'); const extendedAsset = new ExtendedAsset(asset, contract) print(extendedAsset.toString()) // 1.000000 XUSDC@mycontract
# Static Methods
static function add(a: ExtendedAsset, b: ExtendedAsset): ExtendedAssetAdds two extended assets with the same symbol and contract and returns a new extended assets with amount a + b
Throws if:
- Asset contracts do not match
 - Asset symbols do not match
 - (a + b) underflows i64
 - (a + b) overflows i64
 
static function sub(a: ExtendedAsset, b: ExtendedAsset): ExtendedAssetSubstracts two extended assets with the same symbol and contract and returns a new extended asset with amount a - b
Throws if:
- Asset contracts do not match
 - Asset symbols do not match
 - (a - b) underflows i64
 - (a - b) overflows i64
 
static function eq(a: ExtendedAsset, b: ExtendedAsset): boolChecks that the amounts of two assets are equal
Throws if:
- Asset symbols do not match
 
static function neq(a: ExtendedAsset, b: ExtendedAsset): boolChecks that the amounts of two assets are not equal and the contracts of two assets are not equal
Throws if:
- Asset symbols do not match
 
static function lt(a: ExtendedAsset, b: ExtendedAsset): boolChecks that the amounts of a is less than b
Throws if:
- Asset contracts do not match
 - Asset symbols do not match
 
static function gt(a: ExtendedAsset, b: ExtendedAsset): boolChecks that the amounts of a is greater than b
Throws if:
- Asset contracts do not match
 - Asset symbols do not match
 
static function lte(a: Asset, b: Asset): boolChecks that the amounts of a is less than or equal to b
Throws if:
- Asset contracts do not match
 - Asset symbols do not match
 
static function gte(a: Asset, b: Asset): boolChecks that the amounts of a is greater than or equal to b
Throws if:
- Asset contracts do not match
 - Asset symbols do not match