multicoyn-sdk 0.1.9 → 0.1.11

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.
@@ -1,4 +1,4 @@
1
- import { s as b, t as x, f as F, A as I, d as C, g as M, a as E, b as D, e as w, c as G, h as A, i as T, I as H, j as m, k as v, l as R, m as k, B as y, n as N, o as P, p as j, q as B, r as U, H as L, u as _ } from "./index-BqTi7WKI.js";
1
+ import { s as b, t as x, f as F, A as I, d as C, g as M, a as E, b as D, e as w, c as G, h as A, i as T, I as H, j as m, k as v, l as R, m as k, B as y, n as N, o as P, p as j, q as B, r as U, H as L, u as _ } from "./index-B4pbkFH9.js";
2
2
  function J(e) {
3
3
  const { abi: s, data: a } = e, r = b(a, 0, 4), t = s.find((n) => n.type === "function" && r === x(F(n)));
4
4
  if (!t)
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DqlG-QlC.cjs");function k(r){const{abi:n,data:a}=r,o=e.slice(a,0,4),t=n.find(s=>s.type==="function"&&o===e.toFunctionSelector(e.formatAbiItem(s)));if(!t)throw new e.AbiFunctionSignatureNotFoundError(o,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:t.name,args:"inputs"in t&&t.inputs&&t.inputs.length>0?e.decodeAbiParameters(t.inputs,e.slice(a,4)):void 0}}const h="/docs/contract/encodeErrorResult";function y(r){const{abi:n,errorName:a,args:o}=r;let t=n[0];if(a){const f=e.getAbiItem({abi:n,args:o,name:a});if(!f)throw new e.AbiErrorNotFoundError(a,{docsPath:h});t=f}if(t.type!=="error")throw new e.AbiErrorNotFoundError(void 0,{docsPath:h});const s=e.formatAbiItem(t),c=e.toFunctionSelector(s);let i="0x";if(o&&o.length>0){if(!t.inputs)throw new e.AbiErrorInputsNotFoundError(t.name,{docsPath:h});i=e.encodeAbiParameters(t.inputs,o)}return e.concatHex([c,i])}const m="/docs/contract/encodeFunctionResult";function L(r){const{abi:n,functionName:a,result:o}=r;let t=n[0];if(a){const c=e.getAbiItem({abi:n,name:a});if(!c)throw new e.AbiFunctionNotFoundError(a,{docsPath:m});t=c}if(t.type!=="function")throw new e.AbiFunctionNotFoundError(void 0,{docsPath:m});if(!t.outputs)throw new e.AbiFunctionOutputsNotFoundError(t.name,{docsPath:m});const s=(()=>{if(t.outputs.length===0)return[];if(t.outputs.length===1)return[o];if(Array.isArray(o))return o;throw new e.InvalidArrayError(o)})();return e.encodeAbiParameters(t.outputs,s)}const b="x-batch-gateway:true";async function g(r){const{data:n,ccipRequest:a}=r,{args:[o]}=k({abi:e.batchGatewayAbi,data:n}),t=[],s=[];return await Promise.all(o.map(async(c,i)=>{try{s[i]=c.urls.includes(b)?await g({data:c.data,ccipRequest:a}):await a(c),t[i]=!1}catch(f){t[i]=!0,s[i]=F(f)}})),L({abi:e.batchGatewayAbi,functionName:"query",result:[t,s]})}function F(r){return r.name==="HttpRequestError"&&r.status?y({abi:e.batchGatewayAbi,errorName:"HttpError",args:[r.status,r.shortMessage]}):y({abi:[e.solidityError],errorName:"Error",args:["shortMessage"in r?r.shortMessage:r.message]})}function O(r,n){if(!e.isAddress(r,{strict:!1}))throw new e.InvalidAddressError({address:r});if(!e.isAddress(n,{strict:!1}))throw new e.InvalidAddressError({address:n});return r.toLowerCase()===n.toLowerCase()}class P extends e.BaseError{constructor({callbackSelector:n,cause:a,data:o,extraData:t,sender:s,urls:c}){super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],a.metaMessages?.length?"":[],"Offchain Gateway Call:",c&&[" Gateway URL(s):",...c.map(i=>` ${e.getUrl(i)}`)],` Sender: ${s}`,` Data: ${o}`,` Callback selector: ${n}`,` Extra data: ${t}`].flat(),name:"OffchainLookupError"})}}class S extends e.BaseError{constructor({result:n,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(a)}`,`Response: ${e.stringify(n)}`],name:"OffchainLookupResponseMalformedError"})}}class x extends e.BaseError{constructor({sender:n,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${n}`],name:"OffchainLookupSenderMismatchError"})}}const M="0x556f1830",E={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function N(r,{blockNumber:n,blockTag:a,data:o,to:t}){const{args:s}=e.decodeErrorResult({data:o,abi:[E]}),[c,i,f,u,d]=s,{ccipRead:l}=r,w=l&&typeof l?.request=="function"?l.request:A;try{if(!O(t,c))throw new x({sender:c,to:t});const p=i.includes(b)?await g({data:f,ccipRequest:w}):await w({data:f,sender:c,urls:i}),{data:R}=await e.call(r,{blockNumber:n,blockTag:a,data:e.concat([u,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,d])]),to:t});return R}catch(p){throw new P({callbackSelector:u,cause:p,data:o,extraData:d,sender:c,urls:i})}}async function A({data:r,sender:n,urls:a}){let o=new Error("An unknown error occurred.");for(let t=0;t<a.length;t++){const s=a[t],c=s.includes("{data}")?"GET":"POST",i=c==="POST"?{data:r,sender:n}:void 0,f=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(s.replace("{sender}",n.toLowerCase()).replace("{data}",r),{body:JSON.stringify(i),headers:f,method:c});let d;if(u.headers.get("Content-Type")?.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){o=new e.HttpRequestError({body:i,details:d?.error?e.stringify(d.error):u.statusText,headers:u.headers,status:u.status,url:s});continue}if(!e.isHex(d)){o=new S({result:d,url:s});continue}return d}catch(u){o=new e.HttpRequestError({body:i,details:u.message,url:s})}}throw o}exports.ccipRequest=A;exports.offchainLookup=N;exports.offchainLookupAbiItem=E;exports.offchainLookupSignature=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Cv93tYMN.cjs");function k(r){const{abi:n,data:a}=r,o=e.slice(a,0,4),t=n.find(s=>s.type==="function"&&o===e.toFunctionSelector(e.formatAbiItem(s)));if(!t)throw new e.AbiFunctionSignatureNotFoundError(o,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:t.name,args:"inputs"in t&&t.inputs&&t.inputs.length>0?e.decodeAbiParameters(t.inputs,e.slice(a,4)):void 0}}const h="/docs/contract/encodeErrorResult";function y(r){const{abi:n,errorName:a,args:o}=r;let t=n[0];if(a){const f=e.getAbiItem({abi:n,args:o,name:a});if(!f)throw new e.AbiErrorNotFoundError(a,{docsPath:h});t=f}if(t.type!=="error")throw new e.AbiErrorNotFoundError(void 0,{docsPath:h});const s=e.formatAbiItem(t),c=e.toFunctionSelector(s);let i="0x";if(o&&o.length>0){if(!t.inputs)throw new e.AbiErrorInputsNotFoundError(t.name,{docsPath:h});i=e.encodeAbiParameters(t.inputs,o)}return e.concatHex([c,i])}const m="/docs/contract/encodeFunctionResult";function L(r){const{abi:n,functionName:a,result:o}=r;let t=n[0];if(a){const c=e.getAbiItem({abi:n,name:a});if(!c)throw new e.AbiFunctionNotFoundError(a,{docsPath:m});t=c}if(t.type!=="function")throw new e.AbiFunctionNotFoundError(void 0,{docsPath:m});if(!t.outputs)throw new e.AbiFunctionOutputsNotFoundError(t.name,{docsPath:m});const s=(()=>{if(t.outputs.length===0)return[];if(t.outputs.length===1)return[o];if(Array.isArray(o))return o;throw new e.InvalidArrayError(o)})();return e.encodeAbiParameters(t.outputs,s)}const b="x-batch-gateway:true";async function g(r){const{data:n,ccipRequest:a}=r,{args:[o]}=k({abi:e.batchGatewayAbi,data:n}),t=[],s=[];return await Promise.all(o.map(async(c,i)=>{try{s[i]=c.urls.includes(b)?await g({data:c.data,ccipRequest:a}):await a(c),t[i]=!1}catch(f){t[i]=!0,s[i]=F(f)}})),L({abi:e.batchGatewayAbi,functionName:"query",result:[t,s]})}function F(r){return r.name==="HttpRequestError"&&r.status?y({abi:e.batchGatewayAbi,errorName:"HttpError",args:[r.status,r.shortMessage]}):y({abi:[e.solidityError],errorName:"Error",args:["shortMessage"in r?r.shortMessage:r.message]})}function O(r,n){if(!e.isAddress(r,{strict:!1}))throw new e.InvalidAddressError({address:r});if(!e.isAddress(n,{strict:!1}))throw new e.InvalidAddressError({address:n});return r.toLowerCase()===n.toLowerCase()}class P extends e.BaseError{constructor({callbackSelector:n,cause:a,data:o,extraData:t,sender:s,urls:c}){super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],a.metaMessages?.length?"":[],"Offchain Gateway Call:",c&&[" Gateway URL(s):",...c.map(i=>` ${e.getUrl(i)}`)],` Sender: ${s}`,` Data: ${o}`,` Callback selector: ${n}`,` Extra data: ${t}`].flat(),name:"OffchainLookupError"})}}class S extends e.BaseError{constructor({result:n,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(a)}`,`Response: ${e.stringify(n)}`],name:"OffchainLookupResponseMalformedError"})}}class x extends e.BaseError{constructor({sender:n,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${n}`],name:"OffchainLookupSenderMismatchError"})}}const M="0x556f1830",E={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function N(r,{blockNumber:n,blockTag:a,data:o,to:t}){const{args:s}=e.decodeErrorResult({data:o,abi:[E]}),[c,i,f,u,d]=s,{ccipRead:l}=r,w=l&&typeof l?.request=="function"?l.request:A;try{if(!O(t,c))throw new x({sender:c,to:t});const p=i.includes(b)?await g({data:f,ccipRequest:w}):await w({data:f,sender:c,urls:i}),{data:R}=await e.call(r,{blockNumber:n,blockTag:a,data:e.concat([u,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,d])]),to:t});return R}catch(p){throw new P({callbackSelector:u,cause:p,data:o,extraData:d,sender:c,urls:i})}}async function A({data:r,sender:n,urls:a}){let o=new Error("An unknown error occurred.");for(let t=0;t<a.length;t++){const s=a[t],c=s.includes("{data}")?"GET":"POST",i=c==="POST"?{data:r,sender:n}:void 0,f=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(s.replace("{sender}",n.toLowerCase()).replace("{data}",r),{body:JSON.stringify(i),headers:f,method:c});let d;if(u.headers.get("Content-Type")?.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){o=new e.HttpRequestError({body:i,details:d?.error?e.stringify(d.error):u.statusText,headers:u.headers,status:u.status,url:s});continue}if(!e.isHex(d)){o=new S({result:d,url:s});continue}return d}catch(u){o=new e.HttpRequestError({body:i,details:u.message,url:s})}}throw o}exports.ccipRequest=A;exports.offchainLookup=N;exports.offchainLookupAbiItem=E;exports.offchainLookupSignature=M;
@@ -11,7 +11,8 @@ interface PaymentModalProps {
11
11
  transactionHash?: string;
12
12
  isProcessing?: boolean;
13
13
  isSuccess?: boolean;
14
+ isError?: boolean;
14
15
  conversionRate?: number;
15
16
  }
