mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-01-12 22:53:27 +08:00
refactor: add network to other rpc methods
This commit is contained in:
@@ -45,6 +45,7 @@ export async function rpcSendTransfer(message: SendTransferRequest, port: chrome
|
||||
const requestParams: RequestParams = [
|
||||
['address', message.params.address],
|
||||
['amount', message.params.amount],
|
||||
['network', (message.params as any).network ?? 'mainnet'],
|
||||
['requestId', message.id],
|
||||
];
|
||||
|
||||
|
||||
@@ -64,8 +64,9 @@ export async function rpcSignMessage(message: SignMessageRequest, port: chrome.r
|
||||
|
||||
const requestParams: RequestParams = [
|
||||
['message', message.params.message],
|
||||
['requestId', message.id],
|
||||
['network', (message.params as any).network ?? 'mainnet'],
|
||||
['paymentType', paymentType],
|
||||
['requestId', message.id],
|
||||
];
|
||||
|
||||
if (isDefined((message.params as any).account)) {
|
||||
|
||||
@@ -66,9 +66,9 @@ export async function rpcSignPsbt(message: SignPsbtRequest, port: chrome.runtime
|
||||
}
|
||||
|
||||
const requestParams: RequestParams = [
|
||||
['requestId', message.id],
|
||||
['hex', message.params.hex],
|
||||
['network', message.params.network ?? 'mainnet'],
|
||||
['requestId', message.id],
|
||||
];
|
||||
|
||||
if (isDefined(message.params.account)) {
|
||||
@@ -80,10 +80,6 @@ export async function rpcSignPsbt(message: SignPsbtRequest, port: chrome.runtime
|
||||
requestParams.push(['allowedSighash', hash.toString()])
|
||||
);
|
||||
|
||||
if (isDefined(message.params.publicKey)) {
|
||||
requestParams.push(['publicKey', message.params.publicKey.toString()]);
|
||||
}
|
||||
|
||||
if (isDefined(message.params.signAtIndex))
|
||||
ensureArray(message.params.signAtIndex).forEach(index =>
|
||||
requestParams.push(['signAtIndex', index.toString()])
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import * as yup from 'yup';
|
||||
|
||||
import { WalletDefaultNetworkConfigurationIds } from '@shared/constants';
|
||||
|
||||
import {
|
||||
accountSchema,
|
||||
formatValidationErrors,
|
||||
@@ -11,6 +13,7 @@ const rpcSendTransferParamsSchema = yup.object().shape({
|
||||
account: accountSchema,
|
||||
address: yup.string().required(),
|
||||
amount: yup.string().required(),
|
||||
network: yup.string().oneOf(Object.values(WalletDefaultNetworkConfigurationIds)),
|
||||
});
|
||||
|
||||
// TODO: Import param types from btckit when updated
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { PaymentTypes } from '@btckit/types';
|
||||
import * as yup from 'yup';
|
||||
|
||||
import { WalletDefaultNetworkConfigurationIds } from '@shared/constants';
|
||||
|
||||
import {
|
||||
accountSchema,
|
||||
formatValidationErrors,
|
||||
@@ -15,6 +17,7 @@ const rpcSignMessageParamsSchema = yup.object().shape({
|
||||
type: yup.string<SupportedBip322MessageTypes>(),
|
||||
account: accountSchema,
|
||||
message: yup.string().required(),
|
||||
network: yup.string().oneOf(Object.values(WalletDefaultNetworkConfigurationIds)),
|
||||
paymentType: yup.string<PaymentTypes>().required(),
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ const rpcSignPsbtParamsSchema = yup.object().shape({
|
||||
allowedSighash: yup.array().of(yup.mixed().oneOf(Object.values(btc.SignatureHash))),
|
||||
hex: yup.string().required(),
|
||||
network: yup.string().oneOf(Object.values(WalletDefaultNetworkConfigurationIds)),
|
||||
publicKey: yup.string(),
|
||||
signAtIndex: yup.mixed<number | number[]>().test(testIsNumberOrArrayOfNumbers),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
import { fetchInscription } from '@app/query/bitcoin/ordinals/inscription.query';
|
||||
import { getNumberOfInscriptionOnUtxo } from '@app/query/bitcoin/ordinals/ordinals-aware-utxo.query';
|
||||
import { fetchData } from '@app/query/utils';
|
||||
|
||||
import { test } from './../fixtures/fixtures';
|
||||
|
||||
test.describe('OrdAPI.xyz', () => {
|
||||
test('should return 3 in case of 3 inscriptions', async () => {
|
||||
const resp = await getNumberOfInscriptionOnUtxo(
|
||||
|
||||
Reference in New Issue
Block a user