coinley-test 0.0.56 → 0.0.57
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/index.esm.js +139 -179
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/vanilla/coinley-vanilla.umd.js +3 -3
- package/dist/vanilla/coinley-vanilla.umd.js.map +1 -1
- package/dist/vanilla/style.css +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1835,7 +1835,6 @@ const SimpleCoinleyPayment = ({
|
|
|
1835
1835
|
] }) });
|
|
1836
1836
|
};
|
|
1837
1837
|
const logo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABxCAYAAAAj+QZ8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAzrSURBVHgB7V3dcRs5Em4MtXWPq41gZ1+v7mwrgh3rArAUgagITNcFYDmAK9ERSBuBfQGsxY3Aku26V/MiOO7j1nqAQwMgRQ4xQONnhqOfr8q2TA4H1HzoRqO70c1g4JhUH/dhNKqgrhfT2cEMOoQaqxidyx+P5J8F8PpYjnkNPYLBgPGq+vxSFOJM/rhvXpp39ZAkGaUk40r+WK69jKT8JMdbQE8oYKDAByTJmMItGQj10OR7zyA3itFr2CQD1NhFMYYeMVhCHA8C1co7pV4yYXL4aSz/GVvfFFBBjxguIcCeOt4szYxOhiG2/V7M+T2yY7iEMOaTgIl8mBWkoth7Cduqah2u97JjuIQIUXqvYWlSohZyUEaDE/88/M+P0BMGrLIIYFAZ/R+HTGovJ+42IRqvYxZ485kKBob7QEgZZZoWoyMgrg//+vDX/0JPuA+ESLCXEApG/kxvm0LEkK2secDVZYjFpRZzIWibSyHm0COGSwjnYWoiyOIqjujXskcJUWCBqgItLuriPipOgAombqBH7EEGTKovUvz/xIdxnc8Rx8IdiHp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YF4QqgmpAuqYICq3tD6kIL619JapdIJoXWf9kJ5iTHJo7nYW0pSpaislLDlQkXZrp74S2mMlGlNA6FVqmlb4b1uDVkMl7XFvlFpadMzkNILN/QX0xDq5O0BOeRJlY6QVqkhXaiLIgshCCRlevV0DJvZPUjGaow0sxe73VDThjQRz0lSsQ7q+hEyOYKaDjN6u1Yi5GJ/KScFtoc9bVqWGc6pOytTL1Lrmci4AlZM9etxDseU7pzB98WGXldPD6AnJCdbm9k+lsScgSpEY2qb6JomQR0Umghqlwr1DEKAXagpnoY+6oStIVv2uyFmDnlB1d/hR+GwCzUbUVw/+6E5XynotOVROogLKrWz8yZQgkkP2ZwM7gXDJoTSkJ7Y2bkJPeNpxT5r/sdP0BMGLiHMX6FUQHy7V+oxjFxeCcpQMGQwRljQ48+29NZfNwADlxAvLpOzz/vqQk3E3SYkw7n2oUnJsAkRwmEFiXzn/gYkJQOXEGFP51Eue07zhREwJCkZupVldxYWLH/VB1cXat5fdaJhE8JriwUl3nTRrk4T3Bbdq1NCDUEYNCFm87Z8SAtzUukMOoK94bHo7Yw6orMjbTmxDOD05U/SBz2l2wab3ncgjS78H0eagrHjdQciAAAAAElFTkSuQmCC";
|
|
1838
|
-
var define_Buffer_default = ["buffer", "Buffer"];
|
|
1839
1838
|
class SimplePaymentAPI2 {
|
|
1840
1839
|
constructor(baseURL, apiKey, apiSecret) {
|
|
1841
1840
|
this.baseURL = baseURL.endsWith("/") ? baseURL.slice(0, -1) : baseURL;
|
|
@@ -1868,8 +1867,7 @@ class SimplePaymentAPI2 {
|
|
|
1868
1867
|
return {
|
|
1869
1868
|
networks: [
|
|
1870
1869
|
{ id: "1", name: "Ethereum", shortName: "ethereum", chainId: "0x1", type: "ethereum" },
|
|
1871
|
-
{ id: "56", name: "BSC", shortName: "bsc", chainId: "0x38", type: "bsc" }
|
|
1872
|
-
{ id: "solana", name: "Solana", shortName: "solana", chainId: "solana-mainnet", type: "solana" }
|
|
1870
|
+
{ id: "56", name: "BSC", shortName: "bsc", chainId: "0x38", type: "bsc" }
|
|
1873
1871
|
]
|
|
1874
1872
|
};
|
|
1875
1873
|
}
|
|
@@ -1891,13 +1889,13 @@ class SimplePaymentAPI2 {
|
|
|
1891
1889
|
Network: { shortName: "ethereum", name: "Ethereum" }
|
|
1892
1890
|
},
|
|
1893
1891
|
{
|
|
1894
|
-
id: "
|
|
1892
|
+
id: "2",
|
|
1895
1893
|
name: "USD Coin",
|
|
1896
1894
|
symbol: "USDC",
|
|
1897
|
-
contractAddress: "
|
|
1895
|
+
contractAddress: "0xA0b86a33E6441d81d0B93bF9EE0f74ca32F7e6f6",
|
|
1898
1896
|
decimals: 6,
|
|
1899
|
-
networkId: "
|
|
1900
|
-
Network: { shortName: "
|
|
1897
|
+
networkId: "1",
|
|
1898
|
+
Network: { shortName: "ethereum", name: "Ethereum" }
|
|
1901
1899
|
}
|
|
1902
1900
|
]
|
|
1903
1901
|
};
|
|
@@ -1926,30 +1924,31 @@ class SimpleMetaMaskWallet2 {
|
|
|
1926
1924
|
if (!window.ethereum) {
|
|
1927
1925
|
throw new Error("MetaMask not installed. Please install MetaMask extension.");
|
|
1928
1926
|
}
|
|
1927
|
+
let metamaskProvider = window.ethereum;
|
|
1929
1928
|
if (window.ethereum.providers) {
|
|
1930
1929
|
console.log("🔍 Multiple wallets detected:", window.ethereum.providers.length);
|
|
1931
|
-
|
|
1930
|
+
metamaskProvider = window.ethereum.providers.find((provider) => provider.isMetaMask && !provider.isRabby);
|
|
1932
1931
|
if (!metamaskProvider) {
|
|
1933
1932
|
throw new Error("MetaMask not found among installed wallets");
|
|
1934
1933
|
}
|
|
1935
1934
|
console.log("🦊 Using MetaMask provider specifically");
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
throw new Error("Please use MetaMask wallet");
|
|
1935
|
+
} else if (!window.ethereum.isMetaMask || window.ethereum.isRabby) {
|
|
1936
|
+
throw new Error("Please use MetaMask wallet (not Rabby)");
|
|
1939
1937
|
}
|
|
1940
1938
|
try {
|
|
1941
1939
|
console.log("🦊 Requesting MetaMask account access...");
|
|
1942
|
-
const accounts = await
|
|
1940
|
+
const accounts = await metamaskProvider.request({
|
|
1943
1941
|
method: "eth_requestAccounts"
|
|
1944
1942
|
});
|
|
1945
1943
|
if (!accounts || accounts.length === 0) {
|
|
1946
1944
|
throw new Error("No accounts found in MetaMask");
|
|
1947
1945
|
}
|
|
1948
|
-
const chainId = await
|
|
1946
|
+
const chainId = await metamaskProvider.request({
|
|
1949
1947
|
method: "eth_chainId"
|
|
1950
1948
|
});
|
|
1951
1949
|
this.account = accounts[0];
|
|
1952
1950
|
this.chainId = chainId;
|
|
1951
|
+
this.provider = metamaskProvider;
|
|
1953
1952
|
console.log("✅ MetaMask connected successfully:");
|
|
1954
1953
|
console.log(" Account:", this.account);
|
|
1955
1954
|
console.log(" Chain ID:", this.chainId);
|
|
@@ -1960,40 +1959,37 @@ class SimpleMetaMaskWallet2 {
|
|
|
1960
1959
|
}
|
|
1961
1960
|
}
|
|
1962
1961
|
async sendTransaction(txParams) {
|
|
1963
|
-
if (!this.account) {
|
|
1964
|
-
throw new Error("
|
|
1962
|
+
if (!this.account || !this.provider) {
|
|
1963
|
+
throw new Error("MetaMask wallet not connected");
|
|
1965
1964
|
}
|
|
1966
1965
|
try {
|
|
1967
1966
|
console.log("🦊 Sending MetaMask transaction:", txParams);
|
|
1968
|
-
if (!window.ethereum.isMetaMask) {
|
|
1969
|
-
throw new Error("Not using MetaMask provider");
|
|
1970
|
-
}
|
|
1971
1967
|
const fullTxParams = {
|
|
1972
1968
|
...txParams,
|
|
1973
1969
|
from: this.account
|
|
1974
1970
|
};
|
|
1975
1971
|
try {
|
|
1976
|
-
const gasEstimate = await
|
|
1972
|
+
const gasEstimate = await this.provider.request({
|
|
1977
1973
|
method: "eth_estimateGas",
|
|
1978
1974
|
params: [fullTxParams]
|
|
1979
1975
|
});
|
|
1980
1976
|
const gasLimit = Math.floor(parseInt(gasEstimate, 16) * 1.2);
|
|
1981
1977
|
fullTxParams.gas = `0x${gasLimit.toString(16)}`;
|
|
1982
|
-
console.log("⛽ Gas estimate:", parseInt(gasEstimate, 16));
|
|
1983
|
-
console.log("⛽ Gas limit (with buffer):", gasLimit);
|
|
1978
|
+
console.log("⛽ MetaMask Gas estimate:", parseInt(gasEstimate, 16));
|
|
1979
|
+
console.log("⛽ MetaMask Gas limit (with buffer):", gasLimit);
|
|
1984
1980
|
} catch (gasError) {
|
|
1985
|
-
console.warn("
|
|
1981
|
+
console.warn("MetaMask gas estimation failed:", gasError);
|
|
1986
1982
|
fullTxParams.gas = "0x15F90";
|
|
1987
1983
|
}
|
|
1988
|
-
console.log("📤 Final transaction params:", fullTxParams);
|
|
1989
|
-
const txHash = await
|
|
1984
|
+
console.log("📤 MetaMask Final transaction params:", fullTxParams);
|
|
1985
|
+
const txHash = await this.provider.request({
|
|
1990
1986
|
method: "eth_sendTransaction",
|
|
1991
1987
|
params: [fullTxParams]
|
|
1992
1988
|
});
|
|
1993
|
-
console.log("✅ Transaction sent successfully:", txHash);
|
|
1989
|
+
console.log("✅ MetaMask Transaction sent successfully:", txHash);
|
|
1994
1990
|
return txHash;
|
|
1995
1991
|
} catch (error) {
|
|
1996
|
-
console.error("Transaction failed:", error);
|
|
1992
|
+
console.error("MetaMask Transaction failed:", error);
|
|
1997
1993
|
if (error.code === 4001) {
|
|
1998
1994
|
throw new Error("Transaction cancelled by user");
|
|
1999
1995
|
} else if (error.message.includes("insufficient funds")) {
|
|
@@ -2009,102 +2005,115 @@ class SimpleMetaMaskWallet2 {
|
|
|
2009
2005
|
return !!this.account;
|
|
2010
2006
|
}
|
|
2011
2007
|
}
|
|
2012
|
-
class
|
|
2008
|
+
class SimpleRabbyWallet {
|
|
2013
2009
|
constructor() {
|
|
2014
2010
|
this.account = null;
|
|
2015
|
-
this.
|
|
2016
|
-
this.walletType = "
|
|
2011
|
+
this.chainId = null;
|
|
2012
|
+
this.walletType = "rabby";
|
|
2013
|
+
this.provider = null;
|
|
2017
2014
|
}
|
|
2018
2015
|
async connect() {
|
|
2019
|
-
if (!window.
|
|
2020
|
-
throw new Error("
|
|
2016
|
+
if (!window.ethereum) {
|
|
2017
|
+
throw new Error("No Ethereum wallet found. Please install Rabby wallet.");
|
|
2021
2018
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2019
|
+
let rabbyProvider = null;
|
|
2020
|
+
if (window.ethereum.providers) {
|
|
2021
|
+
console.log("🔍 Multiple wallets detected, looking for Rabby:", window.ethereum.providers.length);
|
|
2022
|
+
rabbyProvider = window.ethereum.providers.find((provider) => provider.isRabby);
|
|
2023
|
+
if (!rabbyProvider) {
|
|
2024
|
+
throw new Error("Rabby wallet not found among installed wallets");
|
|
2025
|
+
}
|
|
2026
|
+
console.log("🐰 Using Rabby provider specifically");
|
|
2027
|
+
} else if (window.ethereum.isRabby) {
|
|
2028
|
+
rabbyProvider = window.ethereum;
|
|
2029
|
+
console.log("🐰 Using Rabby as primary provider");
|
|
2030
|
+
} else {
|
|
2031
|
+
throw new Error("Rabby wallet not detected. Please install Rabby wallet extension.");
|
|
2024
2032
|
}
|
|
2025
2033
|
try {
|
|
2026
|
-
console.log("
|
|
2027
|
-
const
|
|
2028
|
-
|
|
2029
|
-
|
|
2034
|
+
console.log("🐰 Requesting Rabby wallet account access...");
|
|
2035
|
+
const accounts = await rabbyProvider.request({
|
|
2036
|
+
method: "eth_requestAccounts"
|
|
2037
|
+
});
|
|
2038
|
+
if (!accounts || accounts.length === 0) {
|
|
2039
|
+
throw new Error("No accounts found in Rabby wallet");
|
|
2030
2040
|
}
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2041
|
+
const chainId = await rabbyProvider.request({
|
|
2042
|
+
method: "eth_chainId"
|
|
2043
|
+
});
|
|
2044
|
+
this.account = accounts[0];
|
|
2045
|
+
this.chainId = chainId;
|
|
2046
|
+
this.provider = rabbyProvider;
|
|
2047
|
+
console.log("✅ Rabby wallet connected successfully:");
|
|
2034
2048
|
console.log(" Account:", this.account);
|
|
2035
|
-
|
|
2049
|
+
console.log(" Chain ID:", this.chainId);
|
|
2050
|
+
return { account: this.account, chainId: this.chainId };
|
|
2036
2051
|
} catch (error) {
|
|
2037
|
-
console.error("
|
|
2038
|
-
throw new Error(error.message || "Failed to connect to
|
|
2052
|
+
console.error("Rabby wallet connection failed:", error);
|
|
2053
|
+
throw new Error(error.message || "Failed to connect to Rabby wallet");
|
|
2039
2054
|
}
|
|
2040
2055
|
}
|
|
2041
2056
|
async sendTransaction(txParams) {
|
|
2042
|
-
if (!this.account || !this.
|
|
2043
|
-
throw new Error("
|
|
2057
|
+
if (!this.account || !this.provider) {
|
|
2058
|
+
throw new Error("Rabby wallet not connected");
|
|
2044
2059
|
}
|
|
2045
2060
|
try {
|
|
2046
|
-
console.log("
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
instructions: [
|
|
2051
|
-
{
|
|
2052
|
-
keys: [
|
|
2053
|
-
{ pubkey: this.publicKey, isSigner: true, isWritable: true },
|
|
2054
|
-
{ pubkey: txParams.to, isSigner: false, isWritable: true }
|
|
2055
|
-
],
|
|
2056
|
-
programId: txParams.programId || "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
2057
|
-
// SPL Token program
|
|
2058
|
-
data: txParams.data
|
|
2059
|
-
}
|
|
2060
|
-
]
|
|
2061
|
+
console.log("🐰 Sending Rabby wallet transaction:", txParams);
|
|
2062
|
+
const fullTxParams = {
|
|
2063
|
+
...txParams,
|
|
2064
|
+
from: this.account
|
|
2061
2065
|
};
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
+
try {
|
|
2067
|
+
const gasEstimate = await this.provider.request({
|
|
2068
|
+
method: "eth_estimateGas",
|
|
2069
|
+
params: [fullTxParams]
|
|
2070
|
+
});
|
|
2071
|
+
const gasLimit = Math.floor(parseInt(gasEstimate, 16) * 1.2);
|
|
2072
|
+
fullTxParams.gas = `0x${gasLimit.toString(16)}`;
|
|
2073
|
+
console.log("⛽ Rabby Gas estimate:", parseInt(gasEstimate, 16));
|
|
2074
|
+
console.log("⛽ Rabby Gas limit (with buffer):", gasLimit);
|
|
2075
|
+
} catch (gasError) {
|
|
2076
|
+
console.warn("Rabby gas estimation failed:", gasError);
|
|
2077
|
+
fullTxParams.gas = "0x15F90";
|
|
2078
|
+
}
|
|
2079
|
+
console.log("📤 Rabby Final transaction params:", fullTxParams);
|
|
2080
|
+
const txHash = await this.provider.request({
|
|
2081
|
+
method: "eth_sendTransaction",
|
|
2082
|
+
params: [fullTxParams]
|
|
2083
|
+
});
|
|
2084
|
+
console.log("✅ Rabby Transaction sent successfully:", txHash);
|
|
2085
|
+
return txHash;
|
|
2066
2086
|
} catch (error) {
|
|
2067
|
-
console.error("
|
|
2087
|
+
console.error("Rabby Transaction failed:", error);
|
|
2068
2088
|
if (error.code === 4001) {
|
|
2069
2089
|
throw new Error("Transaction cancelled by user");
|
|
2070
2090
|
} else if (error.message.includes("insufficient funds")) {
|
|
2071
|
-
throw new Error("Insufficient
|
|
2091
|
+
throw new Error("Insufficient funds in wallet");
|
|
2092
|
+
} else if (error.message.includes("gas")) {
|
|
2093
|
+
throw new Error("Gas estimation failed. You may not have enough ETH for gas fees.");
|
|
2072
2094
|
} else {
|
|
2073
2095
|
throw new Error(error.message || "Transaction failed");
|
|
2074
2096
|
}
|
|
2075
2097
|
}
|
|
2076
2098
|
}
|
|
2077
|
-
async getRecentBlockhash() {
|
|
2078
|
-
return "placeholder-blockhash";
|
|
2079
|
-
}
|
|
2080
|
-
async sendSignedTransaction(signedTransaction) {
|
|
2081
|
-
return "placeholder-signature-" + Date.now();
|
|
2082
|
-
}
|
|
2083
2099
|
isConnected() {
|
|
2084
2100
|
return !!this.account;
|
|
2085
2101
|
}
|
|
2086
2102
|
}
|
|
2087
2103
|
const CMC_LOGO_BASE_URL = "https://s2.coinmarketcap.com/static/img/coins/64x64";
|
|
2088
2104
|
const CmcIds = {
|
|
2089
|
-
// Networks
|
|
2090
2105
|
bitcoin: 1,
|
|
2091
2106
|
ethereum: 1027,
|
|
2092
2107
|
bsc: 1839,
|
|
2093
|
-
// BNB
|
|
2094
2108
|
polygon: 3890,
|
|
2095
|
-
// MATIC
|
|
2096
2109
|
tron: 1958,
|
|
2097
2110
|
solana: 5426,
|
|
2098
2111
|
algorand: 4030,
|
|
2099
2112
|
cardano: 2010,
|
|
2100
2113
|
avalanche: 5805,
|
|
2101
|
-
// AVAX
|
|
2102
2114
|
fantom: 3513,
|
|
2103
2115
|
arbitrum: 11841,
|
|
2104
|
-
// ARB
|
|
2105
2116
|
optimism: 11840,
|
|
2106
|
-
// OP
|
|
2107
|
-
// Major Stablecoins
|
|
2108
2117
|
USDT: 825,
|
|
2109
2118
|
USDC: 3408,
|
|
2110
2119
|
BUSD: 4687,
|
|
@@ -2115,119 +2124,60 @@ const CmcIds = {
|
|
|
2115
2124
|
USDD: 5994,
|
|
2116
2125
|
FDUSD: 26081,
|
|
2117
2126
|
PYUSD: 28295,
|
|
2118
|
-
// Popular ERC-20 Tokens
|
|
2119
2127
|
WBTC: 3717,
|
|
2120
|
-
// Wrapped Bitcoin
|
|
2121
2128
|
LINK: 1975,
|
|
2122
|
-
// Chainlink
|
|
2123
2129
|
UNI: 7083,
|
|
2124
|
-
// Uniswap
|
|
2125
2130
|
AAVE: 7278,
|
|
2126
|
-
// Aave
|
|
2127
2131
|
COMP: 5692,
|
|
2128
|
-
// Compound
|
|
2129
2132
|
YFI: 5864,
|
|
2130
|
-
// Yearn Finance
|
|
2131
2133
|
MKR: 1518,
|
|
2132
|
-
// Maker
|
|
2133
2134
|
SUSHI: 6758,
|
|
2134
|
-
// SushiSwap
|
|
2135
2135
|
CRV: 6538,
|
|
2136
|
-
// Curve DAO Token
|
|
2137
2136
|
SNX: 2586,
|
|
2138
|
-
// Synthetix
|
|
2139
2137
|
UMA: 5617,
|
|
2140
|
-
// UMA
|
|
2141
2138
|
BAL: 5728,
|
|
2142
|
-
// Balancer
|
|
2143
2139
|
MANA: 1966,
|
|
2144
|
-
// Decentraland
|
|
2145
2140
|
SAND: 6210,
|
|
2146
|
-
// The Sandbox
|
|
2147
2141
|
APE: 18876,
|
|
2148
|
-
// ApeCoin
|
|
2149
2142
|
LDO: 8e3,
|
|
2150
|
-
// Lido DAO
|
|
2151
2143
|
GRT: 6719,
|
|
2152
|
-
// The Graph
|
|
2153
2144
|
ENS: 13855,
|
|
2154
|
-
// Ethereum Name Service
|
|
2155
2145
|
RPL: 2943,
|
|
2156
|
-
// Rocket Pool
|
|
2157
2146
|
SHIB: 5994,
|
|
2158
|
-
// Shiba Inu (different from USDD)
|
|
2159
|
-
// Other Popular Tokens
|
|
2160
2147
|
MATIC: 3890,
|
|
2161
|
-
// Polygon (same as polygon network)
|
|
2162
2148
|
BNB: 1839,
|
|
2163
|
-
// Binance Coin
|
|
2164
2149
|
ADA: 2010,
|
|
2165
|
-
// Cardano (same as cardano network)
|
|
2166
2150
|
SOL: 5426,
|
|
2167
|
-
// Solana (same as solana network)
|
|
2168
2151
|
DOT: 6636,
|
|
2169
|
-
// Polkadot
|
|
2170
2152
|
AVAX: 5805,
|
|
2171
|
-
// Avalanche (same as avalanche network)
|
|
2172
2153
|
TRX: 1958,
|
|
2173
|
-
// Tron (same as tron network)
|
|
2174
2154
|
ALGO: 4030,
|
|
2175
|
-
// Algorand (same as algorand network)
|
|
2176
2155
|
FTM: 3513,
|
|
2177
|
-
// Fantom (same as fantom network)
|
|
2178
2156
|
ARB: 11841,
|
|
2179
|
-
// Arbitrum (same as arbitrum network)
|
|
2180
2157
|
OP: 11840,
|
|
2181
|
-
// Optimism (same as optimism network)
|
|
2182
|
-
// Additional DeFi tokens
|
|
2183
2158
|
"1INCH": 8104,
|
|
2184
|
-
// 1inch
|
|
2185
2159
|
DYDX: 11156,
|
|
2186
|
-
// dYdX
|
|
2187
2160
|
ICP: 8916,
|
|
2188
|
-
// Internet Computer
|
|
2189
2161
|
FIL: 2280,
|
|
2190
|
-
// Filecoin
|
|
2191
2162
|
CAKE: 7186,
|
|
2192
|
-
// PancakeSwap
|
|
2193
2163
|
RUNE: 4157,
|
|
2194
|
-
// THORChain
|
|
2195
2164
|
ALPHA: 7232,
|
|
2196
|
-
// Alpha Finance Lab
|
|
2197
2165
|
BNT: 1727,
|
|
2198
|
-
// Bancor
|
|
2199
2166
|
KNC: 1982,
|
|
2200
|
-
// Kyber Network Crystal
|
|
2201
2167
|
ZRX: 1896,
|
|
2202
|
-
// 0x
|
|
2203
2168
|
REN: 2539,
|
|
2204
|
-
// Ren
|
|
2205
2169
|
LRC: 1934,
|
|
2206
|
-
// Loopring
|
|
2207
|
-
// Wrapped tokens
|
|
2208
2170
|
WETH: 2396,
|
|
2209
|
-
// Wrapped Ether
|
|
2210
2171
|
WMATIC: 3890,
|
|
2211
|
-
// Wrapped MATIC (same as MATIC)
|
|
2212
2172
|
WBNB: 1839,
|
|
2213
|
-
// Wrapped BNB (same as BNB)
|
|
2214
|
-
// Additional stablecoins and pegged tokens
|
|
2215
2173
|
UST: 7129,
|
|
2216
|
-
// TerraUSD (Classic)
|
|
2217
2174
|
USTC: 7129,
|
|
2218
|
-
// TerraUSD Classic
|
|
2219
2175
|
LUSD: 8115,
|
|
2220
|
-
// Liquity USD
|
|
2221
2176
|
MIM: 9681,
|
|
2222
|
-
// Magic Internet Money
|
|
2223
2177
|
FEI: 8642,
|
|
2224
|
-
// Fei USD
|
|
2225
2178
|
TRIBE: 8741,
|
|
2226
|
-
// Tribe
|
|
2227
2179
|
RAI: 8525,
|
|
2228
|
-
// Rai Reflex Index
|
|
2229
2180
|
SUSD: 2927
|
|
2230
|
-
// sUSD (Synthetix USD)
|
|
2231
2181
|
};
|
|
2232
2182
|
const getCmcLogoUrl = (symbol) => {
|
|
2233
2183
|
if (!symbol) return null;
|
|
@@ -2248,7 +2198,6 @@ const NetworkLogos = {
|
|
|
2248
2198
|
avalanche: "https://s2.coinmarketcap.com/static/img/coins/64x64/5805.png",
|
|
2249
2199
|
celo: "https://s2.coinmarketcap.com/static/img/coins/64x64/5567.png",
|
|
2250
2200
|
optimism: "https://s2.coinmarketcap.com/static/img/coins/64x64/11840.png",
|
|
2251
|
-
// Alternative shortNames that might be used
|
|
2252
2201
|
eth: "https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png",
|
|
2253
2202
|
bnb: "https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png",
|
|
2254
2203
|
trx: "https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png",
|
|
@@ -2271,7 +2220,6 @@ const ModernDropdown = ({
|
|
|
2271
2220
|
getOptionKey,
|
|
2272
2221
|
getOptionValue,
|
|
2273
2222
|
getSearchableText,
|
|
2274
|
-
// NEW: Function to get searchable text
|
|
2275
2223
|
disabled = false
|
|
2276
2224
|
}) => {
|
|
2277
2225
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -2365,7 +2313,6 @@ const ModernDropdown = ({
|
|
|
2365
2313
|
maxHeight: dropdownPosition.maxHeight,
|
|
2366
2314
|
zIndex: 999999,
|
|
2367
2315
|
transform: "translateZ(0)",
|
|
2368
|
-
// GPU acceleration
|
|
2369
2316
|
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05)"
|
|
2370
2317
|
},
|
|
2371
2318
|
children: [
|
|
@@ -2401,7 +2348,6 @@ const ModernDropdown = ({
|
|
|
2401
2348
|
className: "overflow-y-auto custom-scrollbar",
|
|
2402
2349
|
style: {
|
|
2403
2350
|
maxHeight: `${(dropdownPosition.maxHeight || 450) - 180}px`,
|
|
2404
|
-
// Subtract header, search, and footer
|
|
2405
2351
|
minHeight: "200px"
|
|
2406
2352
|
},
|
|
2407
2353
|
children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-8 text-gray-500 text-center", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
|
|
@@ -2495,25 +2441,42 @@ const WalletSelector = ({
|
|
|
2495
2441
|
loading
|
|
2496
2442
|
}) => {
|
|
2497
2443
|
const [selectedWalletType, setSelectedWalletType] = useState(null);
|
|
2444
|
+
const isWalletInstalled = (walletType) => {
|
|
2445
|
+
var _a, _b, _c, _d, _e;
|
|
2446
|
+
switch (walletType) {
|
|
2447
|
+
case "metamask":
|
|
2448
|
+
if ((_a = window.ethereum) == null ? void 0 : _a.providers) {
|
|
2449
|
+
return window.ethereum.providers.some((provider) => provider.isMetaMask && !provider.isRabby);
|
|
2450
|
+
}
|
|
2451
|
+
return ((_b = window.ethereum) == null ? void 0 : _b.isMetaMask) && !((_c = window.ethereum) == null ? void 0 : _c.isRabby);
|
|
2452
|
+
case "rabby":
|
|
2453
|
+
if ((_d = window.ethereum) == null ? void 0 : _d.providers) {
|
|
2454
|
+
return window.ethereum.providers.some((provider) => provider.isRabby);
|
|
2455
|
+
}
|
|
2456
|
+
return (_e = window.ethereum) == null ? void 0 : _e.isRabby;
|
|
2457
|
+
default:
|
|
2458
|
+
return false;
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2498
2461
|
const getAvailableWallets = () => {
|
|
2499
2462
|
if (!selectedNetwork) return [];
|
|
2500
2463
|
const wallets = [];
|
|
2501
|
-
if (["ethereum", "bsc", "polygon", "arbitrum", "optimism", "avalanche"].includes(selectedNetwork.shortName)) {
|
|
2464
|
+
if (["ethereum", "bsc", "polygon", "arbitrum", "optimism", "avalanche", "solana"].includes(selectedNetwork.shortName)) {
|
|
2502
2465
|
wallets.push({
|
|
2503
2466
|
type: "metamask",
|
|
2504
2467
|
name: "MetaMask",
|
|
2505
2468
|
icon: "🦊",
|
|
2506
2469
|
description: "Connect using MetaMask wallet",
|
|
2507
|
-
isInstalled:
|
|
2470
|
+
isInstalled: isWalletInstalled("metamask"),
|
|
2471
|
+
color: "orange"
|
|
2508
2472
|
});
|
|
2509
|
-
}
|
|
2510
|
-
if (selectedNetwork.shortName === "solana") {
|
|
2511
2473
|
wallets.push({
|
|
2512
|
-
type: "
|
|
2513
|
-
name: "
|
|
2514
|
-
icon: "
|
|
2515
|
-
description: "Connect using
|
|
2516
|
-
isInstalled:
|
|
2474
|
+
type: "rabby",
|
|
2475
|
+
name: "Rabby",
|
|
2476
|
+
icon: "🐰",
|
|
2477
|
+
description: "Connect using Rabby wallet",
|
|
2478
|
+
isInstalled: isWalletInstalled("rabby"),
|
|
2479
|
+
color: "blue"
|
|
2517
2480
|
});
|
|
2518
2481
|
}
|
|
2519
2482
|
return wallets;
|
|
@@ -2549,14 +2512,30 @@ const WalletSelector = ({
|
|
|
2549
2512
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-3", children: [
|
|
2550
2513
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-2xl", children: wallet.icon }),
|
|
2551
2514
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
|
|
2552
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
2515
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-semibold text-gray-800 flex items-center", children: [
|
|
2516
|
+
wallet.name,
|
|
2517
|
+
wallet.type === "rabby" && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full", children: "NEW" })
|
|
2518
|
+
] }),
|
|
2553
2519
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: !wallet.isInstalled ? `Please install ${wallet.name} extension` : (connectedWallet == null ? void 0 : connectedWallet.walletType) === wallet.type ? "✅ Connected" : wallet.description })
|
|
2554
2520
|
] }),
|
|
2555
2521
|
loading && selectedWalletType === wallet.type && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-[#7042D2]" })
|
|
2556
2522
|
] })
|
|
2557
2523
|
},
|
|
2558
2524
|
wallet.type
|
|
2559
|
-
))
|
|
2525
|
+
)),
|
|
2526
|
+
availableWallets.some((w) => !w.isInstalled) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 p-3 bg-amber-50 rounded-lg border border-amber-200", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-amber-800", style: { fontFamily: "Bricolage Grotesque, sans-serif" }, children: [
|
|
2527
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: "💡 Need to install a wallet?" }),
|
|
2528
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 text-xs", children: [
|
|
2529
|
+
!isWalletInstalled("metamask") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
2530
|
+
"• ",
|
|
2531
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://metamask.io", target: "_blank", rel: "noopener noreferrer", className: "text-amber-700 underline hover:text-amber-900", children: "Install MetaMask" })
|
|
2532
|
+
] }),
|
|
2533
|
+
!isWalletInstalled("rabby") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
2534
|
+
"• ",
|
|
2535
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "https://rabby.io", target: "_blank", rel: "noopener noreferrer", className: "text-amber-700 underline hover:text-amber-900", children: "Install Rabby Wallet" })
|
|
2536
|
+
] })
|
|
2537
|
+
] })
|
|
2538
|
+
] }) })
|
|
2560
2539
|
] });
|
|
2561
2540
|
};
|
|
2562
2541
|
const EnhancedQRCode = ({
|
|
@@ -2870,7 +2849,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
2870
2849
|
const [error, setError] = useState("");
|
|
2871
2850
|
const [wallets, setWallets] = useState({
|
|
2872
2851
|
metamask: new SimpleMetaMaskWallet2(),
|
|
2873
|
-
|
|
2852
|
+
rabby: new SimpleRabbyWallet()
|
|
2874
2853
|
});
|
|
2875
2854
|
const [selectedWalletType, setSelectedWalletType] = useState(null);
|
|
2876
2855
|
const [connectedWallet, setConnectedWallet] = useState(null);
|
|
@@ -2895,7 +2874,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
2895
2874
|
setProcessing(false);
|
|
2896
2875
|
setWallets({
|
|
2897
2876
|
metamask: new SimpleMetaMaskWallet2(),
|
|
2898
|
-
|
|
2877
|
+
rabby: new SimpleRabbyWallet()
|
|
2899
2878
|
});
|
|
2900
2879
|
setPaymentType("wallet");
|
|
2901
2880
|
};
|
|
@@ -2983,7 +2962,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
2983
2962
|
selectedNetwork: selectedNetwork.shortName,
|
|
2984
2963
|
selectedToken: selectedToken.symbol,
|
|
2985
2964
|
walletType: selectedWalletType
|
|
2986
|
-
//
|
|
2965
|
+
// Include wallet type in metadata
|
|
2987
2966
|
}
|
|
2988
2967
|
};
|
|
2989
2968
|
console.log("🔄 Creating payment:", paymentPayload);
|
|
@@ -3014,26 +2993,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
3014
2993
|
console.log(`🔄 Preparing ${selectedWalletType} transaction to:`, recipientAddress);
|
|
3015
2994
|
let txParams;
|
|
3016
2995
|
let txHash;
|
|
3017
|
-
if (
|
|
3018
|
-
const amount = Math.floor(paymentData.totalAmount * Math.pow(10, selectedToken.decimals || 6));
|
|
3019
|
-
txParams = {
|
|
3020
|
-
to: recipientAddress,
|
|
3021
|
-
amount,
|
|
3022
|
-
tokenMint: selectedToken.contractAddress,
|
|
3023
|
-
// For SPL tokens
|
|
3024
|
-
programId: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
3025
|
-
// SPL Token program
|
|
3026
|
-
data: define_Buffer_default.from([
|
|
3027
|
-
/* transaction data */
|
|
3028
|
-
])
|
|
3029
|
-
};
|
|
3030
|
-
console.log("🔄 Solana Transaction:", {
|
|
3031
|
-
token: selectedToken.symbol,
|
|
3032
|
-
amount: paymentData.totalAmount,
|
|
3033
|
-
amountWithDecimals: amount,
|
|
3034
|
-
to: recipientAddress
|
|
3035
|
-
});
|
|
3036
|
-
} else if (selectedWalletType === "metamask") {
|
|
2996
|
+
if (["metamask", "rabby"].includes(selectedWalletType)) {
|
|
3037
2997
|
if (selectedToken.contractAddress) {
|
|
3038
2998
|
const decimals = selectedToken.decimals || 6;
|
|
3039
2999
|
const amount = Math.floor(paymentData.totalAmount * Math.pow(10, decimals));
|
|
@@ -3046,7 +3006,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
3046
3006
|
data,
|
|
3047
3007
|
value: "0x0"
|
|
3048
3008
|
};
|
|
3049
|
-
console.log(
|
|
3009
|
+
console.log(`🔄 ${selectedWalletType.toUpperCase()} ERC-20 Transaction:`, {
|
|
3050
3010
|
token: selectedToken.symbol,
|
|
3051
3011
|
amount: paymentData.totalAmount,
|
|
3052
3012
|
amountWithDecimals: amount,
|
|
@@ -3059,7 +3019,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
3059
3019
|
to: recipientAddress,
|
|
3060
3020
|
value: `0x${value.toString(16)}`
|
|
3061
3021
|
};
|
|
3062
|
-
console.log(
|
|
3022
|
+
console.log(`🔄 ${selectedWalletType.toUpperCase()} Native Transaction:`, {
|
|
3063
3023
|
amount: paymentData.totalAmount,
|
|
3064
3024
|
to: recipientAddress
|
|
3065
3025
|
});
|
|
@@ -3076,7 +3036,7 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
3076
3036
|
amount: paymentData.totalAmount,
|
|
3077
3037
|
method: paymentMethod,
|
|
3078
3038
|
walletType: selectedWalletType
|
|
3079
|
-
//
|
|
3039
|
+
// Include wallet type in callback
|
|
3080
3040
|
});
|
|
3081
3041
|
}, 2e3);
|
|
3082
3042
|
} catch (err) {
|