-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26370ed
commit 68151a6
Showing
6 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"mappings":"AiCOA;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB,EAAE,CACtB,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,KAClB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AACD;gBAKc,MAAM,EAAE,cAAc;IAgE3B,IAAI;IAwBJ,KAAK;CAGb;AAED,OAAO,MAAM,oBAAqB,cAAc,SAE/C,CAAC","sources":["src/src/components/InnerWrapper/index.tsx","src/src/components/ErrorWrapper/index.tsx","src/src/components/LoadingWrapper/index.tsx","src/src/generated/apollo-gql.tsx","src/src/utils/abis/erc20.ts","src/src/utils/transactions/evm/index.ts","src/src/providers/Store/index.tsx","src/src/components/ProgressBar/index.tsx","src/src/constants/index.ts","src/src/utils/toHex.ts","src/src/hooks/useWeb3.tsx","src/src/hooks/useChainWatcher.tsx","src/src/utils/debounce.tsx","src/src/steps/AssetSelection/index.tsx","src/src/components/MethodIcon/index.tsx","src/src/components/methods/WalletConnect/index.tsx","src/src/components/methods/WindowEthereum/index.tsx","src/src/hooks/useDepositAddress.tsx","src/src/hooks/usePrebuildTx.tsx","src/src/steps/EnterAmount/index.tsx","src/src/steps/NetworkSelection/index.tsx","src/src/steps/PaymentMethod/index.tsx","src/src/hooks/useModalSize.tsx","src/src/steps/QRCode/index.tsx","src/src/steps/Result/index.tsx","src/src/steps/SwitchChain/index.tsx","src/src/steps/WalletConnect/index.tsx","src/src/steps/index.tsx","src/src/App.withAddressAndNetwork.tsx","src/src/App.withAssetId.tsx","src/src/App.withNetwork.tsx","src/src/hooks/useWindowSize.tsx","src/src/App.tsx","src/src/index.tsx","src/index.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';\nimport { offsetLimitPagination } from '@apollo/client/utilities';\nimport { createRoot, Root } from 'react-dom/client';\n\nimport App from './App';\nimport { CONSOLE_API_URL } from './constants';\n\nexport interface Map3InitConfig {\n address?: string;\n anonKey: string;\n assetId?: string;\n authorizeTransaction?: (\n fromAddress: string,\n network: string,\n amount: string\n ) => Promise<Boolean>;\n fiat?: string;\n generateDepositAddress: (\n asset?: string,\n network?: string,\n memoEnabled?: boolean\n ) => Promise<{ address: string; memo?: string }>;\n networkCode?: string;\n rainbowRoad?: boolean;\n theme?: 'dark' | 'light';\n}\nexport class Map3 {\n private onClose: () => void;\n private root: Root;\n private config: Map3InitConfig;\n\n constructor(config: Map3InitConfig) {\n if (!config.generateDepositAddress) {\n throw new Error('generateDepositAddress is required');\n }\n if (!config.anonKey) {\n throw new Error('anonKey is required');\n }\n\n if (!config.theme) {\n config.theme = 'light';\n }\n\n if (!config.fiat) {\n config.fiat = 'USD';\n }\n\n if (config.address && !config.networkCode) {\n console.warn(\n 'Warning: networkCode is required when address is provided. Falling back to asset selection.'\n );\n config.address = undefined;\n }\n\n if (config.rainbowRoad) {\n document.body.classList.add('rainbow-road');\n }\n\n this.config = config;\n\n this.onClose = () => {\n this.root.unmount();\n document.body.classList.remove('dark');\n };\n\n const element = document.createElement('div');\n element.id = 'map3';\n document.body.appendChild(element);\n\n if (config.theme === 'dark') {\n document.body.classList.add('dark');\n }\n\n var parent = document.createElement('div');\n parent.setAttribute('style', 'width:30px;height:30px;');\n parent.classList.add('scrollbar-test');\n\n var child = document.createElement('div');\n child.setAttribute('style', 'width:100%;height:40px');\n parent.appendChild(child);\n document.body.appendChild(parent);\n\n // Measure the child element, if it is not\n // 30px wide the scrollbars are obtrusive.\n // @ts-ignore\n var scrollbarWidth = 30 - parent?.firstChild?.clientWidth;\n if (scrollbarWidth) {\n document.body.classList.add('map3-layout-scrollbar-obtrusive');\n }\n\n document.body.removeChild(parent);\n\n this.root = createRoot(element);\n }\n\n public open() {\n const client = new ApolloClient({\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n assetsForOrganization: offsetLimitPagination(),\n },\n },\n },\n }),\n headers: {\n Authorization: 'Bearer ' + this.config.anonKey,\n 'X-MAP3-USER': '123',\n },\n uri: (process.env.CONSOLE_API_URL || CONSOLE_API_URL) + '/graphql',\n });\n this.root.render(\n <ApolloProvider client={client}>\n <App config={this.config} onClose={this.onClose} />\n </ApolloProvider>\n );\n }\n\n public close() {\n this.onClose();\n }\n}\n\nexport const initMap3Sdk = (args: Map3InitConfig) => {\n return new Map3(args);\n};\n\nif (typeof window !== 'undefined') {\n // @ts-ignore\n window.initMap3Sdk = initMap3Sdk;\n}\n"],"names":[],"version":3,"file":"types.d.ts.map"} | ||
{"mappings":"AiCOA;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB,EAAE,CACtB,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AACD;gBAKc,MAAM,EAAE,cAAc;IAoE3B,IAAI;IAwBJ,KAAK;CAGb;AAED,OAAO,MAAM,oBAAqB,cAAc,SAE/C,CAAC","sources":["src/src/components/InnerWrapper/index.tsx","src/src/components/ErrorWrapper/index.tsx","src/src/components/LoadingWrapper/index.tsx","src/src/generated/apollo-gql.tsx","src/src/utils/abis/erc20.ts","src/src/utils/transactions/evm/index.ts","src/src/providers/Store/index.tsx","src/src/components/ProgressBar/index.tsx","src/src/constants/index.ts","src/src/utils/toHex.ts","src/src/hooks/useWeb3.tsx","src/src/hooks/useChainWatcher.tsx","src/src/utils/debounce.tsx","src/src/steps/AssetSelection/index.tsx","src/src/components/MethodIcon/index.tsx","src/src/components/methods/WalletConnect/index.tsx","src/src/components/methods/WindowEthereum/index.tsx","src/src/hooks/useDepositAddress.tsx","src/src/hooks/usePrebuildTx.tsx","src/src/steps/EnterAmount/index.tsx","src/src/steps/NetworkSelection/index.tsx","src/src/steps/PaymentMethod/index.tsx","src/src/hooks/useModalSize.tsx","src/src/steps/QRCode/index.tsx","src/src/steps/Result/index.tsx","src/src/steps/SwitchChain/index.tsx","src/src/steps/WalletConnect/index.tsx","src/src/steps/index.tsx","src/src/App.withAddressAndNetwork.tsx","src/src/App.withAssetId.tsx","src/src/App.withNetwork.tsx","src/src/hooks/useWindowSize.tsx","src/src/App.tsx","src/src/index.tsx","src/index.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';\nimport { offsetLimitPagination } from '@apollo/client/utilities';\nimport { createRoot, Root } from 'react-dom/client';\n\nimport App from './App';\nimport { CONSOLE_API_URL } from './constants';\n\nexport interface Map3InitConfig {\n address?: string;\n anonKey: string;\n assetId?: string;\n authorizeTransaction?: (\n fromAddress: string,\n network: string,\n amount: string\n ) => Promise<Boolean>;\n fiat?: string;\n generateDepositAddress: (\n asset?: string,\n network?: string\n ) => Promise<{ address: string; memo?: string }>;\n networkCode?: string;\n onClose?: () => void;\n onFailure?: (error: string, networkCode: string, address?: string) => void;\n onSuccess?: (txHash: string, networkCode: string, address?: string) => void;\n rainbowRoad?: boolean;\n theme?: 'dark' | 'light';\n userId: string;\n}\nexport class Map3 {\n private onClose: () => void;\n private root: Root;\n private config: Map3InitConfig;\n\n constructor(config: Map3InitConfig) {\n if (!config.generateDepositAddress) {\n throw new Error('generateDepositAddress is required.');\n }\n if (!config.anonKey) {\n throw new Error('anonKey is required.');\n }\n\n if (!config.userId) {\n throw new Error('userId is required.');\n }\n\n if (!config.theme) {\n config.theme = 'light';\n }\n\n if (!config.fiat) {\n config.fiat = 'USD';\n }\n\n if (config.address && !config.networkCode) {\n console.warn(\n 'Warning: networkCode is required when address is provided. Falling back to asset selection.'\n );\n config.address = undefined;\n }\n\n if (config.rainbowRoad) {\n document.body.classList.add('rainbow-road');\n }\n\n this.config = config;\n\n this.onClose = () => {\n this.root.unmount();\n this.config.onClose?.();\n };\n\n const element = document.createElement('div');\n element.id = 'map3';\n document.body.appendChild(element);\n\n if (config.theme === 'dark' && !document.body.classList.contains('dark')) {\n document.body.classList.add('dark');\n }\n\n var parent = document.createElement('div');\n parent.setAttribute('style', 'width:30px;height:30px;');\n parent.classList.add('scrollbar-test');\n\n var child = document.createElement('div');\n child.setAttribute('style', 'width:100%;height:40px');\n parent.appendChild(child);\n document.body.appendChild(parent);\n\n // Measure the child element, if it is not\n // 30px wide the scrollbars are obtrusive.\n // @ts-ignore\n var scrollbarWidth = 30 - parent?.firstChild?.clientWidth;\n if (scrollbarWidth) {\n document.body.classList.add('map3-layout-scrollbar-obtrusive');\n }\n\n document.body.removeChild(parent);\n\n this.root = createRoot(element);\n }\n\n public open() {\n const client = new ApolloClient({\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n assetsForOrganization: offsetLimitPagination(),\n },\n },\n },\n }),\n headers: {\n Authorization: 'Bearer ' + this.config.anonKey,\n 'X-MAP3-USER': this.config.userId,\n },\n uri: (process.env.CONSOLE_API_URL || CONSOLE_API_URL) + '/graphql',\n });\n this.root.render(\n <ApolloProvider client={client}>\n <App config={this.config} onClose={this.onClose} />\n </ApolloProvider>\n );\n }\n\n public close() {\n this.onClose();\n }\n}\n\nexport const initMap3Sdk = (args: Map3InitConfig) => {\n return new Map3(args);\n};\n\nif (typeof window !== 'undefined') {\n // @ts-ignore\n window.initMap3Sdk = initMap3Sdk;\n}\n"],"names":[],"version":3,"file":"types.d.ts.map"} |