|
1 | 1 | /** biome-ignore-all lint/suspicious/noExplicitAny: ok */ |
2 | 2 | import MetaMaskOpenRPCDocument from '@metamask/api-specs'; |
3 | 3 | import type { Scope, SessionData } from '@metamask/multichain-sdk'; |
4 | | -import { type CaipAccountId, type CaipChainId, type CaipAccountAddress, parseCaipAccountId, type Json } from '@metamask/utils'; |
5 | | -import type { OpenrpcDocument, MethodObject } from '@open-rpc/meta-schema'; |
6 | | -import { useState, useCallback, useEffect } from 'react'; |
7 | | -import { METHODS_REQUIRING_PARAM_INJECTION, injectParams } from '../constants/methods'; |
| 4 | +import { type CaipAccountAddress, type CaipAccountId, type CaipChainId, type Json, parseCaipAccountId } from '@metamask/utils'; |
| 5 | +import type { MethodObject, OpenrpcDocument } from '@open-rpc/meta-schema'; |
| 6 | +import { useCallback, useEffect, useState } from 'react'; |
| 7 | +import { injectParams, METHODS_REQUIRING_PARAM_INJECTION } from '../constants/methods'; |
8 | 8 | import { getNetworkName } from '../constants/networks'; |
9 | 9 | import { escapeHtmlId } from '../helpers/IdHelpers'; |
10 | 10 | import { openRPCExampleToJSON, truncateJSON } from '../helpers/JsonHelpers'; |
11 | | -import { generateSolanaMethodExamples } from '../helpers/solana-method-signatures'; |
12 | 11 | import { extractRequestForStorage, extractRequestParams, normalizeMethodParams, updateInvokeMethodResults } from '../helpers/MethodInvocationHelpers'; |
| 12 | +import { generateSolanaMethodExamples } from '../helpers/solana-method-signatures'; |
13 | 13 | import { useSDK } from '../sdk'; |
14 | 14 |
|
15 | 15 | const metamaskOpenrpcDocument: OpenrpcDocument = MetaMaskOpenRPCDocument; |
@@ -154,14 +154,14 @@ export function ScopeCard({ scope, details }: { scope: Scope; details: SessionDa |
154 | 154 | const params = extractRequestParams(finalRequestObject); |
155 | 155 | console.log(`📤 Calling invokeMethod with params:`, params); |
156 | 156 |
|
157 | | - const paramsArray = normalizeMethodParams(method, params); |
158 | | - console.log(`📤 Normalized params array:`, paramsArray); |
| 157 | + const normalizedParams = normalizeMethodParams(method, params, scope); |
| 158 | + console.log(`📤 Normalized params:`, normalizedParams); |
159 | 159 |
|
160 | 160 | const result = await invokeMethod({ |
161 | 161 | scope, |
162 | 162 | request: { |
163 | 163 | method, |
164 | | - params: paramsArray, |
| 164 | + params: normalizedParams, |
165 | 165 | }, |
166 | 166 | }); |
167 | 167 |
|
@@ -308,11 +308,10 @@ export function ScopeCard({ scope, details }: { scope: Scope; details: SessionDa |
308 | 308 | className={` |
309 | 309 | w-full mt-4 px-6 py-3 rounded-lg font-medium text-white transition-all duration-200 |
310 | 310 | flex items-center justify-center gap-2 |
311 | | - ${ |
312 | | - !selectedMethods[scope] || !invokeMethodRequests[scope] |
313 | | - ? 'bg-gray-300 cursor-not-allowed text-gray-500' |
314 | | - : 'bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 hover:shadow-lg hover:scale-105 active:scale-95 cursor-pointer' |
315 | | - } |
| 311 | + ${!selectedMethods[scope] || !invokeMethodRequests[scope] |
| 312 | + ? 'bg-gray-300 cursor-not-allowed text-gray-500' |
| 313 | + : 'bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 hover:shadow-lg hover:scale-105 active:scale-95 cursor-pointer' |
| 314 | + } |
316 | 315 | `} |
317 | 316 | > |
318 | 317 | <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> |
|
0 commit comments