From 00cbfda15c59fc2f102bea79d62f96c387cc0ed8 Mon Sep 17 00:00:00 2001 From: i Date: Thu, 2 May 2024 11:13:29 +0200 Subject: [PATCH 1/5] fix --- src/mina-signer/mina-signer.ts | 5 ++--- src/mina-signer/src/rosetta.ts | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mina-signer/mina-signer.ts b/src/mina-signer/mina-signer.ts index b5de51d847..d6b9793a43 100644 --- a/src/mina-signer/mina-signer.ts +++ b/src/mina-signer/mina-signer.ts @@ -460,9 +460,8 @@ class Client { * @param privateKey The private key used to sign the transaction * @returns A string with the resulting payload for /construction/combine. */ - rosettaCombinePayload(signingPayload: string, privateKey: Json.PrivateKey) { - let parsedPayload = JSON.parse(signingPayload); - return JSON.stringify(Rosetta.rosettaCombinePayload(parsedPayload, privateKey, this.network)); + rosettaCombinePayload(signingPayload: Rosetta.UnsignedPayload, privateKey: Json.PrivateKey) { + return Rosetta.rosettaCombinePayload(signingPayload, privateKey, this.network); } /** diff --git a/src/mina-signer/src/rosetta.ts b/src/mina-signer/src/rosetta.ts index 012b23fcb1..cdd82bc4f0 100644 --- a/src/mina-signer/src/rosetta.ts +++ b/src/mina-signer/src/rosetta.ts @@ -192,7 +192,7 @@ function rosettaCombinePayload( network: NetworkId ) { let signature = signTransaction( - unsignedPayload.unsigned_transaction, + JSON.parse(unsignedPayload.unsigned_transaction), privateKey, network ); @@ -282,7 +282,7 @@ function rosettaTransactionToSignedCommand({ } type UnsignedPayload = { - unsigned_transaction: UnsignedTransaction; + unsigned_transaction: string; payloads: unknown[]; }; From e3e758b5e8fbd2e8a38b6a4fbf1b2896841ccca6 Mon Sep 17 00:00:00 2001 From: i Date: Thu, 2 May 2024 11:15:08 +0200 Subject: [PATCH 2/5] update version --- src/mina-signer/package-lock.json | 4 ++-- src/mina-signer/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mina-signer/package-lock.json b/src/mina-signer/package-lock.json index ce9e20b7ed..ce6ed4b280 100644 --- a/src/mina-signer/package-lock.json +++ b/src/mina-signer/package-lock.json @@ -1,12 +1,12 @@ { "name": "mina-signer", - "version": "3.0.6", + "version": "3.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mina-signer", - "version": "3.0.6", + "version": "3.0.7", "license": "Apache-2.0", "dependencies": { "blakejs": "^1.2.1", diff --git a/src/mina-signer/package.json b/src/mina-signer/package.json index 39013917fd..a3fadbd44b 100644 --- a/src/mina-signer/package.json +++ b/src/mina-signer/package.json @@ -1,7 +1,7 @@ { "name": "mina-signer", "description": "Node API for signing transactions on various networks for Mina Protocol", - "version": "3.0.6", + "version": "3.0.7", "type": "module", "scripts": { "build": "tsc -p ../../tsconfig.mina-signer.json", From 50f55a011219f885dc13d49a41393ab40bef98af Mon Sep 17 00:00:00 2001 From: i Date: Thu, 2 May 2024 16:59:02 +0200 Subject: [PATCH 3/5] fix tests --- src/mina-signer/tests/rosetta.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mina-signer/tests/rosetta.test.ts b/src/mina-signer/tests/rosetta.test.ts index 2527f526ea..338746882c 100644 --- a/src/mina-signer/tests/rosetta.test.ts +++ b/src/mina-signer/tests/rosetta.test.ts @@ -101,7 +101,7 @@ describe('Rosetta', () => { }); it('generates valid combine payload', () => { - const combinePayload = client.rosettaCombinePayload(JSON.stringify(rosettaUnsignedPayload), privateKey); + const combinePayload = client.rosettaCombinePayload(rosettaUnsignedPayload, privateKey); const expectedCombinePayload = { network_identifier: { blockchain: 'mina', network: 'mainnet' }, unsigned_transaction: rosettaUnsignedTxn, @@ -118,6 +118,6 @@ describe('Rosetta', () => { } ] }; - expect(combinePayload).toBe(JSON.stringify(expectedCombinePayload)); + expect(combinePayload).toBe(expectedCombinePayload); }); }); From 5c45a7d6380b775c7890cf5dc5e49fa42fdd03da Mon Sep 17 00:00:00 2001 From: i Date: Fri, 3 May 2024 11:24:35 +0200 Subject: [PATCH 4/5] fix test --- src/mina-signer/tests/rosetta.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mina-signer/tests/rosetta.test.ts b/src/mina-signer/tests/rosetta.test.ts index 338746882c..2c298c7583 100644 --- a/src/mina-signer/tests/rosetta.test.ts +++ b/src/mina-signer/tests/rosetta.test.ts @@ -8,7 +8,7 @@ describe('Rosetta', () => { const rosettaUnsignedTxn: UnsignedTransaction = { "randomOracleInput": "0000000333E1F14C6155B706D4EA12CF70685B8DCD3342A8B36A27CC3EB61B5871F9219E33E1F14C6155B706D4EA12CF70685B8DCD3342A8B36A27CC3EB61B5871F9219E33E1F14C6155B706D4EA12CF70685B8DCD3342A8B36A27CC3EB61B5871F9219E000002570242F000000000008000000000000000C00000007FFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000E0000000000000000014D677000000000", "signerInput": { "prefix": ["33E1F14C6155B706D4EA12CF70685B8DCD3342A8B36A27CC3EB61B5871F9219E", "33E1F14C6155B706D4EA12CF70685B8DCD3342A8B36A27CC3EB61B5871F9219E", "33E1F14C6155B706D4EA12CF70685B8DCD3342A8B36A27CC3EB61B5871F9219E"], "suffix": ["0000000000000007FFFFFFFC00000006000000000000000200000000001E8480", "0000000003800000000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000001DCD65000000000"] }, "payment": { "to": "B62qqQomCgjaKhayN79wWqDNsSJKFaZjrkuCp8Kcrt36ubXb14XHU2X", "from": "B62qqQomCgjaKhayN79wWqDNsSJKFaZjrkuCp8Kcrt36ubXb14XHU2X", "fee": "1000000", "token": "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf", "nonce": "1", "memo": null, "amount": "1000000000", "valid_until": null }, "stakeDelegation": null }; const rosettaUnsignedPayload = { - unsigned_transaction: rosettaUnsignedTxn, + unsigned_transaction: JSON.stringify(rosettaUnsignedTxn), payloads: [ { account_identifier: { From 5b6d1497cf8a8f8cb680f2773a92ef070db550ed Mon Sep 17 00:00:00 2001 From: i Date: Fri, 3 May 2024 15:00:58 +0200 Subject: [PATCH 5/5] fix test --- src/mina-signer/tests/rosetta.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mina-signer/tests/rosetta.test.ts b/src/mina-signer/tests/rosetta.test.ts index 2c298c7583..8b8d691822 100644 --- a/src/mina-signer/tests/rosetta.test.ts +++ b/src/mina-signer/tests/rosetta.test.ts @@ -104,7 +104,7 @@ describe('Rosetta', () => { const combinePayload = client.rosettaCombinePayload(rosettaUnsignedPayload, privateKey); const expectedCombinePayload = { network_identifier: { blockchain: 'mina', network: 'mainnet' }, - unsigned_transaction: rosettaUnsignedTxn, + unsigned_transaction: JSON.stringify(rosettaUnsignedTxn), signatures: [ { hex_bytes: mainnetSignatureHex, @@ -118,6 +118,6 @@ describe('Rosetta', () => { } ] }; - expect(combinePayload).toBe(expectedCombinePayload); + expect(JSON.stringify(combinePayload)).toBe(JSON.stringify(expectedCombinePayload)); }); });