@portal-hq/utils
Advanced tools
Comparing version 0.2.8 to 0.2.9
{ | ||
"name": "@portal-hq/utils", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"main": "lib/commonjs/index", | ||
@@ -5,0 +5,0 @@ "module": "lib/esm/index", |
@@ -166,3 +166,2 @@ const currencyCodes: Record<string, string> = { | ||
Palau: 'USD', | ||
Palestine: null, | ||
Panama: 'PAB', | ||
@@ -169,0 +168,0 @@ 'Papua New Guinea': 'PGK', |
import { ClientWithCustodianData, Dapp, DkgData, Network } from '../../types' | ||
export abstract class KeychainAdapter { | ||
deleteAddress: () => Promise<boolean> | ||
deleteDkgResult: () => Promise<boolean> | ||
getAddress: (isSim?: boolean) => Promise<string> | ||
getDkgResult: (isSim?: boolean) => Promise<string> | ||
storeAddress: (address: string, isSim?: boolean) => Promise<void> | ||
storeDkgResult: (result: DkgData, isSim?: boolean) => Promise<void> | ||
deleteAddress(): Promise<boolean> { | ||
throw new Error( | ||
'[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.', | ||
) | ||
} | ||
deleteDkgResult(): Promise<boolean> { | ||
throw new Error( | ||
'[Portal] KeychainAdapter method deleteDkgResult cannot be called directly. Please extend KeychainAdapter.', | ||
) | ||
} | ||
getAddress(isSim?: boolean): Promise<string> { | ||
throw new Error( | ||
`[Portal] KeychainAdapter method getAddress(${isSim}) cannot be called directly. Please extend KeychainAdapter.`, | ||
) | ||
} | ||
getDkgResult(isSim?: boolean): Promise<string> { | ||
throw new Error( | ||
`[Portal] KeychainAdapter method getDkgResult(${isSim}) cannot be called directly. Please extend KeychainAdapter.`, | ||
) | ||
} | ||
storeAddress(address: string, isSim?: boolean): Promise<void> { | ||
throw new Error( | ||
`[Portal] KeychainAdapter method storeAddress(${address}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`, | ||
) | ||
} | ||
storeDkgResult(result: DkgData, isSim?: boolean): Promise<void> { | ||
throw new Error( | ||
`[Portal] KeychainAdapter method storeDkgResult(${result}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`, | ||
) | ||
} | ||
} | ||
@@ -19,6 +43,14 @@ | ||
export abstract class Storage { | ||
public api: PortalApi | ||
public api?: PortalApi | ||
read: () => Promise<string> | ||
write: (privateKey: string) => Promise<string> | ||
read(): Promise<string> { | ||
throw new Error( | ||
'[Portal] Storage method read cannot be called directly. Please extend Storage.', | ||
) | ||
} | ||
write(privateKey: string): Promise<string> { | ||
throw new Error( | ||
`[Portal] Storage method write(${privateKey}) cannot be called directly. Please extend Storage.`, | ||
) | ||
} | ||
} |
@@ -46,3 +46,3 @@ import { | ||
const log = console | ||
const definition = providerErrors[code] | ||
const definition = providerErrors[code as ValidRpcErrorCodes] | ||
@@ -49,0 +49,0 @@ if (!definition) { |
@@ -77,3 +77,2 @@ import { convert } from '../currency' | ||
const txParam0 = Array.isArray(params) ? params[0] : params | ||
const txParam1 = Array.isArray(params) ? params[1] : null | ||
@@ -94,4 +93,6 @@ switch (method) { | ||
console.log(`requestData: `, requestData) | ||
break | ||
return { | ||
method, | ||
data: requestData, | ||
} | ||
case 'eth_sign': | ||
@@ -102,11 +103,15 @@ case 'personal_sign': | ||
} as MessageData | ||
break | ||
return { | ||
method, | ||
data: requestData, | ||
} | ||
default: | ||
return { | ||
method, | ||
data: { | ||
message: 'NO_DATA_PROVIDED', | ||
}, | ||
} | ||
break | ||
} | ||
return { | ||
method, | ||
data: requestData, | ||
} | ||
} |
@@ -37,2 +37,4 @@ export { convert } from './currency' | ||
type SignableTransactionData, | ||
type SigningRequestArguments, | ||
type SigningResponse, | ||
} from '../types' |
@@ -114,1 +114,13 @@ export type OutgoingRequestData = MessageData | SignableTransactionData | ||
} | ||
export interface SigningRequestArguments { | ||
readonly chainId?: number | ||
readonly method: string | ||
readonly params?: unknown[] | SigningRequestParams | ||
} | ||
export interface SigningResponse { | ||
method: string | ||
params?: unknown[] | SigningRequestParams | ||
signature?: any | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54191
41
1903