Skip to content

Commit

Permalink
Release 3.7.1 (#370)
Browse files Browse the repository at this point in the history
* Update Material UI

* Update xrpl

* Update Sentry

* Update XRPL account lib

* Update version numbers
  • Loading branch information
FlorianBouron authored Jun 16, 2024
1 parent 429085d commit 04fb267
Show file tree
Hide file tree
Showing 10 changed files with 315 additions and 216 deletions.
4 changes: 2 additions & 2 deletions packages/api/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -70,7 +70,7 @@
destinationTag: 12,
fee: '199',
flags: {
tfNoDirectRipple: false,
tfNoRippleDirect: false,
tfPartialPayment: false,
tfLimitQuality: false
}
Expand Down
4 changes: 2 additions & 2 deletions packages/api/templates/indexv2.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -57,7 +57,7 @@
destinationTag: 12,
fee: '199',
flags: {
tfNoDirectRipple: false,
tfNoRippleDirect: false,
tfPartialPayment: false,
tfLimitQuality: false
}
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
},
"homepage": "https://github.com/GemWallet/gemwallet-extension#readme",
"peerDependencies": {
"xrpl": "^3.0.0"
"xrpl": "^3.1.0"
}
}
10 changes: 5 additions & 5 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gemwallet/extension",
"version": "3.7.0",
"version": "3.7.1",
"description": "GemWallet browser extension",
"private": true,
"type": "module",
Expand All @@ -16,8 +16,8 @@
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.5",
"@mui/material": "^5.15.5",
"@sentry/react": "^7.93.0",
"@mui/material": "^5.15.20",
"@sentry/react": "^7.117.0",
"copy-to-clipboard": "^3.3.3",
"crypto-browserify": "^3.12.0",
"crypto-js": "^4.2.0",
Expand All @@ -37,8 +37,8 @@
"react-simple-code-editor": "^0.13.1",
"stream-browserify": "^3.0.0",
"web-vitals": "^3.5.1",
"xrpl": "^3.0.0",
"xrpl-accountlib": "^3.2.9"
"xrpl": "^3.1.0",
"xrpl-accountlib": "^3.6.2"
},
"devDependencies": {
"@gemwallet/constants": "*",
Expand Down
4 changes: 2 additions & 2 deletions packages/extension/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "GemWallet",
"description": "GemWallet brings the XRPL to your web browser - https://gemwallet.app",
"version": "3.7.0",
"description": "GemWallet brings the XRP Ledger (XRPL) and Xahau to your web browser - https://gemwallet.app",
"version": "3.7.1",
"manifest_version": 3,
"action": {
"default_popup": "index.html",
Expand Down
34 changes: 23 additions & 11 deletions packages/extension/src/utils/format.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TrustSet, xrpToDrops } from 'xrpl';
import { PaymentFlags as PaymentFlagsBitmask, TrustSet, xrpToDrops } from 'xrpl';

import {
formatAmount,
Expand All @@ -11,6 +11,14 @@ import {
} from './format';
import { describe, it, expect, test } from 'vitest';

// Mocking navigator.language
Object.defineProperty(global, 'navigator', {
value: {
language: 'en-US'
},
writable: true
});

describe('Format util', () => {
describe('formatAmount', () => {
test('should return 1,234,567 XRP', () => {
Expand Down Expand Up @@ -78,17 +86,21 @@ describe('Format util', () => {
});

describe('formatFlags', () => {
type PaymentFlags = {
[key in keyof typeof PaymentFlagsBitmask]: boolean;
};

it('should return a number as it is if flags is a number', () => {
expect(formatFlags(123456)).toBe(123456);
});

it('should return formatted string if flags is an object', () => {
const paymentFlags = {
tfNoDirectRipple: true,
const paymentFlags: PaymentFlags = {
tfNoRippleDirect: true,
tfPartialPayment: false,
tfLimitQuality: false
};
let expectedResult = 'tfNoDirectRipple: true\ntfPartialPayment: false\ntfLimitQuality: false';
let expectedResult = 'tfNoRippleDirect: true\ntfPartialPayment: false\ntfLimitQuality: false';
expect(formatFlags(paymentFlags)).toBe(expectedResult);

const trustSetFlags = {
Expand Down Expand Up @@ -187,14 +199,14 @@ describe('formatFlags', () => {
});

it('should format Payment flags correctly when given as a number', () => {
const flags = 196608; // both tfNoDirectRipple and tfPartialPayment flags are set
const flags = 196608; // both tfNoRippleDirect and tfPartialPayment flags are set
const expectedResult = 'No Direct Ripple\nPartial Payment';
expect(formatFlags(flags, 'Payment')).toBe(expectedResult);
});

it('should format Payment flags correctly when given as an object', () => {
const flags = {
tfNoDirectRipple: true,
const flags: PaymentFlags = {
tfNoRippleDirect: true,
tfPartialPayment: true,
tfLimitQuality: false
};
Expand All @@ -203,17 +215,17 @@ describe('formatFlags', () => {
});

it('should not show false flags for Payment', () => {
const flags = {
tfNoDirectRipple: false,
const flags: PaymentFlags = {
tfNoRippleDirect: false,
tfPartialPayment: false,
tfLimitQuality: true
};
expect(formatFlags(flags, 'Payment')).toBe('Limit Quality');
});

it('should format Payment flags to "None" when no flags are set', () => {
const flags = {
tfNoDirectRipple: false,
const flags: PaymentFlags = {
tfNoRippleDirect: false,
tfPartialPayment: false,
tfLimitQuality: false
};
Expand Down
20 changes: 10 additions & 10 deletions packages/extension/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const formatFlags = (

if (flagsType === 'NFTokenMint') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & NFTokenMintFlags.tfBurnable) {
flagDescriptions.push(LABEL_BURNABLE);
Expand Down Expand Up @@ -231,7 +231,7 @@ export const formatFlags = (

if (flagsType === 'OfferCreate') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & OfferCreateFlags.tfPassive) {
flagDescriptions.push(LABEL_PASSIVE);
Expand Down Expand Up @@ -276,9 +276,9 @@ export const formatFlags = (

if (flagsType === 'Payment') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & PaymentFlagsBitmask.tfNoDirectRipple) {
if (flags & PaymentFlagsBitmask.tfNoRippleDirect) {
flagDescriptions.push(LABEL_NO_DIRECT_RIPPLE);
}
if (flags & PaymentFlagsBitmask.tfPartialPayment) {
Expand All @@ -294,7 +294,7 @@ export const formatFlags = (
if (typeof flags === 'object') {
const formattedFlags = Object.entries(flags)
.map(([key, value]) => {
if (key === 'tfNoDirectRipple' && value) {
if (key === 'tfNoRippleDirect' && value) {
return `${LABEL_NO_DIRECT_RIPPLE}`;
}
if (key === 'tfPartialPayment' && value) {
Expand All @@ -303,7 +303,7 @@ export const formatFlags = (
if (key === 'tfLimitQuality' && value) {
return `${LABEL_LIMIT_QUALITY}`;
}
if (['tfNoDirectRipple', 'tfPartialPayment', 'tfLimitQuality'].includes(key)) {
if (['tfNoRippleDirect', 'tfPartialPayment', 'tfLimitQuality'].includes(key)) {
return null;
}
return `${key}: ${value}`;
Expand All @@ -316,7 +316,7 @@ export const formatFlags = (

if (flagsType === 'AccountSet') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & AccountSetTfFlagsBitmask.tfRequireDestTag) {
flagDescriptions.push(LABEL_REQUIRE_DEST_TAG);
Expand Down Expand Up @@ -383,7 +383,7 @@ export const formatFlags = (

if (flagsType === 'TrustSet') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & TrustSetFlagsBitmask.tfSetfAuth) {
flagDescriptions.push(LABEL_SET_AUTH);
Expand Down Expand Up @@ -443,7 +443,7 @@ export const formatFlags = (

if (flagsType === 'AMMDeposit') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & AMMDepositFlagsBitmask.tfLPToken) {
flagDescriptions.push(LABEL_LPTOKEN);
Expand Down Expand Up @@ -505,7 +505,7 @@ export const formatFlags = (

if (flagsType === 'AMMWithdraw') {
if (typeof flags === 'number') {
let flagDescriptions: string[] = [];
const flagDescriptions: string[] = [];

if (flags & AMMWithdrawFlagsBitmask.tfLPToken) {
flagDescriptions.push(LABEL_LPTOKEN);
Expand Down
27 changes: 17 additions & 10 deletions packages/extension/src/utils/parseParams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
NFTokenCreateOfferFlags,
NFTokenMintFlags,
NFTokenMintFlagsInterface,
PaymentFlags as PaymentFlagsBitmask,
Transaction
} from 'xrpl';

Expand Down Expand Up @@ -172,27 +173,33 @@ describe('parseSigners', () => {
});

describe('parsePaymentFlags', () => {
type PaymentFlags = {
[key in keyof typeof PaymentFlagsBitmask]: boolean;
};

test('parse flags', () => {
expect(parsePaymentFlags('123')).toEqual(123);
expect(parsePaymentFlags(123)).toEqual(123);
});
test('parse flags json', () => {
expect(
parsePaymentFlags('{"tfNoDirectRipple":true,"tfPartialPayment":true,"tfLimitQuality":false}')
).toEqual({
tfNoDirectRipple: true,
const result: PaymentFlags = {
tfNoRippleDirect: true,
tfPartialPayment: true,
tfLimitQuality: false
});
};
expect(
parsePaymentFlags('{"tfNoRippleDirect":true,"tfPartialPayment":true,"tfLimitQuality":false}')
).toEqual(result);
});
test('parse flags object', () => {
expect(
parsePaymentFlags({ tfNoDirectRipple: true, tfPartialPayment: true, tfLimitQuality: false })
).toEqual({
tfNoDirectRipple: true,
const result: PaymentFlags = {
tfNoRippleDirect: true,
tfPartialPayment: true,
tfLimitQuality: false
});
};
expect(
parsePaymentFlags({ tfNoRippleDirect: true, tfPartialPayment: true, tfLimitQuality: false })
).toEqual(result);
});
});

Expand Down
Loading

0 comments on commit 04fb267

Please sign in to comment.