@moonbeam-network/xcm-types 1.0.0-dev.105 → 1.0.0-dev.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +11 -13
- package/build/index.d.ts +10 -12
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/package.json +2 -2
package/build/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=Object.create;var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var S=(r,t)=>{for(var s in t)p(r,s,{get:t[s],enumerable:!0})},P=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of k(t))!E.call(r,n)&&n!==s&&p(r,n,{get:()=>t[n],enumerable:!(e=v(t,n))||e.enumerable});return r};var D=(r,t,s)=>(s=r!=null?I(w(r)):{},P(t||!r||!r.__esModule?p(s,"default",{value:r,enumerable:!0}):s,r)),M=r=>P(p({},"__esModule",{value:!0}),r);var B={};S(B,{Asset:()=>m,AssetAmount:()=>C,Chain:()=>u,ChainAsset:()=>h,ChainType:()=>c,Ecosystem:()=>f,EvmParachain:()=>g,Parachain:()=>d});module.exports=M(B);var m=class r{key;originSymbol;constructor({key:t,originSymbol:s}){this.key=t,this.originSymbol=s}copyWith(t){return new r({...this,...t})}isEqual(t){return this.key===t.key&&this.originSymbol===t.originSymbol}};var b=require("@moonbeam-network/xcm-utils");var h=class r extends m{address;decimals;ids;min;#t;constructor({address:t,decimals:s,ids:e,min:n,symbol:a,...o}){super(o),this.address=t,this.decimals=s,this.ids=e,this.min=n?(0,b.toBigInt)(n,s):void 0,this.#t=a}static fromAsset(t,s){return new r({...t,...s})}copyWith(t){return new r({...this,symbol:this.#t,...t})}get symbol(){return this.#t||this.originSymbol}getAssetId(){var t;return((t=this.ids)==null?void 0:t.id)??this.originSymbol}getBalanceAssetId(){var t;return((t=this.ids)==null?void 0:t.balanceId)??this.getAssetId()}getMinAssetId(){var t;return((t=this.ids)==null?void 0:t.minId)??this.getAssetId()}getAssetPalletInstance(){var t;return(t=this.ids)==null?void 0:t.palletInstance}getAssetMin(){return this.min??0n}};var i=require("@moonbeam-network/xcm-utils"),y=D(require("big.js"),1);y.default.NE=-18;var C=class r extends h{amount;constructor({amount:t,...s}){super(s),this.amount=(0,i.toBigInt)(t,s.decimals)}static fromChainAsset(t,s){return new r({...t,...s})}isSame(t){return super.isEqual(t)&&this.decimals===t.decimals}isEqual(t){return this.isSame(t)&&this.amount===t.amount}copyWith(t){return new r({...this,...t})}convertDecimals(t){return this.decimals===t?this.copyWith({}):this.copyWith({amount:(0,i.convertDecimals)(this.amount,this.decimals,t),decimals:t})}toBig(){return(0,y.default)(this.amount.toString())}toBigDecimal(t,s){return(0,y.default)(this.toDecimal(t,s))}toDecimal(t,s){return(0,i.toDecimal)(this.amount,this.decimals,t,s)}};var c=(s=>(s.Parachain="parachain",s.EvmParachain="evm-parachain",s))(c||{}),f=(e=>(e.Polkadot="polkadot",e.Kusama="kusama",e.AlphanetRelay="alphanet-relay",e))(f||{});var u=class{assets;ecosystem;isTestChain;key;name;#t;type;constructor({assets:t,ecosystem:s,isTestChain:e=!1,key:n,name:a,nativeAsset:o,type:A}){this.assets=t instanceof Map?t:new Map(t==null?void 0:t.map(l=>[l.key,l])),this.ecosystem=s,this.isTestChain=e,this.key=n,this.name=a,this.#t=o,this.type=A}get nativeAsset(){return this.getChainAsset(this.#t)}getChainAsset(t){let s=typeof t=="string"?t:t.key,e=this.assets.get(s);if(!e)throw new Error(`No ChainAsset found by the key ${s} for chain ${this.name} (${this.key})`);return e}isParachain(){return this.type==="parachain"}isEvmParachain(){return this.type==="evm-parachain"}};var x=require("viem");var d=class extends u{genesisHash;parachainId;ss58Format;usesChainDecimals;weight;ws;constructor({genesisHash:t,parachainId:s,usesChainDecimals:e,ss58Format:n,weight:a,ws:o,type:A="parachain",...l}){super({type:A,...l}),this.genesisHash=t,this.parachainId=s,this.ss58Format=n,this.usesChainDecimals=!!e,this.weight=a,this.ws=o}};var g=class extends d{id;rpc;isEvmSigner;contracts;constructor({id:t,rpc:s,isEvmSigner:e=!1,contracts:n,...a}){super({type:"evm-parachain",...a}),this.contracts=n,this.id=t,this.rpc=s,this.isEvmSigner=e}getViemChain(){return(0,x.defineChain)({id:this.id,name:this.name,nativeCurrency:{decimals:this.nativeAsset.decimals,name:this.nativeAsset.originSymbol,symbol:this.nativeAsset.originSymbol},rpcUrls:{default:{http:[this.rpc],webSocket:Array.isArray(this.ws)?this.ws:[this.ws]}}})}};0&&(module.exports={Asset,AssetAmount,Chain,ChainAsset,ChainType,Ecosystem,EvmParachain,Parachain});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/build/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/asset/Asset.ts","../src/asset/ChainAsset.ts","../src/asset/AssetAmount.ts","../src/chain/Chain.interfaces.ts","../src/chain/Chain.ts","../src/chain/parachain/EvmParachain.ts","../src/chain/parachain/Parachain.ts"],"sourcesContent":["export * from './asset';\nexport * from './chain';\nexport * from './common.interfaces';\n","export interface AssetConstructorParams {\n key: string;\n originSymbol: string;\n}\n\nexport class Asset {\n readonly key: string;\n\n readonly originSymbol: string;\n\n constructor({ key, originSymbol }: AssetConstructorParams) {\n this.key = key;\n this.originSymbol = originSymbol;\n }\n\n isEqual(asset: Asset): boolean {\n return this.key === asset.key && this.originSymbol === asset.originSymbol;\n }\n}\n","import { toBigInt } from '@moonbeam-network/xcm-utils';\nimport { Asset, AssetConstructorParams } from './Asset';\n\nexport interface ChainAssetConstructorParams extends AssetConstructorParams {\n address?: string;\n decimals: number;\n ids?: ChainAssetIds;\n min?: number | bigint;\n symbol?: string;\n}\n\nexport interface ChainAssetIds {\n balanceId?: ChainAssetId;\n id?: ChainAssetId;\n minId?: ChainAssetId;\n palletInstance?: number;\n}\n\nexport type ChainAssetId =\n | string\n | number\n | bigint\n | { [key: string]: ChainAssetId };\n\nexport class ChainAsset extends Asset {\n readonly address?: string;\n\n readonly decimals: number;\n\n readonly ids?: ChainAssetIds;\n\n readonly min?: bigint;\n\n readonly #symbol?: string;\n\n constructor({\n address,\n decimals,\n ids,\n min,\n symbol,\n ...other\n }: ChainAssetConstructorParams) {\n super(other);\n\n this.address = address;\n this.decimals = decimals;\n this.ids = ids;\n this.min = min ? toBigInt(min, decimals) : undefined;\n this.#symbol = symbol;\n }\n\n static fromAsset(\n asset: Asset,\n params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>,\n ): ChainAsset {\n return new ChainAsset({\n ...asset,\n ...params,\n });\n }\n\n get symbol(): string {\n return this.#symbol || this.originSymbol;\n }\n\n getAssetId(): ChainAssetId {\n return this.ids?.id ?? this.originSymbol;\n }\n\n getBalanceAssetId(): ChainAssetId {\n return this.ids?.balanceId ?? this.getAssetId();\n }\n\n getMinAssetId(): ChainAssetId {\n return this.ids?.minId ?? this.getAssetId();\n }\n\n getAssetPalletInstance(): number | undefined {\n return this.ids?.palletInstance;\n }\n\n getAssetMin(): bigint {\n return this.min ?? 0n;\n }\n}\n","import {\n convertDecimals,\n toBigInt,\n toDecimal,\n} from '@moonbeam-network/xcm-utils';\nimport Big, { RoundingMode } from 'big.js';\nimport { ChainAsset, ChainAssetConstructorParams } from './ChainAsset';\n\nBig.NE = -18;\n\nexport interface AssetAmountConstructorParams\n extends ChainAssetConstructorParams {\n amount: number | bigint;\n decimals: number;\n symbol?: string;\n}\n\nexport class AssetAmount extends ChainAsset {\n readonly amount: bigint;\n\n constructor({ amount, ...other }: AssetAmountConstructorParams) {\n super(other);\n\n this.amount = toBigInt(amount, other.decimals);\n }\n\n static fromChainAsset(\n asset: ChainAsset,\n params: Omit<\n AssetAmountConstructorParams,\n keyof ChainAssetConstructorParams\n >,\n ): AssetAmount {\n return new AssetAmount({\n ...asset,\n ...params,\n });\n }\n\n isSame(asset: AssetAmount): boolean {\n return super.isEqual(asset) && this.decimals === asset.decimals;\n }\n\n isEqual(asset: AssetAmount): boolean {\n return this.isSame(asset) && this.amount === asset.amount;\n }\n\n copyWith(params: Partial<AssetAmountConstructorParams>) {\n return new AssetAmount({\n ...this,\n ...params,\n });\n }\n\n convertDecimals(decimals: number): AssetAmount {\n if (this.decimals === decimals) {\n return this.copyWith({});\n }\n\n return this.copyWith({\n amount: convertDecimals(this.amount, this.decimals, decimals),\n decimals,\n });\n }\n\n toBig(): Big {\n return Big(this.amount.toString());\n }\n\n toBigDecimal(maxDecimal?: number, roundType?: RoundingMode): Big {\n return Big(this.toDecimal(maxDecimal, roundType));\n }\n\n toDecimal(maxDecimal?: number, roundType?: RoundingMode): string {\n return toDecimal(this.amount, this.decimals, maxDecimal, roundType);\n }\n}\n","import type { EvmParachain, Parachain } from './parachain';\n\nexport type AnyChain = Parachain | EvmParachain;\nexport type AnyParachain = Parachain | EvmParachain;\n\nexport enum ChainType {\n 'Parachain' = 'parachain',\n 'EvmParachain' = 'evm-parachain',\n}\n\nexport enum Ecosystem {\n Polkadot = 'polkadot',\n Kusama = 'kusama',\n AlphanetRelay = 'alphanet-relay',\n}\n","import { ChainType, Ecosystem } from './Chain.interfaces';\nimport type { EvmParachain, Parachain } from './parachain';\n\nexport interface ChainConstructorParams {\n ecosystem?: Ecosystem;\n isTestChain?: boolean;\n key: string;\n name: string;\n type: ChainType;\n}\n\nexport abstract class Chain {\n readonly ecosystem?: Ecosystem;\n\n readonly isTestChain: boolean;\n\n readonly key: string;\n\n readonly name: string;\n\n readonly type: ChainType;\n\n constructor({\n ecosystem,\n isTestChain = false,\n key,\n name,\n type,\n }: ChainConstructorParams) {\n this.ecosystem = ecosystem;\n this.isTestChain = isTestChain;\n this.key = key;\n this.name = name;\n this.type = type;\n }\n\n isParachain(): this is Parachain {\n return this.type === ChainType.Parachain;\n }\n\n isEvmParachain(): this is EvmParachain {\n return this.type === ChainType.EvmParachain;\n }\n}\n","import { Address, defineChain } from 'viem';\nimport { Chain } from 'viem/chains';\nimport { ChainType } from '../Chain.interfaces';\nimport { Parachain, ParachainConstructorParams } from './Parachain';\n\nexport interface EvmParachainConstructorParams\n extends Omit<ParachainConstructorParams, 'type'> {\n id: number;\n rpc: string;\n nativeCurrency: NativeCurrency;\n isEvmSigner?: boolean;\n contracts?: Contracts;\n}\n\ntype NativeCurrency = {\n decimals: number;\n name: string;\n symbol: string;\n};\n\ntype Contracts = {\n Xtokens?: Address;\n};\n\nexport class EvmParachain extends Parachain {\n readonly id: number;\n\n readonly rpc: string;\n\n readonly nativeCurrency: NativeCurrency;\n\n readonly isEvmSigner: boolean;\n\n readonly contracts?: Contracts;\n\n constructor({\n id,\n rpc,\n nativeCurrency,\n isEvmSigner = false,\n contracts,\n ...others\n }: EvmParachainConstructorParams) {\n super({ type: ChainType.EvmParachain, ...others });\n\n this.contracts = contracts;\n this.id = id;\n this.rpc = rpc;\n this.nativeCurrency = nativeCurrency;\n this.isEvmSigner = isEvmSigner;\n }\n\n getViemChain(): Chain {\n return defineChain({\n id: this.id,\n name: this.name,\n nativeCurrency: this.nativeCurrency,\n rpcUrls: {\n default: {\n http: [this.rpc],\n webSocket: Array.isArray(this.ws) ? this.ws : [this.ws],\n },\n },\n });\n }\n}\n","import { Asset, AssetAmount, ChainAsset } from '../../asset';\nimport { SetOptional } from '../../common.interfaces';\nimport { Chain, ChainConstructorParams } from '../Chain';\nimport { ChainType } from '../Chain.interfaces';\n\nexport interface ParachainConstructorParams\n extends SetOptional<ChainConstructorParams, 'type'> {\n assets?: Map<string, ChainAsset> | ChainAsset[];\n genesisHash: string;\n parachainId: number;\n ss58Format: number;\n usesChainDecimals?: boolean;\n weight?: number;\n ws: string | string[];\n}\n\nexport class Parachain extends Chain {\n readonly assets: Map<string, ChainAsset>;\n\n readonly genesisHash: string;\n\n readonly parachainId: number;\n\n readonly ss58Format: number;\n\n readonly usesChainDecimals: boolean;\n\n readonly weight: number | undefined;\n\n readonly ws: string | string[];\n\n constructor({\n assets,\n genesisHash,\n parachainId,\n usesChainDecimals,\n ss58Format,\n weight,\n ws,\n type = ChainType.Parachain,\n ...others\n }: ParachainConstructorParams) {\n super({ type, ...others });\n\n this.assets =\n assets instanceof Map\n ? assets\n : new Map(assets?.map((data) => [data.key, data]));\n this.genesisHash = genesisHash;\n this.parachainId = parachainId;\n this.ss58Format = ss58Format;\n this.usesChainDecimals = !!usesChainDecimals;\n this.weight = weight;\n this.ws = ws;\n }\n\n getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset {\n const key = typeof keyOrAsset === 'string' ? keyOrAsset : keyOrAsset.key;\n const chainAsset = this.assets.get(key);\n\n if (!chainAsset) {\n throw new Error(\n `No ChainAsset found by the key ${key} for chain ${this.name} (${this.key})`,\n );\n }\n\n return chainAsset;\n }\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,gBAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,cAAAC,EAAA,iBAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAV,GCKO,IAAMW,EAAN,KAAY,CACR,IAEA,aAET,YAAY,CAAE,IAAAC,EAAK,aAAAC,CAAa,EAA2B,CACzD,KAAK,IAAMD,EACX,KAAK,aAAeC,CACtB,CAEA,QAAQC,EAAuB,CAC7B,OAAO,KAAK,MAAQA,EAAM,KAAO,KAAK,eAAiBA,EAAM,YAC/D,CACF,EClBA,IAAAC,EAAyB,uCAwBlB,IAAMC,EAAN,MAAMC,UAAmBC,CAAM,CAC3B,QAEA,SAEA,IAEA,IAEAC,GAET,YAAY,CACV,QAAAC,EACA,SAAAC,EACA,IAAAC,EACA,IAAAC,EACA,OAAAC,EACA,GAAGC,CACL,EAAgC,CAC9B,MAAMA,CAAK,EAEX,KAAK,QAAUL,EACf,KAAK,SAAWC,EA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EzB,KAAK,OACHR,aAAkB,IACdA,EACA,IAAI,IAAIA,GAAA,YAAAA,EAAQ,IAAKS,GAAS,CAACA,EAAK,IAAKA,CAAI,EAAE,EACrD,KAAK,YAAcR,EACnB,KAAK,YAAcC,EACnB,KAAK,WAAaE,EAClB,KAAK,kBAAoB,CAAC,CAACD,EAC3B,KAAK,OAASE,EACd,KAAK,GAAKC,CACZ,CAEA,cAAcI,EAAsD,CAClE,IAAMC,EAAM,OAAOD,GAAe,SAAWA,EAAaA,EAAW,IAC/DE,EAAa,KAAK,OAAO,IAAID,CAAG,EAEtC,GAAI,CAACC,EACH,MAAM,IAAI,MACR,kCAAkCD,CAAG,cAAc,KAAK,IAAI,KAAK,KAAK,GAAG,GAC3E,EAGF,OAAOC,CACT,CACF,ED5CO,IAAMC,EAAN,cAA2BC,CAAU,CACjC,GAEA,IAEA,eAEA,YAEA,UAET,YAAY,CACV,GAAAC,EACA,IAAAC,EACA,eAAAC,EACA,YAAAC,EAAc,GACd,UAAAC,EACA,GAAGC,CACL,EAAkC,CAChC,MAAM,CAAE,qBAA8B,GAAGA,CAAO,CAAC,EAEjD,KAAK,UAAYD,EACjB,KAAK,GAAKJ,EACV,KAAK,IAAMC,EACX,KAAK,eAAiBC,EACtB,KAAK,YAAcC,CACrB,CAEA,cAAsB,CACpB,SAAO,eAAY,CACjB,GAAI,KAAK,GACT,KAAM,KAAK,KACX,eAAgB,KAAK,eACrB,QAAS,CACP,QAAS,CACP,KAAM,CAAC,KAAK,GAAG,EACf,UAAW,MAAM,QAAQ,KAAK,EAAE,EAAI,KAAK,GAAK,CAAC,KAAK,EAAE,CACxD,CACF,CACF,CAAC,CACH,CACF","names":["src_exports","__export","Asset","AssetAmount","Chain","ChainAsset","ChainType","Ecosystem","EvmParachain","Parachain","__toCommonJS","Asset","key","originSymbol","asset","import_xcm_utils","ChainAsset","_ChainAsset","Asset","#symbol","address","decimals","ids","min","symbol","other","asset","params","_a","import_xcm_utils","import_big","Big","AssetAmount","_AssetAmount","ChainAsset","amount","other","asset","params","decimals","maxDecimal","roundType","ChainType","Ecosystem","Chain","ecosystem","isTestChain","key","name","type","import_viem","Parachain","Chain","assets","genesisHash","parachainId","usesChainDecimals","ss58Format","weight","ws","type","others","data","keyOrAsset","key","chainAsset","EvmParachain","Parachain","id","rpc","nativeCurrency","isEvmSigner","contracts","others"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/asset/Asset.ts","../src/asset/ChainAsset.ts","../src/asset/AssetAmount.ts","../src/chain/Chain.interfaces.ts","../src/chain/Chain.ts","../src/chain/parachain/EvmParachain.ts","../src/chain/parachain/Parachain.ts"],"sourcesContent":["export * from './asset';\nexport * from './chain';\nexport * from './common.interfaces';\n","export interface AssetConstructorParams {\n key: string;\n originSymbol: string;\n}\n\nexport class Asset {\n readonly key: string;\n\n readonly originSymbol: string;\n\n constructor({ key, originSymbol }: AssetConstructorParams) {\n this.key = key;\n this.originSymbol = originSymbol;\n }\n\n copyWith(params: Partial<AssetConstructorParams>): Asset {\n return new Asset({\n ...this,\n ...params,\n });\n }\n\n isEqual(asset: Asset): boolean {\n return this.key === asset.key && this.originSymbol === asset.originSymbol;\n }\n}\n","import { toBigInt } from '@moonbeam-network/xcm-utils';\nimport { Asset, AssetConstructorParams } from './Asset';\n\nexport interface ChainAssetConstructorParams extends AssetConstructorParams {\n address?: string;\n decimals: number;\n ids?: ChainAssetIds;\n min?: number | bigint;\n symbol?: string;\n}\n\nexport interface ChainAssetIds {\n balanceId?: ChainAssetId;\n id?: ChainAssetId;\n minId?: ChainAssetId;\n palletInstance?: number;\n}\n\nexport type ChainAssetId =\n | string\n | number\n | bigint\n | { [key: string]: ChainAssetId };\n\nexport class ChainAsset extends Asset {\n readonly address?: string;\n\n readonly decimals: number;\n\n readonly ids?: ChainAssetIds;\n\n readonly min?: bigint;\n\n readonly #symbol?: string;\n\n constructor({\n address,\n decimals,\n ids,\n min,\n symbol,\n ...other\n }: ChainAssetConstructorParams) {\n super(other);\n\n this.address = address;\n this.decimals = decimals;\n this.ids = ids;\n this.min = min ? toBigInt(min, decimals) : undefined;\n this.#symbol = symbol;\n }\n\n static fromAsset(\n asset: Asset,\n params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>,\n ): ChainAsset {\n return new ChainAsset({\n ...asset,\n ...params,\n });\n }\n\n copyWith(params: Partial<ChainAssetConstructorParams>): ChainAsset {\n return new ChainAsset({\n ...this,\n symbol: this.#symbol,\n ...params,\n });\n }\n\n get symbol(): string {\n return this.#symbol || this.originSymbol;\n }\n\n getAssetId(): ChainAssetId {\n return this.ids?.id ?? this.originSymbol;\n }\n\n getBalanceAssetId(): ChainAssetId {\n return this.ids?.balanceId ?? this.getAssetId();\n }\n\n getMinAssetId(): ChainAssetId {\n return this.ids?.minId ?? this.getAssetId();\n }\n\n getAssetPalletInstance(): number | undefined {\n return this.ids?.palletInstance;\n }\n\n getAssetMin(): bigint {\n return this.min ?? 0n;\n }\n}\n","import {\n convertDecimals,\n toBigInt,\n toDecimal,\n} from '@moonbeam-network/xcm-utils';\nimport Big, { RoundingMode } from 'big.js';\nimport { ChainAsset, ChainAssetConstructorParams } from './ChainAsset';\n\nBig.NE = -18;\n\nexport interface AssetAmountConstructorParams\n extends ChainAssetConstructorParams {\n amount: number | bigint;\n decimals: number;\n symbol?: string;\n}\n\nexport class AssetAmount extends ChainAsset {\n readonly amount: bigint;\n\n constructor({ amount, ...other }: AssetAmountConstructorParams) {\n super(other);\n\n this.amount = toBigInt(amount, other.decimals);\n }\n\n static fromChainAsset(\n asset: ChainAsset,\n params: Omit<\n AssetAmountConstructorParams,\n keyof ChainAssetConstructorParams\n >,\n ): AssetAmount {\n return new AssetAmount({\n ...asset,\n ...params,\n });\n }\n\n isSame(asset: AssetAmount): boolean {\n return super.isEqual(asset) && this.decimals === asset.decimals;\n }\n\n isEqual(asset: AssetAmount): boolean {\n return this.isSame(asset) && this.amount === asset.amount;\n }\n\n copyWith(params: Partial<AssetAmountConstructorParams>): AssetAmount {\n return new AssetAmount({\n ...this,\n ...params,\n });\n }\n\n convertDecimals(decimals: number): AssetAmount {\n if (this.decimals === decimals) {\n return this.copyWith({});\n }\n\n return this.copyWith({\n amount: convertDecimals(this.amount, this.decimals, decimals),\n decimals,\n });\n }\n\n toBig(): Big {\n return Big(this.amount.toString());\n }\n\n toBigDecimal(maxDecimal?: number, roundType?: RoundingMode): Big {\n return Big(this.toDecimal(maxDecimal, roundType));\n }\n\n toDecimal(maxDecimal?: number, roundType?: RoundingMode): string {\n return toDecimal(this.amount, this.decimals, maxDecimal, roundType);\n }\n}\n","import type { EvmParachain, Parachain } from './parachain';\n\nexport type AnyChain = Parachain | EvmParachain;\nexport type AnyParachain = Parachain | EvmParachain;\n\nexport enum ChainType {\n 'Parachain' = 'parachain',\n 'EvmParachain' = 'evm-parachain',\n}\n\nexport enum Ecosystem {\n Polkadot = 'polkadot',\n Kusama = 'kusama',\n AlphanetRelay = 'alphanet-relay',\n}\n","import { Asset, AssetAmount, ChainAsset } from '../asset';\nimport { ChainType, Ecosystem } from './Chain.interfaces';\nimport type { EvmParachain, Parachain } from './parachain';\n\nexport interface ChainConstructorParams {\n assets: Map<string, ChainAsset> | ChainAsset[];\n ecosystem?: Ecosystem;\n isTestChain?: boolean;\n key: string;\n name: string;\n nativeAsset: Asset;\n type: ChainType;\n}\n\nexport abstract class Chain {\n readonly assets: Map<string, ChainAsset>;\n\n readonly ecosystem?: Ecosystem;\n\n readonly isTestChain: boolean;\n\n readonly key: string;\n\n readonly name: string;\n\n readonly #nativeAsset: Asset;\n\n readonly type: ChainType;\n\n constructor({\n assets,\n ecosystem,\n isTestChain = false,\n key,\n name,\n nativeAsset,\n type,\n }: ChainConstructorParams) {\n this.assets =\n assets instanceof Map\n ? assets\n : new Map(assets?.map((data) => [data.key, data]));\n this.ecosystem = ecosystem;\n this.isTestChain = isTestChain;\n this.key = key;\n this.name = name;\n this.#nativeAsset = nativeAsset;\n this.type = type;\n }\n\n get nativeAsset(): ChainAsset {\n return this.getChainAsset(this.#nativeAsset);\n }\n\n getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset {\n const key = typeof keyOrAsset === 'string' ? keyOrAsset : keyOrAsset.key;\n const chainAsset = this.assets.get(key);\n\n if (!chainAsset) {\n throw new Error(\n `No ChainAsset found by the key ${key} for chain ${this.name} (${this.key})`,\n );\n }\n\n return chainAsset;\n }\n\n isParachain(): this is Parachain {\n return this.type === ChainType.Parachain;\n }\n\n isEvmParachain(): this is EvmParachain {\n return this.type === ChainType.EvmParachain;\n }\n}\n","import { Address, defineChain } from 'viem';\nimport { Chain } from 'viem/chains';\nimport { ChainType } from '../Chain.interfaces';\nimport { Parachain, ParachainConstructorParams } from './Parachain';\n\nexport interface EvmParachainConstructorParams\n extends Omit<ParachainConstructorParams, 'type'> {\n id: number;\n rpc: string;\n isEvmSigner?: boolean;\n contracts?: Contracts;\n}\n\ntype Contracts = {\n Xtokens?: Address;\n};\n\nexport class EvmParachain extends Parachain {\n readonly id: number;\n\n readonly rpc: string;\n\n readonly isEvmSigner: boolean;\n\n readonly contracts?: Contracts;\n\n constructor({\n id,\n rpc,\n isEvmSigner = false,\n contracts,\n ...others\n }: EvmParachainConstructorParams) {\n super({ type: ChainType.EvmParachain, ...others });\n\n this.contracts = contracts;\n this.id = id;\n this.rpc = rpc;\n this.isEvmSigner = isEvmSigner;\n }\n\n getViemChain(): Chain {\n return defineChain({\n id: this.id,\n name: this.name,\n nativeCurrency: {\n decimals: this.nativeAsset.decimals,\n name: this.nativeAsset.originSymbol,\n symbol: this.nativeAsset.originSymbol,\n },\n rpcUrls: {\n default: {\n http: [this.rpc],\n webSocket: Array.isArray(this.ws) ? this.ws : [this.ws],\n },\n },\n });\n }\n}\n","import { SetOptional } from '../../common.interfaces';\nimport { Chain, ChainConstructorParams } from '../Chain';\nimport { ChainType } from '../Chain.interfaces';\n\nexport interface ParachainConstructorParams\n extends SetOptional<ChainConstructorParams, 'type'> {\n genesisHash: string;\n parachainId: number;\n ss58Format: number;\n usesChainDecimals?: boolean;\n weight?: number;\n ws: string | string[];\n}\n\nexport class Parachain extends Chain {\n readonly genesisHash: string;\n\n readonly parachainId: number;\n\n readonly ss58Format: number;\n\n readonly usesChainDecimals: boolean;\n\n readonly weight: number | undefined;\n\n readonly ws: string | string[];\n\n constructor({\n genesisHash,\n parachainId,\n usesChainDecimals,\n ss58Format,\n weight,\n ws,\n type = ChainType.Parachain,\n ...others\n }: ParachainConstructorParams) {\n super({ type, ...others });\n\n this.genesisHash = genesisHash;\n this.parachainId = parachainId;\n this.ss58Format = ss58Format;\n this.usesChainDecimals = !!usesChainDecimals;\n this.weight = weight;\n this.ws = ws;\n }\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,gBAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,cAAAC,EAAA,iBAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAV,GCKO,IAAMW,EAAN,MAAMC,CAAM,CACR,IAEA,aAET,YAAY,CAAE,IAAAC,EAAK,aAAAC,CAAa,EAA2B,CACzD,KAAK,IAAMD,EACX,KAAK,aAAeC,CACtB,CAEA,SAASC,EAAgD,CACvD,OAAO,IAAIH,EAAM,CACf,GAAG,KACH,GAAGG,CACL,CAAC,CACH,CAEA,QAAQC,EAAuB,CAC7B,OAAO,KAAK,MAAQA,EAAM,KAAO,KAAK,eAAiBA,EAAM,YAC/D,CACF,ECzBA,IAAAC,EAAyB,uCAwBlB,IAAMC,EAAN,MAAMC,UAAmBC,CAAM,CAC3B,QAEA,SAEA,IAEA,IAEAC,GAET,YAAY,CACV,QAAAC,EACA,SAAAC,EACA,IAAAC,EACA,IAAAC,EACA,OAAAC,EACA,GAAGC,CACL,EAAgC,CAC9B,MAAMA,CAAK,EAEX,KAAK,QAAUL,EACf,KAAK,SAAWC,EAChB,KAAK,IAAMC,EACX,KAAK,IAAMC,KAAM,YAASA,EAAKF,CAAQ,EAAI,OA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","Chain","ChainAsset","ChainType","Ecosystem","EvmParachain","Parachain","__toCommonJS","Asset","_Asset","key","originSymbol","params","asset","import_xcm_utils","ChainAsset","_ChainAsset","Asset","#symbol","address","decimals","ids","min","symbol","other","asset","params","_a","import_xcm_utils","import_big","Big","AssetAmount","_AssetAmount","ChainAsset","amount","other","asset","params","decimals","maxDecimal","roundType","ChainType","Ecosystem","Chain","#nativeAsset","assets","ecosystem","isTestChain","key","name","nativeAsset","type","data","keyOrAsset","chainAsset","import_viem","Parachain","Chain","genesisHash","parachainId","usesChainDecimals","ss58Format","weight","ws","type","others","EvmParachain","Parachain","id","rpc","isEvmSigner","contracts","others"]}
|
package/build/index.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ declare class Asset {
|
|
|
10
10
|
readonly key: string;
|
|
11
11
|
readonly originSymbol: string;
|
|
12
12
|
constructor({ key, originSymbol }: AssetConstructorParams);
|
|
13
|
+
copyWith(params: Partial<AssetConstructorParams>): Asset;
|
|
13
14
|
isEqual(asset: Asset): boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -37,6 +38,7 @@ declare class ChainAsset extends Asset {
|
|
|
37
38
|
readonly min?: bigint;
|
|
38
39
|
constructor({ address, decimals, ids, min, symbol, ...other }: ChainAssetConstructorParams);
|
|
39
40
|
static fromAsset(asset: Asset, params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>): ChainAsset;
|
|
41
|
+
copyWith(params: Partial<ChainAssetConstructorParams>): ChainAsset;
|
|
40
42
|
get symbol(): string;
|
|
41
43
|
getAssetId(): ChainAssetId;
|
|
42
44
|
getBalanceAssetId(): ChainAssetId;
|
|
@@ -66,7 +68,6 @@ declare class AssetAmount extends ChainAsset {
|
|
|
66
68
|
type SetOptional<Base, Keys extends keyof Base> = Omit<Base, Keys> & Partial<Pick<Base, Keys>>;
|
|
67
69
|
|
|
68
70
|
interface ParachainConstructorParams extends SetOptional<ChainConstructorParams, 'type'> {
|
|
69
|
-
assets?: Map<string, ChainAsset> | ChainAsset[];
|
|
70
71
|
genesisHash: string;
|
|
71
72
|
parachainId: number;
|
|
72
73
|
ss58Format: number;
|
|
@@ -75,39 +76,30 @@ interface ParachainConstructorParams extends SetOptional<ChainConstructorParams,
|
|
|
75
76
|
ws: string | string[];
|
|
76
77
|
}
|
|
77
78
|
declare class Parachain extends Chain {
|
|
78
|
-
readonly assets: Map<string, ChainAsset>;
|
|
79
79
|
readonly genesisHash: string;
|
|
80
80
|
readonly parachainId: number;
|
|
81
81
|
readonly ss58Format: number;
|
|
82
82
|
readonly usesChainDecimals: boolean;
|
|
83
83
|
readonly weight: number | undefined;
|
|
84
84
|
readonly ws: string | string[];
|
|
85
|
-
constructor({
|
|
86
|
-
getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset;
|
|
85
|
+
constructor({ genesisHash, parachainId, usesChainDecimals, ss58Format, weight, ws, type, ...others }: ParachainConstructorParams);
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
interface EvmParachainConstructorParams extends Omit<ParachainConstructorParams, 'type'> {
|
|
90
89
|
id: number;
|
|
91
90
|
rpc: string;
|
|
92
|
-
nativeCurrency: NativeCurrency;
|
|
93
91
|
isEvmSigner?: boolean;
|
|
94
92
|
contracts?: Contracts;
|
|
95
93
|
}
|
|
96
|
-
type NativeCurrency = {
|
|
97
|
-
decimals: number;
|
|
98
|
-
name: string;
|
|
99
|
-
symbol: string;
|
|
100
|
-
};
|
|
101
94
|
type Contracts = {
|
|
102
95
|
Xtokens?: Address;
|
|
103
96
|
};
|
|
104
97
|
declare class EvmParachain extends Parachain {
|
|
105
98
|
readonly id: number;
|
|
106
99
|
readonly rpc: string;
|
|
107
|
-
readonly nativeCurrency: NativeCurrency;
|
|
108
100
|
readonly isEvmSigner: boolean;
|
|
109
101
|
readonly contracts?: Contracts;
|
|
110
|
-
constructor({ id, rpc,
|
|
102
|
+
constructor({ id, rpc, isEvmSigner, contracts, ...others }: EvmParachainConstructorParams);
|
|
111
103
|
getViemChain(): Chain$1;
|
|
112
104
|
}
|
|
113
105
|
|
|
@@ -124,19 +116,25 @@ declare enum Ecosystem {
|
|
|
124
116
|
}
|
|
125
117
|
|
|
126
118
|
interface ChainConstructorParams {
|
|
119
|
+
assets: Map<string, ChainAsset> | ChainAsset[];
|
|
127
120
|
ecosystem?: Ecosystem;
|
|
128
121
|
isTestChain?: boolean;
|
|
129
122
|
key: string;
|
|
130
123
|
name: string;
|
|
124
|
+
nativeAsset: Asset;
|
|
131
125
|
type: ChainType;
|
|
132
126
|
}
|
|
133
127
|
declare abstract class Chain {
|
|
128
|
+
#private;
|
|
129
|
+
readonly assets: Map<string, ChainAsset>;
|
|
134
130
|
readonly ecosystem?: Ecosystem;
|
|
135
131
|
readonly isTestChain: boolean;
|
|
136
132
|
readonly key: string;
|
|
137
133
|
readonly name: string;
|
|
138
134
|
readonly type: ChainType;
|
|
139
|
-
constructor({ ecosystem, isTestChain, key, name, type, }: ChainConstructorParams);
|
|
135
|
+
constructor({ assets, ecosystem, isTestChain, key, name, nativeAsset, type, }: ChainConstructorParams);
|
|
136
|
+
get nativeAsset(): ChainAsset;
|
|
137
|
+
getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset;
|
|
140
138
|
isParachain(): this is Parachain;
|
|
141
139
|
isEvmParachain(): this is EvmParachain;
|
|
142
140
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare class Asset {
|
|
|
10
10
|
readonly key: string;
|
|
11
11
|
readonly originSymbol: string;
|
|
12
12
|
constructor({ key, originSymbol }: AssetConstructorParams);
|
|
13
|
+
copyWith(params: Partial<AssetConstructorParams>): Asset;
|
|
13
14
|
isEqual(asset: Asset): boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -51,6 +52,7 @@ declare class ChainAsset extends Asset {
|
|
|
51
52
|
asset: Asset,
|
|
52
53
|
params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>,
|
|
53
54
|
): ChainAsset;
|
|
55
|
+
copyWith(params: Partial<ChainAssetConstructorParams>): ChainAsset;
|
|
54
56
|
get symbol(): string;
|
|
55
57
|
getAssetId(): ChainAssetId;
|
|
56
58
|
getBalanceAssetId(): ChainAssetId;
|
|
@@ -88,7 +90,6 @@ type SetOptional<Base, Keys extends keyof Base> = Omit<Base, Keys> &
|
|
|
88
90
|
|
|
89
91
|
interface ParachainConstructorParams
|
|
90
92
|
extends SetOptional<ChainConstructorParams, 'type'> {
|
|
91
|
-
assets?: Map<string, ChainAsset> | ChainAsset[];
|
|
92
93
|
genesisHash: string;
|
|
93
94
|
parachainId: number;
|
|
94
95
|
ss58Format: number;
|
|
@@ -97,7 +98,6 @@ interface ParachainConstructorParams
|
|
|
97
98
|
ws: string | string[];
|
|
98
99
|
}
|
|
99
100
|
declare class Parachain extends Chain {
|
|
100
|
-
readonly assets: Map<string, ChainAsset>;
|
|
101
101
|
readonly genesisHash: string;
|
|
102
102
|
readonly parachainId: number;
|
|
103
103
|
readonly ss58Format: number;
|
|
@@ -105,7 +105,6 @@ declare class Parachain extends Chain {
|
|
|
105
105
|
readonly weight: number | undefined;
|
|
106
106
|
readonly ws: string | string[];
|
|
107
107
|
constructor({
|
|
108
|
-
assets,
|
|
109
108
|
genesisHash,
|
|
110
109
|
parachainId,
|
|
111
110
|
usesChainDecimals,
|
|
@@ -115,35 +114,26 @@ declare class Parachain extends Chain {
|
|
|
115
114
|
type,
|
|
116
115
|
...others
|
|
117
116
|
}: ParachainConstructorParams);
|
|
118
|
-
getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset;
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
interface EvmParachainConstructorParams
|
|
122
120
|
extends Omit<ParachainConstructorParams, 'type'> {
|
|
123
121
|
id: number;
|
|
124
122
|
rpc: string;
|
|
125
|
-
nativeCurrency: NativeCurrency;
|
|
126
123
|
isEvmSigner?: boolean;
|
|
127
124
|
contracts?: Contracts;
|
|
128
125
|
}
|
|
129
|
-
type NativeCurrency = {
|
|
130
|
-
decimals: number;
|
|
131
|
-
name: string;
|
|
132
|
-
symbol: string;
|
|
133
|
-
};
|
|
134
126
|
type Contracts = {
|
|
135
127
|
Xtokens?: Address;
|
|
136
128
|
};
|
|
137
129
|
declare class EvmParachain extends Parachain {
|
|
138
130
|
readonly id: number;
|
|
139
131
|
readonly rpc: string;
|
|
140
|
-
readonly nativeCurrency: NativeCurrency;
|
|
141
132
|
readonly isEvmSigner: boolean;
|
|
142
133
|
readonly contracts?: Contracts;
|
|
143
134
|
constructor({
|
|
144
135
|
id,
|
|
145
136
|
rpc,
|
|
146
|
-
nativeCurrency,
|
|
147
137
|
isEvmSigner,
|
|
148
138
|
contracts,
|
|
149
139
|
...others
|
|
@@ -164,25 +154,33 @@ declare enum Ecosystem {
|
|
|
164
154
|
}
|
|
165
155
|
|
|
166
156
|
interface ChainConstructorParams {
|
|
157
|
+
assets: Map<string, ChainAsset> | ChainAsset[];
|
|
167
158
|
ecosystem?: Ecosystem;
|
|
168
159
|
isTestChain?: boolean;
|
|
169
160
|
key: string;
|
|
170
161
|
name: string;
|
|
162
|
+
nativeAsset: Asset;
|
|
171
163
|
type: ChainType;
|
|
172
164
|
}
|
|
173
165
|
declare abstract class Chain {
|
|
166
|
+
#private;
|
|
167
|
+
readonly assets: Map<string, ChainAsset>;
|
|
174
168
|
readonly ecosystem?: Ecosystem;
|
|
175
169
|
readonly isTestChain: boolean;
|
|
176
170
|
readonly key: string;
|
|
177
171
|
readonly name: string;
|
|
178
172
|
readonly type: ChainType;
|
|
179
173
|
constructor({
|
|
174
|
+
assets,
|
|
180
175
|
ecosystem,
|
|
181
176
|
isTestChain,
|
|
182
177
|
key,
|
|
183
178
|
name,
|
|
179
|
+
nativeAsset,
|
|
184
180
|
type,
|
|
185
181
|
}: ChainConstructorParams);
|
|
182
|
+
get nativeAsset(): ChainAsset;
|
|
183
|
+
getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset;
|
|
186
184
|
isParachain(): this is Parachain;
|
|
187
185
|
isEvmParachain(): this is EvmParachain;
|
|
188
186
|
}
|
package/build/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m=class e{key;originSymbol;constructor({key:t,originSymbol:s}){this.key=t,this.originSymbol=s}copyWith(t){return new e({...this,...t})}isEqual(t){return this.key===t.key&&this.originSymbol===t.originSymbol}};import{toBigInt as C}from"@moonbeam-network/xcm-utils";var h=class e extends m{address;decimals;ids;min;#t;constructor({address:t,decimals:s,ids:r,min:n,symbol:a,...i}){super(i),this.address=t,this.decimals=s,this.ids=r,this.min=n?C(n,s):void 0,this.#t=a}static fromAsset(t,s){return new e({...t,...s})}copyWith(t){return new e({...this,symbol:this.#t,...t})}get symbol(){return this.#t||this.originSymbol}getAssetId(){var t;return((t=this.ids)==null?void 0:t.id)??this.originSymbol}getBalanceAssetId(){var t;return((t=this.ids)==null?void 0:t.balanceId)??this.getAssetId()}getMinAssetId(){var t;return((t=this.ids)==null?void 0:t.minId)??this.getAssetId()}getAssetPalletInstance(){var t;return(t=this.ids)==null?void 0:t.palletInstance}getAssetMin(){return this.min??0n}};import{convertDecimals as g,toBigInt as P,toDecimal as b}from"@moonbeam-network/xcm-utils";import p from"big.js";p.NE=-18;var y=class e extends h{amount;constructor({amount:t,...s}){super(s),this.amount=P(t,s.decimals)}static fromChainAsset(t,s){return new e({...t,...s})}isSame(t){return super.isEqual(t)&&this.decimals===t.decimals}isEqual(t){return this.isSame(t)&&this.amount===t.amount}copyWith(t){return new e({...this,...t})}convertDecimals(t){return this.decimals===t?this.copyWith({}):this.copyWith({amount:g(this.amount,this.decimals,t),decimals:t})}toBig(){return p(this.amount.toString())}toBigDecimal(t,s){return p(this.toDecimal(t,s))}toDecimal(t,s){return b(this.amount,this.decimals,t,s)}};var c=(s=>(s.Parachain="parachain",s.EvmParachain="evm-parachain",s))(c||{}),f=(r=>(r.Polkadot="polkadot",r.Kusama="kusama",r.AlphanetRelay="alphanet-relay",r))(f||{});var u=class{assets;ecosystem;isTestChain;key;name;#t;type;constructor({assets:t,ecosystem:s,isTestChain:r=!1,key:n,name:a,nativeAsset:i,type:l}){this.assets=t instanceof Map?t:new Map(t==null?void 0:t.map(o=>[o.key,o])),this.ecosystem=s,this.isTestChain=r,this.key=n,this.name=a,this.#t=i,this.type=l}get nativeAsset(){return this.getChainAsset(this.#t)}getChainAsset(t){let s=typeof t=="string"?t:t.key,r=this.assets.get(s);if(!r)throw new Error(`No ChainAsset found by the key ${s} for chain ${this.name} (${this.key})`);return r}isParachain(){return this.type==="parachain"}isEvmParachain(){return this.type==="evm-parachain"}};import{defineChain as x}from"viem";var d=class extends u{genesisHash;parachainId;ss58Format;usesChainDecimals;weight;ws;constructor({genesisHash:t,parachainId:s,usesChainDecimals:r,ss58Format:n,weight:a,ws:i,type:l="parachain",...o}){super({type:l,...o}),this.genesisHash=t,this.parachainId=s,this.ss58Format=n,this.usesChainDecimals=!!r,this.weight=a,this.ws=i}};var A=class extends d{id;rpc;isEvmSigner;contracts;constructor({id:t,rpc:s,isEvmSigner:r=!1,contracts:n,...a}){super({type:"evm-parachain",...a}),this.contracts=n,this.id=t,this.rpc=s,this.isEvmSigner=r}getViemChain(){return x({id:this.id,name:this.name,nativeCurrency:{decimals:this.nativeAsset.decimals,name:this.nativeAsset.originSymbol,symbol:this.nativeAsset.originSymbol},rpcUrls:{default:{http:[this.rpc],webSocket:Array.isArray(this.ws)?this.ws:[this.ws]}}})}};export{m as Asset,y as AssetAmount,u as Chain,h as ChainAsset,c as ChainType,f as Ecosystem,A as EvmParachain,d as Parachain};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asset/Asset.ts","../src/asset/ChainAsset.ts","../src/asset/AssetAmount.ts","../src/chain/Chain.interfaces.ts","../src/chain/Chain.ts","../src/chain/parachain/EvmParachain.ts","../src/chain/parachain/Parachain.ts"],"sourcesContent":["export interface AssetConstructorParams {\n key: string;\n originSymbol: string;\n}\n\nexport class Asset {\n readonly key: string;\n\n readonly originSymbol: string;\n\n constructor({ key, originSymbol }: AssetConstructorParams) {\n this.key = key;\n this.originSymbol = originSymbol;\n }\n\n isEqual(asset: Asset): boolean {\n return this.key === asset.key && this.originSymbol === asset.originSymbol;\n }\n}\n","import { toBigInt } from '@moonbeam-network/xcm-utils';\nimport { Asset, AssetConstructorParams } from './Asset';\n\nexport interface ChainAssetConstructorParams extends AssetConstructorParams {\n address?: string;\n decimals: number;\n ids?: ChainAssetIds;\n min?: number | bigint;\n symbol?: string;\n}\n\nexport interface ChainAssetIds {\n balanceId?: ChainAssetId;\n id?: ChainAssetId;\n minId?: ChainAssetId;\n palletInstance?: number;\n}\n\nexport type ChainAssetId =\n | string\n | number\n | bigint\n | { [key: string]: ChainAssetId };\n\nexport class ChainAsset extends Asset {\n readonly address?: string;\n\n readonly decimals: number;\n\n readonly ids?: ChainAssetIds;\n\n readonly min?: bigint;\n\n readonly #symbol?: string;\n\n constructor({\n address,\n decimals,\n ids,\n min,\n symbol,\n ...other\n }: ChainAssetConstructorParams) {\n super(other);\n\n this.address = address;\n this.decimals = decimals;\n this.ids = ids;\n this.min = min ? toBigInt(min, decimals) : undefined;\n this.#symbol = symbol;\n }\n\n static fromAsset(\n asset: Asset,\n params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>,\n ): ChainAsset {\n return new ChainAsset({\n ...asset,\n ...params,\n });\n }\n\n get symbol(): string {\n return this.#symbol || this.originSymbol;\n }\n\n getAssetId(): ChainAssetId {\n return this.ids?.id ?? this.originSymbol;\n }\n\n getBalanceAssetId(): ChainAssetId {\n return this.ids?.balanceId ?? this.getAssetId();\n }\n\n getMinAssetId(): ChainAssetId {\n return this.ids?.minId ?? this.getAssetId();\n }\n\n getAssetPalletInstance(): number | undefined {\n return this.ids?.palletInstance;\n }\n\n getAssetMin(): bigint {\n return this.min ?? 0n;\n }\n}\n","import {\n convertDecimals,\n toBigInt,\n toDecimal,\n} from '@moonbeam-network/xcm-utils';\nimport Big, { RoundingMode } from 'big.js';\nimport { ChainAsset, ChainAssetConstructorParams } from './ChainAsset';\n\nBig.NE = -18;\n\nexport interface AssetAmountConstructorParams\n extends ChainAssetConstructorParams {\n amount: number | bigint;\n decimals: number;\n symbol?: string;\n}\n\nexport class AssetAmount extends ChainAsset {\n readonly amount: bigint;\n\n constructor({ amount, ...other }: AssetAmountConstructorParams) {\n super(other);\n\n this.amount = toBigInt(amount, other.decimals);\n }\n\n static fromChainAsset(\n asset: ChainAsset,\n params: Omit<\n AssetAmountConstructorParams,\n keyof ChainAssetConstructorParams\n >,\n ): AssetAmount {\n return new AssetAmount({\n ...asset,\n ...params,\n });\n }\n\n isSame(asset: AssetAmount): boolean {\n return super.isEqual(asset) && this.decimals === asset.decimals;\n }\n\n isEqual(asset: AssetAmount): boolean {\n return this.isSame(asset) && this.amount === asset.amount;\n }\n\n copyWith(params: Partial<AssetAmountConstructorParams>) {\n return new AssetAmount({\n ...this,\n ...params,\n });\n }\n\n convertDecimals(decimals: number): AssetAmount {\n if (this.decimals === decimals) {\n return this.copyWith({});\n }\n\n return this.copyWith({\n amount: convertDecimals(this.amount, this.decimals, decimals),\n decimals,\n });\n }\n\n toBig(): Big {\n return Big(this.amount.toString());\n }\n\n toBigDecimal(maxDecimal?: number, roundType?: RoundingMode): Big {\n return Big(this.toDecimal(maxDecimal, roundType));\n }\n\n toDecimal(maxDecimal?: number, roundType?: RoundingMode): string {\n return toDecimal(this.amount, this.decimals, maxDecimal, roundType);\n }\n}\n","import type { EvmParachain, Parachain } from './parachain';\n\nexport type AnyChain = Parachain | EvmParachain;\nexport type AnyParachain = Parachain | EvmParachain;\n\nexport enum ChainType {\n 'Parachain' = 'parachain',\n 'EvmParachain' = 'evm-parachain',\n}\n\nexport enum Ecosystem {\n Polkadot = 'polkadot',\n Kusama = 'kusama',\n AlphanetRelay = 'alphanet-relay',\n}\n","import { ChainType, Ecosystem } from './Chain.interfaces';\nimport type { EvmParachain, Parachain } from './parachain';\n\nexport interface ChainConstructorParams {\n ecosystem?: Ecosystem;\n isTestChain?: boolean;\n key: string;\n name: string;\n type: ChainType;\n}\n\nexport abstract class Chain {\n readonly ecosystem?: Ecosystem;\n\n readonly isTestChain: boolean;\n\n readonly key: string;\n\n readonly name: string;\n\n readonly type: ChainType;\n\n constructor({\n ecosystem,\n isTestChain = false,\n key,\n name,\n type,\n }: ChainConstructorParams) {\n this.ecosystem = ecosystem;\n this.isTestChain = isTestChain;\n this.key = key;\n this.name = name;\n this.type = type;\n }\n\n isParachain(): this is Parachain {\n return this.type === ChainType.Parachain;\n }\n\n isEvmParachain(): this is EvmParachain {\n return this.type === ChainType.EvmParachain;\n }\n}\n","import { Address, defineChain } from 'viem';\nimport { Chain } from 'viem/chains';\nimport { ChainType } from '../Chain.interfaces';\nimport { Parachain, ParachainConstructorParams } from './Parachain';\n\nexport interface EvmParachainConstructorParams\n extends Omit<ParachainConstructorParams, 'type'> {\n id: number;\n rpc: string;\n nativeCurrency: NativeCurrency;\n isEvmSigner?: boolean;\n contracts?: Contracts;\n}\n\ntype NativeCurrency = {\n decimals: number;\n name: string;\n symbol: string;\n};\n\ntype Contracts = {\n Xtokens?: Address;\n};\n\nexport class EvmParachain extends Parachain {\n readonly id: number;\n\n readonly rpc: string;\n\n readonly nativeCurrency: NativeCurrency;\n\n readonly isEvmSigner: boolean;\n\n readonly contracts?: Contracts;\n\n constructor({\n id,\n rpc,\n nativeCurrency,\n isEvmSigner = false,\n contracts,\n ...others\n }: EvmParachainConstructorParams) {\n super({ type: ChainType.EvmParachain, ...others });\n\n this.contracts = contracts;\n this.id = id;\n this.rpc = rpc;\n this.nativeCurrency = nativeCurrency;\n this.isEvmSigner = isEvmSigner;\n }\n\n getViemChain(): Chain {\n return defineChain({\n id: this.id,\n name: this.name,\n nativeCurrency: this.nativeCurrency,\n rpcUrls: {\n default: {\n http: [this.rpc],\n webSocket: Array.isArray(this.ws) ? this.ws : [this.ws],\n },\n },\n });\n }\n}\n","import { Asset, AssetAmount, ChainAsset } from '../../asset';\nimport { SetOptional } from '../../common.interfaces';\nimport { Chain, ChainConstructorParams } from '../Chain';\nimport { ChainType } from '../Chain.interfaces';\n\nexport interface ParachainConstructorParams\n extends SetOptional<ChainConstructorParams, 'type'> {\n assets?: Map<string, ChainAsset> | ChainAsset[];\n genesisHash: string;\n parachainId: number;\n ss58Format: number;\n usesChainDecimals?: boolean;\n weight?: number;\n ws: string | string[];\n}\n\nexport class Parachain extends Chain {\n readonly assets: Map<string, ChainAsset>;\n\n readonly genesisHash: string;\n\n readonly parachainId: number;\n\n readonly ss58Format: number;\n\n readonly usesChainDecimals: boolean;\n\n readonly weight: number | undefined;\n\n readonly ws: string | string[];\n\n constructor({\n assets,\n genesisHash,\n parachainId,\n usesChainDecimals,\n ss58Format,\n weight,\n ws,\n type = ChainType.Parachain,\n ...others\n }: ParachainConstructorParams) {\n super({ type, ...others });\n\n this.assets =\n assets instanceof Map\n ? assets\n : new Map(assets?.map((data) => [data.key, data]));\n this.genesisHash = genesisHash;\n this.parachainId = parachainId;\n this.ss58Format = ss58Format;\n this.usesChainDecimals = !!usesChainDecimals;\n this.weight = weight;\n this.ws = ws;\n }\n\n getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset {\n const key = typeof keyOrAsset === 'string' ? keyOrAsset : keyOrAsset.key;\n const chainAsset = this.assets.get(key);\n\n if (!chainAsset) {\n throw new Error(\n `No ChainAsset found by the key ${key} for chain ${this.name} (${this.key})`,\n );\n }\n\n return chainAsset;\n }\n}\n"],"mappings":"AAKO,IAAMA,EAAN,KAAY,CACR,IAEA,aAET,YAAY,CAAE,IAAAC,EAAK,aAAAC,CAAa,EAA2B,CACzD,KAAK,IAAMD,EACX,KAAK,aAAeC,CACtB,CAEA,QAAQC,EAAuB,CAC7B,OAAO,KAAK,MAAQA,EAAM,KAAO,KAAK,eAAiBA,EAAM,YAC/D,CACF,EClBA,OAAS,YAAA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AE,EAAI,KAAK,GAAK,CAAC,KAAK,EAAE,CACxD,CACF,CACF,CAAC,CACH,CACF","names":["Asset","key","originSymbol","asset","toBigInt","ChainAsset","_ChainAsset","Asset","#symbol","address","decimals","ids","min","symbol","other","toBigInt","asset","params","_a","convertDecimals","toBigInt","toDecimal","Big","Big","AssetAmount","_AssetAmount","ChainAsset","amount","other","toBigInt","asset","params","decimals","convertDecimals","maxDecimal","roundType","toDecimal","ChainType","Ecosystem","Chain","ecosystem","isTestChain","key","name","type","defineChain","Parachain","Chain","assets","genesisHash","parachainId","usesChainDecimals","ss58Format","weight","ws","type","others","data","keyOrAsset","key","chainAsset","EvmParachain","Parachain","id","rpc","nativeCurrency","isEvmSigner","contracts","others","defineChain"]}
|
|
1
|
+
{"version":3,"sources":["../src/asset/Asset.ts","../src/asset/ChainAsset.ts","../src/asset/AssetAmount.ts","../src/chain/Chain.interfaces.ts","../src/chain/Chain.ts","../src/chain/parachain/EvmParachain.ts","../src/chain/parachain/Parachain.ts"],"sourcesContent":["export interface AssetConstructorParams {\n key: string;\n originSymbol: string;\n}\n\nexport class Asset {\n readonly key: string;\n\n readonly originSymbol: string;\n\n constructor({ key, originSymbol }: AssetConstructorParams) {\n this.key = key;\n this.originSymbol = originSymbol;\n }\n\n copyWith(params: Partial<AssetConstructorParams>): Asset {\n return new Asset({\n ...this,\n ...params,\n });\n }\n\n isEqual(asset: Asset): boolean {\n return this.key === asset.key && this.originSymbol === asset.originSymbol;\n }\n}\n","import { toBigInt } from '@moonbeam-network/xcm-utils';\nimport { Asset, AssetConstructorParams } from './Asset';\n\nexport interface ChainAssetConstructorParams extends AssetConstructorParams {\n address?: string;\n decimals: number;\n ids?: ChainAssetIds;\n min?: number | bigint;\n symbol?: string;\n}\n\nexport interface ChainAssetIds {\n balanceId?: ChainAssetId;\n id?: ChainAssetId;\n minId?: ChainAssetId;\n palletInstance?: number;\n}\n\nexport type ChainAssetId =\n | string\n | number\n | bigint\n | { [key: string]: ChainAssetId };\n\nexport class ChainAsset extends Asset {\n readonly address?: string;\n\n readonly decimals: number;\n\n readonly ids?: ChainAssetIds;\n\n readonly min?: bigint;\n\n readonly #symbol?: string;\n\n constructor({\n address,\n decimals,\n ids,\n min,\n symbol,\n ...other\n }: ChainAssetConstructorParams) {\n super(other);\n\n this.address = address;\n this.decimals = decimals;\n this.ids = ids;\n this.min = min ? toBigInt(min, decimals) : undefined;\n this.#symbol = symbol;\n }\n\n static fromAsset(\n asset: Asset,\n params: Omit<ChainAssetConstructorParams, keyof AssetConstructorParams>,\n ): ChainAsset {\n return new ChainAsset({\n ...asset,\n ...params,\n });\n }\n\n copyWith(params: Partial<ChainAssetConstructorParams>): ChainAsset {\n return new ChainAsset({\n ...this,\n symbol: this.#symbol,\n ...params,\n });\n }\n\n get symbol(): string {\n return this.#symbol || this.originSymbol;\n }\n\n getAssetId(): ChainAssetId {\n return this.ids?.id ?? this.originSymbol;\n }\n\n getBalanceAssetId(): ChainAssetId {\n return this.ids?.balanceId ?? this.getAssetId();\n }\n\n getMinAssetId(): ChainAssetId {\n return this.ids?.minId ?? this.getAssetId();\n }\n\n getAssetPalletInstance(): number | undefined {\n return this.ids?.palletInstance;\n }\n\n getAssetMin(): bigint {\n return this.min ?? 0n;\n }\n}\n","import {\n convertDecimals,\n toBigInt,\n toDecimal,\n} from '@moonbeam-network/xcm-utils';\nimport Big, { RoundingMode } from 'big.js';\nimport { ChainAsset, ChainAssetConstructorParams } from './ChainAsset';\n\nBig.NE = -18;\n\nexport interface AssetAmountConstructorParams\n extends ChainAssetConstructorParams {\n amount: number | bigint;\n decimals: number;\n symbol?: string;\n}\n\nexport class AssetAmount extends ChainAsset {\n readonly amount: bigint;\n\n constructor({ amount, ...other }: AssetAmountConstructorParams) {\n super(other);\n\n this.amount = toBigInt(amount, other.decimals);\n }\n\n static fromChainAsset(\n asset: ChainAsset,\n params: Omit<\n AssetAmountConstructorParams,\n keyof ChainAssetConstructorParams\n >,\n ): AssetAmount {\n return new AssetAmount({\n ...asset,\n ...params,\n });\n }\n\n isSame(asset: AssetAmount): boolean {\n return super.isEqual(asset) && this.decimals === asset.decimals;\n }\n\n isEqual(asset: AssetAmount): boolean {\n return this.isSame(asset) && this.amount === asset.amount;\n }\n\n copyWith(params: Partial<AssetAmountConstructorParams>): AssetAmount {\n return new AssetAmount({\n ...this,\n ...params,\n });\n }\n\n convertDecimals(decimals: number): AssetAmount {\n if (this.decimals === decimals) {\n return this.copyWith({});\n }\n\n return this.copyWith({\n amount: convertDecimals(this.amount, this.decimals, decimals),\n decimals,\n });\n }\n\n toBig(): Big {\n return Big(this.amount.toString());\n }\n\n toBigDecimal(maxDecimal?: number, roundType?: RoundingMode): Big {\n return Big(this.toDecimal(maxDecimal, roundType));\n }\n\n toDecimal(maxDecimal?: number, roundType?: RoundingMode): string {\n return toDecimal(this.amount, this.decimals, maxDecimal, roundType);\n }\n}\n","import type { EvmParachain, Parachain } from './parachain';\n\nexport type AnyChain = Parachain | EvmParachain;\nexport type AnyParachain = Parachain | EvmParachain;\n\nexport enum ChainType {\n 'Parachain' = 'parachain',\n 'EvmParachain' = 'evm-parachain',\n}\n\nexport enum Ecosystem {\n Polkadot = 'polkadot',\n Kusama = 'kusama',\n AlphanetRelay = 'alphanet-relay',\n}\n","import { Asset, AssetAmount, ChainAsset } from '../asset';\nimport { ChainType, Ecosystem } from './Chain.interfaces';\nimport type { EvmParachain, Parachain } from './parachain';\n\nexport interface ChainConstructorParams {\n assets: Map<string, ChainAsset> | ChainAsset[];\n ecosystem?: Ecosystem;\n isTestChain?: boolean;\n key: string;\n name: string;\n nativeAsset: Asset;\n type: ChainType;\n}\n\nexport abstract class Chain {\n readonly assets: Map<string, ChainAsset>;\n\n readonly ecosystem?: Ecosystem;\n\n readonly isTestChain: boolean;\n\n readonly key: string;\n\n readonly name: string;\n\n readonly #nativeAsset: Asset;\n\n readonly type: ChainType;\n\n constructor({\n assets,\n ecosystem,\n isTestChain = false,\n key,\n name,\n nativeAsset,\n type,\n }: ChainConstructorParams) {\n this.assets =\n assets instanceof Map\n ? assets\n : new Map(assets?.map((data) => [data.key, data]));\n this.ecosystem = ecosystem;\n this.isTestChain = isTestChain;\n this.key = key;\n this.name = name;\n this.#nativeAsset = nativeAsset;\n this.type = type;\n }\n\n get nativeAsset(): ChainAsset {\n return this.getChainAsset(this.#nativeAsset);\n }\n\n getChainAsset(keyOrAsset: string | Asset | AssetAmount): ChainAsset {\n const key = typeof keyOrAsset === 'string' ? keyOrAsset : keyOrAsset.key;\n const chainAsset = this.assets.get(key);\n\n if (!chainAsset) {\n throw new Error(\n `No ChainAsset found by the key ${key} for chain ${this.name} (${this.key})`,\n );\n }\n\n return chainAsset;\n }\n\n isParachain(): this is Parachain {\n return this.type === ChainType.Parachain;\n }\n\n isEvmParachain(): this is EvmParachain {\n return this.type === ChainType.EvmParachain;\n }\n}\n","import { Address, defineChain } from 'viem';\nimport { Chain } from 'viem/chains';\nimport { ChainType } from '../Chain.interfaces';\nimport { Parachain, ParachainConstructorParams } from './Parachain';\n\nexport interface EvmParachainConstructorParams\n extends Omit<ParachainConstructorParams, 'type'> {\n id: number;\n rpc: string;\n isEvmSigner?: boolean;\n contracts?: Contracts;\n}\n\ntype Contracts = {\n Xtokens?: Address;\n};\n\nexport class EvmParachain extends Parachain {\n readonly id: number;\n\n readonly rpc: string;\n\n readonly isEvmSigner: boolean;\n\n readonly contracts?: Contracts;\n\n constructor({\n id,\n rpc,\n isEvmSigner = false,\n contracts,\n ...others\n }: EvmParachainConstructorParams) {\n super({ type: ChainType.EvmParachain, ...others });\n\n this.contracts = contracts;\n this.id = id;\n this.rpc = rpc;\n this.isEvmSigner = isEvmSigner;\n }\n\n getViemChain(): Chain {\n return defineChain({\n id: this.id,\n name: this.name,\n nativeCurrency: {\n decimals: this.nativeAsset.decimals,\n name: this.nativeAsset.originSymbol,\n symbol: this.nativeAsset.originSymbol,\n },\n rpcUrls: {\n default: {\n http: [this.rpc],\n webSocket: Array.isArray(this.ws) ? this.ws : [this.ws],\n },\n },\n });\n }\n}\n","import { SetOptional } from '../../common.interfaces';\nimport { Chain, ChainConstructorParams } from '../Chain';\nimport { ChainType } from '../Chain.interfaces';\n\nexport interface ParachainConstructorParams\n extends SetOptional<ChainConstructorParams, 'type'> {\n genesisHash: string;\n parachainId: number;\n ss58Format: number;\n usesChainDecimals?: boolean;\n weight?: number;\n ws: string | string[];\n}\n\nexport class Parachain extends Chain {\n readonly genesisHash: string;\n\n readonly parachainId: number;\n\n readonly ss58Format: number;\n\n readonly usesChainDecimals: boolean;\n\n readonly weight: number | undefined;\n\n readonly ws: string | string[];\n\n constructor({\n genesisHash,\n parachainId,\n usesChainDecimals,\n ss58Format,\n weight,\n ws,\n type = ChainType.Parachain,\n ...others\n }: ParachainConstructorParams) {\n super({ type, ...others });\n\n this.genesisHash = genesisHash;\n this.parachainId = parachainId;\n this.ss58Format = ss58Format;\n this.usesChainDecimals = !!usesChainDecimals;\n this.weight = weight;\n this.ws = ws;\n }\n}\n"],"mappings":"AAKO,IAAMA,EAAN,MAAMC,CAAM,CACR,IAEA,aAET,YAAY,CAAE,IAAAC,EAAK,aAAAC,CAAa,EAA2B,CACzD,KAAK,IAAMD,EACX,KAAK,aAAeC,CACtB,CAEA,SAASC,EAAgD,CACvD,OAAO,IAAIH,EAAM,CACf,GAAG,KACH,GAAGG,CACL,CAAC,CACH,CAEA,QAAQC,EAAuB,CAC7B,OAAO,KAAK,MAAQA,EAAM,KAAO,KAAK,eAAiBA,EAAM,YAC/D,CACF,ECzBA,OAAS,YAAAC,MAAgB,8BAwBlB,IAAMC,EAAN,MAAMC,UAAmBC,CAAM,CAC3B,QAEA,SAEA,IAEA,IAEAC,GAET,YAAY,CACV,QAAAC,EACA,SAAAC,EACA,IAAAC,EACA,IAAAC,EACA,OAAAC,EACA,GAAGC,CACL,EAAgC,CAC9B,MAAMA,CAAK,EAEX,KAAK,QAAUL,EACf,KAAK,SAAWC,EAChB,KAAK,IAAMC,EACX,KAAK,IAAMC,EAAMG,E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CACF,CACF,CAAC,CACH,CACF","names":["Asset","_Asset","key","originSymbol","params","asset","toBigInt","ChainAsset","_ChainAsset","Asset","#symbol","address","decimals","ids","min","symbol","other","toBigInt","asset","params","_a","convertDecimals","toBigInt","toDecimal","Big","Big","AssetAmount","_AssetAmount","ChainAsset","amount","other","toBigInt","asset","params","decimals","convertDecimals","maxDecimal","roundType","toDecimal","ChainType","Ecosystem","Chain","#nativeAsset","assets","ecosystem","isTestChain","key","name","nativeAsset","type","data","keyOrAsset","chainAsset","defineChain","Parachain","Chain","genesisHash","parachainId","usesChainDecimals","ss58Format","weight","ws","type","others","EvmParachain","Parachain","id","rpc","isEvmSigner","contracts","others","defineChain"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbeam-network/xcm-types",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.107",
|
|
4
4
|
"description": "Moonbeam XCM Types",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"types": "./build/index.d.ts",
|
|
49
49
|
"main": "./build/index.cjs",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@moonbeam-network/xcm-utils": "1.0.0-dev.
|
|
51
|
+
"@moonbeam-network/xcm-utils": "1.0.0-dev.107",
|
|
52
52
|
"big.js": "^6.2.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|