wallet-core: mock implementation of GetCurrencyInfo
This commit is contained in:
parent
951d1b66fa
commit
308a4282cb
@ -26,7 +26,7 @@ import {
|
|||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
||||||
import { defaultCoinConfig } from "../harness/denomStructures.js";
|
import { defaultCoinConfig } from "../harness/denomStructures.js";
|
||||||
import { GlobalTestState, WalletCli } from "../harness/harness.js";
|
import { GlobalTestState } from "../harness/harness.js";
|
||||||
import {
|
import {
|
||||||
createSimpleTestkudosEnvironmentV2,
|
createSimpleTestkudosEnvironmentV2,
|
||||||
createWalletDaemonWithClient,
|
createWalletDaemonWithClient,
|
||||||
@ -106,7 +106,7 @@ export async function runAgeRestrictionsPeerTest(t: GlobalTestState) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await wallet2.call(WalletApiOperation.ConfirmPeerPushCredit, {
|
await wallet2.call(WalletApiOperation.ConfirmPeerPushCredit, {
|
||||||
peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId,
|
transactionId: checkResp.transactionId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const peerPullCreditDoneCond = wallet2.waitForNotificationCond(
|
const peerPullCreditDoneCond = wallet2.waitForNotificationCond(
|
||||||
|
@ -379,6 +379,20 @@ export interface Balance {
|
|||||||
requiresUserInput: boolean;
|
requiresUserInput: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetCurrencyInfoRequest {
|
||||||
|
currency: string;
|
||||||
|
scope: ScopeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetCurrencyInfoResponse {
|
||||||
|
decimalSeparator: string;
|
||||||
|
numFractionalDigits: number;
|
||||||
|
/**
|
||||||
|
* Is the currency name leading or trailing?
|
||||||
|
*/
|
||||||
|
isCurrencyNameLeading: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface InitRequest {
|
export interface InitRequest {
|
||||||
skipDefaults?: boolean;
|
skipDefaults?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -711,7 +711,10 @@ export interface RewardCoinSource {
|
|||||||
coinIndex: number;
|
coinIndex: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CoinSource = WithdrawCoinSource | RefreshCoinSource | RewardCoinSource;
|
export type CoinSource =
|
||||||
|
| WithdrawCoinSource
|
||||||
|
| RefreshCoinSource
|
||||||
|
| RewardCoinSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoinRecord as stored in the "coins" data store
|
* CoinRecord as stored in the "coins" data store
|
||||||
|
@ -114,6 +114,8 @@ import {
|
|||||||
WithdrawUriInfoResponse,
|
WithdrawUriInfoResponse,
|
||||||
SharePaymentRequest,
|
SharePaymentRequest,
|
||||||
SharePaymentResult,
|
SharePaymentResult,
|
||||||
|
GetCurrencyInfoRequest,
|
||||||
|
GetCurrencyInfoResponse,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { AuditorTrustRecord, WalletContractData } from "./db.js";
|
import { AuditorTrustRecord, WalletContractData } from "./db.js";
|
||||||
import {
|
import {
|
||||||
@ -210,6 +212,7 @@ export enum WalletApiOperation {
|
|||||||
ApplyDevExperiment = "applyDevExperiment",
|
ApplyDevExperiment = "applyDevExperiment",
|
||||||
ValidateIban = "validateIban",
|
ValidateIban = "validateIban",
|
||||||
TestingWaitTransactionsFinal = "testingWaitTransactionsFinal",
|
TestingWaitTransactionsFinal = "testingWaitTransactionsFinal",
|
||||||
|
GetCurrencyInfo = "getCurrencyInfo",
|
||||||
}
|
}
|
||||||
|
|
||||||
// group: Initialization
|
// group: Initialization
|
||||||
@ -601,6 +604,12 @@ export type ListCurrenciesOp = {
|
|||||||
response: WalletCurrencyInfo;
|
response: WalletCurrencyInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type GetCurrencyInfoOp = {
|
||||||
|
op: WalletApiOperation.GetCurrencyInfo;
|
||||||
|
request: GetCurrencyInfoRequest;
|
||||||
|
response: GetCurrencyInfoResponse;
|
||||||
|
};
|
||||||
|
|
||||||
// group: Deposits
|
// group: Deposits
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1072,6 +1081,7 @@ export type WalletOperations = {
|
|||||||
[WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp;
|
[WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp;
|
||||||
[WalletApiOperation.ValidateIban]: ValidateIbanOp;
|
[WalletApiOperation.ValidateIban]: ValidateIbanOp;
|
||||||
[WalletApiOperation.TestingWaitTransactionsFinal]: TestingWaitTransactionsFinal;
|
[WalletApiOperation.TestingWaitTransactionsFinal]: TestingWaitTransactionsFinal;
|
||||||
|
[WalletApiOperation.GetCurrencyInfo]: GetCurrencyInfoOp;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WalletCoreRequestType<
|
export type WalletCoreRequestType<
|
||||||
|
@ -118,6 +118,7 @@ import {
|
|||||||
sampleWalletCoreTransactions,
|
sampleWalletCoreTransactions,
|
||||||
validateIban,
|
validateIban,
|
||||||
codecForSharePaymentRequest,
|
codecForSharePaymentRequest,
|
||||||
|
GetCurrencyInfoResponse,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
HttpRequestLibrary,
|
HttpRequestLibrary,
|
||||||
@ -1395,6 +1396,14 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
|
|||||||
const resp = await getBackupRecovery(ws);
|
const resp = await getBackupRecovery(ws);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
case WalletApiOperation.GetCurrencyInfo: {
|
||||||
|
const resp: GetCurrencyInfoResponse = {
|
||||||
|
decimalSeparator: ",",
|
||||||
|
isCurrencyNameLeading: false,
|
||||||
|
numFractionalDigits: 2,
|
||||||
|
};
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
case WalletApiOperation.ImportBackupRecovery: {
|
case WalletApiOperation.ImportBackupRecovery: {
|
||||||
const req = codecForAny().decode(payload);
|
const req = codecForAny().decode(payload);
|
||||||
await loadBackupRecovery(ws, req);
|
await loadBackupRecovery(ws, req);
|
||||||
|
Loading…
Reference in New Issue
Block a user