From 40fe021db4c936d6218749f8c74ba0b90621d241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?NB=F0=9F=98=88?= Date: Mon, 25 Sep 2023 16:17:51 +0200 Subject: [PATCH] fix test --- sdk/apps/sui/src/e2e.test.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sdk/apps/sui/src/e2e.test.ts b/sdk/apps/sui/src/e2e.test.ts index 17c7eee2..6bbcc8eb 100644 --- a/sdk/apps/sui/src/e2e.test.ts +++ b/sdk/apps/sui/src/e2e.test.ts @@ -140,23 +140,31 @@ describe('SUI client tests', () => { } }) test('#on("signAndExecuteSignTransaction")', async () => { + client.removeListener('signTransactions') const tx = new TransactionBlock() const coin = tx.splitCoins(tx.gas, [tx.pure(100)]) tx.transferObjects([coin], tx.pure(RECEIVER_SUI_ADDRESS)) tx.setSenderIfNotSet(RECEIVER_SUI_ADDRESS) - + const exampleDigest = "I'm a digest" client.on('signTransactions', async (e) => { const metadata = e.transactions[0].metadata ? JSON.parse(e.transactions[0].metadata) : undefined - assert.ok(metadata?.execute) + assert.ok(metadata?.execute === true) + // Send TX and resolve with digest + await client.resolveSignTransaction({ + responseId: e.requestId, + signedTransactions: [{ digest: exampleDigest, confirmedLocalExecution: true }] + }) }) - await app.signAndExecuteTransactionBlock({ + await smartDelay() + const response = await app.signAndExecuteTransactionBlock({ transactionBlock: tx, account: aliceWalletAccount, chain: 'sui:testnet' }) + assert.equal(response.digest, exampleDigest) }) test('#getPendingRequests()', async () => { client.removeListener('signTransactions')