From d1003325eced06378656eb32a3a2d09b9fa5d6f9 Mon Sep 17 00:00:00 2001 From: "Justin R. Evans" Date: Fri, 7 Jul 2023 08:09:10 -0400 Subject: [PATCH] Add public key to schema, tested --- packages/types/src/tx/schema/tx.ts | 23 ++++++++++++++--------- packages/types/src/tx/types.ts | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/types/src/tx/schema/tx.ts b/packages/types/src/tx/schema/tx.ts index 24d3c47f6..b3e055e98 100644 --- a/packages/types/src/tx/schema/tx.ts +++ b/packages/types/src/tx/schema/tx.ts @@ -7,18 +7,22 @@ export class TxMsgValue { fee_amount: BN; gas_limit: BN; chain_id: string; + public_key?: string; constructor(properties: TxProps | SchemaObject) { this.token = properties.token; - this.fee_amount = 'feeAmount' in properties ? - new BN(properties.feeAmount.toString()) : - properties.fee_amount; - this.gas_limit = 'gasLimit' in properties ? - new BN(properties.gasLimit.toString()) : - properties.gas_limit; - this.chain_id = 'chainId' in properties ? - properties.chainId : - properties.chain_id; + this.fee_amount = + "feeAmount" in properties + ? new BN(properties.feeAmount.toString()) + : properties.fee_amount; + this.gas_limit = + "gasLimit" in properties + ? new BN(properties.gasLimit.toString()) + : properties.gas_limit; + this.chain_id = + "chainId" in properties ? properties.chainId : properties.chain_id; + this.public_key = + "publicKey" in properties ? properties.publicKey : undefined; } } @@ -31,6 +35,7 @@ export const TxMsgSchema = [ ["fee_amount", "u64"], ["gas_limit", "u64"], ["chain_id", "string"], + ["public_key", { kind: "option", type: "string" }], ], }, ] as const; // needed for SchemaObject to deduce types correctly diff --git a/packages/types/src/tx/types.ts b/packages/types/src/tx/types.ts index 45e32a4bf..4eb07f906 100644 --- a/packages/types/src/tx/types.ts +++ b/packages/types/src/tx/types.ts @@ -20,6 +20,7 @@ export type TxProps = { feeAmount: BigNumber; gasLimit: BigNumber; chainId: string; + publicKey?: string; }; export type TransferProps = {