@reown/appkit-common-react-native 0.0.0-fix-approved-networks-20250822000414 → 0.0.0-fix-ui-changes-20250828183750
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 +94 -0
- package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -0
- package/lib/commonjs/adapters/EvmAdapter.js +193 -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/contracts/erc20.js.map +1 -1
- package/lib/commonjs/contracts/usdt.js.map +1 -1
- package/lib/commonjs/index.js +66 -5
- 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/package.json +1 -0
- package/lib/commonjs/types/api/blockchain-api.js +15 -0
- package/lib/commonjs/types/api/blockchain-api.js.map +1 -0
- package/lib/commonjs/types/api/events.js +6 -0
- package/lib/commonjs/types/api/events.js.map +1 -0
- package/lib/commonjs/types/api/index.js +39 -0
- package/lib/commonjs/types/api/index.js.map +1 -0
- package/lib/commonjs/types/api/wallet-api.js +6 -0
- package/lib/commonjs/types/api/wallet-api.js.map +1 -0
- package/lib/commonjs/types/blockchain/adapter.js +6 -0
- package/lib/commonjs/types/blockchain/adapter.js.map +1 -0
- package/lib/commonjs/types/blockchain/balance.js +6 -0
- package/lib/commonjs/types/blockchain/balance.js.map +1 -0
- package/lib/commonjs/types/blockchain/index.js +50 -0
- package/lib/commonjs/types/blockchain/index.js.map +1 -0
- package/lib/commonjs/types/blockchain/network.js +6 -0
- package/lib/commonjs/types/blockchain/network.js.map +1 -0
- package/lib/commonjs/types/blockchain/transaction.js +2 -0
- package/lib/commonjs/types/blockchain/transaction.js.map +1 -0
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/common.js.map +1 -0
- package/lib/commonjs/types/index.js +105 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/onramp/countries.js +2 -0
- package/lib/commonjs/types/onramp/countries.js.map +1 -0
- package/lib/commonjs/types/onramp/currencies.js +2 -0
- package/lib/commonjs/types/onramp/currencies.js.map +1 -0
- package/lib/commonjs/types/onramp/errors.js +22 -0
- package/lib/commonjs/types/onramp/errors.js.map +1 -0
- package/lib/commonjs/types/onramp/index.js +50 -0
- package/lib/commonjs/types/onramp/index.js.map +1 -0
- package/lib/commonjs/types/onramp/quotes.js +2 -0
- package/lib/commonjs/types/onramp/quotes.js.map +1 -0
- package/lib/commonjs/types/siwe/config.js +6 -0
- package/lib/commonjs/types/siwe/config.js.map +1 -0
- package/lib/commonjs/types/siwe/index.js +28 -0
- package/lib/commonjs/types/siwe/index.js.map +1 -0
- package/lib/commonjs/types/siwe/message.js +6 -0
- package/lib/commonjs/types/siwe/message.js.map +1 -0
- package/lib/commonjs/types/storage.js +2 -0
- package/lib/commonjs/types/storage.js.map +1 -0
- package/lib/commonjs/types/swap/index.js +17 -0
- package/lib/commonjs/types/swap/index.js.map +1 -0
- package/lib/commonjs/types/swap/tokens.js +6 -0
- package/lib/commonjs/types/swap/tokens.js.map +1 -0
- package/lib/commonjs/types/ui.js +6 -0
- package/lib/commonjs/{utils/TypeUtil.js.map → types/ui.js.map} +1 -1
- package/lib/commonjs/types/wallet/connection.js +6 -0
- package/lib/commonjs/types/wallet/connection.js.map +1 -0
- package/lib/commonjs/types/wallet/connector.js +30 -0
- package/lib/commonjs/types/wallet/connector.js.map +1 -0
- package/lib/commonjs/types/wallet/index.js +39 -0
- package/lib/commonjs/types/wallet/index.js.map +1 -0
- package/lib/commonjs/types/wallet/wallet-info.js +6 -0
- package/lib/commonjs/types/wallet/wallet-info.js.map +1 -0
- package/lib/commonjs/utils/ConstantsUtil.js +52 -6
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/ContractUtil.js.map +1 -1
- package/lib/commonjs/utils/DateUtil.js.map +1 -1
- package/lib/commonjs/utils/ErrorUtil.js.map +1 -1
- package/lib/commonjs/utils/NamesUtil.js.map +1 -1
- package/lib/commonjs/utils/NetworkUtil.js +3 -0
- package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
- package/lib/commonjs/utils/NumberUtil.js +53 -13
- package/lib/commonjs/utils/NumberUtil.js.map +1 -1
- package/lib/commonjs/utils/PresetsUtil.js +34 -21
- package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
- package/lib/commonjs/utils/StringUtil.js +7 -0
- package/lib/commonjs/utils/StringUtil.js.map +1 -1
- package/lib/module/adapters/BlockchainAdapter.js +89 -0
- package/lib/module/adapters/BlockchainAdapter.js.map +1 -0
- package/lib/module/adapters/EvmAdapter.js +189 -0
- package/lib/module/adapters/EvmAdapter.js.map +1 -0
- package/lib/module/adapters/SolanaBaseAdapter.js +5 -0
- package/lib/module/adapters/SolanaBaseAdapter.js.map +1 -0
- package/lib/module/contracts/erc20.js +2 -0
- package/lib/module/contracts/erc20.js.map +1 -1
- package/lib/module/contracts/usdt.js +2 -0
- package/lib/module/contracts/usdt.js.map +1 -1
- package/lib/module/index.js +8 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/networks/bitcoin.js +36 -0
- package/lib/module/networks/bitcoin.js.map +1 -0
- package/lib/module/networks/solana.js +74 -0
- package/lib/module/networks/solana.js.map +1 -0
- package/lib/module/types/api/blockchain-api.js +10 -0
- package/lib/module/types/api/blockchain-api.js.map +1 -0
- package/lib/module/types/api/events.js +4 -0
- package/lib/module/types/api/events.js.map +1 -0
- package/lib/module/types/api/index.js +7 -0
- package/lib/module/types/api/index.js.map +1 -0
- package/lib/module/types/api/wallet-api.js +4 -0
- package/lib/module/types/api/wallet-api.js.map +1 -0
- package/lib/module/types/blockchain/adapter.js +4 -0
- package/lib/module/types/blockchain/adapter.js.map +1 -0
- package/lib/module/types/blockchain/balance.js +4 -0
- package/lib/module/types/blockchain/balance.js.map +1 -0
- package/lib/module/types/blockchain/index.js +8 -0
- package/lib/module/types/blockchain/index.js.map +1 -0
- package/lib/module/types/blockchain/network.js +4 -0
- package/lib/module/types/blockchain/network.js.map +1 -0
- package/lib/module/types/blockchain/transaction.js +2 -0
- package/lib/module/types/blockchain/transaction.js.map +1 -0
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +31 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/onramp/countries.js +2 -0
- package/lib/module/types/onramp/countries.js.map +1 -0
- package/lib/module/types/onramp/currencies.js +2 -0
- package/lib/module/types/onramp/currencies.js.map +1 -0
- package/lib/module/types/onramp/errors.js +18 -0
- package/lib/module/types/onramp/errors.js.map +1 -0
- package/lib/module/types/onramp/index.js +8 -0
- package/lib/module/types/onramp/index.js.map +1 -0
- package/lib/module/types/onramp/quotes.js +2 -0
- package/lib/module/types/onramp/quotes.js.map +1 -0
- package/lib/module/types/siwe/config.js +4 -0
- package/lib/module/types/siwe/config.js.map +1 -0
- package/lib/module/types/siwe/index.js +6 -0
- package/lib/module/types/siwe/index.js.map +1 -0
- package/lib/module/types/siwe/message.js +4 -0
- package/lib/module/types/siwe/message.js.map +1 -0
- package/lib/module/types/storage.js +2 -0
- package/lib/module/types/storage.js.map +1 -0
- package/lib/module/types/swap/index.js +5 -0
- package/lib/module/types/swap/index.js.map +1 -0
- package/lib/module/types/swap/tokens.js +4 -0
- package/lib/module/types/swap/tokens.js.map +1 -0
- package/lib/module/types/ui.js +4 -0
- package/lib/module/{utils/TypeUtil.js.map → types/ui.js.map} +1 -1
- package/lib/module/types/wallet/connection.js +4 -0
- package/lib/module/types/wallet/connection.js.map +1 -0
- package/lib/module/types/wallet/connector.js +25 -0
- package/lib/module/types/wallet/connector.js.map +1 -0
- package/lib/module/types/wallet/index.js +7 -0
- package/lib/module/types/wallet/index.js.map +1 -0
- package/lib/module/types/wallet/wallet-info.js +4 -0
- package/lib/module/types/wallet/wallet-info.js.map +1 -0
- package/lib/module/utils/ConstantsUtil.js +54 -6
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/ContractUtil.js +2 -0
- package/lib/module/utils/ContractUtil.js.map +1 -1
- package/lib/module/utils/DateUtil.js +2 -0
- package/lib/module/utils/DateUtil.js.map +1 -1
- package/lib/module/utils/ErrorUtil.js +2 -0
- package/lib/module/utils/ErrorUtil.js.map +1 -1
- package/lib/module/utils/NamesUtil.js +2 -0
- package/lib/module/utils/NamesUtil.js.map +1 -1
- package/lib/module/utils/NetworkUtil.js +5 -0
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/utils/NumberUtil.js +54 -11
- package/lib/module/utils/NumberUtil.js.map +1 -1
- package/lib/module/utils/PresetsUtil.js +36 -21
- package/lib/module/utils/PresetsUtil.js.map +1 -1
- package/lib/module/utils/StringUtil.js +9 -0
- package/lib/module/utils/StringUtil.js.map +1 -1
- package/lib/typescript/adapters/BlockchainAdapter.d.ts +26 -0
- package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -0
- package/lib/typescript/adapters/EvmAdapter.d.ts +26 -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 +6 -1
- 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/types/api/blockchain-api.d.ts +183 -0
- package/lib/typescript/types/api/blockchain-api.d.ts.map +1 -0
- package/lib/typescript/types/api/events.d.ts +304 -0
- package/lib/typescript/types/api/events.d.ts.map +1 -0
- package/lib/typescript/types/api/index.d.ts +4 -0
- package/lib/typescript/types/api/index.d.ts.map +1 -0
- package/lib/typescript/types/api/wallet-api.d.ts +50 -0
- package/lib/typescript/types/api/wallet-api.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/adapter.d.ts +40 -0
- package/lib/typescript/types/blockchain/adapter.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/balance.d.ts +28 -0
- package/lib/typescript/types/blockchain/balance.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/index.d.ts +5 -0
- package/lib/typescript/types/blockchain/index.d.ts.map +1 -0
- package/lib/typescript/types/blockchain/network.d.ts +47 -0
- package/lib/typescript/types/blockchain/network.d.ts.map +1 -0
- package/lib/typescript/{utils/TypeUtil.d.ts → types/blockchain/transaction.d.ts} +1 -22
- package/lib/typescript/types/blockchain/transaction.d.ts.map +1 -0
- package/lib/typescript/types/common.d.ts +24 -0
- package/lib/typescript/types/common.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +10 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/types/onramp/countries.d.ts +11 -0
- package/lib/typescript/types/onramp/countries.d.ts.map +1 -0
- package/lib/typescript/types/onramp/currencies.d.ts +30 -0
- package/lib/typescript/types/onramp/currencies.d.ts.map +1 -0
- package/lib/typescript/types/onramp/errors.d.ts +21 -0
- package/lib/typescript/types/onramp/errors.d.ts.map +1 -0
- package/lib/typescript/types/onramp/index.d.ts +5 -0
- package/lib/typescript/types/onramp/index.d.ts.map +1 -0
- package/lib/typescript/types/onramp/quotes.d.ts +45 -0
- package/lib/typescript/types/onramp/quotes.d.ts.map +1 -0
- package/lib/typescript/types/siwe/config.d.ts +31 -0
- package/lib/typescript/types/siwe/config.d.ts.map +1 -0
- package/lib/typescript/types/siwe/index.d.ts +3 -0
- package/lib/typescript/types/siwe/index.d.ts.map +1 -0
- package/lib/typescript/types/siwe/message.d.ts +57 -0
- package/lib/typescript/types/siwe/message.d.ts.map +1 -0
- package/lib/typescript/types/storage.d.ts +27 -0
- package/lib/typescript/types/storage.d.ts.map +1 -0
- package/lib/typescript/types/swap/index.d.ts +2 -0
- package/lib/typescript/types/swap/index.d.ts.map +1 -0
- package/lib/typescript/types/swap/tokens.d.ts +19 -0
- package/lib/typescript/types/swap/tokens.d.ts.map +1 -0
- package/lib/typescript/types/ui.d.ts +26 -0
- package/lib/typescript/types/ui.d.ts.map +1 -0
- package/lib/typescript/types/wallet/connection.d.ts +30 -0
- package/lib/typescript/types/wallet/connection.d.ts.map +1 -0
- package/lib/typescript/types/wallet/connector.d.ts +61 -0
- package/lib/typescript/types/wallet/connector.d.ts.map +1 -0
- package/lib/typescript/types/wallet/index.d.ts +4 -0
- package/lib/typescript/types/wallet/index.d.ts.map +1 -0
- package/lib/typescript/types/wallet/wallet-info.d.ts +36 -0
- package/lib/typescript/types/wallet/wallet-info.d.ts.map +1 -0
- package/lib/typescript/utils/ConstantsUtil.d.ts +48 -4
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +2 -0
- package/lib/typescript/utils/NetworkUtil.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 -6
- package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StringUtil.d.ts +1 -0
- package/lib/typescript/utils/StringUtil.d.ts.map +1 -1
- package/package.json +6 -16
- package/src/adapters/BlockchainAdapter.ts +126 -0
- package/src/adapters/EvmAdapter.ts +247 -0
- package/src/adapters/SolanaBaseAdapter.ts +6 -0
- package/src/adapters/__tests__/EvmAdapter.test.ts +126 -0
- package/src/index.ts +7 -1
- package/src/networks/bitcoin.ts +32 -0
- package/src/networks/solana.ts +44 -0
- package/src/types/api/blockchain-api.ts +213 -0
- package/src/types/api/events.ts +394 -0
- package/src/types/api/index.ts +4 -0
- package/src/types/api/wallet-api.ts +70 -0
- package/src/types/blockchain/adapter.ts +52 -0
- package/src/types/blockchain/balance.ts +31 -0
- package/src/types/blockchain/index.ts +5 -0
- package/src/types/blockchain/network.ts +39 -0
- package/src/{utils/TypeUtil.ts → types/blockchain/transaction.ts} +0 -26
- package/src/types/common.ts +56 -0
- package/src/types/index.ts +28 -0
- package/src/types/onramp/countries.ts +11 -0
- package/src/types/onramp/currencies.ts +32 -0
- package/src/types/onramp/errors.ts +22 -0
- package/src/types/onramp/index.ts +5 -0
- package/src/types/onramp/quotes.ts +46 -0
- package/src/types/siwe/config.ts +44 -0
- package/src/types/siwe/index.ts +3 -0
- package/src/types/siwe/message.ts +62 -0
- package/src/types/storage.ts +30 -0
- package/src/types/swap/index.ts +2 -0
- package/src/types/swap/tokens.ts +21 -0
- package/src/types/ui.ts +26 -0
- package/src/types/wallet/connection.ts +33 -0
- package/src/types/wallet/connector.ts +85 -0
- package/src/types/wallet/index.ts +4 -0
- package/src/types/wallet/wallet-info.ts +41 -0
- package/src/utils/ConstantsUtil.ts +55 -8
- package/src/utils/NetworkUtil.ts +5 -0
- package/src/utils/NumberUtil.ts +54 -11
- package/src/utils/PresetsUtil.ts +34 -26
- package/src/utils/StringUtil.ts +7 -0
- package/lib/commonjs/utils/TypeUtil.js +0 -2
- package/lib/module/utils/TypeUtil.js +0 -2
- package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type OnRampFiatCurrency = {
|
|
2
|
+
currencyCode: string;
|
|
3
|
+
name: string;
|
|
4
|
+
symbolImageUrl: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type OnRampCryptoCurrency = {
|
|
8
|
+
currencyCode: string;
|
|
9
|
+
name: string;
|
|
10
|
+
chainCode: string;
|
|
11
|
+
chainName: string;
|
|
12
|
+
chainId: string;
|
|
13
|
+
contractAddress: string | null;
|
|
14
|
+
symbolImageUrl: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type OnRampFiatLimit = {
|
|
18
|
+
currencyCode: string;
|
|
19
|
+
defaultAmount: number | null;
|
|
20
|
+
minimumAmount: number;
|
|
21
|
+
maximumAmount: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type OnRampTransactionResult = {
|
|
25
|
+
purchaseCurrency: string | null;
|
|
26
|
+
purchaseAmount: string | null;
|
|
27
|
+
purchaseImageUrl: string | null;
|
|
28
|
+
paymentCurrency: string | null;
|
|
29
|
+
paymentAmount: string | null;
|
|
30
|
+
status: string | null;
|
|
31
|
+
network: string | null;
|
|
32
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const OnRampErrorType = {
|
|
2
|
+
AMOUNT_TOO_LOW: 'INVALID_AMOUNT_TOO_LOW',
|
|
3
|
+
AMOUNT_TOO_HIGH: 'INVALID_AMOUNT_TOO_HIGH',
|
|
4
|
+
INVALID_AMOUNT: 'INVALID_AMOUNT',
|
|
5
|
+
INCOMPATIBLE_REQUEST: 'INCOMPATIBLE_REQUEST',
|
|
6
|
+
BAD_REQUEST: 'BAD_REQUEST',
|
|
7
|
+
NO_VALID_QUOTES: 'NO_VALID_QUOTES',
|
|
8
|
+
FAILED_TO_LOAD: 'FAILED_TO_LOAD',
|
|
9
|
+
FAILED_TO_LOAD_COUNTRIES: 'FAILED_TO_LOAD_COUNTRIES',
|
|
10
|
+
FAILED_TO_LOAD_PROVIDERS: 'FAILED_TO_LOAD_PROVIDERS',
|
|
11
|
+
FAILED_TO_LOAD_METHODS: 'FAILED_TO_LOAD_METHODS',
|
|
12
|
+
FAILED_TO_LOAD_CURRENCIES: 'FAILED_TO_LOAD_CURRENCIES',
|
|
13
|
+
FAILED_TO_LOAD_LIMITS: 'FAILED_TO_LOAD_LIMITS',
|
|
14
|
+
UNKNOWN: 'UNKNOWN_ERROR'
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export type OnRampErrorTypeValues = (typeof OnRampErrorType)[keyof typeof OnRampErrorType];
|
|
18
|
+
|
|
19
|
+
export interface OnRampError {
|
|
20
|
+
type: OnRampErrorTypeValues;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type OnRampPaymentMethod = {
|
|
2
|
+
logos: {
|
|
3
|
+
dark: string;
|
|
4
|
+
light: string;
|
|
5
|
+
};
|
|
6
|
+
name: string;
|
|
7
|
+
paymentMethod: string;
|
|
8
|
+
paymentType: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type OnRampQuote = {
|
|
12
|
+
countryCode: string;
|
|
13
|
+
customerScore: number;
|
|
14
|
+
destinationAmount: number;
|
|
15
|
+
destinationAmountWithoutFees: number;
|
|
16
|
+
destinationCurrencyCode: string;
|
|
17
|
+
exchangeRate: number;
|
|
18
|
+
fiatAmountWithoutFees: number;
|
|
19
|
+
lowKyc: boolean;
|
|
20
|
+
networkFee: number;
|
|
21
|
+
paymentMethodType: string;
|
|
22
|
+
serviceProvider: string;
|
|
23
|
+
sourceAmount: number;
|
|
24
|
+
sourceAmountWithoutFees: number;
|
|
25
|
+
sourceCurrencyCode: string;
|
|
26
|
+
totalFee: number;
|
|
27
|
+
transactionFee: number;
|
|
28
|
+
transactionType: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type OnRampServiceProvider = {
|
|
32
|
+
categories: string[];
|
|
33
|
+
categoryStatuses: {
|
|
34
|
+
additionalProp: string;
|
|
35
|
+
};
|
|
36
|
+
logos: {
|
|
37
|
+
dark: string;
|
|
38
|
+
darkShort: string;
|
|
39
|
+
light: string;
|
|
40
|
+
lightShort: string;
|
|
41
|
+
};
|
|
42
|
+
name: string;
|
|
43
|
+
serviceProvider: string;
|
|
44
|
+
status: string;
|
|
45
|
+
websiteUrl: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SIWESession,
|
|
3
|
+
SIWECreateMessageArgs,
|
|
4
|
+
SIWEMessageArgs,
|
|
5
|
+
SIWEVerifyMessageArgs
|
|
6
|
+
} from './message';
|
|
7
|
+
|
|
8
|
+
export interface SIWEClientMethods {
|
|
9
|
+
getNonce: (address?: string) => Promise<string>;
|
|
10
|
+
createMessage: (args: SIWECreateMessageArgs) => string;
|
|
11
|
+
verifyMessage: (args: SIWEVerifyMessageArgs) => Promise<boolean>;
|
|
12
|
+
getSession: () => Promise<SIWESession | null>;
|
|
13
|
+
signOut: () => Promise<boolean>;
|
|
14
|
+
getMessageParams?: () => Promise<SIWEMessageArgs>;
|
|
15
|
+
onSignIn?: (session?: SIWESession) => void;
|
|
16
|
+
onSignOut?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SIWEConfig extends SIWEClientMethods {
|
|
20
|
+
// Defaults to true
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
// In milliseconds, defaults to 5 minutes
|
|
23
|
+
nonceRefetchIntervalMs?: number;
|
|
24
|
+
// In milliseconds, defaults to 5 minutes
|
|
25
|
+
sessionRefetchIntervalMs?: number;
|
|
26
|
+
// Defaults to true
|
|
27
|
+
signOutOnDisconnect?: boolean;
|
|
28
|
+
// Defaults to true
|
|
29
|
+
signOutOnAccountChange?: boolean;
|
|
30
|
+
// Defaults to true
|
|
31
|
+
signOutOnNetworkChange?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AppKitSIWEClient extends SIWEClientMethods {
|
|
35
|
+
signIn: () => Promise<SIWESession | undefined>;
|
|
36
|
+
options: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
nonceRefetchIntervalMs: number;
|
|
39
|
+
sessionRefetchIntervalMs: number;
|
|
40
|
+
signOutOnDisconnect: boolean;
|
|
41
|
+
signOutOnAccountChange: boolean;
|
|
42
|
+
signOutOnNetworkChange: boolean;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { CaipAddress, CaipNetworkId } from '../common';
|
|
2
|
+
|
|
3
|
+
export interface SIWESession {
|
|
4
|
+
address: string;
|
|
5
|
+
chainId: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface CacaoHeader {
|
|
9
|
+
t: 'caip122';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SIWECreateMessageArgs {
|
|
13
|
+
domain: string;
|
|
14
|
+
nonce: string;
|
|
15
|
+
uri: string;
|
|
16
|
+
address: CaipAddress;
|
|
17
|
+
version: '1';
|
|
18
|
+
type?: CacaoHeader['t'];
|
|
19
|
+
nbf?: string;
|
|
20
|
+
exp?: string;
|
|
21
|
+
statement?: string;
|
|
22
|
+
requestId?: string;
|
|
23
|
+
resources?: string[];
|
|
24
|
+
expiry?: number;
|
|
25
|
+
iat?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type SIWEMessageArgs = {
|
|
29
|
+
chains: CaipNetworkId[];
|
|
30
|
+
methods?: string[];
|
|
31
|
+
} & Omit<SIWECreateMessageArgs, 'address' | 'nonce' | 'version'>;
|
|
32
|
+
|
|
33
|
+
interface CacaoPayload {
|
|
34
|
+
domain: string;
|
|
35
|
+
aud: string;
|
|
36
|
+
nonce: string;
|
|
37
|
+
iss: string;
|
|
38
|
+
version?: string;
|
|
39
|
+
iat?: string;
|
|
40
|
+
nbf?: string;
|
|
41
|
+
exp?: string;
|
|
42
|
+
statement?: string;
|
|
43
|
+
requestId?: string;
|
|
44
|
+
resources?: string[];
|
|
45
|
+
type?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface Cacao {
|
|
49
|
+
h: CacaoHeader;
|
|
50
|
+
p: CacaoPayload;
|
|
51
|
+
s: {
|
|
52
|
+
t: 'eip191' | 'eip1271';
|
|
53
|
+
s: string;
|
|
54
|
+
m?: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SIWEVerifyMessageArgs {
|
|
59
|
+
message: string;
|
|
60
|
+
signature: string;
|
|
61
|
+
cacao?: Cacao;
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface Storage {
|
|
2
|
+
/**
|
|
3
|
+
* Returns all keys in storage.
|
|
4
|
+
*/
|
|
5
|
+
getKeys(): Promise<string[]>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns all key-value entries in storage.
|
|
9
|
+
*/
|
|
10
|
+
getEntries<T = any>(): Promise<[string, T][]>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get an item from storage for a given key.
|
|
14
|
+
* @param key The key to retrieve.
|
|
15
|
+
*/
|
|
16
|
+
getItem<T = any>(key: string): Promise<T | undefined>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Set an item in storage for a given key.
|
|
20
|
+
* @param key The key to set.
|
|
21
|
+
* @param value The value to set.
|
|
22
|
+
*/
|
|
23
|
+
setItem<T = any>(key: string, value: T): Promise<void>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Remove an item from storage for a given key.
|
|
27
|
+
* @param key The key to remove.
|
|
28
|
+
*/
|
|
29
|
+
removeItem(key: string): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CaipAddress } from '../common';
|
|
2
|
+
|
|
3
|
+
export type SwapToken = {
|
|
4
|
+
name: string;
|
|
5
|
+
symbol: string;
|
|
6
|
+
address: CaipAddress;
|
|
7
|
+
decimals: number;
|
|
8
|
+
logoUri: string;
|
|
9
|
+
eip2612?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type SwapTokenWithBalance = SwapToken & {
|
|
13
|
+
quantity: {
|
|
14
|
+
decimals: string;
|
|
15
|
+
numeric: string;
|
|
16
|
+
};
|
|
17
|
+
price: number;
|
|
18
|
+
value: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type SwapInputTarget = 'sourceToken' | 'toToken';
|
package/src/types/ui.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SocialProvider } from './common';
|
|
2
|
+
|
|
3
|
+
type EnabledSocials = SocialProvider;
|
|
4
|
+
|
|
5
|
+
export type Features = {
|
|
6
|
+
/**
|
|
7
|
+
* @description Enable or disable the swaps feature. Enabled by default.
|
|
8
|
+
* @type {boolean}
|
|
9
|
+
*/
|
|
10
|
+
swaps?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @description Enable or disable the onramp feature. Enabled by default.
|
|
13
|
+
* @type {boolean}
|
|
14
|
+
*/
|
|
15
|
+
onramp?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @description Show or hide the regular wallet options when socials are enabled. Enabled by default.
|
|
18
|
+
* @type {boolean}
|
|
19
|
+
*/
|
|
20
|
+
showWallets?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @description Enable or disable the socials feature. Enabled by default.
|
|
23
|
+
* @type {EnabledSocials[]}
|
|
24
|
+
*/
|
|
25
|
+
socials?: EnabledSocials[] | false;
|
|
26
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CaipAddress, CaipNetworkId, SocialProvider, AccountType } from '../common';
|
|
2
|
+
import type { Balance } from '../blockchain/balance';
|
|
3
|
+
import type { WalletInfo, Identity } from './wallet-info';
|
|
4
|
+
import type { BlockchainAdapter } from '../../adapters/BlockchainAdapter';
|
|
5
|
+
|
|
6
|
+
export interface Connection {
|
|
7
|
+
accounts: CaipAddress[];
|
|
8
|
+
balances: Map<CaipAddress, Balance[]>;
|
|
9
|
+
adapter: BlockchainAdapter;
|
|
10
|
+
caipNetwork: CaipNetworkId;
|
|
11
|
+
wallet?: WalletInfo;
|
|
12
|
+
properties?: ConnectionProperties;
|
|
13
|
+
type?: AccountType;
|
|
14
|
+
identities?: Map<CaipAddress, Identity>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ConnectionProperties {
|
|
18
|
+
email?: string;
|
|
19
|
+
username?: string;
|
|
20
|
+
smartAccounts?: CaipAddress[];
|
|
21
|
+
provider?: SocialProvider;
|
|
22
|
+
sessionTopic?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface LinkingRecord {
|
|
26
|
+
redirect: string;
|
|
27
|
+
href: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface WalletDeepLink {
|
|
31
|
+
href: string;
|
|
32
|
+
name: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import type { ChainNamespace, CaipAddress, CaipNetworkId } from '../common';
|
|
3
|
+
import type { AppKitNetwork } from '../blockchain/network';
|
|
4
|
+
import type { Provider } from '../blockchain/adapter';
|
|
5
|
+
import type { WalletInfo, Metadata } from './wallet-info';
|
|
6
|
+
import type { ConnectionProperties } from './connection';
|
|
7
|
+
import type { AppKitSIWEClient } from '../siwe';
|
|
8
|
+
import type { Storage } from '../storage';
|
|
9
|
+
import type { WcWallet } from '../api/wallet-api';
|
|
10
|
+
|
|
11
|
+
export type ConnectorType = 'walletconnect' | 'coinbase' | 'phantom' | 'solflare';
|
|
12
|
+
|
|
13
|
+
export interface BaseNamespace {
|
|
14
|
+
chains?: CaipNetworkId[];
|
|
15
|
+
accounts: CaipAddress[];
|
|
16
|
+
methods: string[];
|
|
17
|
+
events: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type Namespace = BaseNamespace;
|
|
21
|
+
|
|
22
|
+
export type Namespaces = Record<string, Namespace>;
|
|
23
|
+
|
|
24
|
+
export type ProposalNamespaces = Record<
|
|
25
|
+
string,
|
|
26
|
+
Omit<Namespace, 'accounts'> &
|
|
27
|
+
Required<Pick<Namespace, 'chains'>> & { rpcMap: Record<string, string> }
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export type ConnectOptions = {
|
|
31
|
+
namespaces?: ProposalNamespaces;
|
|
32
|
+
defaultNetwork?: AppKitNetwork;
|
|
33
|
+
universalLink?: string;
|
|
34
|
+
siweConfig?: AppKitSIWEClient;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type ConnectorInitOptions = {
|
|
38
|
+
storage: Storage;
|
|
39
|
+
metadata: Metadata;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export abstract class WalletConnector extends EventEmitter {
|
|
43
|
+
public type: ConnectorType;
|
|
44
|
+
protected provider?: Provider;
|
|
45
|
+
protected namespaces?: Namespaces;
|
|
46
|
+
protected wallet?: WalletInfo;
|
|
47
|
+
protected storage?: Storage;
|
|
48
|
+
protected metadata?: Metadata;
|
|
49
|
+
protected properties?: ConnectionProperties;
|
|
50
|
+
|
|
51
|
+
constructor({ type }: { type: ConnectorType }) {
|
|
52
|
+
super();
|
|
53
|
+
this.type = type;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public async init(ops: ConnectorInitOptions) {
|
|
57
|
+
this.storage = ops.storage;
|
|
58
|
+
this.metadata = ops.metadata;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public setProvider(provider: Provider) {
|
|
62
|
+
this.provider = provider;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public async disconnect() {
|
|
66
|
+
await this.provider?.disconnect();
|
|
67
|
+
this.namespaces = undefined;
|
|
68
|
+
this.wallet = undefined;
|
|
69
|
+
this.properties = undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
abstract connect(opts: ConnectOptions): Promise<Namespaces | undefined>;
|
|
73
|
+
abstract getProvider(namespace?: ChainNamespace): Provider;
|
|
74
|
+
abstract getNamespaces(): Namespaces;
|
|
75
|
+
abstract getChainId(namespace: ChainNamespace): CaipNetworkId | undefined;
|
|
76
|
+
abstract getWalletInfo(): WalletInfo | undefined;
|
|
77
|
+
abstract getProperties(): ConnectionProperties | undefined;
|
|
78
|
+
abstract switchNetwork(network: AppKitNetwork): Promise<void>;
|
|
79
|
+
abstract restoreSession(): Promise<boolean>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type AppKitConnectOptions = {
|
|
83
|
+
walletId?: string;
|
|
84
|
+
wallet?: WcWallet;
|
|
85
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CaipNetworkId } from '../common';
|
|
2
|
+
|
|
3
|
+
export interface WalletInfo {
|
|
4
|
+
name?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
icons?: string[];
|
|
9
|
+
redirect?: {
|
|
10
|
+
native?: string;
|
|
11
|
+
universal?: string;
|
|
12
|
+
linkMode?: boolean;
|
|
13
|
+
};
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Metadata = {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
url: string;
|
|
21
|
+
icons: string[];
|
|
22
|
+
redirect?: {
|
|
23
|
+
native?: string;
|
|
24
|
+
universal?: string;
|
|
25
|
+
linkMode?: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface Token {
|
|
30
|
+
address: string;
|
|
31
|
+
image?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type Tokens = Record<CaipNetworkId, Token>;
|
|
35
|
+
|
|
36
|
+
export interface Identity {
|
|
37
|
+
name: string;
|
|
38
|
+
avatar?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type ConnectedWalletInfo = WalletInfo | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ConstantsUtil = {
|
|
2
|
-
VERSION: '0.0.0-fix-
|
|
2
|
+
VERSION: '0.0.0-fix-ui-changes-20250828183750',
|
|
3
3
|
|
|
4
4
|
EIP155: 'eip155',
|
|
5
5
|
ADD_CHAIN_METHOD: 'wallet_addEthereumChain',
|
|
@@ -11,12 +11,10 @@ export const ConstantsUtil = {
|
|
|
11
11
|
BLOCKCHAIN_API_RPC_URL_STAGING: 'https://staging.rpc.walletconnect.org',
|
|
12
12
|
PULSE_API_URL: 'https://pulse.walletconnect.org',
|
|
13
13
|
API_URL: 'https://api.web3modal.org',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
|
|
14
|
+
WEB_WALLET_URL: 'https://web-wallet.walletconnect.org',
|
|
15
|
+
SECURE_SITE_DASHBOARD: `https://secure.reown.com/dashboard`,
|
|
16
|
+
SECURE_SITE_ICON: `https://secure.reown.com/images/favicon.png`,
|
|
17
|
+
REOWN_URL: `https://reown.com`,
|
|
20
18
|
|
|
21
19
|
USDT_CONTRACT_ADDRESSES: [
|
|
22
20
|
// Mainnet
|
|
@@ -33,5 +31,54 @@ export const ConstantsUtil = {
|
|
|
33
31
|
'0x55d398326f99059fF775485246999027B3197955',
|
|
34
32
|
// Arbitrum
|
|
35
33
|
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'
|
|
36
|
-
]
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
PHANTOM_CUSTOM_WALLET: {
|
|
37
|
+
id: 'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393',
|
|
38
|
+
name: 'Phantom Wallet',
|
|
39
|
+
image_id: 'b6ec7b81-bb4f-427d-e290-7631e6e50d00',
|
|
40
|
+
mobile_link: 'phantom://',
|
|
41
|
+
play_store: 'https://play.google.com/store/apps/details?id=app.phantom',
|
|
42
|
+
app_store: 'https://apps.apple.com/app/id1598432977',
|
|
43
|
+
android_app_id: 'app.phantom',
|
|
44
|
+
ios_schema: 'phantom://'
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
COINBASE_CUSTOM_WALLET: {
|
|
48
|
+
id: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
|
|
49
|
+
name: 'Coinbase Wallet',
|
|
50
|
+
image_id: 'a5ebc364-8f91-4200-fcc6-be81310a0000',
|
|
51
|
+
mobile_link: 'https://wallet.coinbase.com/wsegue',
|
|
52
|
+
play_store: 'https://play.google.com/store/apps/details?id=org.toshi',
|
|
53
|
+
app_store: 'https://apps.apple.com/app/id1278383455',
|
|
54
|
+
android_app_id: 'org.toshi',
|
|
55
|
+
ios_schema: 'cbwallet://'
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
SOLFLARE_CUSTOM_WALLET: {
|
|
59
|
+
id: '1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79',
|
|
60
|
+
name: 'Solflare Wallet',
|
|
61
|
+
image_id: '34c0e38d-66c4-470e-1aed-a6fabe2d1e00',
|
|
62
|
+
mobile_link: 'solflare://',
|
|
63
|
+
play_store: 'https://play.google.com/store/apps/details?id=com.solflare.mobile',
|
|
64
|
+
app_store: 'https://apps.apple.com/app/id1580902717',
|
|
65
|
+
android_app_id: 'com.solflare.mobile',
|
|
66
|
+
ios_schema: 'solflare://'
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Storage Keys
|
|
70
|
+
STORAGE_KEYS: {
|
|
71
|
+
WC_DEEPLINK: 'WALLETCONNECT_DEEPLINK_CHOICE', //dont change this one
|
|
72
|
+
RECENT_WALLET: '@appkit/recent_wallet',
|
|
73
|
+
CONNECTED_CONNECTORS: '@appkit/connected_connectors',
|
|
74
|
+
ONRAMP_PREFERRED_COUNTRY: '@appkit/onramp_preferred_country',
|
|
75
|
+
ONRAMP_COUNTRIES: '@appkit/onramp_countries',
|
|
76
|
+
ONRAMP_SERVICE_PROVIDERS: '@appkit/onramp_service_providers',
|
|
77
|
+
ONRAMP_FIAT_LIMITS: '@appkit/onramp_fiat_limits',
|
|
78
|
+
ONRAMP_FIAT_CURRENCIES: '@appkit/onramp_fiat_currencies',
|
|
79
|
+
ONRAMP_PREFERRED_FIAT_CURRENCY: '@appkit/onramp_preferred_fiat_currency',
|
|
80
|
+
ONRAMP_COUNTRIES_DEFAULTS: '@appkit/onramp_countries_defaults',
|
|
81
|
+
ACTIVE_NAMESPACE: '@appkit/active_namespace',
|
|
82
|
+
COINBASE_CONNECTOR_SESSION: '@appkit/coinbase_connector/session'
|
|
83
|
+
}
|
|
37
84
|
};
|
package/src/utils/NetworkUtil.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { CaipAddress } from '../types';
|
|
2
|
+
|
|
1
3
|
export const NetworkUtil = {
|
|
2
4
|
caipNetworkIdToNumber(caipnetworkId?: `${string}:${string}`) {
|
|
3
5
|
return caipnetworkId ? Number(caipnetworkId.split(':')[1]) : undefined;
|
|
6
|
+
},
|
|
7
|
+
getPlainAddress(caipAddress?: CaipAddress) {
|
|
8
|
+
return caipAddress?.split(':')[2];
|
|
4
9
|
}
|
|
5
10
|
};
|