Skip to content

Commit

Permalink
Add serialized transaction field and return in API
Browse files Browse the repository at this point in the history
This adds a new field to Transaction called serialized which will
contain the full base64 encoded transaction of the Ironfish SDK
Transaction type. It also returns it in transactions/find API.
  • Loading branch information
NullSoldier committed Dec 24, 2023
1 parent 20e9cd4 commit 6090718
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "transactions" ADD COLUMN "serialized" VARCHAR;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ model Transaction {
notes Json
spends Json
network_version Int
serialized String? @db.VarChar
asset_descriptions AssetDescription[]
created_assets Asset[]
blocks_transactions BlockTransaction[]
Expand Down
1 change: 1 addition & 0 deletions src/transactions/interfaces/serialized-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface SerializedTransaction {
size: number;
notes: JsonValue;
spends: JsonValue;
serialized: string | null;
mints: SerializedAssetDescription[];
burns: SerializedAssetDescription[];
object: 'transaction';
Expand Down
3 changes: 3 additions & 0 deletions src/transactions/transactions.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ describe('TransactionsController', () => {
size: faker.datatype.number(),
notes,
spends,
serialized:
'U3dh76O7TMnEb+KPrRghTyz4G3lHV/BWfogtW59oUSFKACk56Jl3eMY9Ky9c5uc2nBhePgCo0hIM+ednqYAjoA',
},
});

Expand All @@ -85,6 +87,7 @@ describe('TransactionsController', () => {
hash: testTransactionHash,
fee: expect.any(String),
size: expect.any(Number),
serialized: transaction.serialized,
notes,
spends,
});
Expand Down
1 change: 1 addition & 0 deletions src/transactions/utils/transaction-translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function serializedTransactionFromRecord(
size: transaction.size,
notes: transaction.notes,
spends: transaction.spends,
serialized: transaction.serialized,
mints,
burns,
object: 'transaction',
Expand Down

0 comments on commit 6090718

Please sign in to comment.