Skip to content

Commit

Permalink
remove xrp naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Wozacosta committed Jan 15, 2025
1 parent aaa7f2f commit ce238d7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion libs/coin-modules/coin-module-boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"scripts": {
"clean": "rimraf lib lib-es",
"build": "tsc && tsc -m ES6 --outDir lib-es",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-xrp.json",
"coverage": "jest --coverage --testPathIgnorePatterns='/bridge.integration.test.ts|node_modules|lib-es|lib/' --passWithNoTests && mv coverage/coverage-final.json coverage/coverage-boilerplate.json",
"prewatch": "pnpm build",
"watch": "tsc --watch",
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
Expand Down
12 changes: 8 additions & 4 deletions libs/coin-modules/coin-module-boilerplate/src/bridge/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { getTransactions } from "../network/indexer";
import { getAccountInfo, getBlockHeight } from "../network/node";

import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
import { XrplOperation } from "../network/types";
import { BoilerplateOperation } from "../network/types";
import coinConfig from "../config";

const operationAdapter =
(accountId: string, address: string) =>
({
meta: { delivered_amount },
tx: { Fee, hash, inLedger, date, Account, Destination, Sequence },
}: XrplOperation) => {
}: BoilerplateOperation) => {
const type = Account === address ? "OUT" : "IN";
let value =
delivered_amount && typeof delivered_amount === "string"
Expand Down Expand Up @@ -47,10 +47,14 @@ const operationAdapter =
return op;
};

const filterOperations = (transactions: XrplOperation[], accountId: string, address: string) => {
const filterOperations = (
transactions: BoilerplateOperation[],
accountId: string,
address: string,
) => {
return transactions
.filter(
({ tx, meta }: XrplOperation) =>
({ tx, meta }: BoilerplateOperation) =>
tx.TransactionType === "Payment" && typeof meta.delivered_amount === "string",
)
.map(operationAdapter(accountId, address))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type XrplOperation = {
export type BoilerplateOperation = {
meta: {
AffectedNodes: {
ModifiedNode: {
Expand Down Expand Up @@ -80,7 +80,6 @@ export type AccountInfoResponse = {
disallowIncomingNFTokenOffer: boolean;
disallowIncomingPayChan: boolean;
disallowIncomingTrustline: boolean;
disallowIncomingXRP: boolean;
globalFreeze: boolean;
noFreeze: boolean;
passwordSpent: boolean;
Expand Down Expand Up @@ -129,10 +128,8 @@ export type ServerInfoResponse = {
uptime: number;
validated_ledger: {
age: number;
base_fee_xrp: number;
base_fee: number;
hash: string;
reserve_base_xrp: number;
reserve_inc_xrp: number;
seq: number;
};
validation_quorum: number;
Expand All @@ -141,7 +138,7 @@ export type ServerInfoResponse = {

export type AccountTxResponse = {
account: string;
transactions: XrplOperation[];
transactions: BoilerplateOperation[];
} & ResponseStatus;

export type LedgerResponse = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const currency = getCryptoCurrencyById("ripple");
const minAmountCutoff = parseCurrencyUnit(currency.units[0], "0.1");
const reserve = parseCurrencyUnit(currency.units[0], "20");

const xrp: AppSpec<Transaction> = {
name: "XRP",
const boilerplateSpec: AppSpec<Transaction> = {
name: "BOILERPLATE",
currency,
appQuery: {
model: DeviceModelId.nanoS,
appName: "XRP",
appName: "BOILERPLATE_APP_NAME",
},
genericDeviceAction: acceptTransaction,
minViableAmount: minAmountCutoff,
Expand Down Expand Up @@ -69,5 +69,5 @@ const xrp: AppSpec<Transaction> = {
],
};
export default {
xrp,
boilerplateSpec,
};

0 comments on commit ce238d7

Please sign in to comment.