Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LukassF committed Sep 27, 2024
1 parent 39348ad commit c15b83a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 8 additions & 5 deletions sdk/packages/sui/src/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { parseSerializedSignature, toSerializedSignature } from '@mysten/sui/cryptography'
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
import { Transaction } from '@mysten/sui/transactions'
import { fromB64, toB64 } from '@mysten/sui/utils'
import { fromBase64, toBase64 } from '@mysten/sui/utils'
import { verifyPersonalMessageSignature, verifyTransactionSignature } from '@mysten/sui/verify'
import { WalletAccount } from '@mysten/wallet-standard'
import { Connect, ContentType } from '@nightlylabs/nightly-connect-base'
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('SUI client tests', () => {
responseId: e.requestId,
signedTransactions: [
{
transactionBlockBytes: toB64(transactionBlockBytes),
transactionBlockBytes: toBase64(transactionBlockBytes),
signature: signature
}
]
Expand All @@ -92,7 +92,10 @@ describe('SUI client tests', () => {

try {
// Will throw if invalid
await verifyTransactionSignature(fromB64(signedTx.transactionBlockBytes), signedTx.signature)
await verifyTransactionSignature(
fromBase64(signedTx.transactionBlockBytes),
signedTx.signature
)
} catch (error) {
assert(false, 'Transaction block is invalid')
}
Expand All @@ -107,7 +110,7 @@ describe('SUI client tests', () => {
const signedMessage = {
messageBytes: msg,
signature: toSerializedSignature({
signature: fromB64(signature),
signature: fromBase64(signature),
signatureScheme: 'ED25519',
publicKey: alice_keypair.getPublicKey()
})
Expand All @@ -129,7 +132,7 @@ describe('SUI client tests', () => {
// Will throw if invalid
await verifyPersonalMessageSignature(
new TextEncoder().encode(msgToSign),
toB64(parsedSignature.signature!)
toBase64(parsedSignature.signature!)
)
} catch (error) {
assert(false, 'Message is invalid')
Expand Down
9 changes: 6 additions & 3 deletions sdk/packages/sui/src/http-client.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'
import { Transaction } from '@mysten/sui/transactions'
import { fromB64, toB64 } from '@mysten/sui/utils'
import { fromBase64, toBase64 } from '@mysten/sui/utils'
import { verifyTransactionSignature } from '@mysten/sui/verify'
import { WalletAccount } from '@mysten/wallet-standard'
import { Connect, ContentType, getRandomId } from '@nightlylabs/nightly-connect-base'
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('SUI http-client tests', () => {
sessionId: app.sessionId,
signedTransactions: [
{
transactionBlockBytes: toB64(transactionBlockBytes),
transactionBlockBytes: toBase64(transactionBlockBytes),
signature: signature
}
]
Expand All @@ -93,7 +93,10 @@ describe('SUI http-client tests', () => {

try {
// Will throw if invalid
await verifyTransactionSignature(fromB64(signedTx.transactionBlockBytes), signedTx.signature)
await verifyTransactionSignature(
fromBase64(signedTx.transactionBlockBytes),
signedTx.signature
)
} catch (error) {
assert(false, 'Transaction block is invalid')
}
Expand Down

0 comments on commit c15b83a

Please sign in to comment.