Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 0 additions & 85 deletions packages/sdk-multichain/src/domain/multichain/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,88 +64,3 @@ export const infuraRpcUrls: RPC_URLS_MAP = {
'eip155:44787': 'https://celo-alfajores.infura.io/v3/',
};

/**
* Standard RPC method names used in the MetaMask ecosystem.
*
* This constant provides a centralized registry of all supported
* RPC methods, making it easier to reference them consistently
* throughout the codebase.
*/
export const RPC_METHODS = {
/** Get the current provider state */
METAMASK_GETPROVIDERSTATE: 'metamask_getProviderState',
/** Connect and sign in a single operation */
METAMASK_CONNECTSIGN: 'metamask_connectSign',
/** Connect with specific parameters */
METAMASK_CONNECTWITH: 'metamask_connectWith',
/** Open MetaMask interface */
METAMASK_OPEN: 'metamask_open',
/** Execute multiple operations in a batch */
METAMASK_BATCH: 'metamask_batch',
/** Sign a message with personal_sign */
PERSONAL_SIGN: 'personal_sign',
/** Request wallet permissions */
WALLET_REQUESTPERMISSIONS: 'wallet_requestPermissions',
/** Revoke wallet permissions */
WALLET_REVOKEPERMISSIONS: 'wallet_revokePermissions',
/** Get current wallet permissions */
WALLET_GETPERMISSIONS: 'wallet_getPermissions',
/** Watch/add a token to the wallet */
WALLET_WATCHASSET: 'wallet_watchAsset',
/** Add a new Ethereum chain */
WALLET_ADDETHEREUMCHAIN: 'wallet_addEthereumChain',
/** Switch to a different Ethereum chain */
WALLET_SWITCHETHEREUMCHAIN: 'wallet_switchEthereumChain',
/** Request account access */
ETH_REQUESTACCOUNTS: 'eth_requestAccounts',
/** Get available accounts */
ETH_ACCOUNTS: 'eth_accounts',
/** Get current chain ID */
ETH_CHAINID: 'eth_chainId',
/** Send a transaction */
ETH_SENDTRANSACTION: 'eth_sendTransaction',
/** Sign typed data */
ETH_SIGNTYPEDDATA: 'eth_signTypedData',
/** Sign typed data v3 */
ETH_SIGNTYPEDDATA_V3: 'eth_signTypedData_v3',
/** Sign typed data v4 */
ETH_SIGNTYPEDDATA_V4: 'eth_signTypedData_v4',
/** Sign a transaction */
ETH_SIGNTRANSACTION: 'eth_signTransaction',
/** Sign arbitrary data */
ETH_SIGN: 'eth_sign',
/** Recover address from signature */
PERSONAL_EC_RECOVER: 'personal_ecRecover',
};

/**
* Configuration mapping for RPC methods that should be redirected to the wallet.
*
* This constant defines which RPC methods require user interaction through
* the wallet interface (true) versus those that can be handled locally (false).
* Methods marked as true will redirect to the wallet for user approval.
*/
export const METHODS_TO_REDIRECT: { [method: string]: boolean } = {
[RPC_METHODS.ETH_REQUESTACCOUNTS]: true,
[RPC_METHODS.ETH_SENDTRANSACTION]: true,
[RPC_METHODS.ETH_SIGNTRANSACTION]: true,
[RPC_METHODS.ETH_SIGN]: true,
[RPC_METHODS.PERSONAL_SIGN]: true,
// stop redirecting these as we are caching values in the provider
[RPC_METHODS.ETH_ACCOUNTS]: false,
[RPC_METHODS.ETH_CHAINID]: false,
//
[RPC_METHODS.ETH_SIGNTYPEDDATA]: true,
[RPC_METHODS.ETH_SIGNTYPEDDATA_V3]: true,
[RPC_METHODS.ETH_SIGNTYPEDDATA_V4]: true,
[RPC_METHODS.WALLET_REQUESTPERMISSIONS]: true,
[RPC_METHODS.WALLET_GETPERMISSIONS]: true,
[RPC_METHODS.WALLET_WATCHASSET]: true,
[RPC_METHODS.WALLET_ADDETHEREUMCHAIN]: true,
[RPC_METHODS.WALLET_SWITCHETHEREUMCHAIN]: true,
[RPC_METHODS.METAMASK_CONNECTSIGN]: true,
[RPC_METHODS.METAMASK_CONNECTWITH]: true,
[RPC_METHODS.PERSONAL_EC_RECOVER]: true,
[RPC_METHODS.METAMASK_BATCH]: true,
[RPC_METHODS.METAMASK_OPEN]: true,
};
3 changes: 2 additions & 1 deletion packages/sdk-multichain/src/invoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ function testSuite<T extends MultichainOptions>({ platform, createSDK, options:
{ timeout: 100000 },
);

t.it(`${platform} should invoke readonly method successfully from client if infuraAPIKey exists`, async () => {
// TODO: Re-enable this test once we handle RPC node routing (INTERCEPT_AND_ROUTE_TO_RPC_NODE strategy)
t.it.skip(`${platform} should invoke readonly method successfully from client if infuraAPIKey exists`, async () => {
const scopes = ['eip155:1'] as Scope[];
const caipAccountIds = ['eip155:1:0x1234567890abcdef1234567890abcdef12345678'] as any;

Expand Down
Loading
Loading