Skip to content

Commit

Permalink
Update blindEscrow.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufidimaina9989 authored Jul 19, 2024
1 parent 7150977 commit 4b17145
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/blindEscrow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
pubKey2Addr,
} from 'scrypt-ts'
import { Signature } from 'scrypt-ts-lib'
import { BlindEscrow } from '../src/contracts/blindEscrow'
import { BlindEscrow, Actions } from '../src/contracts/blindEscrow'
import { getDefaultSigner } from './utils/helper'

use(chaiAsPromised)
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {

// Create "stamp", i.e. seller signature of the escrowNonce.
const oracleMsg: ByteString =
escrowNonce + int2ByteString(BlindEscrow.RELEASE_BY_SELLER)
escrowNonce + int2ByteString(BigInt(Actions.RELEASE_BY_SELLER))
const hashBuff = Buffer.from(hash256(oracleMsg), 'hex')
const oracleSigObj = bsv.crypto.ECDSA.sign(hashBuff, seller)
const oracleSig: Signature = {
Expand All @@ -89,7 +89,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
PubKey(buyerPubKey.toByteString()),
oracleSig,
PubKey(sellerPubKey.toByteString()),
BlindEscrow.RELEASE_BY_SELLER,
Actions.RELEASE_BY_SELLER,
{
pubKeyOrAddrToSign: buyer.publicKey,
} as MethodCallOptions<BlindEscrow>
Expand All @@ -102,7 +102,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
//// Sig by buyer, stamp by arbiter.

const oracleMsg: ByteString =
escrowNonce + int2ByteString(BlindEscrow.RELEASE_BY_ARBITER)
escrowNonce + int2ByteString(BigInt(Actions.RELEASE_BY_ARBITER))
const hashBuff = Buffer.from(hash256(oracleMsg), 'hex')
const oracleSigObj = bsv.crypto.ECDSA.sign(hashBuff, arbiter)
const oracleSig: Signature = {
Expand All @@ -120,7 +120,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
PubKey(buyerPubKey.toByteString()),
oracleSig,
PubKey(arbiterPubKey.toByteString()),
BlindEscrow.RELEASE_BY_ARBITER,
Actions.RELEASE_BY_ARBITER,
{
pubKeyOrAddrToSign: buyer.publicKey,
} as MethodCallOptions<BlindEscrow>
Expand All @@ -133,7 +133,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
//// Sig by seller, stamp by buyer.

const oracleMsg: ByteString =
escrowNonce + int2ByteString(BlindEscrow.RETURN_BY_BUYER)
escrowNonce + int2ByteString(BigInt(Actions.RETURN_BY_BUYER))
const hashBuff = Buffer.from(hash256(oracleMsg), 'hex')
const oracleSigObj = bsv.crypto.ECDSA.sign(hashBuff, buyer)
const oracleSig: Signature = {
Expand All @@ -149,7 +149,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
PubKey(sellerPubKey.toByteString()),
oracleSig,
PubKey(buyerPubKey.toByteString()),
BlindEscrow.RETURN_BY_BUYER,
Actions.RETURN_BY_BUYER,
{
pubKeyOrAddrToSign: seller.publicKey,
} as MethodCallOptions<BlindEscrow>
Expand All @@ -162,7 +162,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
//// Sig by seller, stamp by arbiter.

const oracleMsg: ByteString =
escrowNonce + int2ByteString(BlindEscrow.RETURN_BY_ARBITER)
escrowNonce + int2ByteString(BigInt(Actions.RETURN_BY_ARBITER))
const hashBuff = Buffer.from(hash256(oracleMsg), 'hex')
const oracleSigObj = bsv.crypto.ECDSA.sign(hashBuff, arbiter)
const oracleSig: Signature = {
Expand All @@ -179,7 +179,7 @@ describe('Heavy: Test SmartContract `BlindEscrow`', () => {
PubKey(sellerPubKey.toByteString()),
oracleSig,
PubKey(arbiterPubKey.toByteString()),
BlindEscrow.RETURN_BY_ARBITER,
Actions.RETURN_BY_ARBITER,
{
pubKeyOrAddrToSign: seller.publicKey,
} as MethodCallOptions<BlindEscrow>
Expand Down

0 comments on commit 4b17145

Please sign in to comment.