@chainrails/common 0.2.5 → 0.2.6
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/dist/chainrails-common.es.js +375 -331
- package/dist/chainrails-common.es.mjs +375 -331
- package/dist/chainrails-common.umd.js +2 -2
- package/dist/src/chains/all.d.ts +2 -2
- package/dist/src/chains/all.d.ts.map +1 -1
- package/dist/src/chains/constants.d.ts +21 -1
- package/dist/src/chains/constants.d.ts.map +1 -1
- package/dist/src/chains/index.d.ts +1 -0
- package/dist/src/chains/index.d.ts.map +1 -1
- package/dist/src/chains/types.d.ts +3 -2
- package/dist/src/chains/types.d.ts.map +1 -1
- package/dist/src/chains/utils.d.ts +58 -0
- package/dist/src/chains/utils.d.ts.map +1 -0
- package/dist/src/tokens/types.d.ts +3 -5
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/utils.d.ts +11 -10
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/validation.d.ts +7 -7
- package/dist/src/tokens/validation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(d,
|
|
2
|
-
`);super(a,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=s,this.version=Q}walk(s){return Z(this,s)}}function Z(e,s){return s?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Z(e.cause,s):s?null:e}class ee extends T{constructor({size:s,targetSize:t,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${s}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function A(e,{dir:s,size:t=32}={}){return typeof e=="string"?De(e,{dir:s,size:t}):Ie(e,{dir:s,size:t})}function De(e,{dir:s,size:t=32}={}){if(t===null)return e;const o=e.replace("0x","");if(o.length>t*2)throw new ee({size:Math.ceil(o.length/2),targetSize:t,type:"hex"});return`0x${o[s==="right"?"padEnd":"padStart"](t*2,"0")}`}function Ie(e,{dir:s,size:t=32}={}){if(t===null)return e;if(e.length>t)throw new ee({size:e.length,targetSize:t,type:"bytes"});const o=new Uint8Array(t);for(let i=0;i<t;i++){const r=s==="right";o[r?i:t-i-1]=e[r?i:e.length-i-1]}return o}class ye extends T{constructor({max:s,min:t,signed:o,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${s?`(${t} to ${s})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class Ce extends T{constructor({givenSize:s,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${s} bytes.`,{name:"SizeOverflowError"})}}function R(e,{size:s}){if(J(e)>s)throw new Ce({givenSize:J(e),maxSize:s})}function Re(e,s={}){const{signed:t,size:o}=s,i=BigInt(e);let r;o?t?r=(1n<<BigInt(o)*8n-1n)-1n:r=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&t?-r-1n:0;if(r&&i>r||i<a){const f=typeof e=="bigint"?"n":"";throw new ye({max:r?`${r}${f}`:void 0,min:`${a}${f}`,signed:t,size:o,value:`${e}${f}`})}const m=`0x${(t&&i<0?(1n<<BigInt(o*8))+BigInt(i):i).toString(16)}`;return o?A(m,{size:o}):m}const Ne=new TextEncoder;function ke(e,s={}){return typeof e=="number"||typeof e=="bigint"?Be(e,s):typeof e=="boolean"?Me(e,s):y(e)?te(e,s):ne(e,s)}function Me(e,s={}){const t=new Uint8Array(1);return t[0]=Number(e),typeof s.size=="number"?(R(t,{size:s.size}),A(t,{size:s.size})):t}const E={zero:48,nine:57,A:65,F:70,a:97,f:102};function se(e){if(e>=E.zero&&e<=E.nine)return e-E.zero;if(e>=E.A&&e<=E.F)return e-(E.A-10);if(e>=E.a&&e<=E.f)return e-(E.a-10)}function te(e,s={}){let t=e;s.size&&(R(t,{size:s.size}),t=A(t,{dir:"right",size:s.size}));let o=t.slice(2);o.length%2&&(o=`0${o}`);const i=o.length/2,r=new Uint8Array(i);for(let a=0,m=0;a<i;a++){const f=se(o.charCodeAt(m++)),p=se(o.charCodeAt(m++));if(f===void 0||p===void 0)throw new T(`Invalid byte sequence ("${o[m-2]}${o[m-1]}" in "${o}").`);r[a]=f*16+p}return r}function Be(e,s){const t=Re(e,s);return te(t)}function ne(e,s={}){const t=Ne.encode(e);return typeof s.size=="number"?(R(t,{size:s.size}),A(t,{dir:"right",size:s.size})):t}const U=BigInt(2**32-1),oe=BigInt(32);function xe(e,s=!1){return s?{h:Number(e&U),l:Number(e>>oe&U)}:{h:Number(e>>oe&U)|0,l:Number(e&U)|0}}function we(e,s=!1){const t=e.length;let o=new Uint32Array(t),i=new Uint32Array(t);for(let r=0;r<t;r++){const{h:a,l:m}=xe(e[r],s);[o[r],i[r]]=[a,m]}return[o,i]}const ve=(e,s,t)=>e<<t|s>>>32-t,Oe=(e,s,t)=>s<<t|e>>>32-t,He=(e,s,t)=>s<<t-32|e>>>64-t,_e=(e,s,t)=>e<<t-32|s>>>64-t;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Fe(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ie(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function D(e,...s){if(!Fe(e))throw new Error("Uint8Array expected");if(s.length>0&&!s.includes(e.length))throw new Error("Uint8Array expected of length "+s+", got length="+e.length)}function ae(e,s=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(s&&e.finished)throw new Error("Hash#digest() has already been called")}function Le(e,s){D(e);const t=s.outputLen;if(e.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function $e(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function re(...e){for(let s=0;s<e.length;s++)e[s].fill(0)}const Pe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ve(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ke(e){for(let s=0;s<e.length;s++)e[s]=Ve(e[s]);return e}const ce=Pe?e=>e:Ke;function ze(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function de(e){return typeof e=="string"&&(e=ze(e)),D(e),e}class We{}function je(e){const s=o=>e().update(de(o)).digest(),t=e();return s.outputLen=t.outputLen,s.blockLen=t.blockLen,s.create=()=>e(),s}const Ye=BigInt(0),S=BigInt(1),Ge=BigInt(2),Xe=BigInt(7),qe=BigInt(256),Je=BigInt(113),le=[],me=[],ue=[];for(let e=0,s=S,t=1,o=0;e<24;e++){[t,o]=[o,(2*t+3*o)%5],le.push(2*(5*o+t)),me.push((e+1)*(e+2)/2%64);let i=Ye;for(let r=0;r<7;r++)s=(s<<S^(s>>Xe)*Je)%qe,s&Ge&&(i^=S<<(S<<BigInt(r))-S);ue.push(i)}const he=we(ue,!0),Qe=he[0],Ze=he[1],ge=(e,s,t)=>t>32?He(e,s,t):ve(e,s,t),fe=(e,s,t)=>t>32?_e(e,s,t):Oe(e,s,t);function es(e,s=24){const t=new Uint32Array(10);for(let o=24-s;o<24;o++){for(let a=0;a<10;a++)t[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const m=(a+8)%10,f=(a+2)%10,p=t[f],b=t[f+1],fs=ge(p,b,1)^t[m],Es=fe(p,b,1)^t[m+1];for(let I=0;I<50;I+=10)e[a+I]^=fs,e[a+I+1]^=Es}let i=e[2],r=e[3];for(let a=0;a<24;a++){const m=me[a],f=ge(i,r,m),p=fe(i,r,m),b=le[a];i=e[b],r=e[b+1],e[b]=f,e[b+1]=p}for(let a=0;a<50;a+=10){for(let m=0;m<10;m++)t[m]=e[a+m];for(let m=0;m<10;m++)e[a+m]^=~t[(m+2)%10]&t[(m+4)%10]}e[0]^=Qe[o],e[1]^=Ze[o]}re(t)}class N extends We{constructor(s,t,o,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=s,this.suffix=t,this.outputLen=o,this.enableXOF=i,this.rounds=r,ie(o),!(0<s&&s<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$e(this.state)}clone(){return this._cloneInto()}keccak(){ce(this.state32),es(this.state32,this.rounds),ce(this.state32),this.posOut=0,this.pos=0}update(s){ae(this),s=de(s),D(s);const{blockLen:t,state:o}=this,i=s.length;for(let r=0;r<i;){const a=Math.min(t-this.pos,i-r);for(let m=0;m<a;m++)o[this.pos++]^=s[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:s,suffix:t,pos:o,blockLen:i}=this;s[o]^=t,(t&128)!==0&&o===i-1&&this.keccak(),s[i-1]^=128,this.keccak()}writeInto(s){ae(this,!1),D(s),this.finish();const t=this.state,{blockLen:o}=this;for(let i=0,r=s.length;i<r;){this.posOut>=o&&this.keccak();const a=Math.min(o-this.posOut,r-i);s.set(t.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return s}xofInto(s){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(s)}xof(s){return ie(s),this.xofInto(new Uint8Array(s))}digestInto(s){if(Le(s,this),this.finished)throw new Error("digest() was already called");return this.writeInto(s),this.destroy(),s}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,re(this.state)}_cloneInto(s){const{blockLen:t,suffix:o,outputLen:i,rounds:r,enableXOF:a}=this;return s||(s=new N(t,o,i,a,r)),s.state32.set(this.state32),s.pos=this.pos,s.posOut=this.posOut,s.finished=this.finished,s.rounds=r,s.suffix=o,s.outputLen=i,s.enableXOF=a,s.destroyed=this.destroyed,s}}const ss=(e,s,t)=>je(()=>new N(s,e,t)),ts=ss(1,136,256/8);function ns(e,s){return ts(y(e,{strict:!1})?ke(e):e)}class os extends T{constructor({address:s}){super(`Address "${s}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Ee extends Map{constructor(s){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=s}get(s){const t=super.get(s);return super.has(s)&&t!==void 0&&(this.delete(s),super.set(s,t)),t}set(s,t){if(super.set(s,t),this.maxSize&&this.size>this.maxSize){const o=this.keys().next().value;o&&this.delete(o)}return this}}const k=new Ee(8192);function Te(e,s){if(k.has(`${e}.${s}`))return k.get(`${e}.${s}`);const t=e.substring(2).toLowerCase(),o=ns(ne(t)),i=t.split("");for(let a=0;a<40;a+=2)o[a>>1]>>4>=8&&i[a]&&(i[a]=i[a].toUpperCase()),(o[a>>1]&15)>=8&&i[a+1]&&(i[a+1]=i[a+1].toUpperCase());const r=`0x${i.join("")}`;return k.set(`${e}.${s}`,r),r}function g(e,s){if(!as(e,{strict:!1}))throw new os({address:e});return Te(e,s)}const is=/^0x[a-fA-F0-9]{40}$/,M=new Ee(8192);function as(e,s){const{strict:t=!0}=s??{},o=`${e}.${t}`;if(M.has(o))return M.get(o);const i=is.test(e)?e.toLowerCase()===e?!0:t?Te(e)===e:!0:!1;return M.set(o,i),i}const n={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"},rs=n.USDC,l={[c.ARBITRUM]:{[n.DAI]:{address:g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:n.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[n.USDC]:{address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"},[n.USDT]:{address:g("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:n.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[n.WETH]:{address:g("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:n.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.ARBITRUM_TESTNET]:{[n.USDC]:{address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:n.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.AVALANCHE]:{[n.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.USDC]:{address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:n.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[n.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:n.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[n.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:n.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.AVALANCHE_TESTNET]:{[n.USDC]:{address:g("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:n.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.BASE]:{[n.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:n.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[n.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:n.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png"},[n.USDC]:{address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:n.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[n.WETH]:{address:g("0x4200000000000000000000000000000000000006"),symbol:n.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.BASE_TESTNET]:{[n.USDC]:{address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:n.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.BSC]:{[n.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:n.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp"},[n.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:n.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png"},[n.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:n.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[n.USDC]:{address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:n.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[n.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:n.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png"}},[c.ETHEREUM]:{[n.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:n.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png"},[n.DAI]:{address:g("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:n.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[n.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:n.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png"},[n.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:n.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg"},[n.USDC]:{address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[n.USDT]:{address:g("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:n.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[n.WETH]:{address:g("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:n.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.ETHEREUM_TESTNET]:{[n.USDC]:{address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:n.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.HYPEREVM]:{[n.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.LISK]:{[n.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.MONAD]:{[n.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.MONAD_TESTNET]:{[n.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.OPTIMISM]:{[n.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:n.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[n.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"},[n.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:n.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[n.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:n.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.OPTIMISM_TESTNET]:{[n.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.POLYGON]:{[n.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"},[n.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:n.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[n.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:n.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.STARKNET]:{[n.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:n.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[n.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:n.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[n.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:n.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png"},[n.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:n.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg"},[n.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[n.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:n.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"}},[c.STARKNET_TESTNET]:{[n.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:n.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}}},cs={ARBITRUM:l[c.ARBITRUM],ARBITRUM_TESTNET:l[c.ARBITRUM_TESTNET],AVALANCHE:l[c.AVALANCHE],AVALANCHE_TESTNET:l[c.AVALANCHE_TESTNET],BASE:l[c.BASE],BASE_TESTNET:l[c.BASE_TESTNET],BSC:l[c.BSC],ETHEREUM:l[c.ETHEREUM],ETHEREUM_TESTNET:l[c.ETHEREUM_TESTNET],STARKNET:l[c.STARKNET]},ds={ARBITRUM_MAINNET:{...w,tokens:l[c.ARBITRUM]},ARBITRUM_TESTNET:{...v,tokens:l[c.ARBITRUM_TESTNET]},AVALANCHE_MAINNET:{...O,tokens:l[c.AVALANCHE]},AVALANCHE_TESTNET:{...H,tokens:l[c.AVALANCHE_TESTNET]},BASE_MAINNET:{..._,tokens:l[c.BASE]},BASE_TESTNET:{...F,tokens:l[c.BASE_TESTNET]},BSC_MAINNET:{...L,tokens:l[c.BSC]},ETHEREUM_MAINNET:{...$,tokens:l[c.ETHEREUM]},ETHEREUM_TESTNET:{...P,tokens:l[c.ETHEREUM_TESTNET]},HYPEREVM_MAINNET:{...V,tokens:l[c.HYPEREVM]},LISK_MAINNET:{...K,tokens:l[c.LISK]},MONAD_MAINNET:{...z,tokens:l[c.MONAD]},MONAD_TESTNET:{...W,tokens:l[c.MONAD_TESTNET]},OPTIMISM_MAINNET:{...j,tokens:l[c.OPTIMISM]},OPTIMISM_TESTNET:{...Y,tokens:l[c.OPTIMISM_TESTNET]},POLYGON_MAINNET:{...G,tokens:l[c.POLYGON]},STARKNET_MAINNET:{...X,tokens:l[c.STARKNET]},STARKNET_TESTNET:{...q,tokens:l[c.STARKNET_TESTNET]}};function ls(e,s){if(e.symbol!==s)throw new Error(`Token symbol mismatch: token is ${e.symbol}, tokenSymbol is ${s}. The token symbol must match the tokenSymbol parameter.`)}function pe(e,s){const t=s.toLowerCase().trim(),o=l[e];if(!o)throw new Error(`Chain not found: ${e}. The chain key must be a valid chain identifier.`);let i;for(const r in o){const a=o[r];if(a&&a.address.toLowerCase()===t.toLowerCase()){i=a;break}}if(!i)throw new Error(`Token address mismatch: address ${s} does not exist on chain ${e}. The token address must be a valid token address on the specified chain.`);return i}function ms(e,s){if(e.symbol!==s)throw new Error(`Token symbol mismatch: token symbol is "${e.symbol}", expected "${s}". The token symbol must match the expected token symbol.`)}function us(e,s,t){const o=pe(e,s);if(o.symbol!==t)throw new Error(`Token address and symbol mismatch: address ${s} on chain ${e} corresponds to token "${o.symbol}", but expected "${t}". The token address must correspond to a token with the expected symbol on the specified chain.`);return o}function B(e,s){return l[e]?.[s]}function hs(e,s){return B(e,s)?.address}function gs(e,s){return B(e,s)?.decimals}var x=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(x||{});class h{constructor({api_key:s,env:t,seesion_token:o,props:i}){this.api_key=s||"",this.sessionToken=o||"",this.env=t??x.PRODUCTION,this.props=i}static async config(s){if(!h.app){if(!s)throw new Error("Please provide an api_key");h.app=new h(s)}return s&&(s.api_key!==void 0&&(h.app.api_key=s.api_key),s.seesion_token!==void 0&&(h.app.sessionToken=s.seesion_token),s.env!==void 0&&(h.app.env=s.env),s.props!==void 0&&(h.app.props=s.props)),h.app}static getApiKey(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.api_key}static getSessionToken(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.sessionToken}static getProps(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.props}static getEnv(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return h.app.env==="internal"?"staging":h.app.env}static getBaseUrl(){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(h.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(s){if(!h.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const t=h.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=Number(s),i=s&&!isNaN(Number(s))&&o>0?"/pay/":"/deposit/",r=`${s&&!isNaN(Number(s))&&o>0?o*100:""}`;return t+i+r}}d.AmountSymbols=n,d.ChainTypes=u,d.Chainrails=h,d.Chains=c,d.DEFAULT_AMOUNT_SYMBOL=rs,d.TOKEN_REGISTRY=l,d.Tokens=cs,d.allChains=ds,d.arbitrum=w,d.arbitrumTestnet=v,d.assertTokenAddressMatchesChain=pe,d.assertTokenAddressMatchesChainAndSymbol=us,d.assertTokenMatchesAmountSymbol=ls,d.assertTokenSymbolMatches=ms,d.avalanche=O,d.avalancheTestnet=H,d.base=_,d.baseTestnet=F,d.bsc=L,d.celo=be,d.environment=x,d.ethereum=$,d.ethereumTestnet=P,d.getToken=B,d.getTokenAddress=hs,d.getTokenDecimals=gs,d.hyperevm=V,d.linea=Se,d.lisk=K,d.monad=z,d.monadTestnet=W,d.optimism=j,d.optimismTestnet=Y,d.polygon=G,d.starknet=X,d.starknetTestnet=q,d.unichain=Ae,d.worldchain=Ue,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(d,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(d=typeof globalThis<"u"?globalThis:d||self,E(d.Chainrails={}))})(this,(function(d){"use strict";const E={EVM:"EVM",STARKNET:"STARKNET"},c={ARBITRUM:"ARBITRUM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE_MAINNET",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE_MAINNET",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC_MAINNET",ETHEREUM:"ETHEREUM_MAINNET",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM_MAINNET",LISK:"LISK_MAINNET",MONAD:"MONAD_MAINNET",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON_MAINNET",STARKNET:"STARKNET_MAINNET",STARKNET_TESTNET:"STARKNET_TESTNET"},x={ARBITRUM:"ARBITRUM",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC",ETHEREUM:"ETHEREUM",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM",LISK:"LISK",MONAD:"MONAD",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON",STARKNET:"STARKNET",STARKNET_TESTNET:"STARKNET_TESTNET"},v={type:E.EVM,chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg",explorer:"https://arbiscan.io"},O={type:E.EVM,chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg",explorer:"https://sepolia.arbiscan.io"},H={type:E.EVM,chainId:43114,name:"Avalanche",cctpDomain:1,logoURI:"/images/chains/avalanche.svg",explorer:"https://snowtrace.io"},_={type:E.EVM,chainId:43113,name:"Avalanche Fuji",cctpDomain:1,logoURI:"/images/chains/avalanche.svg",explorer:"https://testnet.snowtrace.io"},L={type:E.EVM,chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp",explorer:"https://basescan.org"},F={type:E.EVM,chainId:84532,name:"Base Sepolia",cctpDomain:6,logoURI:"/images/chains/base.webp",explorer:"https://sepolia.basescan.org"},$={type:E.EVM,chainId:56,name:"BNB Chain",cctpDomain:null,logoURI:"/images/chains/bsc.webp",explorer:"https://bscscan.com"},be={type:E.EVM,chainId:42220,name:"Celo",cctpDomain:null,logoURI:"/images/chains/celo.svg",explorer:"https://celoscan.io"},P={type:E.EVM,chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg",explorer:"https://etherscan.io"},V={type:E.EVM,chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg",explorer:"https://sepolia.etherscan.io"},K={type:E.EVM,chainId:999,name:"HyperEVM",cctpDomain:19,logoURI:"/images/chains/hyperevm.webp",explorer:"https://liquidscan.io"},Ie={type:E.EVM,chainId:59144,name:"Linea",cctpDomain:11,logoURI:"/images/chains/linea.svg",explorer:"https://lineascan.build"},z={type:E.EVM,chainId:1135,name:"Lisk",cctpDomain:null,logoURI:"/images/chains/lisk.png",explorer:"https://blockscout.lisk.com"},W={type:E.EVM,chainId:15,name:"Monad",cctpDomain:7,logoURI:"/images/chains/monad.png",explorer:"https://monadvision.com"},Y={type:E.EVM,chainId:10143,name:"Monad Testnet",cctpDomain:null,logoURI:"/images/chains/monad.png",explorer:"https://testnet.monadvision.com"},j={type:E.EVM,chainId:10,name:"Optimism",cctpDomain:2,logoURI:"/images/chains/optimism.svg",explorer:"https://optimistic.etherscan.io"},G={type:E.EVM,chainId:11155420,name:"Optimism Testnet",cctpDomain:2,logoURI:"/images/chains/optimism.svg",explorer:"https://testnet-explorer.optimism.io"},X={type:E.EVM,chainId:137,name:"Polygon",cctpDomain:7,logoURI:"/images/chains/polygon.svg",explorer:"https://polygonscan.com"},q={type:E.STARKNET,chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:25,logoURI:"/images/chains/starknet.svg",explorer:""},J={type:E.STARKNET,chainId:"0x534e5f5345504f4c4941",name:"Starknet Testnet",cctpDomain:null,logoURI:"/images/chains/starknet.svg",explorer:""},Ue={type:E.EVM,chainId:130,name:"Unichain",cctpDomain:10,logoURI:"/images/chains/unichain.webp",explorer:""},De={type:E.EVM,chainId:480,name:"Worldchain",cctpDomain:14,logoURI:"/images/chains/worldchain.svg",explorer:""};function C(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Q(e){return C(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Z="2.43.4";let y={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Z}`};class g extends Error{constructor(t,n={}){const o=n.cause instanceof g?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof g&&n.cause.docsPath||n.docsPath,r=y.getDocsUrl?.({...n,docsPath:i}),a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...o?[`Details: ${o}`]:[],...y.version?[`Version: ${y.version}`]:[]].join(`
|
|
2
|
+
`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Z}walk(t){return ee(this,t)}}function ee(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?ee(e.cause,t):t?null:e}class te extends g{constructor({size:t,targetSize:n,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function b(e,{dir:t,size:n=32}={}){return typeof e=="string"?Ce(e,{dir:t,size:n}):ye(e,{dir:t,size:n})}function Ce(e,{dir:t,size:n=32}={}){if(n===null)return e;const o=e.replace("0x","");if(o.length>n*2)throw new te({size:Math.ceil(o.length/2),targetSize:n,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function ye(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new te({size:e.length,targetSize:n,type:"bytes"});const o=new Uint8Array(n);for(let i=0;i<n;i++){const r=t==="right";o[r?i:n-i-1]=e[r?i:e.length-i-1]}return o}class Re extends g{constructor({max:t,min:n,signed:o,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Ne extends g{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function R(e,{size:t}){if(Q(e)>t)throw new Ne({givenSize:Q(e),maxSize:t})}function Me(e,t={}){const{signed:n,size:o}=t,i=BigInt(e);let r;o?n?r=(1n<<BigInt(o)*8n-1n)-1n:r=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof r=="bigint"&&n?-r-1n:0;if(r&&i>r||i<a){const h=typeof e=="bigint"?"n":"";throw new Re({max:r?`${r}${h}`:void 0,min:`${a}${h}`,signed:n,size:o,value:`${e}${h}`})}const m=`0x${(n&&i<0?(1n<<BigInt(o*8))+BigInt(i):i).toString(16)}`;return o?b(m,{size:o}):m}const ke=new TextEncoder;function Be(e,t={}){return typeof e=="number"||typeof e=="bigint"?xe(e,t):typeof e=="boolean"?we(e,t):C(e)?se(e,t):oe(e,t)}function we(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(R(n,{size:t.size}),b(n,{size:t.size})):n}const f={zero:48,nine:57,A:65,F:70,a:97,f:102};function ne(e){if(e>=f.zero&&e<=f.nine)return e-f.zero;if(e>=f.A&&e<=f.F)return e-(f.A-10);if(e>=f.a&&e<=f.f)return e-(f.a-10)}function se(e,t={}){let n=e;t.size&&(R(n,{size:t.size}),n=b(n,{dir:"right",size:t.size}));let o=n.slice(2);o.length%2&&(o=`0${o}`);const i=o.length/2,r=new Uint8Array(i);for(let a=0,m=0;a<i;a++){const h=ne(o.charCodeAt(m++)),S=ne(o.charCodeAt(m++));if(h===void 0||S===void 0)throw new g(`Invalid byte sequence ("${o[m-2]}${o[m-1]}" in "${o}").`);r[a]=h*16+S}return r}function xe(e,t){const n=Me(e,t);return se(n)}function oe(e,t={}){const n=ke.encode(e);return typeof t.size=="number"?(R(n,{size:t.size}),b(n,{dir:"right",size:t.size})):n}const I=BigInt(2**32-1),ie=BigInt(32);function ve(e,t=!1){return t?{h:Number(e&I),l:Number(e>>ie&I)}:{h:Number(e>>ie&I)|0,l:Number(e&I)|0}}function Oe(e,t=!1){const n=e.length;let o=new Uint32Array(n),i=new Uint32Array(n);for(let r=0;r<n;r++){const{h:a,l:m}=ve(e[r],t);[o[r],i[r]]=[a,m]}return[o,i]}const He=(e,t,n)=>e<<n|t>>>32-n,_e=(e,t,n)=>t<<n|e>>>32-n,Le=(e,t,n)=>t<<n-32|e>>>64-n,Fe=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $e(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ae(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function U(e,...t){if(!$e(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function re(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Pe(e,t){U(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ve(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const Ke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ze(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function We(e){for(let t=0;t<e.length;t++)e[t]=ze(e[t]);return e}const de=Ke?e=>e:We;function Ye(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function le(e){return typeof e=="string"&&(e=Ye(e)),U(e),e}class je{}function Ge(e){const t=o=>e().update(le(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const Xe=BigInt(0),A=BigInt(1),qe=BigInt(2),Je=BigInt(7),Qe=BigInt(256),Ze=BigInt(113),me=[],Ee=[],Te=[];for(let e=0,t=A,n=1,o=0;e<24;e++){[n,o]=[o,(2*n+3*o)%5],me.push(2*(5*o+n)),Ee.push((e+1)*(e+2)/2%64);let i=Xe;for(let r=0;r<7;r++)t=(t<<A^(t>>Je)*Ze)%Qe,t&qe&&(i^=A<<(A<<BigInt(r))-A);Te.push(i)}const ue=Oe(Te,!0),et=ue[0],tt=ue[1],he=(e,t,n)=>n>32?Le(e,t,n):He(e,t,n),fe=(e,t,n)=>n>32?Fe(e,t,n):_e(e,t,n);function nt(e,t=24){const n=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let a=0;a<10;a++)n[a]=e[a]^e[a+10]^e[a+20]^e[a+30]^e[a+40];for(let a=0;a<10;a+=2){const m=(a+8)%10,h=(a+2)%10,S=n[h],p=n[h+1],bt=he(S,p,1)^n[m],It=fe(S,p,1)^n[m+1];for(let D=0;D<50;D+=10)e[a+D]^=bt,e[a+D+1]^=It}let i=e[2],r=e[3];for(let a=0;a<24;a++){const m=Ee[a],h=he(i,r,m),S=fe(i,r,m),p=me[a];i=e[p],r=e[p+1],e[p]=h,e[p+1]=S}for(let a=0;a<50;a+=10){for(let m=0;m<10;m++)n[m]=e[a+m];for(let m=0;m<10;m++)e[a+m]^=~n[(m+2)%10]&n[(m+4)%10]}e[0]^=et[o],e[1]^=tt[o]}ce(n)}class N extends je{constructor(t,n,o,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=o,this.enableXOF=i,this.rounds=r,ae(o),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ve(this.state)}clone(){return this._cloneInto()}keccak(){de(this.state32),nt(this.state32,this.rounds),de(this.state32),this.posOut=0,this.pos=0}update(t){re(this),t=le(t),U(t);const{blockLen:n,state:o}=this,i=t.length;for(let r=0;r<i;){const a=Math.min(n-this.pos,i-r);for(let m=0;m<a;m++)o[this.pos++]^=t[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:o,blockLen:i}=this;t[o]^=n,(n&128)!==0&&o===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){re(this,!1),U(t),this.finish();const n=this.state,{blockLen:o}=this;for(let i=0,r=t.length;i<r;){this.posOut>=o&&this.keccak();const a=Math.min(o-this.posOut,r-i);t.set(n.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ae(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Pe(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ce(this.state)}_cloneInto(t){const{blockLen:n,suffix:o,outputLen:i,rounds:r,enableXOF:a}=this;return t||(t=new N(n,o,i,a,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=o,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}}const st=(e,t,n)=>Ge(()=>new N(t,e,n)),ot=st(1,136,256/8);function it(e,t){return ot(C(e,{strict:!1})?Be(e):e)}class at extends g{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class ge extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const o=this.keys().next().value;o&&this.delete(o)}return this}}const M=new ge(8192);function Se(e,t){if(M.has(`${e}.${t}`))return M.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),o=it(oe(n)),i=n.split("");for(let a=0;a<40;a+=2)o[a>>1]>>4>=8&&i[a]&&(i[a]=i[a].toUpperCase()),(o[a>>1]&15)>=8&&i[a+1]&&(i[a+1]=i[a+1].toUpperCase());const r=`0x${i.join("")}`;return M.set(`${e}.${t}`,r),r}function u(e,t){if(!ct(e,{strict:!1}))throw new at({address:e});return Se(e,t)}const rt=/^0x[a-fA-F0-9]{40}$/,k=new ge(8192);function ct(e,t){const{strict:n=!0}=t??{},o=`${e}.${n}`;if(k.has(o))return k.get(o);const i=rt.test(e)?e.toLowerCase()===e?!0:n?Se(e)===e:!0:!1;return k.set(o,i),i}const s={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"},dt=s.USDC,l={[c.ARBITRUM]:{[s.DAI]:{address:u("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:s.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[s.USDC]:{address:u("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"},[s.USDT]:{address:u("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:s.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[s.WETH]:{address:u("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:s.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.ARBITRUM_TESTNET]:{[s.USDC]:{address:u("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:s.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.AVALANCHE]:{[s.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.USDC]:{address:u("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:s.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[s.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:s.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[s.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:s.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.AVALANCHE_TESTNET]:{[s.USDC]:{address:u("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:s.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.BASE]:{[s.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:s.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[s.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:s.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png"},[s.USDC]:{address:u("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:s.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[s.WETH]:{address:u("0x4200000000000000000000000000000000000006"),symbol:s.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.BASE_TESTNET]:{[s.USDC]:{address:u("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:s.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.BSC]:{[s.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:s.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp"},[s.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:s.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png"},[s.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:s.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[s.USDC]:{address:u("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:s.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[s.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:s.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png"}},[c.ETHEREUM]:{[s.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:s.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png"},[s.DAI]:{address:u("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:s.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[s.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:s.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png"},[s.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:s.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg"},[s.USDC]:{address:u("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[s.USDT]:{address:u("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:s.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[s.WETH]:{address:u("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:s.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.ETHEREUM_TESTNET]:{[s.USDC]:{address:u("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:s.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"}},[c.HYPEREVM]:{[s.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.LISK]:{[s.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.MONAD]:{[s.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.MONAD_TESTNET]:{[s.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.OPTIMISM]:{[s.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:s.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[s.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"},[s.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:s.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[s.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:s.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.OPTIMISM_TESTNET]:{[s.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}},[c.POLYGON]:{[s.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"},[s.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:s.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"},[s.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:s.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png"}},[c.STARKNET]:{[s.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:s.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png"},[s.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:s.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg"},[s.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:s.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png"},[s.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:s.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg"},[s.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},[s.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:s.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png"}},[c.STARKNET_TESTNET]:{[s.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:s.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg"}}},lt={ARBITRUM:l[c.ARBITRUM],ARBITRUM_TESTNET:l[c.ARBITRUM_TESTNET],AVALANCHE:l[c.AVALANCHE],AVALANCHE_TESTNET:l[c.AVALANCHE_TESTNET],BASE:l[c.BASE],BASE_TESTNET:l[c.BASE_TESTNET],BSC:l[c.BSC],ETHEREUM:l[c.ETHEREUM],ETHEREUM_TESTNET:l[c.ETHEREUM_TESTNET],STARKNET:l[c.STARKNET]},mt={ARBITRUM_MAINNET:{...v,tokens:l[c.ARBITRUM]},ARBITRUM_TESTNET:{...O,tokens:l[c.ARBITRUM_TESTNET]},AVALANCHE_MAINNET:{...H,tokens:l[c.AVALANCHE]},AVALANCHE_TESTNET:{..._,tokens:l[c.AVALANCHE_TESTNET]},BASE_MAINNET:{...L,tokens:l[c.BASE]},BASE_TESTNET:{...F,tokens:l[c.BASE_TESTNET]},BSC_MAINNET:{...$,tokens:l[c.BSC]},ETHEREUM_MAINNET:{...P,tokens:l[c.ETHEREUM]},ETHEREUM_TESTNET:{...V,tokens:l[c.ETHEREUM_TESTNET]},HYPEREVM_MAINNET:{...K,tokens:l[c.HYPEREVM]},LISK_MAINNET:{...z,tokens:l[c.LISK]},MONAD_MAINNET:{...W,tokens:l[c.MONAD]},MONAD_TESTNET:{...Y,tokens:l[c.MONAD_TESTNET]},OPTIMISM_MAINNET:{...j,tokens:l[c.OPTIMISM]},OPTIMISM_TESTNET:{...G,tokens:l[c.OPTIMISM_TESTNET]},POLYGON_MAINNET:{...X,tokens:l[c.POLYGON]},STARKNET_MAINNET:{...q,tokens:l[c.STARKNET]},STARKNET_TESTNET:{...J,tokens:l[c.STARKNET_TESTNET]}},Et=new Set(Object.values(c));function Tt(e){if(pe(e))return e;const t=c[e];if(!t)throw new Error(`Invalid chain: ${e}. Chain must be a valid chain alias or internal chain value from Chains.`);return t}function ut(e){for(const[t,n]of Object.entries(c))if(n===e)return t;throw new Error(`Invalid internal chain value: ${e}. Internal chain value must be a valid value from InternalChains.`)}function ht(e){return e in x}function pe(e){return Et.has(e)}function ft(e,t){if(e.symbol!==t)throw new Error(`Token symbol mismatch: token is ${e.symbol}, tokenSymbol is ${t}. The token symbol must match the tokenSymbol parameter.`)}function Ae(e,t){const n=t.toLowerCase().trim(),o=l[e];if(!o)throw new Error(`Chain not found: ${e}. The chain key must be a valid chain identifier.`);let i;for(const r in o){const a=o[r];if(a&&a.address.toLowerCase()===n.toLowerCase()){i=a;break}}if(!i)throw new Error(`Token address mismatch: address ${t} does not exist on chain ${e}. The token address must be a valid token address on the specified chain.`);return i}function gt(e,t){if(e.symbol!==t)throw new Error(`Token symbol mismatch: token symbol is "${e.symbol}", expected "${t}". The token symbol must match the expected token symbol.`)}function St(e,t,n){const o=Ae(e,t);if(o.symbol!==n)throw new Error(`Token address and symbol mismatch: address ${t} on chain ${e} corresponds to token "${o.symbol}", but expected "${n}". The token address must correspond to a token with the expected symbol on the specified chain.`);return o}function B(e,t){return l[e]?.[t]}function pt(e,t){return B(e,t)?.address}function At(e,t){return B(e,t)?.decimals}var w=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(w||{});class T{constructor({api_key:t,env:n,seesion_token:o,props:i}){this.api_key=t||"",this.sessionToken=o||"",this.env=n??w.PRODUCTION,this.props=i}static async config(t){if(!T.app){if(!t)throw new Error("Please provide an api_key");T.app=new T(t)}return t&&(t.api_key!==void 0&&(T.app.api_key=t.api_key),t.seesion_token!==void 0&&(T.app.sessionToken=t.seesion_token),t.env!==void 0&&(T.app.env=t.env),t.props!==void 0&&(T.app.props=t.props)),T.app}static getApiKey(){if(!T.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return T.app.api_key}static getSessionToken(){if(!T.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return T.app.sessionToken}static getProps(){if(!T.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return T.app.props}static getEnv(){if(!T.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return T.app.env==="internal"?"staging":T.app.env}static getBaseUrl(){if(!T.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(T.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(t){if(!T.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=T.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=Number(t),i=t&&!isNaN(Number(t))&&o>0?"/pay/":"/deposit/",r=`${t&&!isNaN(Number(t))&&o>0?o*100:""}`;return n+i+r}}d.AmountSymbols=s,d.ChainTypes=E,d.Chainrails=T,d.Chains=x,d.DEFAULT_AMOUNT_SYMBOL=dt,d.InternalChains=c,d.TOKEN_REGISTRY=l,d.Tokens=lt,d.allChains=mt,d.arbitrum=v,d.arbitrumTestnet=O,d.assertTokenAddressMatchesChain=Ae,d.assertTokenAddressMatchesChainAndSymbol=St,d.assertTokenMatchesAmountSymbol=ft,d.assertTokenSymbolMatches=gt,d.avalanche=H,d.avalancheTestnet=_,d.base=L,d.baseTestnet=F,d.bsc=$,d.celo=be,d.environment=w,d.ethereum=P,d.ethereumTestnet=V,d.getToken=B,d.getTokenAddress=pt,d.getTokenDecimals=At,d.hyperevm=K,d.isChainAlias=ht,d.isInternalChain=pe,d.linea=Ie,d.lisk=z,d.monad=W,d.monadTestnet=Y,d.optimism=j,d.optimismTestnet=G,d.polygon=X,d.starknet=q,d.starknetTestnet=J,d.toChainAlias=ut,d.toInternalChain=Tt,d.unichain=Ue,d.worldchain=De,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/src/chains/all.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const allChains: Record<
|
|
1
|
+
import { InternalChain, ChainData } from "./types";
|
|
2
|
+
export declare const allChains: Record<InternalChain, ChainData>;
|
|
3
3
|
//# sourceMappingURL=all.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../src/chains/all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../src/chains/all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA0BnD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,aAAa,EAAE,SAAS,CAyEtD,CAAC"}
|
|
@@ -3,7 +3,7 @@ export declare const ChainTypes: {
|
|
|
3
3
|
readonly EVM: "EVM";
|
|
4
4
|
readonly STARKNET: "STARKNET";
|
|
5
5
|
};
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const InternalChains: {
|
|
7
7
|
readonly ARBITRUM: "ARBITRUM_MAINNET";
|
|
8
8
|
readonly ARBITRUM_TESTNET: "ARBITRUM_TESTNET";
|
|
9
9
|
readonly AVALANCHE: "AVALANCHE_MAINNET";
|
|
@@ -23,6 +23,26 @@ export declare const Chains: {
|
|
|
23
23
|
readonly STARKNET: "STARKNET_MAINNET";
|
|
24
24
|
readonly STARKNET_TESTNET: "STARKNET_TESTNET";
|
|
25
25
|
};
|
|
26
|
+
export declare const Chains: {
|
|
27
|
+
readonly ARBITRUM: "ARBITRUM";
|
|
28
|
+
readonly ARBITRUM_TESTNET: "ARBITRUM_TESTNET";
|
|
29
|
+
readonly AVALANCHE: "AVALANCHE";
|
|
30
|
+
readonly AVALANCHE_TESTNET: "AVALANCHE_TESTNET";
|
|
31
|
+
readonly BASE: "BASE";
|
|
32
|
+
readonly BASE_TESTNET: "BASE_TESTNET";
|
|
33
|
+
readonly BSC: "BSC";
|
|
34
|
+
readonly ETHEREUM: "ETHEREUM";
|
|
35
|
+
readonly ETHEREUM_TESTNET: "ETHEREUM_TESTNET";
|
|
36
|
+
readonly HYPEREVM: "HYPEREVM";
|
|
37
|
+
readonly LISK: "LISK";
|
|
38
|
+
readonly MONAD: "MONAD";
|
|
39
|
+
readonly MONAD_TESTNET: "MONAD_TESTNET";
|
|
40
|
+
readonly OPTIMISM: "OPTIMISM";
|
|
41
|
+
readonly OPTIMISM_TESTNET: "OPTIMISM_TESTNET";
|
|
42
|
+
readonly POLYGON: "POLYGON";
|
|
43
|
+
readonly STARKNET: "STARKNET";
|
|
44
|
+
readonly STARKNET_TESTNET: "STARKNET_TESTNET";
|
|
45
|
+
};
|
|
26
46
|
export declare const arbitrum: ChainItem;
|
|
27
47
|
export declare const arbitrumTestnet: ChainItem;
|
|
28
48
|
export declare const avalanche: ChainItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/chains/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;CAmBT,CAAC;AAGX,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAOvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAO9B,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,SAOzB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,SAOjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAOnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAOnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAO1B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,SAOrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAOxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/chains/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAGX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAmBjB,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;CAmBT,CAAC;AAGX,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAOvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAO9B,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,SAOzB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,SAOjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAOnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAOlB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,SAOnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAO1B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,SAOrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAO7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAOtB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAOxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chains/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chains/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Token } from "src/tokens";
|
|
2
2
|
import { AmountSymbol } from "src/amountSymbols";
|
|
3
|
-
import { Chains, ChainTypes } from "./constants";
|
|
3
|
+
import { Chains, ChainTypes, InternalChains } from "./constants";
|
|
4
4
|
export type ChainType = (typeof ChainTypes)[keyof typeof ChainTypes];
|
|
5
|
-
export type Chain =
|
|
5
|
+
export type Chain = keyof typeof Chains;
|
|
6
|
+
export type InternalChain = typeof InternalChains[keyof typeof InternalChains];
|
|
6
7
|
export type ChainItem = {
|
|
7
8
|
type: ChainType;
|
|
8
9
|
chainId: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/chains/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/chains/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGjE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG,MAAM,OAAO,MAAM,CAAC;AAGxC,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG;IAClC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Chain, InternalChain } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a chain alias (e.g., "ARBITRUM") to its internal chain value (e.g., "ARBITRUM_MAINNET")
|
|
4
|
+
* If the input is already an internal chain, it returns it as-is.
|
|
5
|
+
*
|
|
6
|
+
* @param chain - Chain alias like "ARBITRUM", "ETHEREUM", etc., or internal chain like "ARBITRUM_MAINNET"
|
|
7
|
+
* @returns Internal chain value like "ARBITRUM_MAINNET", "ETHEREUM_MAINNET", etc.
|
|
8
|
+
* @throws Error if the chain alias or internal chain value is not found
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const internalChain = toInternalChain("ARBITRUM"); // Returns "ARBITRUM_MAINNET"
|
|
13
|
+
* const sameChain = toInternalChain("ARBITRUM_MAINNET"); // Returns "ARBITRUM_MAINNET"
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function toInternalChain(chain: Chain | InternalChain | string): InternalChain;
|
|
17
|
+
/**
|
|
18
|
+
* Converts an internal chain value (e.g., "ARBITRUM_MAINNET") to its chain alias (e.g., "ARBITRUM")
|
|
19
|
+
*
|
|
20
|
+
* @param chain - Internal chain value like "ARBITRUM_MAINNET", "ETHEREUM_MAINNET", etc.
|
|
21
|
+
* @returns Chain alias like "ARBITRUM", "ETHEREUM", etc.
|
|
22
|
+
* @throws Error if the internal chain value is not found
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const alias = toChainAlias("ARBITRUM_MAINNET"); // Returns "ARBITRUM"
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function toChainAlias(chain: InternalChain): Chain;
|
|
30
|
+
/**
|
|
31
|
+
* Type guard to check if a string is a valid chain alias
|
|
32
|
+
*
|
|
33
|
+
* @param chain - String to check
|
|
34
|
+
* @returns True if the string is a valid chain alias
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* if (isChainAlias("ARBITRUM")) {
|
|
39
|
+
* // TypeScript knows chain is Chain type here
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function isChainAlias(chain: string): chain is Chain;
|
|
44
|
+
/**
|
|
45
|
+
* Type guard to check if a string is a valid internal chain value
|
|
46
|
+
*
|
|
47
|
+
* @param chain - String to check
|
|
48
|
+
* @returns True if the string is a valid internal chain value
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* if (isInternalChain("ARBITRUM_MAINNET")) {
|
|
53
|
+
* // TypeScript knows chain is InternalChain type here
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function isInternalChain(chain: string): chain is InternalChain;
|
|
58
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/chains/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI/C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,GAAG,MAAM,GAAG,aAAa,CAUpF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAOxD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,KAAK,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAErE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InternalChain } from "../chains/types";
|
|
2
2
|
import { AmountSymbol } from "../amountSymbols";
|
|
3
3
|
/**
|
|
4
4
|
* Token type representing any token on a chain
|
|
@@ -12,13 +12,11 @@ export type Token = {
|
|
|
12
12
|
logoURI: string;
|
|
13
13
|
logoSourceURI?: string;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Chain key type - all valid chain enum values (e.g., "ARBITRUM_MAINNET", "ETHEREUM_MAINNET")
|
|
17
|
-
*/
|
|
18
15
|
/**
|
|
19
16
|
* Token registry structure
|
|
20
17
|
* Maps chain -> symbol -> Token
|
|
21
18
|
* Using Record to allow partial token coverage per chain
|
|
19
|
+
* Uses InternalChain (values like "ARBITRUM_MAINNET") internally
|
|
22
20
|
*/
|
|
23
|
-
export type TokenRegistry = Record<
|
|
21
|
+
export type TokenRegistry = Record<InternalChain, Partial<Record<AmountSymbol, Token>>>;
|
|
24
22
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tokens/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tokens/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import { Token } from "./types";
|
|
2
|
-
import {
|
|
2
|
+
import { InternalChain } from "../chains/types";
|
|
3
3
|
import { AmountSymbol } from "../amountSymbols";
|
|
4
4
|
/**
|
|
5
5
|
* Get token by chain and symbol
|
|
6
6
|
*
|
|
7
|
-
* @param chain - The chain
|
|
7
|
+
* @param chain - The internal chain value (e.g., "ETHEREUM_MAINNET")
|
|
8
8
|
* @param symbol - The token symbol (e.g., "USDC", "ETH")
|
|
9
9
|
* @returns Token object or undefined if not found
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* const usdc = getToken(
|
|
14
|
-
* const eth = getToken(
|
|
13
|
+
* const usdc = getToken("ETHEREUM_MAINNET", "USDC");
|
|
14
|
+
* const eth = getToken("ETHEREUM_MAINNET", "ETH");
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export declare function getToken(chain:
|
|
17
|
+
export declare function getToken(chain: InternalChain, symbol: AmountSymbol): Token | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* Get token address by chain and symbol
|
|
20
20
|
* Backward compatible function that returns just the address string
|
|
21
21
|
*
|
|
22
|
-
* @param chain - The chain
|
|
22
|
+
* @param chain - The internal chain value (e.g., "ETHEREUM_MAINNET")
|
|
23
23
|
* @param symbol - The token symbol (e.g., "USDC", "ETH")
|
|
24
24
|
* @returns Token address string or undefined if not found
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
28
|
-
* const usdcAddress = getTokenAddress(
|
|
28
|
+
* const usdcAddress = getTokenAddress("ETHEREUM_MAINNET", "USDC");
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export declare function getTokenAddress(chain:
|
|
31
|
+
export declare function getTokenAddress(chain: InternalChain, symbol: AmountSymbol): `0x${string}` | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* Get token decimals for a given chain
|
|
34
34
|
* Legacy function kept for backward compatibility
|
|
35
35
|
*
|
|
36
|
-
* @param chain - The chain
|
|
36
|
+
* @param chain - The internal chain value (e.g., "ETHEREUM_MAINNET")
|
|
37
|
+
* @param symbol - The token symbol (e.g., "USDC", "ETH")
|
|
37
38
|
* @returns Token decimals (defaults to 6 for USDC)
|
|
38
39
|
*/
|
|
39
|
-
export declare function getTokenDecimals(chain:
|
|
40
|
+
export declare function getTokenDecimals(chain: InternalChain, symbol: AmountSymbol): number | undefined;
|
|
40
41
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokens/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokens/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,SAAS,CAEtF;AAGD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,MAAM,EAAE,GAAG,SAAS,CAGrG;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,sBAG1E"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { AmountSymbol } from "../amountSymbols";
|
|
2
2
|
import { Token } from "./types";
|
|
3
|
-
import {
|
|
3
|
+
import { InternalChain } from "../chains/types";
|
|
4
4
|
export declare function assertTokenMatchesAmountSymbol(token: Token, tokenSymbol: AmountSymbol): asserts token is Token;
|
|
5
5
|
/**
|
|
6
6
|
* Asserts that a token address exists on the specified chain.
|
|
7
7
|
*
|
|
8
|
-
* @param chainKey - The chain
|
|
8
|
+
* @param chainKey - The internal chain value (e.g., "ETHEREUM_MAINNET")
|
|
9
9
|
* @param tokenAddress - The token address to validate
|
|
10
10
|
* @returns The token object if found
|
|
11
11
|
* @throws Error if the address does not exist on the specified chain
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* const token = assertTokenAddressMatchesChain(
|
|
15
|
+
* const token = assertTokenAddressMatchesChain("ETHEREUM_MAINNET", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
export declare function assertTokenAddressMatchesChain(chainKey:
|
|
18
|
+
export declare function assertTokenAddressMatchesChain(chainKey: InternalChain, tokenAddress: string): Token;
|
|
19
19
|
/**
|
|
20
20
|
* Asserts that a token's symbol matches the expected token symbol.
|
|
21
21
|
*
|
|
@@ -34,7 +34,7 @@ export declare function assertTokenSymbolMatches(token: Token, tokenSymbol: Amou
|
|
|
34
34
|
* Asserts that a token address exists on the specified chain AND matches the expected token symbol.
|
|
35
35
|
* This is a combined validation that checks both conditions and provides clear error messages.
|
|
36
36
|
*
|
|
37
|
-
* @param chainKey - The chain
|
|
37
|
+
* @param chainKey - The internal chain value (e.g., "ETHEREUM_MAINNET")
|
|
38
38
|
* @param tokenAddress - The token address to validate
|
|
39
39
|
* @param tokenSymbol - The expected token symbol
|
|
40
40
|
* @returns The token object if both validations pass
|
|
@@ -46,11 +46,11 @@ export declare function assertTokenSymbolMatches(token: Token, tokenSymbol: Amou
|
|
|
46
46
|
* @example
|
|
47
47
|
* ```typescript
|
|
48
48
|
* const token = assertTokenAddressMatchesChainAndSymbol(
|
|
49
|
-
*
|
|
49
|
+
* "ETHEREUM_MAINNET",
|
|
50
50
|
* "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
51
51
|
* "USDC"
|
|
52
52
|
* );
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare function assertTokenAddressMatchesChainAndSymbol(chainKey:
|
|
55
|
+
export declare function assertTokenAddressMatchesChainAndSymbol(chainKey: InternalChain, tokenAddress: string, tokenSymbol: AmountSymbol): Token;
|
|
56
56
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/tokens/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/tokens/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC,KAAK,IAAI,KAAK,CAOxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,aAAa,EACvB,YAAY,EAAE,MAAM,GACnB,KAAK,CAkCP;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,YAAY,GACxB,OAAO,CAAC,KAAK,IAAI,KAAK,CAOxB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,aAAa,EACvB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,YAAY,GACxB,KAAK,CAcP"}
|