@reown/appkit-common-react-native 0.0.0-feat-onramp-20250722205908 → 0.0.0-feat-coinbase-20250723173858
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/lib/commonjs/adapters/BlockchainAdapter.js +81 -0
- package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -0
- package/lib/commonjs/adapters/EvmAdapter.js +208 -0
- package/lib/commonjs/adapters/EvmAdapter.js.map +1 -0
- package/lib/commonjs/adapters/SolanaBaseAdapter.js +10 -0
- package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +1 -0
- package/lib/commonjs/index.js +62 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/networks/bitcoin.js +40 -0
- package/lib/commonjs/networks/bitcoin.js.map +1 -0
- package/lib/commonjs/networks/solana.js +78 -0
- package/lib/commonjs/networks/solana.js.map +1 -0
- package/lib/commonjs/utils/ConstantsUtil.js +13 -3
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/NumberUtil.js +52 -11
- package/lib/commonjs/utils/NumberUtil.js.map +1 -1
- package/lib/commonjs/utils/PresetsUtil.js +35 -10
- package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
- package/lib/commonjs/utils/TypeUtil.js +42 -0
- package/lib/commonjs/utils/TypeUtil.js.map +1 -1
- package/lib/module/adapters/BlockchainAdapter.js +74 -0
- package/lib/module/adapters/BlockchainAdapter.js.map +1 -0
- package/lib/module/adapters/EvmAdapter.js +202 -0
- package/lib/module/adapters/EvmAdapter.js.map +1 -0
- package/lib/module/adapters/SolanaBaseAdapter.js +3 -0
- package/lib/module/adapters/SolanaBaseAdapter.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/networks/bitcoin.js +34 -0
- package/lib/module/networks/bitcoin.js.map +1 -0
- package/lib/module/networks/solana.js +72 -0
- package/lib/module/networks/solana.js.map +1 -0
- package/lib/module/utils/ConstantsUtil.js +13 -3
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/NumberUtil.js +52 -11
- package/lib/module/utils/NumberUtil.js.map +1 -1
- package/lib/module/utils/PresetsUtil.js +35 -10
- package/lib/module/utils/PresetsUtil.js.map +1 -1
- package/lib/module/utils/TypeUtil.js +36 -0
- package/lib/module/utils/TypeUtil.js.map +1 -1
- package/lib/typescript/adapters/BlockchainAdapter.d.ts +25 -0
- package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -0
- package/lib/typescript/adapters/EvmAdapter.d.ts +27 -0
- package/lib/typescript/adapters/EvmAdapter.d.ts.map +1 -0
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +6 -0
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +1 -0
- package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts +2 -0
- package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/networks/bitcoin.d.ts +4 -0
- package/lib/typescript/networks/bitcoin.d.ts.map +1 -0
- package/lib/typescript/networks/solana.d.ts +5 -0
- package/lib/typescript/networks/solana.d.ts.map +1 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts +10 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/NumberUtil.d.ts +39 -11
- package/lib/typescript/utils/NumberUtil.d.ts.map +1 -1
- package/lib/typescript/utils/PresetsUtil.d.ts +1 -3
- package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +296 -12
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapters/BlockchainAdapter.ts +107 -0
- package/src/adapters/EvmAdapter.ts +260 -0
- package/src/adapters/SolanaBaseAdapter.ts +6 -0
- package/src/adapters/__tests__/EvmAdapter.test.ts +126 -0
- package/src/index.ts +5 -0
- package/src/networks/bitcoin.ts +32 -0
- package/src/networks/solana.ts +44 -0
- package/src/utils/ConstantsUtil.ts +14 -3
- package/src/utils/NumberUtil.ts +54 -11
- package/src/utils/PresetsUtil.ts +37 -12
- package/src/utils/TypeUtil.ts +379 -14
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const solana = {
|
|
2
|
+
id: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
3
|
+
name: 'Solana',
|
|
4
|
+
nativeCurrency: {
|
|
5
|
+
name: 'Solana',
|
|
6
|
+
symbol: 'SOL',
|
|
7
|
+
decimals: 9
|
|
8
|
+
},
|
|
9
|
+
rpcUrls: {
|
|
10
|
+
default: {
|
|
11
|
+
http: ['https://rpc.walletconnect.org/v1']
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'Solscan',
|
|
17
|
+
url: 'https://solscan.io'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
chainNamespace: 'solana',
|
|
21
|
+
caipNetworkId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
22
|
+
deprecatedCaipNetworkId: 'solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ',
|
|
23
|
+
testnet: false
|
|
24
|
+
};
|
|
25
|
+
export const solanaDevnet = {
|
|
26
|
+
id: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
27
|
+
name: 'Solana Devnet',
|
|
28
|
+
nativeCurrency: {
|
|
29
|
+
name: 'Solana',
|
|
30
|
+
symbol: 'SOL',
|
|
31
|
+
decimals: 9
|
|
32
|
+
},
|
|
33
|
+
rpcUrls: {
|
|
34
|
+
default: {
|
|
35
|
+
http: ['https://rpc.walletconnect.org/v1']
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
blockExplorers: {
|
|
39
|
+
default: {
|
|
40
|
+
name: 'Solscan',
|
|
41
|
+
url: 'https://solscan.io'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
chainNamespace: 'solana',
|
|
45
|
+
caipNetworkId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
46
|
+
deprecatedCaipNetworkId: 'solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K',
|
|
47
|
+
testnet: true
|
|
48
|
+
};
|
|
49
|
+
export const solanaTestnet = {
|
|
50
|
+
id: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
|
|
51
|
+
name: 'Solana Testnet',
|
|
52
|
+
nativeCurrency: {
|
|
53
|
+
name: 'Solana',
|
|
54
|
+
symbol: 'SOL',
|
|
55
|
+
decimals: 9
|
|
56
|
+
},
|
|
57
|
+
rpcUrls: {
|
|
58
|
+
default: {
|
|
59
|
+
http: ['https://rpc.walletconnect.org/v1']
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
blockExplorers: {
|
|
63
|
+
default: {
|
|
64
|
+
name: 'Solscan',
|
|
65
|
+
url: 'https://solscan.io'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
chainNamespace: 'solana',
|
|
69
|
+
caipNetworkId: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
|
|
70
|
+
testnet: true
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=solana.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["solana","id","name","nativeCurrency","symbol","decimals","rpcUrls","default","http","blockExplorers","url","chainNamespace","caipNetworkId","deprecatedCaipNetworkId","testnet","solanaDevnet","solanaTestnet"],"sourceRoot":"../../../src","sources":["networks/solana.ts"],"mappings":"AAEA,OAAO,MAAMA,MAAqB,GAAG;EACnCC,EAAE,EAAE,kCAAkC;EACtCC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE;IAAED,IAAI,EAAE,QAAQ;IAAEE,MAAM,EAAE,KAAK;IAAEC,Q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Q;EACxBC,aAAa,EAAE,yCAAyC;EACxDE,OAAO,EAAE;AACX,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ConstantsUtil = {
|
|
2
|
-
VERSION: '0.0.0-feat-
|
|
2
|
+
VERSION: '0.0.0-feat-coinbase-20250723173858',
|
|
3
3
|
EIP155: 'eip155',
|
|
4
4
|
ADD_CHAIN_METHOD: 'wallet_addEthereumChain',
|
|
5
5
|
WC_NAME_SUFFIX: '.reown.id',
|
|
@@ -8,10 +8,14 @@ export const ConstantsUtil = {
|
|
|
8
8
|
BLOCKCHAIN_API_RPC_URL_STAGING: 'https://staging.rpc.walletconnect.org',
|
|
9
9
|
PULSE_API_URL: 'https://pulse.walletconnect.org',
|
|
10
10
|
API_URL: 'https://api.web3modal.org',
|
|
11
|
+
WEB_WALLET_URL: 'https://web-wallet.walletconnect.org',
|
|
12
|
+
SECURE_SITE_DASHBOARD: `https://secure.reown.com/dashboard`,
|
|
13
|
+
SECURE_SITE_ICON: `https://secure.reown.com/images/favicon.png`,
|
|
14
|
+
//TODO: remove this
|
|
11
15
|
WALLET_CONNECT_CONNECTOR_ID: 'walletConnect',
|
|
12
16
|
COINBASE_CONNECTOR_ID: 'coinbaseWallet',
|
|
13
|
-
AUTH_CONNECTOR_ID: 'appKitAuth',
|
|
14
17
|
COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
|
|
18
|
+
PHANTOM_EXPLORER_ID: 'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393',
|
|
15
19
|
USDT_CONTRACT_ADDRESSES: [
|
|
16
20
|
// Mainnet
|
|
17
21
|
'0xdac17f958d2ee523a2206206994597c13d831ec7',
|
|
@@ -26,6 +30,12 @@ export const ConstantsUtil = {
|
|
|
26
30
|
// Binance
|
|
27
31
|
'0x55d398326f99059fF775485246999027B3197955',
|
|
28
32
|
// Arbitrum
|
|
29
|
-
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9']
|
|
33
|
+
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'],
|
|
34
|
+
PHANTOM_CUSTOM_WALLET: {
|
|
35
|
+
id: 'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393',
|
|
36
|
+
name: 'Phantom Wallet',
|
|
37
|
+
image_id: 'b6ec7b81-bb4f-427d-e290-7631e6e50d00',
|
|
38
|
+
mobile_link: 'phantom://'
|
|
39
|
+
}
|
|
30
40
|
};
|
|
31
41
|
//# sourceMappingURL=ConstantsUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConstantsUtil","VERSION","EIP155","ADD_CHAIN_METHOD","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","BLOCKCHAIN_API_RPC_URL_STAGING","PULSE_API_URL","API_URL","WALLET_CONNECT_CONNECTOR_ID","COINBASE_CONNECTOR_ID","
|
|
1
|
+
{"version":3,"names":["ConstantsUtil","VERSION","EIP155","ADD_CHAIN_METHOD","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","BLOCKCHAIN_API_RPC_URL_STAGING","PULSE_API_URL","API_URL","WEB_WALLET_URL","SECURE_SITE_DASHBOARD","SECURE_SITE_ICON","WALLET_CONNECT_CONNECTOR_ID","COINBASE_CONNECTOR_ID","COINBASE_EXPLORER_ID","PHANTOM_EXPLORER_ID","USDT_CONTRACT_ADDRESSES","PHANTOM_CUSTOM_WALLET","id","name","image_id","mobile_link"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EAC3BC,OAAO,EAAE,oCAAoC;EAE7CC,MAAM,EAAE,QAAQ;EAChBC,gBAAgB,EAAE,yBAAyB;EAE3CC,cAAc,EAAE,WAAW;EAC3BC,qBAAqB,EAAE,SAAS;EAEhCC,sBAAsB,EAAE,+BAA+B;EACvDC,8BAA8B,EAAE,uCAAuC;EACvEC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EACpCC,cAAc,EAAE,sCAAsC;EACtDC,qBAAqB,EAAG,oCAAmC;EAC3DC,gBAAgB,EAAG,6CAA4C;EAE/D;EACAC,2BAA2B,EAAE,eAAe;EAC5CC,qBAAqB,EAAE,gBAAgB;EAEvCC,oBAAoB,EAAE,kEAAkE;EACxFC,mBAAmB,EAAE,kEAAkE;EAEvFC,uBAAuB,EAAE;EACvB;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C,CAC7C;EAEDC,qBAAqB,EAAE;IACrBC,EAAE,EAAE,kEAAkE;IACtEC,IAAI,EAAE,gBAAgB;IACtBC,QAAQ,EAAE,sCAAsC;IAChDC,WAAW,EAAE;EACf;AACF,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as BigNumber from 'bignumber.js';
|
|
2
2
|
export const NumberUtil = {
|
|
3
|
+
/**
|
|
4
|
+
* Creates a BigNumber instance from a given value.
|
|
5
|
+
* If the value is a string, commas are removed before conversion.
|
|
6
|
+
* @param value - The input value (string, number, or BigNumber) to convert to a BigNumber.
|
|
7
|
+
* @returns A BigNumber instance.
|
|
8
|
+
*/
|
|
3
9
|
bigNumber(value) {
|
|
4
10
|
if (typeof value === 'string') {
|
|
5
11
|
return new BigNumber.BigNumber(value.replace(/,/g, ''));
|
|
@@ -7,10 +13,11 @@ export const NumberUtil = {
|
|
|
7
13
|
return new BigNumber.BigNumber(value);
|
|
8
14
|
},
|
|
9
15
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @
|
|
16
|
+
* Multiplies two numbers using BigNumber for precision, especially with decimals.
|
|
17
|
+
* Handles undefined inputs by returning BigNumber(0).
|
|
18
|
+
* @param a - The first multiplicand (string, number, or BigNumber). Commas are removed if it's a string.
|
|
19
|
+
* @param b - The second multiplicand (string, number, or BigNumber). Commas are removed if it's a string.
|
|
20
|
+
* @returns The product as a BigNumber instance, or BigNumber(0) if either input is undefined.
|
|
14
21
|
*/
|
|
15
22
|
multiply(a, b) {
|
|
16
23
|
if (a === undefined || b === undefined) {
|
|
@@ -20,19 +27,32 @@ export const NumberUtil = {
|
|
|
20
27
|
const bBigNumber = new BigNumber.BigNumber(typeof b === 'string' ? b.replace(/,/gu, '') : b);
|
|
21
28
|
return aBigNumber.multipliedBy(bBigNumber);
|
|
22
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* Rounds a number to a specified number of decimal places if its string representation meets a certain length threshold.
|
|
32
|
+
* @param number - The number to potentially round.
|
|
33
|
+
* @param threshold - The minimum string length of the number to trigger rounding.
|
|
34
|
+
* @param fixed - The number of decimal places to round to.
|
|
35
|
+
* @returns The rounded number (as a string if rounded, otherwise the original number) or the original number.
|
|
36
|
+
*/
|
|
23
37
|
roundNumber(number, threshold, fixed) {
|
|
24
38
|
const roundedNumber = number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
|
|
25
39
|
return roundedNumber;
|
|
26
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Calculates the next multiple of ten greater than or equal to the given amount.
|
|
43
|
+
* Defaults to 10 if no amount is provided or if the calculated multiple is less than 10.
|
|
44
|
+
* @param amount - The number for which to find the next multiple of ten. Optional.
|
|
45
|
+
* @returns The next multiple of ten, at least 10.
|
|
46
|
+
*/
|
|
27
47
|
nextMultipleOfTen(amount) {
|
|
28
48
|
if (!amount) return 10;
|
|
29
49
|
return Math.max(Math.ceil(amount / 10) * 10, 10);
|
|
30
50
|
},
|
|
31
51
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param value - The value to format
|
|
34
|
-
* @param decimals - number of
|
|
35
|
-
* @returns
|
|
52
|
+
* Formats a number or string to a human-readable string with a specified number of decimal places, using US locale formatting.
|
|
53
|
+
* @param value - The value to format (string, number, or undefined). If undefined, returns '0.00'.
|
|
54
|
+
* @param decimals - The number of decimal places to display. Defaults to 2.
|
|
55
|
+
* @returns A locale-formatted string representation of the number.
|
|
36
56
|
*/
|
|
37
57
|
formatNumberToLocalString(value, decimals = 2) {
|
|
38
58
|
if (value === undefined) {
|
|
@@ -50,9 +70,9 @@ export const NumberUtil = {
|
|
|
50
70
|
});
|
|
51
71
|
},
|
|
52
72
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @param value - The formatted string to parse
|
|
55
|
-
* @returns
|
|
73
|
+
* Parses a locale-formatted numeric string (e.g., with commas) back into a number.
|
|
74
|
+
* @param value - The formatted string to parse. If undefined, returns 0.
|
|
75
|
+
* @returns The parsed number, or 0 if the input is undefined.
|
|
56
76
|
*/
|
|
57
77
|
parseLocalStringToNumber(value) {
|
|
58
78
|
if (value === undefined) {
|
|
@@ -61,6 +81,27 @@ export const NumberUtil = {
|
|
|
61
81
|
|
|
62
82
|
// Remove any commas used as thousand separators and parse the float
|
|
63
83
|
return parseFloat(value.replace(/,/gu, ''));
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Converts a numeric value (BigInt, number, or string representation of a number) to a 0x-prefixed hexadecimal string.
|
|
87
|
+
* This is often required for Ethereum RPC parameters like value, gas, gasPrice.
|
|
88
|
+
* @param value - The value to convert. Can be BigInt, number, or a string (decimal or hex).
|
|
89
|
+
* @returns A 0x-prefixed hexadecimal string, or undefined if the input is undefined or null.
|
|
90
|
+
* @throws Error if the value cannot be converted to BigInt.
|
|
91
|
+
*/
|
|
92
|
+
convertNumericToHexString: value => {
|
|
93
|
+
if (value === undefined || value === null) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
// This handles BigInt, number, or string representation of a number (decimal or hex)
|
|
98
|
+
const bigIntValue = BigInt(value);
|
|
99
|
+
// Ethereum RPC spec requires "0x0" for zero, and other values to be 0x-prefixed hex.
|
|
100
|
+
|
|
101
|
+
return '0x' + bigIntValue.toString(16);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
throw new Error(`NumberUtil: Invalid parameter, cannot convert to hex: ${value}`);
|
|
104
|
+
}
|
|
64
105
|
}
|
|
65
106
|
};
|
|
66
107
|
//# sourceMappingURL=NumberUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BigNumber","NumberUtil","bigNumber","value","replace","multiply","a","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed","nextMultipleOfTen","amount","Math","max","ceil","formatNumberToLocalString","decimals","toLocaleString","maximumFractionDigits","minimumFractionDigits","parseFloat","parseLocalStringToNumber"],"sourceRoot":"../../../src","sources":["utils/NumberUtil.ts"],"mappings":"AAAA,OAAO,KAAKA,SAAS,MAAM,cAAc;AAEzC,OAAO,MAAMC,UAAU,GAAG;
|
|
1
|
+
{"version":3,"names":["BigNumber","NumberUtil","bigNumber","value","replace","multiply","a","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed","nextMultipleOfTen","amount","Math","max","ceil","formatNumberToLocalString","decimals","toLocaleString","maximumFractionDigits","minimumFractionDigits","parseFloat","parseLocalStringToNumber","convertNumericToHexString","bigIntValue","BigInt","error","Error"],"sourceRoot":"../../../src","sources":["utils/NumberUtil.ts"],"mappings":"AAAA,OAAO,KAAKA,SAAS,MAAM,cAAc;AAEzC,OAAO,MAAMC,UAAU,GAAG;EACxB;AACF;AACA;AACA;AACA;AACA;EACEC,SAASA,CAACC,KAAgC,EAAE;IAC1C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B,OAAO,IAAIH,SAAS,CAACA,SAAS,CAACG,KAAK,CAACC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACzD;IAEA,OAAO,IAAIJ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5
|
},
|
|
6
|
-
|
|
6
|
+
NetworkImageIds: {
|
|
7
7
|
// Ethereum
|
|
8
8
|
1: 'ba0ba0cd-17c6-4806-ad93-f9d174f17900',
|
|
9
9
|
// Arbitrum
|
|
10
|
-
42161: '
|
|
10
|
+
42161: '3bff954d-5cb0-47a0-9a23-d20192e74600',
|
|
11
11
|
// Avalanche
|
|
12
12
|
43114: '30c46e53-e989-45fb-4549-be3bd4eb3b00',
|
|
13
13
|
// Binance Smart Chain
|
|
@@ -18,6 +18,20 @@ export const PresetsUtil = {
|
|
|
18
18
|
10: 'ab9c186a-c52f-464b-2906-ca59d760a400',
|
|
19
19
|
// Polygon
|
|
20
20
|
137: '41d04d42-da3b-4453-8506-668cc0727900',
|
|
21
|
+
// Mantle
|
|
22
|
+
5000: 'e86fae9b-b770-4eea-e520-150e12c81100',
|
|
23
|
+
// Hedera Mainnet
|
|
24
|
+
295: '6a97d510-cac8-4e58-c7ce-e8681b044c00',
|
|
25
|
+
// Sepolia
|
|
26
|
+
11_155_111: 'e909ea0a-f92a-4512-c8fc-748044ea6800',
|
|
27
|
+
// Base Sepolia
|
|
28
|
+
84532: 'a18a7ecd-e307-4360-4746-283182228e00',
|
|
29
|
+
// Unichain Sepolia
|
|
30
|
+
1301: '4eeea7ef-0014-4649-5d1d-07271a80f600',
|
|
31
|
+
// Unichain Mainnet
|
|
32
|
+
130: '2257980a-3463-48c6-cbac-a42d2a956e00',
|
|
33
|
+
// Monad Testnet
|
|
34
|
+
10_143: '0a728e83-bacb-46db-7844-948f05434900',
|
|
21
35
|
// Gnosis
|
|
22
36
|
100: '02b53f6a-e3d4-479e-1cb4-21178987d100',
|
|
23
37
|
// EVMos
|
|
@@ -41,22 +55,33 @@ export const PresetsUtil = {
|
|
|
41
55
|
// Base
|
|
42
56
|
8453: '7289c336-3981-4081-c5f4-efc26ac64a00',
|
|
43
57
|
// Aurora
|
|
44
|
-
1313161554: '3ff73439-a619-4894-9262-4470c773a100'
|
|
58
|
+
1313161554: '3ff73439-a619-4894-9262-4470c773a100',
|
|
59
|
+
// Ronin Mainnet
|
|
60
|
+
2020: 'b8101fc0-9c19-4b6f-ec65-f6dfff106e00',
|
|
61
|
+
// Saigon Testnet (a.k.a. Ronin)
|
|
62
|
+
2021: 'b8101fc0-9c19-4b6f-ec65-f6dfff106e00',
|
|
63
|
+
// Berachain Mainnet
|
|
64
|
+
80094: 'e329c2c9-59b0-4a02-83e4-212ff3779900',
|
|
65
|
+
// Abstract Mainnet
|
|
66
|
+
2741: 'fc2427d1-5af9-4a9c-8da5-6f94627cd900',
|
|
67
|
+
// Solana networks
|
|
68
|
+
/// Mainnet
|
|
69
|
+
'5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'a1b58899-f671-4276-6a5e-56ca5bd59700',
|
|
70
|
+
/// Testnet
|
|
71
|
+
'4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z': 'a1b58899-f671-4276-6a5e-56ca5bd59700',
|
|
72
|
+
// Bitcoin
|
|
73
|
+
'000000000019d6689c085ae165831e93': '0b4838db-0161-4ffe-022d-532bf03dba00',
|
|
74
|
+
// Bitcoin Testnet
|
|
75
|
+
'000000000933ea01ad0ee984209779ba': '39354064-d79b-420b-065d-f980c4b78200'
|
|
45
76
|
},
|
|
46
77
|
ConnectorNamesMap: {
|
|
47
78
|
[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WalletConnect',
|
|
48
|
-
[ConstantsUtil.COINBASE_CONNECTOR_ID]: 'Coinbase Wallet'
|
|
49
|
-
[ConstantsUtil.AUTH_CONNECTOR_ID]: 'AppKit Universal Wallet'
|
|
79
|
+
[ConstantsUtil.COINBASE_CONNECTOR_ID]: 'Coinbase Wallet'
|
|
50
80
|
},
|
|
51
81
|
ConnectorImageIds: {
|
|
52
82
|
[ConstantsUtil.COINBASE_CONNECTOR_ID]: '0c2840c3-5b04-4c44-9661-fbd4b49e1800',
|
|
53
83
|
[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400'
|
|
54
84
|
},
|
|
55
|
-
ConnectorTypesMap: {
|
|
56
|
-
[ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WALLET_CONNECT',
|
|
57
|
-
[ConstantsUtil.COINBASE_CONNECTOR_ID]: 'COINBASE',
|
|
58
|
-
[ConstantsUtil.AUTH_CONNECTOR_ID]: 'AUTH'
|
|
59
|
-
},
|
|
60
85
|
RpcChainIds: [
|
|
61
86
|
// Ethereum
|
|
62
87
|
1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConstantsUtil","PresetsUtil","ConnectorExplorerIds","COINBASE_CONNECTOR_ID","
|
|
1
|
+
{"version":3,"names":["ConstantsUtil","PresetsUtil","ConnectorExplorerIds","COINBASE_CONNECTOR_ID","NetworkImageIds","ConnectorNamesMap","WALLET_CONNECT_CONNECTOR_ID","ConnectorImageIds","RpcChainIds"],"sourceRoot":"../../../src","sources":["utils/PresetsUtil.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB;AAE/C,OAAO,MAAMC,WAAW,GAAG;EACzBC,oBAAoB,EAAE;IACpB,CAACF,aAAa,CAACG,qBAAqB,GAClC;EACJ,CAA2B;EAE3BC,eAAe,EAAE;IACf;IACA,CAAC,EAAE,sCAAsC;IACzC;IACA,KAAK,EAAE,sCAAsC;IAC7C;IACA,KAAK,EAAE,sCAAsC;IAC7C;IACA,EAAE,EAAE,sCAAsC;IAC1C;IACA,GAAG,EAAE,sCAAsC;IAC3C;IACA,EAAE,EAAE,sCAAsC;IAC1C;IACA,GAAG,EAAE,sCAAsC;IAC3C;IACA,IAAI,EAAE,sCAAsC;IAC5C;IACA,GAAG,EAAE,sCAAsC;IAC3C;IACA,UAAU,EAAE,sCAAsC;IAClD;IACA,KAAK,EAAE,sCAAsC;IAC7C;IACA,IAAI,EAAE,sCAAsC;IAC5C;IACA,GAAG,EAAE,sCAAsC;IAC3C;IACA,MA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;EACJ;EACA,KAAK;EACL;EACA,OAAO;EACP;EACA,GAAG;EACH;EACA,GAAG;EACH;EACA,GAAG;AAEP,CAAC"}
|
|
@@ -1,2 +1,38 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
1
2
|
|
|
3
|
+
//********** Adapter Event Payloads **********//
|
|
4
|
+
|
|
5
|
+
//********** Adapter Event Map **********//
|
|
6
|
+
|
|
7
|
+
//********** Connector Types **********//
|
|
8
|
+
|
|
9
|
+
export class WalletConnector extends EventEmitter {
|
|
10
|
+
constructor({
|
|
11
|
+
type
|
|
12
|
+
}) {
|
|
13
|
+
super();
|
|
14
|
+
this.type = type;
|
|
15
|
+
}
|
|
16
|
+
async init(ops) {
|
|
17
|
+
this.storage = ops.storage;
|
|
18
|
+
this.metadata = ops.metadata;
|
|
19
|
+
}
|
|
20
|
+
setProvider(provider) {
|
|
21
|
+
this.provider = provider;
|
|
22
|
+
}
|
|
23
|
+
async disconnect() {
|
|
24
|
+
await this.getProvider().disconnect();
|
|
25
|
+
this.namespaces = undefined;
|
|
26
|
+
this.wallet = undefined;
|
|
27
|
+
this.properties = undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//********** Provider Types **********//
|
|
32
|
+
|
|
33
|
+
//********** Others **********//
|
|
34
|
+
|
|
35
|
+
//********** SIWE Types **********//
|
|
36
|
+
|
|
37
|
+
// Signed Cacao (CAIP-74)
|
|
2
38
|
//# sourceMappingURL=TypeUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["EventEmitter","WalletConnector","constructor","type","init","ops","storage","metadata","setProvider","provider","disconnect","getProvider","namespaces","undefined","wallet","properties"],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":"AAAA,SAASA,YAAY,QAAQ,QAAQ;;AAkLrC;;AAgBA;;AAgBA;;AA8BA,OAAO,MAAeC,eAAe,SAASD,YAAY,CAAC;EASzDE,WAAWA,CAAC;IAAEC;EAA8B,CAAC,EAAE;IAC7C,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,IAAI,GAAGA,IAAI;EAClB;EAEA,MAAaC,IAAIA,CAACC,GAAyB,EAAE;IAC3C,IAAI,CAACC,OAAO,GAAGD,GAAG,CAACC,OAAO;IAC1B,IAAI,CAACC,QAAQ,GAAGF,GAAG,CAACE,QAAQ;EAC9B;EAEOC,WAAWA,CAACC,QAAkB,EAAE;IACrC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEA,MAAaC,UAAUA,CAAA,EAAG;IACxB,MAAM,IAAI,CAACC,WAAW,CAAC,CAAC,CAACD,UAAU,CAAC,CAAC;IACrC,IAAI,CAACE,UAAU,GAAGC,SAAS;IAC3B,IAAI,CAACC,MAAM,GAAGD,SAAS;IACvB,IAAI,CAACE,UAAU,GAAGF,SAAS;EAC7B;AAUF;;AAEA;;AAqBA;;AA+DA;;AA6BA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import type { AdapterEvents, AdapterType, AppKitNetwork, BlockchainAdapterConfig, CaipAddress, ChainNamespace, GetBalanceParams, GetBalanceResponse, Provider, WalletConnector } from '../utils/TypeUtil';
|
|
4
|
+
export declare abstract class BlockchainAdapter extends EventEmitter {
|
|
5
|
+
projectId: string;
|
|
6
|
+
connector?: WalletConnector;
|
|
7
|
+
supportedNamespace: ChainNamespace;
|
|
8
|
+
adapterType: AdapterType;
|
|
9
|
+
emit<K extends keyof AdapterEvents>(event: K, payload: Parameters<AdapterEvents[K]>[0]): boolean;
|
|
10
|
+
constructor({ projectId, supportedNamespace, adapterType }: BlockchainAdapterConfig);
|
|
11
|
+
setConnector(connector: WalletConnector): void;
|
|
12
|
+
removeConnector(): void;
|
|
13
|
+
getProvider(): Provider;
|
|
14
|
+
subscribeToEvents(): void;
|
|
15
|
+
onChainChanged(chainId: string): void;
|
|
16
|
+
onAccountsChanged(accounts: string[]): void;
|
|
17
|
+
onDisconnect(): void;
|
|
18
|
+
parseUnits(value: string, decimals: number): bigint;
|
|
19
|
+
abstract disconnect(): Promise<void>;
|
|
20
|
+
abstract getSupportedNamespace(): ChainNamespace;
|
|
21
|
+
abstract getBalance(params: GetBalanceParams): Promise<GetBalanceResponse>;
|
|
22
|
+
abstract getAccounts(): CaipAddress[] | undefined;
|
|
23
|
+
abstract switchNetwork(network: AppKitNetwork): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=BlockchainAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockchainAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/BlockchainAdapter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,QAAQ,EACR,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,8BAAsB,iBAAkB,SAAQ,YAAY;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,kBAAkB,EAAE,cAAc,CAAC;IACnC,WAAW,EAAE,WAAW,CAAC;IAGvB,IAAI,CAAC,CAAC,SAAS,MAAM,aAAa,EACzC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACvC,OAAO;gBAIE,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAOnF,YAAY,CAAC,SAAS,EAAE,eAAe;IAKvC,eAAe;IAIf,WAAW,IAAI,QAAQ;IAMvB,iBAAiB,IAAI,IAAI;IASzB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IASrC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAa3C,YAAY,IAAI,IAAI;IAapB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAOnD,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IACpC,QAAQ,CAAC,qBAAqB,IAAI,cAAc;IAChD,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAC1E,QAAQ,CAAC,WAAW,IAAI,WAAW,EAAE,GAAG,SAAS;IACjD,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAC9D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BlockchainAdapter } from './BlockchainAdapter';
|
|
2
|
+
import type { AppKitNetwork } from '../utils/TypeUtil';
|
|
3
|
+
export interface WriteContractData {
|
|
4
|
+
tokenAddress: `0x${string}`;
|
|
5
|
+
receiverAddress: `0x${string}`;
|
|
6
|
+
tokenAmount: bigint;
|
|
7
|
+
fromAddress: `0x${string}`;
|
|
8
|
+
method: 'transfer' | 'transferFrom' | 'approve';
|
|
9
|
+
abi?: any;
|
|
10
|
+
spenderAddress?: `0x${string}`;
|
|
11
|
+
network: AppKitNetwork;
|
|
12
|
+
}
|
|
13
|
+
export interface SendTransactionData {
|
|
14
|
+
address: `0x${string}`;
|
|
15
|
+
network: AppKitNetwork;
|
|
16
|
+
to: `0x${string}`;
|
|
17
|
+
value: string;
|
|
18
|
+
data: string;
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class EVMAdapter extends BlockchainAdapter {
|
|
21
|
+
subscribeToEvents(): void;
|
|
22
|
+
signMessage(address: string, message: string, chain?: string): Promise<string>;
|
|
23
|
+
estimateGas({ address, to, data, chainNamespace }: any): Promise<bigint>;
|
|
24
|
+
sendTransaction(data: SendTransactionData): Promise<`0x${string}` | null>;
|
|
25
|
+
writeContract(data: WriteContractData): Promise<`0x${string}` | null>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=EvmAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EvmAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/EvmAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC;IAChD,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,cAAc,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,aAAa,CAAC;IACvB,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAkDD,8BAAsB,UAAW,SAAQ,iBAAiB;IAC/C,iBAAiB,IAAI,IAAI;IAa5B,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB9E,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAkCxE,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,GAAG,IAAI,CAAC;IAkCzE,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,GAAG,IAAI,CAAC;CAwF5E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BlockchainAdapter } from './BlockchainAdapter';
|
|
2
|
+
export declare abstract class SolanaBaseAdapter extends BlockchainAdapter {
|
|
3
|
+
abstract signTransaction(data: any): Promise<string | null>;
|
|
4
|
+
abstract sendTransaction(data: any): Promise<string | null>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=SolanaBaseAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolanaBaseAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/SolanaBaseAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,8BAAsB,iBAAkB,SAAQ,iBAAiB;IAC/D,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EvmAdapter.test.d.ts","sourceRoot":"","sources":["../../../../src/adapters/__tests__/EvmAdapter.test.ts"],"names":[],"mappings":""}
|
|
@@ -8,5 +8,10 @@ export { PresetsUtil } from './utils/PresetsUtil';
|
|
|
8
8
|
export { StringUtil } from './utils/StringUtil';
|
|
9
9
|
export { ErrorUtil } from './utils/ErrorUtil';
|
|
10
10
|
export { erc20ABI } from './contracts/erc20';
|
|
11
|
+
export { solana, solanaDevnet, solanaTestnet } from './networks/solana';
|
|
12
|
+
export { bitcoin, bitcoinTestnet } from './networks/bitcoin';
|
|
13
|
+
export { BlockchainAdapter } from './adapters/BlockchainAdapter';
|
|
14
|
+
export { EVMAdapter } from './adapters/EvmAdapter';
|
|
15
|
+
export { SolanaBaseAdapter } from './adapters/SolanaBaseAdapter';
|
|
11
16
|
export * from './utils/TypeUtil';
|
|
12
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../../../src/networks/bitcoin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,OAAO,EAAE,aAarB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAc5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../src/networks/solana.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,MAAM,EAAE,aAcpB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAY1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAW3B,CAAC"}
|
|
@@ -8,10 +8,19 @@ export declare const ConstantsUtil: {
|
|
|
8
8
|
BLOCKCHAIN_API_RPC_URL_STAGING: string;
|
|
9
9
|
PULSE_API_URL: string;
|
|
10
10
|
API_URL: string;
|
|
11
|
+
WEB_WALLET_URL: string;
|
|
12
|
+
SECURE_SITE_DASHBOARD: string;
|
|
13
|
+
SECURE_SITE_ICON: string;
|
|
11
14
|
WALLET_CONNECT_CONNECTOR_ID: string;
|
|
12
15
|
COINBASE_CONNECTOR_ID: string;
|
|
13
|
-
AUTH_CONNECTOR_ID: string;
|
|
14
16
|
COINBASE_EXPLORER_ID: string;
|
|
17
|
+
PHANTOM_EXPLORER_ID: string;
|
|
15
18
|
USDT_CONTRACT_ADDRESSES: string[];
|
|
19
|
+
PHANTOM_CUSTOM_WALLET: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
image_id: string;
|
|
23
|
+
mobile_link: string;
|
|
24
|
+
};
|
|
16
25
|
};
|
|
17
26
|
//# sourceMappingURL=ConstantsUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstantsUtil.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"ConstantsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstantsUtil.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;CA+CzB,CAAC"}
|
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
import * as BigNumber from 'bignumber.js';
|
|
2
2
|
export declare const NumberUtil: {
|
|
3
|
+
/**
|
|
4
|
+
* Creates a BigNumber instance from a given value.
|
|
5
|
+
* If the value is a string, commas are removed before conversion.
|
|
6
|
+
* @param value - The input value (string, number, or BigNumber) to convert to a BigNumber.
|
|
7
|
+
* @returns A BigNumber instance.
|
|
8
|
+
*/
|
|
3
9
|
bigNumber(value: BigNumber.BigNumber.Value): BigNumber.BigNumber;
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param
|
|
8
|
-
* @
|
|
11
|
+
* Multiplies two numbers using BigNumber for precision, especially with decimals.
|
|
12
|
+
* Handles undefined inputs by returning BigNumber(0).
|
|
13
|
+
* @param a - The first multiplicand (string, number, or BigNumber). Commas are removed if it's a string.
|
|
14
|
+
* @param b - The second multiplicand (string, number, or BigNumber). Commas are removed if it's a string.
|
|
15
|
+
* @returns The product as a BigNumber instance, or BigNumber(0) if either input is undefined.
|
|
9
16
|
*/
|
|
10
17
|
multiply(a: BigNumber.BigNumber.Value | undefined, b: BigNumber.BigNumber.Value | undefined): BigNumber.BigNumber;
|
|
18
|
+
/**
|
|
19
|
+
* Rounds a number to a specified number of decimal places if its string representation meets a certain length threshold.
|
|
20
|
+
* @param number - The number to potentially round.
|
|
21
|
+
* @param threshold - The minimum string length of the number to trigger rounding.
|
|
22
|
+
* @param fixed - The number of decimal places to round to.
|
|
23
|
+
* @returns The rounded number (as a string if rounded, otherwise the original number) or the original number.
|
|
24
|
+
*/
|
|
11
25
|
roundNumber(number: number, threshold: number, fixed: number): string | number;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the next multiple of ten greater than or equal to the given amount.
|
|
28
|
+
* Defaults to 10 if no amount is provided or if the calculated multiple is less than 10.
|
|
29
|
+
* @param amount - The number for which to find the next multiple of ten. Optional.
|
|
30
|
+
* @returns The next multiple of ten, at least 10.
|
|
31
|
+
*/
|
|
12
32
|
nextMultipleOfTen(amount?: number): number;
|
|
13
33
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param value - The value to format
|
|
16
|
-
* @param decimals - number of
|
|
17
|
-
* @returns
|
|
34
|
+
* Formats a number or string to a human-readable string with a specified number of decimal places, using US locale formatting.
|
|
35
|
+
* @param value - The value to format (string, number, or undefined). If undefined, returns '0.00'.
|
|
36
|
+
* @param decimals - The number of decimal places to display. Defaults to 2.
|
|
37
|
+
* @returns A locale-formatted string representation of the number.
|
|
18
38
|
*/
|
|
19
39
|
formatNumberToLocalString(value: string | number | undefined, decimals?: number): string;
|
|
20
40
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param value - The formatted string to parse
|
|
23
|
-
* @returns
|
|
41
|
+
* Parses a locale-formatted numeric string (e.g., with commas) back into a number.
|
|
42
|
+
* @param value - The formatted string to parse. If undefined, returns 0.
|
|
43
|
+
* @returns The parsed number, or 0 if the input is undefined.
|
|
24
44
|
*/
|
|
25
45
|
parseLocalStringToNumber(value: string | undefined): number;
|
|
46
|
+
/**
|
|
47
|
+
* Converts a numeric value (BigInt, number, or string representation of a number) to a 0x-prefixed hexadecimal string.
|
|
48
|
+
* This is often required for Ethereum RPC parameters like value, gas, gasPrice.
|
|
49
|
+
* @param value - The value to convert. Can be BigInt, number, or a string (decimal or hex).
|
|
50
|
+
* @returns A 0x-prefixed hexadecimal string, or undefined if the input is undefined or null.
|
|
51
|
+
* @throws Error if the value cannot be converted to BigInt.
|
|
52
|
+
*/
|
|
53
|
+
convertNumericToHexString: (value: any) => string | undefined;
|
|
26
54
|
};
|
|
27
55
|
//# sourceMappingURL=NumberUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/NumberUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,eAAO,MAAM,UAAU;
|
|
1
|
+
{"version":3,"file":"NumberUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/NumberUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,eAAO,MAAM,UAAU;IACrB;;;;;OAKG;qBACc,mBAAmB,CAAC,KAAK;IAQ1C;;;;;;OAMG;gBACS,mBAAmB,CAAC,KAAK,GAAG,SAAS,KAAK,mBAAmB,CAAC,KAAK,GAAG,SAAS;IAW3F;;;;;;OAMG;wBACiB,MAAM,aAAa,MAAM,SAAS,MAAM;IAO5D;;;;;OAKG;+BACwB,MAAM;IAMjC;;;;;OAKG;qCAC8B,MAAM,GAAG,MAAM,GAAG,SAAS;IAkB5D;;;;OAIG;oCAC6B,MAAM,GAAG,SAAS;IASlD;;;;;;OAMG;uCACgC,GAAG,KAAG,MAAM,GAAG,SAAS;CAc5D,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { ConnectorType } from './TypeUtil';
|
|
2
1
|
export declare const PresetsUtil: {
|
|
3
2
|
ConnectorExplorerIds: Record<string, string>;
|
|
4
|
-
|
|
3
|
+
NetworkImageIds: Record<string, string>;
|
|
5
4
|
ConnectorNamesMap: Record<string, string>;
|
|
6
5
|
ConnectorImageIds: Record<string, string>;
|
|
7
|
-
ConnectorTypesMap: Record<string, ConnectorType>;
|
|
8
6
|
RpcChainIds: number[];
|
|
9
7
|
};
|
|
10
8
|
//# sourceMappingURL=PresetsUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresetsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/PresetsUtil.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PresetsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/PresetsUtil.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;CA0IvB,CAAC"}
|