@chainrails/common 0.0.22 → 0.0.24
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 +658 -41
- package/dist/chainrails-common.es.mjs +658 -41
- package/dist/chainrails-common.umd.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/src/app/index.d.ts +4 -4
- package/dist/src/app/index.d.ts.map +1 -1
- package/dist/src/chains/all.d.ts +5 -0
- package/dist/src/chains/all.d.ts.map +1 -0
- package/dist/src/chains/constants.d.ts +25 -0
- package/dist/src/chains/constants.d.ts.map +1 -0
- 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 +14 -0
- package/dist/src/chains/types.d.ts.map +1 -0
- package/dist/src/tokenAddresses/index.d.ts +8 -0
- package/dist/src/tokenAddresses/index.d.ts.map +1 -0
- package/dist/src/tokens/all.d.ts +35 -0
- package/dist/src/tokens/all.d.ts.map +1 -0
- package/dist/src/tokens/index.d.ts +10 -0
- package/dist/src/tokens/index.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.Chainrails={}))})(this,(function(l){"use strict";var u=(e=>(e.USDC="USDC",e))(u||{});const B={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},k={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},R={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},N={type:"evm",chainId:84532,name:"Base Sepolia",cctpDomain:6,logoURI:"/images/chains/base.webp"},$={type:"evm",chainId:56,name:"BNB Chain",cctpDomain:null,logoURI:"/images/chains/bsc.webp"},M={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},O={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},_={type:"evm",chainId:43114,name:"Avalanche",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},z={type:"evm",chainId:43113,name:"Avalanche Fuji",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},L={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function A(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function H(e){return A(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const P="2.43.4";let U={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${P}`};class p extends Error{constructor(t,n={}){const s=n.cause instanceof p?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof p&&n.cause.docsPath||n.docsPath,r=U.getDocsUrl?.({...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...s?[`Details: ${s}`]:[],...U.version?[`Version: ${U.version}`]:[]].join(`
|
|
2
|
+
`);super(i,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=s,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=P}walk(t){return F(this,t)}}function F(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?F(e.cause,t):t?null:e}class j extends p{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function y(e,{dir:t,size:n=32}={}){return typeof e=="string"?le(e,{dir:t,size:n}):fe(e,{dir:t,size:n})}function le(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new j({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function fe(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new j({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let o=0;o<n;o++){const r=t==="right";s[r?o:n-o-1]=e[r?o:e.length-o-1]}return s}class de extends p{constructor({max:t,min:n,signed:s,size:o,value:r}){super(`Number "${r}" is not in safe ${o?`${o*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class he extends p{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function T(e,{size:t}){if(H(e)>t)throw new he({givenSize:H(e),maxSize:t})}function pe(e,t={}){const{signed:n,size:s}=t,o=BigInt(e);let r;s?n?r=(1n<<BigInt(s)*8n-1n)-1n:r=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<i){const f=typeof e=="bigint"?"n":"";throw new de({max:r?`${r}${f}`:void 0,min:`${i}${f}`,signed:n,size:s,value:`${e}${f}`})}const c=`0x${(n&&o<0?(1n<<BigInt(s*8))+BigInt(o):o).toString(16)}`;return s?y(c,{size:s}):c}const ge=new TextEncoder;function me(e,t={}){return typeof e=="number"||typeof e=="bigint"?ye(e,t):typeof e=="boolean"?be(e,t):A(e)?V(e,t):X(e,t)}function be(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(T(n,{size:t.size}),y(n,{size:t.size})):n}const d={zero:48,nine:57,A:65,F:70,a:97,f:102};function K(e){if(e>=d.zero&&e<=d.nine)return e-d.zero;if(e>=d.A&&e<=d.F)return e-(d.A-10);if(e>=d.a&&e<=d.f)return e-(d.a-10)}function V(e,t={}){let n=e;t.size&&(T(n,{size:t.size}),n=y(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const o=s.length/2,r=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const f=K(s.charCodeAt(c++)),g=K(s.charCodeAt(c++));if(f===void 0||g===void 0)throw new p(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);r[i]=f*16+g}return r}function ye(e,t){const n=pe(e,t);return V(n)}function X(e,t={}){const n=ge.encode(e);return typeof t.size=="number"?(T(n,{size:t.size}),y(n,{dir:"right",size:t.size})):n}const E=BigInt(2**32-1),G=BigInt(32);function Ee(e,t=!1){return t?{h:Number(e&E),l:Number(e>>G&E)}:{h:Number(e>>G&E)|0,l:Number(e&E)|0}}function Ie(e,t=!1){const n=e.length;let s=new Uint32Array(n),o=new Uint32Array(n);for(let r=0;r<n;r++){const{h:i,l:c}=Ee(e[r],t);[s[r],o[r]]=[i,c]}return[s,o]}const Se=(e,t,n)=>e<<n|t>>>32-n,Ae=(e,t,n)=>t<<n|e>>>32-n,Ue=(e,t,n)=>t<<n-32|e>>>64-n,Te=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function we(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function q(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function I(e,...t){if(!we(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 W(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 xe(e,t){I(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ce(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function J(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const De=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 Be(e){for(let t=0;t<e.length;t++)e[t]=ve(e[t]);return e}const Q=De?e=>e:Be;function ke(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Y(e){return typeof e=="string"&&(e=ke(e)),I(e),e}class Re{}function Ne(e){const t=s=>e().update(Y(s)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const $e=BigInt(0),b=BigInt(1),Me=BigInt(2),Oe=BigInt(7),_e=BigInt(256),ze=BigInt(113),Z=[],ee=[],te=[];for(let e=0,t=b,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],Z.push(2*(5*s+n)),ee.push((e+1)*(e+2)/2%64);let o=$e;for(let r=0;r<7;r++)t=(t<<b^(t>>Oe)*ze)%_e,t&Me&&(o^=b<<(b<<BigInt(r))-b);te.push(o)}const ne=Ie(te,!0),Le=ne[0],He=ne[1],se=(e,t,n)=>n>32?Ue(e,t,n):Se(e,t,n),oe=(e,t,n)=>n>32?Te(e,t,n):Ae(e,t,n);function Pe(e,t=24){const n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,f=(i+2)%10,g=n[f],m=n[f+1],it=se(g,m,1)^n[c],rt=oe(g,m,1)^n[c+1];for(let S=0;S<50;S+=10)e[i+S]^=it,e[i+S+1]^=rt}let o=e[2],r=e[3];for(let i=0;i<24;i++){const c=ee[i],f=se(o,r,c),g=oe(o,r,c),m=Z[i];o=e[m],r=e[m+1],e[m]=f,e[m+1]=g}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Le[s],e[1]^=He[s]}J(n)}class w extends Re{constructor(t,n,s,o=!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=s,this.enableXOF=o,this.rounds=r,q(s),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ce(this.state)}clone(){return this._cloneInto()}keccak(){Q(this.state32),Pe(this.state32,this.rounds),Q(this.state32),this.posOut=0,this.pos=0}update(t){W(this),t=Y(t),I(t);const{blockLen:n,state:s}=this,o=t.length;for(let r=0;r<o;){const i=Math.min(n-this.pos,o-r);for(let c=0;c<i;c++)s[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:s,blockLen:o}=this;t[s]^=n,(n&128)!==0&&s===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){W(this,!1),I(t),this.finish();const n=this.state,{blockLen:s}=this;for(let o=0,r=t.length;o<r;){this.posOut>=s&&this.keccak();const i=Math.min(s-this.posOut,r-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return q(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(xe(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,J(this.state)}_cloneInto(t){const{blockLen:n,suffix:s,outputLen:o,rounds:r,enableXOF:i}=this;return t||(t=new w(n,s,o,i,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=s,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Fe=(e,t,n)=>Ne(()=>new w(t,e,n)),je=Fe(1,136,256/8);function Ke(e,t){return je(A(e,{strict:!1})?me(e):e)}class Ve extends p{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 ie 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 s=this.keys().next().value;s&&this.delete(s)}return this}}const x=new ie(8192);function re(e,t){if(x.has(`${e}.${t}`))return x.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=Ke(X(n)),o=n.split("");for(let i=0;i<40;i+=2)s[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(s[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const r=`0x${o.join("")}`;return x.set(`${e}.${t}`,r),r}function h(e,t){if(!Ge(e,{strict:!1}))throw new Ve({address:e});return re(e,t)}const Xe=/^0x[a-fA-F0-9]{40}$/,C=new ie(8192);function Ge(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(C.has(s))return C.get(s);const o=Xe.test(e)?e.toLowerCase()===e?!0:n?re(e)===e:!0:!1;return C.set(s,o),o}const qe={chainId:k.chainId,address:h("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},We={chainId:B.chainId,address:h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},Je={chainId:z.chainId,address:h("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Qe={chainId:_.chainId,address:h("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ye={chainId:N.chainId,address:h("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ze={chainId:R.chainId,address:h("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},et={chainId:$.chainId,address:h("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},tt={chainId:O.chainId,address:h("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},nt={chainId:M.chainId,address:h("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},st={chainId:L.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},D={ARBITRUM_MAINNET:{...B,tokens:{[u.USDC]:We},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...k,explorer:"https://sepolia.arbiscan.io",tokens:{[u.USDC]:qe}},AVALANCHE_MAINNET:{..._,tokens:{[u.USDC]:Qe},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{...z,tokens:{[u.USDC]:Je},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...R,tokens:{[u.USDC]:Ze},explorer:"https://basescan.org"},BASE_TESTNET:{...N,tokens:{[u.USDC]:Ye},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...$,tokens:{[u.USDC]:et},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...M,tokens:{[u.USDC]:nt},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...O,tokens:{[u.USDC]:tt},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...L,tokens:{[u.USDC]:st},explorer:""}};var ce=(e=>(e.ARBITRUM="ARBITRUM_MAINNET",e.ARBITRUM_TESTNET="ARBITRUM_TESTNET",e.AVALANCHE="AVALANCHE_MAINNET",e.AVALANCHE_TESTNET="AVALANCHE_TESTNET",e.BASE="BASE_MAINNET",e.BASE_TESTNET="BASE_TESTNET",e.BSC="BSC_MAINNET",e.ETHEREUM="ETHEREUM_MAINNET",e.ETHEREUM_TESTNET="ETHEREUM_TESTNET",e.STARKNET="STARKNET_MAINNET",e))(ce||{}),ae=(e=>(e.USDC="USDC",e))(ae||{});const ue=e=>{const t=e.trim().toUpperCase();if(D[t])return D[t]};function ot(e,t){return ue(e)?.tokens[t]?.address}var v=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(v||{});class a{constructor({api_key:t,env:n,seesion_token:s}){this.api_key=t||"",this.sessionToken=s||"",this.env=n??v.PRODUCTION}static async config(t){if(!a.app){if(!t)throw new Error("Please provide an api_key");a.app=new a(t)}return t&&(t.api_key!==void 0&&(a.app.api_key=t.api_key),t.seesion_token!==void 0&&(a.app.sessionToken=t.seesion_token),t.env!==void 0&&(a.app.env=t.env)),a.app}static getApiKey(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.api_key}static getSessionToken(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.sessionToken}static getEnv(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.env==="internal"?"staging":a.app.env}static getBaseUrl(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(a.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,n,s,o){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const r=a.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",i=o&&o>0?"/pay/":"/deposit/",c=`_chain_/${t}/_token_/${n}/_to_/${s}${o?"/_amount_/"+o*100:""}`;return r+i+c}}l.Chainrails=a,l.allChains=D,l.chains=ce,l.environment=v,l.getChainByChainEnum=ue,l.getTokenAddress=ot,l.tokens=ae,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { chains } from "./src/chains";
|
|
1
|
+
export { chains, allChains } from "./src/chains";
|
|
2
2
|
export { tokens } from "./src/tokens";
|
|
3
|
+
export { getChainByChainEnum, getTokenAddress } from "./src/tokenAddresses";
|
|
3
4
|
export { environment } from "./src/environment";
|
|
4
5
|
export { Chainrails } from "./src/app";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/src/app/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { EnvType } from "../environment";
|
|
2
2
|
interface ChainrailsConfig {
|
|
3
|
-
api_key
|
|
3
|
+
api_key?: string;
|
|
4
4
|
env?: EnvType;
|
|
5
|
+
seesion_token?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare class Chainrails {
|
|
7
8
|
private static app;
|
|
8
9
|
api_key: string;
|
|
9
10
|
env: EnvType;
|
|
10
|
-
|
|
11
|
+
sessionToken: string;
|
|
11
12
|
private constructor();
|
|
12
13
|
static config(props?: ChainrailsConfig): Promise<Chainrails>;
|
|
13
|
-
static updateJWT(): Promise<void>;
|
|
14
14
|
static getApiKey(): string;
|
|
15
|
-
static
|
|
15
|
+
static getSessionToken(): string;
|
|
16
16
|
static getEnv(): EnvType;
|
|
17
17
|
static getBaseUrl(): string;
|
|
18
18
|
static getPayModalUrl(chain: string, token: string, to: string, amount?: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAa;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IAErB,OAAO;WAMa,MAAM,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;WAqB3D,SAAS,IAAI,MAAM;WAOnB,eAAe,IAAI,MAAM;WAOzB,MAAM,IAAI,OAAO;WAQjB,UAAU,IAAI,MAAM;WAgBpB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAehG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../src/chains/all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA4BpC,eAAO,MAAM,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAuE/C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Chain } from "./types";
|
|
2
|
+
export declare enum TokenEnum {
|
|
3
|
+
USDC = "USDC"
|
|
4
|
+
}
|
|
5
|
+
export declare const arbitrum: Chain;
|
|
6
|
+
export declare const arbitrumTestnet: Chain;
|
|
7
|
+
export declare const base: Chain;
|
|
8
|
+
export declare const baseTestnet: Chain;
|
|
9
|
+
export declare const bsc: Chain;
|
|
10
|
+
export declare const celo: Chain;
|
|
11
|
+
export declare const ethereum: Chain;
|
|
12
|
+
export declare const ethereumTestnet: Chain;
|
|
13
|
+
export declare const linea: Chain;
|
|
14
|
+
export declare const optimism: Chain;
|
|
15
|
+
export declare const polygon: Chain;
|
|
16
|
+
export declare const unichain: Chain;
|
|
17
|
+
export declare const avalanche: Chain;
|
|
18
|
+
export declare const avalancheTestnet: Chain;
|
|
19
|
+
export declare const starknet: Chain;
|
|
20
|
+
export declare const worldchain: Chain;
|
|
21
|
+
export declare const lisk: Chain;
|
|
22
|
+
export declare const hyperevm: Chain;
|
|
23
|
+
export declare const supportedChains: Chain[];
|
|
24
|
+
export declare const featuredChains: Chain[];
|
|
25
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/chains/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,oBAAY,SAAS;IACnB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAMzB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,KAMjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAMvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,EAkBlC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,EAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chains/index.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM;IAChB,QAAQ,qBAAqB;IAC7B,gBAAgB,qBAAqB;IACrC,SAAS,sBAAsB;IAC/B,iBAAiB,sBAAsB;IACvC,IAAI,iBAAiB;IACrB,YAAY,iBAAiB;IAC7B,GAAG,gBAAgB;IACnB,QAAQ,qBAAqB;IAC7B,gBAAgB,qBAAqB;IACrC,QAAQ,qBAAqB;CAC9B"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chains/index.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM;IAChB,QAAQ,qBAAqB;IAC7B,gBAAgB,qBAAqB;IACrC,SAAS,sBAAsB;IAC/B,iBAAiB,sBAAsB;IACvC,IAAI,iBAAiB;IACrB,YAAY,iBAAiB;IAC7B,GAAG,gBAAgB;IACnB,QAAQ,qBAAqB;IAC7B,gBAAgB,qBAAqB;IACrC,QAAQ,qBAAqB;CAC9B;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Token, tokens } from "src/tokens";
|
|
2
|
+
export type ChainType = "evm" | "starknet";
|
|
3
|
+
export type Chain = {
|
|
4
|
+
type: ChainType;
|
|
5
|
+
chainId: number | string;
|
|
6
|
+
name: string;
|
|
7
|
+
cctpDomain: number | null;
|
|
8
|
+
logoURI: string;
|
|
9
|
+
};
|
|
10
|
+
export type chainData = Chain & {
|
|
11
|
+
tokens: Partial<Record<tokens, Token>>;
|
|
12
|
+
explorer: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/chains/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC;AAE3C,MAAM,MAAM,KAAK,GAAG;IAClB,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;CACjB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { chains } from "../chains";
|
|
2
|
+
import { allChains } from "../chains/all";
|
|
3
|
+
import { chainData } from "../chains/types";
|
|
4
|
+
import { tokens } from "../tokens";
|
|
5
|
+
/** @description Get a chain by chain enum */
|
|
6
|
+
export declare const getChainByChainEnum: (chainEnum: keyof typeof allChains) => chainData | undefined;
|
|
7
|
+
export declare function getTokenAddress(destinationChain: keyof typeof chains, destinationToken: keyof typeof tokens): string | undefined;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokenAddresses/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAS,MAAM,EAAE,MAAM,WAAW,CAAC;AAE1C,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,cAAe,MAAM,OAAO,SAAS,KAAG,SAAS,GAAG,SAMnF,CAAC;AAEF,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,OAAO,MAAM,EAAE,gBAAgB,EAAE,MAAM,OAAO,MAAM,sBAI3G"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Token } from ".";
|
|
2
|
+
export declare enum TokenLogo {
|
|
3
|
+
ETH = "https://pay.daimo.com/chain-logos/ethereum.png",
|
|
4
|
+
WETH = "https://pay.daimo.com/coin-logos/weth.png",
|
|
5
|
+
USDC = "https://pay.daimo.com/coin-logos/usdc.png",
|
|
6
|
+
EURC = "https://pay.daimo.com/coin-logos/eurc.png",
|
|
7
|
+
USDT = "https://pay.daimo.com/coin-logos/usdt.png",
|
|
8
|
+
DAI = "https://pay.daimo.com/coin-logos/dai.png",
|
|
9
|
+
POL = "https://pay.daimo.com/coin-logos/pol.png",
|
|
10
|
+
AVAX = "https://pay.daimo.com/coin-logos/avax.png",
|
|
11
|
+
BNB = "https://pay.daimo.com/coin-logos/bnb.png",
|
|
12
|
+
SOL = "https://pay.daimo.com/coin-logos/sol.png",
|
|
13
|
+
WLD = "https://pay.daimo.com/coin-logos/wld.jpeg",
|
|
14
|
+
USDB = "https://pay.daimo.com/coin-logos/usdb.png",
|
|
15
|
+
BLAST = "https://pay.daimo.com/coin-logos/blast.jpg",
|
|
16
|
+
WBTC = "https://pay.daimo.com/coin-logos/wbtc.png",
|
|
17
|
+
MNT = "https://pay.daimo.com/coin-logos/mnt.png",
|
|
18
|
+
CELO = "https://pay.daimo.com/coin-logos/celo.png",
|
|
19
|
+
cUSD = "https://pay.daimo.com/coin-logos/cusd.png"
|
|
20
|
+
}
|
|
21
|
+
export declare const arbitrumTestnetUSDC: Token;
|
|
22
|
+
export declare const arbitrumUSDC: Token;
|
|
23
|
+
export declare const avalancheTestnetUSDC: Token;
|
|
24
|
+
export declare const avalancheUSDC: Token;
|
|
25
|
+
export declare const baseTestnetUSDC: Token;
|
|
26
|
+
export declare const baseUSDC: Token;
|
|
27
|
+
export declare const bscUSDC: Token;
|
|
28
|
+
export declare const ethereumTestnetUSDC: Token;
|
|
29
|
+
export declare const ethereumUSDC: Token;
|
|
30
|
+
export declare const starknetUSDC: Token;
|
|
31
|
+
export declare const supportedTokens: Token[];
|
|
32
|
+
export declare const EVM_USDC_TOKENS: {
|
|
33
|
+
[x: string]: Token;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=all.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all.d.ts","sourceRoot":"","sources":["../../../src/tokens/all.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE1B,oBAAY,SAAS;IACnB,GAAG,mDAAmD;IACtD,IAAI,8CAA8C;IAClD,IAAI,8CAA8C;IAClD,IAAI,8CAA8C;IAClD,IAAI,8CAA8C;IAClD,GAAG,6CAA6C;IAChD,GAAG,6CAA6C;IAChD,IAAI,8CAA8C;IAClD,GAAG,6CAA6C;IAChD,GAAG,6CAA6C;IAChD,GAAG,8CAA8C;IACjD,IAAI,8CAA8C;IAClD,KAAK,+CAA+C;IACpD,IAAI,8CAA8C;IAClD,GAAG,6CAA6C;IAChD,IAAI,8CAA8C;IAClD,IAAI,8CAA8C;CACnD;AAED,eAAO,MAAM,mBAAmB,EAAE,KAQjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAO1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAQlC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAQ3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAOjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAO1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAO1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,EAWlC,CAAC;AAEF,eAAO,MAAM,eAAe;;CAU3B,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export type Token = {
|
|
2
|
+
chainId: number | string;
|
|
3
|
+
address: `0x${string}` | string;
|
|
4
|
+
name?: string;
|
|
5
|
+
symbol: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
fiatISO?: string;
|
|
8
|
+
logoURI: string;
|
|
9
|
+
logoSourceURI?: string;
|
|
10
|
+
};
|
|
1
11
|
export declare enum tokens {
|
|
2
12
|
USDC = "USDC"
|
|
3
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokens/index.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM;IAChB,IAAI,SAAS;CACd"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokens/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,KAAK,MAAM,EAAE,GAAG,MAAM,CAAC;IAChC,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,oBAAY,MAAM;IAChB,IAAI,SAAS;CACd"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainrails/common",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.24",
|
|
5
5
|
"main": "./dist/chainrails-common.umd.js",
|
|
6
6
|
"module": "./dist/chainrails-common.es.mjs",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"viem": "^2.43.4",
|
|
38
39
|
"vite": "^7.1.9"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|