16
- export declare function PaymentModal({ isOpen, onClose, totalAmount, currency, items, tokens: initialTokens, onPaymentSubmit, fee, transactionHash, isProcessing: externalIsProcessing, isSuccess: externalIsSuccess, conversionRate, }: PaymentModalProps): import("react").ReactPortal | null;
17
+ export declare function PaymentModal({ isOpen, onClose, totalAmount, currency, items, tokens: initialTokens, onPaymentSubmit, fee, transactionHash, isProcessing: externalIsProcessing, isSuccess: externalIsSuccess, isError: externalIsError, conversionRate, }: PaymentModalProps): import("react").ReactPortal | null;
17
18
  export {};
@@ -9,30 +9,36 @@ export declare const TOKEN_METADATA: {
9
9
  readonly symbol: "ETH";
10
10
  readonly decimals: 18;
11
11
  readonly name: "Ether";
12
+ readonly logo: "https://cryptologos.cc/logos/ethereum-eth-logo.svg";
12
13
  };
13
14
  readonly USDC: {
14
15
  readonly symbol: "USDC";
15
16
  readonly decimals: 6;
16
17
  readonly name: "USD Coin";
18
+ readonly logo: "https://cryptologos.cc/logos/usd-coin-usdc-logo.svg";
17
19
  };
18
20
  readonly USDT: {
19
21
  readonly symbol: "USDT";
20
22
  readonly decimals: 6;
21
23
  readonly name: "Tether USD";
24
+ readonly logo: "https://cryptologos.cc/logos/tether-usdt-logo.svg";
22
25
  };
23
26
  readonly DAI: {
24
27
  readonly symbol: "DAI";
25
28
  readonly decimals: 18;
26
29
  readonly name: "Dai Stablecoin";
30
+ readonly logo: "https://cryptologos.cc/logos/multi-collateral-dai-dai-logo.svg";
27
31
  };
28
32
  readonly WBTC: {
29
33
  readonly symbol: "WBTC";
30
34
  readonly decimals: 8;
31
35
  readonly name: "Wrapped Bitcoin";
36
+ readonly logo: "https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg";
32
37
  };
33
38
  readonly IDRX: {
34
39
  readonly symbol: "IDRX";
35
40
  readonly decimals: 18;
36
41
  readonly name: "Indonesian Rupiah";
42
+ readonly logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png";
37
43
  };
38
44
  };