Skip to content

Commit

Permalink
fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lourou committed Jan 17, 2024
1 parent 6e579a0 commit 0699b27
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Wallet } from "ethers";
import { Client } from "@xmtp/xmtp-js";
import { ContentTypeTransactionReference, TransactionReferenceCodec } from "./TransactionReference";
import {
ContentTypeTransactionReference,
TransactionReferenceCodec,
} from "./TransactionReference";
import type { TransactionReference } from "./TransactionReference";

test("content type exists", () => {
Expand All @@ -10,7 +13,7 @@ test("content type exists", () => {
expect(ContentTypeTransactionReference.versionMinor).toBe(0);
});

test('should successfully send and receive a TransactionReference message', async () => {
test("should successfully send and receive a TransactionReference message", async () => {
const aliceWallet = Wallet.createRandom();
const aliceClient = await Client.create(aliceWallet, {
codecs: [new TransactionReferenceCodec()],
Expand All @@ -32,12 +35,13 @@ test('should successfully send and receive a TransactionReference message', asyn
const transactionRefToSend: TransactionReference = {
namespace: "eip155",
networkId: "0x14a33",
reference: "0xa7cd32b79204559e46b4ef9b519fce58cedb25246f48d0c00bd628e873a81f2f",
reference:
"0xa7cd32b79204559e46b4ef9b519fce58cedb25246f48d0c00bd628e873a81f2f",
metadata: {
transactionType: "transfer",
currency: "USDC",
amount: 1337,
decimals: 6,
decimals: 6,
fromAddress: aliceWallet.address,
toAddress: bobWallet.address,
},
Expand All @@ -62,4 +66,4 @@ test('should successfully send and receive a TransactionReference message', asyn
expect(messageContent.networkId).toBe(transactionRefToSend.networkId);
expect(messageContent.reference).toBe(transactionRefToSend.reference);
expect(messageContent.metadata).toEqual(transactionRefToSend.metadata);
})
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type TransactionReference = {
transactionType: string;
currency: string;
amount: number;
decimals: number,
decimals: number;
fromAddress: string;
toAddress: string;
};
Expand All @@ -52,7 +52,9 @@ export class TransactionReferenceCodec

decode(encodedContent: EncodedContent): TransactionReference {
const uint8Array = encodedContent.content;
const contentReceived = JSON.parse(new TextDecoder().decode(uint8Array)) as TransactionReference;
const contentReceived = JSON.parse(
new TextDecoder().decode(uint8Array),
) as TransactionReference;
return contentReceived;
}

Expand Down
5 changes: 4 additions & 1 deletion packages/content-type-transaction-reference/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export { TransactionReferenceCodec, ContentTypeTransactionReference } from "./TransactionReference";
export {
TransactionReferenceCodec,
ContentTypeTransactionReference,
} from "./TransactionReference";
export type { TransactionReference } from "./TransactionReference";

0 comments on commit 0699b27

Please sign in to comment.