Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
NorbertBodziony committed Sep 25, 2023
1 parent 1084fd5 commit 40fe021
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sdk/apps/sui/src/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 40fe021

Please sign in to comment.