From 86fd21be6f55f5fe79c0f0e64fdb49d0b9dcc6cb Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Jul 2022 10:55:18 +0900 Subject: [PATCH 1/6] Format to hex string with filled gas price values --- packages/caver-core-method/src/index.js | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/caver-core-method/src/index.js b/packages/caver-core-method/src/index.js index c73fe299..52accafe 100644 --- a/packages/caver-core-method/src/index.js +++ b/packages/caver-core-method/src/index.js @@ -457,11 +457,17 @@ const buildSendFunc = (method, isSendTx) => async (...args) => { const sendSignedTx = buildSendSignedTxFunc(method, payload, sendTxCallback) const sendRequest = buildSendRequestFunc(defer, sendSignedTx, sendTxCallback) - const isGasPriceInputMissing = isSendTx && _.isObject(payload.params[0]) && payload.params[0].gasPrice === undefined + // isSendTx can determine only for "send"Transaction request. + // For sign transaction request, we also need to fill up the optional values. + const isSignTx = method.name.includes('signTransaction') + let isGasPriceInputMissing = false + if ((isSendTx || isSignTx) && _.isObject(payload.params[0]) && payload.params[0].gasPrice === undefined) { + isGasPriceInputMissing = true + } // The TxTypeEthereumDynamicFee transaction does not use the gasPrice field, // so we need to check `maxPriorityFeePerGas` and `maxFeePerGas` field instead of `gasPrice`. - const isDynamicFeeTx = isSendTx && payload.params[0].type === TX_TYPE_STRING.TxTypeEthereumDynamicFee + const isDynamicFeeTx = (isSendTx || isSignTx) && payload.params[0].type === TX_TYPE_STRING.TxTypeEthereumDynamicFee const filledDynamicGasFeeTx = isDynamicFeeTx && payload.params[0].maxPriorityFeePerGas !== undefined && payload.params[0].maxFeePerGas !== undefined @@ -519,6 +525,8 @@ const buildSendFunc = (method, isSendTx) => async (...args) => { } } + // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) + formatGasParametersToHex(payload.params[0]) sendRequest(payload, method) /** * attaching `.on('receipt')` is possible by returning defer.eventEmitter @@ -526,6 +534,20 @@ const buildSendFunc = (method, isSendTx) => async (...args) => { return defer.eventEmitter } +// A function to change the format to a hex string after randomly filling the default gasPrice value +// with the API (personal_sendValueTransfer, personal_sendAccountUpdate) that does not use a transaction object. +function formatGasParametersToHex(txObject) { + if (txObject.gasPrice !== undefined && !utils.isHexStrict(txObject.gasPrice)) { + txObject.gasPrice = utils.toHex(txObject.gasPrice) + } + if (txObject.maxPriorityFeePerGas !== undefined && !utils.isHexStrict(txObject.maxPriorityFeePerGas)) { + txObject.maxPriorityFeePerGas = utils.toHex(txObject.maxPriorityFeePerGas) + } + if (txObject.maxFeePerGas !== undefined && !utils.isHexStrict(txObject.maxFeePerGas)) { + txObject.maxFeePerGas = utils.toHex(txObject.maxFeePerGas) + } +} + function buildCall() { const method = this const isSendTx = From 793eaf03c7b213269cf1c126bf1737000b86d891 Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Jul 2022 09:29:42 +0900 Subject: [PATCH 2/6] Fixed testing errors with dynamic base fee --- package.json | 2 +- packages/caver-core-method/src/index.js | 2 +- test/dynamicBaseFee.js | 118 +- test/getTransactionReceipt.js | 8 +- .../caver.transaction/accountUpdate.js | 8 +- test/packages/caver.transaction/cancel.js | 8 +- .../caver.transaction/chainDataAnchoring.js | 8 +- .../caver.transaction/ethereumAccessList.js | 6 +- .../caver.transaction/ethereumDynamicFee.js | 10 +- .../feeDelegatedAccountUpdate.js | 8 +- .../feeDelegatedAccountUpdateWithRatio.js | 8 +- .../caver.transaction/feeDelegatedCancel.js | 8 +- .../feeDelegatedCancelWIthRatio.js | 8 +- .../feeDelegatedChainDataAnchoring.js | 8 +- ...feeDelegatedChainDataAnchoringWithRatio.js | 8 +- .../feeDelegatedSmartContractDeploy.js | 8 +- ...eeDelegatedSmartContractDeployWithRatio.js | 8 +- .../feeDelegatedSmartContractExecution.js | 8 +- ...elegatedSmartContractExecutionWithRatio.js | 8 +- .../feeDelegatedValueTransfer.js | 8 +- .../feeDelegatedValueTransferMemo.js | 8 +- .../feeDelegatedValueTransferMemoWithRatio.js | 8 +- .../feeDelegatedValueTransferWithRatio.js | 8 +- .../caver.transaction/legacyTransaction.js | 8 +- .../caver.transaction/smartContractDeploy.js | 8 +- .../smartContractExecution.js | 8 +- .../caver.transaction/valueTransfer.js | 8 +- .../caver.transaction/valueTransferMemo.js | 8 +- test/sendSignedTransaction.js | 217 +- test/transactionType/accountCreation.js | 2004 ----------------- test/transactionType/accountUpdate.js | 248 +- test/transactionType/cancelTransaction.js | 70 +- test/transactionType/contractDeploy.js | 74 +- test/transactionType/contractExecution.js | 86 +- .../feeDelegatedAccountUpdate.js | 272 +-- .../feeDelegatedAccountUpdateWithRatio.js | 262 +-- .../feeDelegatedCancelTransaction.js | 70 +- .../feeDelegatedCancelTransactionWithRatio.js | 76 +- .../feeDelegatedContractDeploy.js | 68 +- .../feeDelegatedContractDeployWithRatio.js | 66 +- .../feeDelegatedContractExecution.js | 66 +- .../feeDelegatedContractExecutionWithRatio.js | 66 +- .../feeDelegatedValueTransfer.js | 76 +- .../feeDelegatedValueTransferMemo.js | 74 +- .../feeDelegatedValueTransferMemoWithRatio.js | 74 +- .../feeDelegatedValueTransferWithRatio.js | 74 +- test/transactionType/legacyTransaction.js | 66 +- test/transactionType/valueTransfer.js | 74 +- test/transactionType/valueTransferWithMemo.js | 74 +- 49 files changed, 1283 insertions(+), 3196 deletions(-) delete mode 100644 test/transactionType/accountCreation.js diff --git a/package.json b/package.json index 74292be4..74f1744c 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "txUnitTest": "./node_modules/mocha/bin/mocha test/packages/caver.transaction/*.js && ./node_modules/mocha/bin/mocha test/createTest.js", "etcUnitTest": "./node_modules/mocha/bin/mocha test/decodeFunctionCall.js && ./node_modules/mocha/bin/mocha test/contractError.js && ./node_modules/mocha/bin/mocha test/contractOverloading.js && ./node_modules/mocha/bin/mocha ./test/contract.setWallet.js && ./node_modules/mocha/bin/mocha ./test/setRequestManager.js && ./node_modules/mocha/bin/mocha test/reconnectTest.js && ./node_modules/mocha/bin/mocha test/hashMessage.js && ./node_modules/mocha/bin/mocha test/iban.* && ./node_modules/mocha/bin/mocha test/randomHex.js && ./node_modules/mocha/bin/mocha test/sha3.js && ./node_modules/mocha/bin/mocha test/toChecksumAddress.js && ./node_modules/mocha/bin/mocha test/default*&& ./node_modules/mocha/bin/mocha test/getNodeInfo.js && ./node_modules/mocha/bin/mocha test/getNetworkType.js && ./node_modules/mocha/bin/mocha test/isContractDeployment.js && ./node_modules/mocha/bin/mocha test/multiProviderTest.js && ./node_modules/mocha/bin/mocha test/unitMap.js && ./node_modules/mocha/bin/mocha test/invalidResponse.js && ./node_modules/mocha/bin/mocha test/createTest.js && ./node_modules/mocha/bin/mocha test/setProvider.js && ./node_modules/mocha/bin/mocha test/contractOverloading.js && ./node_modules/mocha/bin/mocha test/supportsSubscriptions.js && ./node_modules/mocha/bin/mocha test/packages/caver.abi.js", "rpcTest": "./node_modules/mocha/bin/mocha test/packages/caver.rpc.js", - "txTest": "./node_modules/mocha/bin/mocha test/methodErrorHandling.js && ./node_modules/mocha/bin/mocha test/sendSignedTransaction.js && ./node_modules/mocha/bin/mocha test/estimateComputationCost.js && ./node_modules/mocha/bin/mocha test/getTransactionReceipt.js && ./node_modules/mocha/bin/mocha test/setNonceWithPendingTag.js && ./node_modules/mocha/bin/mocha test/getTransaction.js && ./node_modules/mocha/bin/mocha test/setContractOptions.js && ./node_modules/mocha/bin/mocha test/encodeContractDeploy.js && ./node_modules/mocha/bin/mocha test/accounts.signTransaction.js && ./node_modules/mocha/bin/mocha test/sendTransactionCallback.js && ./node_modules/mocha/bin/mocha test/signWithMultiSig.js && ./node_modules/mocha/bin/mocha test/transactionType/legacyTransaction.js && ./node_modules/mocha/bin/mocha test/transactionType/valueTransfer* && ./node_modules/mocha/bin/mocha test/transactionType/accountUpdate.js && ./node_modules/mocha/bin/mocha test/transactionType/contract* && ./node_modules/mocha/bin/mocha test/transactionType/cancelTransaction.js && ./node_modules/mocha/bin/mocha test/transactionType/feeDelegated*", + "txTest": "./node_modules/mocha/bin/mocha test/dynamicBaseFee.js && ./node_modules/mocha/bin/mocha test/methodErrorHandling.js && ./node_modules/mocha/bin/mocha test/sendSignedTransaction.js && ./node_modules/mocha/bin/mocha test/estimateComputationCost.js && ./node_modules/mocha/bin/mocha test/getTransactionReceipt.js && ./node_modules/mocha/bin/mocha test/setNonceWithPendingTag.js && ./node_modules/mocha/bin/mocha test/getTransaction.js && ./node_modules/mocha/bin/mocha test/setContractOptions.js && ./node_modules/mocha/bin/mocha test/encodeContractDeploy.js && ./node_modules/mocha/bin/mocha test/accounts.signTransaction.js && ./node_modules/mocha/bin/mocha test/sendTransactionCallback.js && ./node_modules/mocha/bin/mocha test/signWithMultiSig.js && ./node_modules/mocha/bin/mocha test/transactionType/*", "etcTest": "./node_modules/mocha/bin/mocha ./test/packages/caver.contract.js && ./node_modules/mocha/bin/mocha ./test/tupleTest.js && ./node_modules/mocha/bin/mocha test/confirmationListener.js && ./node_modules/mocha/bin/mocha test/eventEmitter.js && ./node_modules/mocha/bin/mocha test/personal.js && ./node_modules/mocha/bin/mocha test/subscription.js && ./node_modules/mocha/bin/mocha test/contract.once.js && ./node_modules/mocha/bin/mocha test/ipfsTest.js", "accountKeyTest": "./node_modules/mocha/bin/mocha test/scenarioTest/accountKeyPublic.js && ./node_modules/mocha/bin/mocha test/scenarioTest/accountKeyMultiSig.js && ./node_modules/mocha/bin/mocha test/scenarioTest/accountKeyRoleBased.js", "kctTest": "./node_modules/mocha/bin/mocha test/packages/caver.klay.KIP7.js && ./node_modules/mocha/bin/mocha test/packages/caver.klay.KIP17.js && ./node_modules/mocha/bin/mocha test/packages/caver.kct.kip37.js && ./node_modules/mocha/bin/mocha test/createTest.js", diff --git a/packages/caver-core-method/src/index.js b/packages/caver-core-method/src/index.js index 52accafe..fb631c98 100644 --- a/packages/caver-core-method/src/index.js +++ b/packages/caver-core-method/src/index.js @@ -534,7 +534,7 @@ const buildSendFunc = (method, isSendTx) => async (...args) => { return defer.eventEmitter } -// A function to change the format to a hex string after randomly filling the default gasPrice value +// A function to change the format to a hex string after randomly filling the default gasPrice value // with the API (personal_sendValueTransfer, personal_sendAccountUpdate) that does not use a transaction object. function formatGasParametersToHex(txObject) { if (txObject.gasPrice !== undefined && !utils.isHexStrict(txObject.gasPrice)) { diff --git a/test/dynamicBaseFee.js b/test/dynamicBaseFee.js index bc55e30a..cc53818d 100644 --- a/test/dynamicBaseFee.js +++ b/test/dynamicBaseFee.js @@ -50,56 +50,76 @@ before(() => { password = process.env.password ? process.env.password : 'password' }) -async function generateTxsBomb(num = 100) { - const txs = [] +async function fillKlay(amount) { + const filled = caver.wallet.keyring.generate() + + const tx = caver.transaction.valueTransfer.create({ + from: sender.address, + to: filled.address, + gas: 10000000, + value: caver.utils.convertToPeb(amount, 'KLAY'), + }) + await caver.wallet.sign(sender.address, tx) + await caver.rpc.klay.sendRawTransaction(tx) + + return filled +} + +async function generateTxsBomb(generator, num = 2000) { const input = '0x608060405234801561001057600080fd5b506101de806100206000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a72305820627ca46bb09478a015762806cc00c431230501118c7c26c30ac58c4e09e51c4f0029' - let senderNonce = caver.utils.hexToNumber(await caver.rpc.klay.getTransactionCount(sender.address)) + caver.wallet.add(generator) + + let senderNonce = caver.utils.hexToNumber(await caver.rpc.klay.getTransactionCount(generator.address, 'pending')) for (let i = 0; i < num; i++) { const tx = caver.transaction.smartContractDeploy.create({ - from: sender.address, + from: generator.address, input, gas: 10000000, nonce: senderNonce, }) - await caver.wallet.sign(sender.address, tx) - txs.push(tx.getRLPEncoding()) + await caver.wallet.sign(generator.address, tx) + caver.rpc.klay.sendRawTransaction(tx) senderNonce++ } - - await Promise.all( - Object.keys(txs).map(async signedTx => { - caver.rpc.klay.sendRawTransaction(signedTx) - }) - ) } async function validateGasFeeWithReceipt(receipt) { const gasPriceInReceipt = caver.utils.hexToNumber(receipt.gasPrice) - const gasPriceAtParentBlock = await caver.rpc.klay.getGasPriceAt(caver.utils.hexToNumber(receipt.blockNumber) - 1) // Klaytn will return baseFee const gasPriceAtReceiptBlock = await caver.rpc.klay.getGasPriceAt(receipt.blockNumber) // Klaytn will return baseFee + // console.log(`gasPriceInReceipt: ${gasPriceInReceipt} / gasPriceAtReceiptBlock: ${caver.utils.hexToNumber(gasPriceAtReceiptBlock)}`) // To process a transaction, the gasPrice of the tx should be equal or bigger than baseFee(effectiveGasPrice) - if (caver.utils.hexToNumber(receipt.effectiveGasPrice) > gasPriceInReceipt) return false + if (caver.utils.hexToNumber(receipt.effectiveGasPrice) > gasPriceInReceipt) { + // console.log(`caver.utils.hexToNumber(receipt.effectiveGasPrice)(${caver.utils.hexToNumber(receipt.effectiveGasPrice)}) > gasPriceInReceipt(${gasPriceInReceipt})`) + return false + } // effectiveGasPrice should be defined by baseFee used gas price when tx is processed - if (receipt.effectiveGasPrice !== gasPriceAtReceiptBlock) return false + if (receipt.effectiveGasPrice !== gasPriceAtReceiptBlock) { + // console.log(`receipt.effectiveGasPrice(${receipt.effectiveGasPrice}) !== gasPriceAtReceiptBlock(${gasPriceAtReceiptBlock})`) + return false + } - // Set gasPrice with `baseFee * 2` - if (caver.utils.hexToNumber(gasPriceAtParentBlock) * 2 !== gasPriceInReceipt) return false + // Set gasPrice with `baseFee * 2`, so should be bigger than gas price of the block + if (caver.utils.hexToNumber(gasPriceAtReceiptBlock) > gasPriceInReceipt) { + // console.log(`gasPriceAtReceiptBlock(${caver.utils.hexToNumber(gasPriceAtReceiptBlock)}) < gasPriceInReceipt(${gasPriceInReceipt})`) + return false + } return true } -async function validateDynamicFeeTxWithReceipt(tx, receipt) { +async function validateDynamicFeeTxWithReceipt(receipt) { const maxFeePerGas = caver.utils.hexToNumber(receipt.maxFeePerGas) - const gasPriceAtParentBlock = await caver.rpc.klay.getGasPriceAt(caver.utils.hexToNumber(receipt.blockNumber) - 1) // Klaytn will return baseFee + const gasPriceAtReceiptBlock = await caver.rpc.klay.getGasPriceAt(receipt.blockNumber) // Klaytn will return baseFee + // console.log(`maxFeePerGas: ${maxFeePerGas} / gasPriceAtReceiptBlock: ${caver.utils.hexToNumber(gasPriceAtReceiptBlock)}`) // To process a transaction, the maxFeePerGas of the tx should be equal or bigger than baseFee(effectiveGasPrice) if (caver.utils.hexToNumber(receipt.effectiveGasPrice) > maxFeePerGas) return false // Set gasPrice with `baseFee * 2` - if (caver.utils.hexToNumber(gasPriceAtParentBlock) * 2 !== maxFeePerGas) return false + if (caver.utils.hexToNumber(gasPriceAtReceiptBlock) > maxFeePerGas) return false return true } @@ -109,7 +129,7 @@ async function validateGasPrice(tx) { // If transaction type is TxTypeEthereumDynamicFee, // validate `maxPriorityFeePerGas` and `maxFeePerGas`. - if (tx.type.incldues('DynamicFee')) { + if (tx.type.includes('DynamicFee')) { const maxPriorityFeePerGas = await caver.rpc.klay.getMaxPriorityFeePerGas() if (tx.maxPriorityFeePerGas !== maxPriorityFeePerGas) return false // maxFeePerGas will be set with `baseFee * 2`, so maxFeePerGas cannnot be smaller than current base fee @@ -125,7 +145,7 @@ async function validateGasPrice(tx) { describe('Have to set correct value optional fields named gasPrice, maxFeePerGas or maxPriorityFeePerGas', () => { it('CAVERJS-UNIT-ETC-405: caver.contract operates with optional gasPrice value', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) // Deploy a contract without optional gasPrice field const contract = caver.contract.create(kip7JsonInterface) @@ -150,7 +170,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas expect(isValid).to.be.true // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) // Execute a contract without optional gasPrice field contract.options.address = receipt.contractAddress @@ -161,7 +181,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas ) expect(minterAddedReceipt).not.to.be.undefined expect(minterAddedReceipt.status).to.equal(true) - expect(minterAddedReceipt.to).to.equal(receipt.contractAddress) + expect(minterAddedReceipt.to.toLowerCase()).to.equal(receipt.contractAddress.toLowerCase()) isValid = await validateGasFeeWithReceipt(minterAddedReceipt) expect(isValid).to.be.true @@ -219,7 +239,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas it('CAVERJS-UNIT-ETC-406: caver.klay.Contract operates with optional gasPrice value', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) // Deploy a contract without optional gasPrice field const contract = new caver.klay.Contract(kip7JsonInterface) @@ -231,6 +251,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas .send({ from: sender.address, gas: 50000000, + value: 0, contractDeployFormatter: r => { return r }, @@ -242,7 +263,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas expect(isValid).to.be.true // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) // Execute a contract without optional gasPrice field contract.options.address = receipt.contractAddress @@ -251,14 +272,14 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas .send({ from: sender.address, gas: 50000000 }) expect(minterAddedReceipt).not.to.be.undefined expect(minterAddedReceipt.status).to.equal(true) - expect(minterAddedReceipt.to).to.equal(receipt.contractAddress) + expect(minterAddedReceipt.to.toLowerCase()).to.equal(receipt.contractAddress.toLowerCase()) isValid = await validateGasFeeWithReceipt(minterAddedReceipt) expect(isValid).to.be.true }).timeout(100000) it('CAVERJS-UNIT-TRANSACTION-556: caver.transaction sign and signAsFeePayer signs with optional gasPrice value', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) // Test transaction.sign with basic tx let tx = caver.transaction.valueTransfer.create({ @@ -308,7 +329,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas it('CAVERJS-UNIT-WALLET-431: caver.wallet sign and signAsFeePayer signs with optional gasPrice value', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) // Test caver.wallet.sign with basic tx let tx = caver.transaction.valueTransfer.create({ @@ -358,7 +379,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas it('CAVERJS-UNIT-RPC-030: caver.rpc.klay.sendTransaction sends a tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) const isUnlock = await caver.klay.personal.unlockAccount(sender.address, password) expect(isUnlock).to.be.true @@ -387,7 +408,7 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas it('CAVERJS-UNIT-RPC-031: caver.rpc.klay.sendTransactionAsFeepayer sends a fee delegation tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) const isUnlock = await caver.klay.personal.unlockAccount(feePayer.address, password) expect(isUnlock).to.be.true @@ -399,13 +420,16 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas gas: 2500000, feePayer: feePayer.address, }) - await caver.wallet.sign(sender, tx) + await caver.wallet.sign(sender.address, tx) const receipt = await caver.rpc.klay.sendTransactionAsFeePayer(tx) const isValid = await validateGasFeeWithReceipt(receipt) expect(isValid).to.be.true }).timeout(100000) it('CAVERJS-UNIT-RPC-032: caver.rpc.klay.signTransaction signs a tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { + // Generate many txs to increase baseFee + generateTxsBomb(await fillKlay(100)) + const isUnlock = await caver.klay.personal.unlockAccount(sender.address, password) expect(isUnlock).to.be.true @@ -434,6 +458,9 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas }).timeout(100000) it('CAVERJS-UNIT-RPC-033: caver.rpc.klay.signTransactionAsFeepayer signs a fee delegation tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { + // Generate many txs to increase baseFee + generateTxsBomb(await fillKlay(100)) + const isUnlock = await caver.klay.personal.unlockAccount(feePayer.address, password) expect(isUnlock).to.be.true @@ -444,13 +471,16 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas gas: 2500000, feePayer: feePayer.address, }) - const signed = await caver.rpc.klay.sendTransactionAsFeepayer(tx) + const signed = await caver.rpc.klay.signTransactionAsFeePayer(tx) const decodedTx = caver.transaction.decode(signed.raw) const isValid = await validateGasPrice(decodedTx) expect(isValid).to.be.true }).timeout(100000) it('CAVERJS-UNIT-WALLET-432: caver.klay.accounts.signTransaction signs with optional gasPrice value', async () => { + // Generate many txs to increase baseFee + generateTxsBomb(await fillKlay(100)) + const tx = { from: sender.address, to: caver.wallet.keyring.generate().address, @@ -468,6 +498,9 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas }).timeout(100000) it('CAVERJS-UNIT-WALLET-433: caver.klay.accounts.feePayerSignTransaction signs as fee payer with optional gasPrice value', async () => { + // Generate many txs to increase baseFee + generateTxsBomb(await fillKlay(100)) + const tx = { type: 'FEE_DELEGATED_VALUE_TRANSFER', from: sender.address, @@ -477,15 +510,15 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas gas: 2500000, } const feePayerAccount = caver.klay.accounts.wallet[feePayer.address] - const signed = await caver.klay.accounts.feePayerSignTransaction(tx, feePayerAccount.privateKey) + const signed = await caver.klay.accounts.feePayerSignTransaction(tx, feePayer.address, feePayerAccount.privateKey) const decodedTx = caver.transaction.decode(signed.rawTransaction) const isValid = await validateGasPrice(decodedTx) expect(isValid).to.be.true }).timeout(100000) - it('CAVERJS-UNIT-ETC-407: caver.klay.personal.sendTransaction sends a tx with optional gasPrice value', async () => { + it('CAVERJS-UNIT-ETC-407: caver.klay.personal.sendTransaction sends a tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) let tx = caver.transaction.valueTransfer.create({ from: sender.address, @@ -509,9 +542,9 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas expect(isValid).to.be.true }).timeout(100000) - it('CAVERJS-UNIT-ETC-408: caver.klay.personal.sendValueTransfer sends a value transfer tx with optional gasPrice value', async () => { + it('CAVERJS-UNIT-ETC-408: caver.klay.personal.sendValueTransfer sends a value transfer tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) const receipt = await caver.klay.personal.sendValueTransfer( { @@ -526,9 +559,9 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas expect(isValid).to.be.true }).timeout(100000) - it('CAVERJS-UNIT-ETC-409: caver.klay.personal.sendAccountUpdate sends a value transfer tx with optional gasPrice value', async () => { + it('CAVERJS-UNIT-ETC-409: caver.klay.personal.sendAccountUpdate sends a value transfer tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { // Generate many txs to increase baseFee - await generateTxsBomb() + generateTxsBomb(await fillKlay(100)) const receipt = await caver.klay.personal.sendAccountUpdate( { @@ -542,7 +575,10 @@ describe('Have to set correct value optional fields named gasPrice, maxFeePerGas expect(isValid).to.be.true }).timeout(100000) - it('CAVERJS-UNIT-RPC-034: caver.klay.sendTransaction sends a tx with optional gasPrice value', async () => { + it('CAVERJS-UNIT-RPC-034: caver.klay.sendTransaction sends a tx with optional gasPrice value (use keystore in Klaytn Node)', async () => { + // Generate many txs to increase baseFee + generateTxsBomb(await fillKlay(100)) + // Sign a tx with an account in the in-memory wallet and send to network. let tx = { from: sender.address, diff --git a/test/getTransactionReceipt.js b/test/getTransactionReceipt.js index d557e038..7813366a 100644 --- a/test/getTransactionReceipt.js +++ b/test/getTransactionReceipt.js @@ -16,6 +16,10 @@ along with the caver-js. If not, see . */ +const chai = require('chai') +const chaiAsPromised = require('chai-as-promised') + +chai.use(chaiAsPromised) const { expect } = require('chai') const Caver = require('../index') @@ -59,8 +63,8 @@ describe('get transaction receipt', () => { .catch(() => done()) }).timeout(100000) - it('should throw an error without parameter', () => { - expect(() => caver.klay.getTransactionReceipt()).to.throw() + it('should throw an error without parameter', async () => { + await expect(caver.klay.getTransactionReceipt()).to.be.rejected }).timeout(100000) it('CAVERJS-UNIT-TX-567 : After sending transction, getTransactionReceipt should return transaction infromation', async () => { diff --git a/test/packages/caver.transaction/accountUpdate.js b/test/packages/caver.transaction/accountUpdate.js index 72e980ed..53835ab7 100644 --- a/test/packages/caver.transaction/accountUpdate.js +++ b/test/packages/caver.transaction/accountUpdate.js @@ -265,6 +265,7 @@ before(() => { describe('TxTypeAccountUpdate', () => { let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy @@ -278,6 +279,8 @@ describe('TxTypeAccountUpdate', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1005,8 +1008,9 @@ describe('TxTypeAccountUpdate', () => { await tx.fillTransaction() expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce } - expect(getGasPriceSpy).to.have.been.callCount(Object.values(expectedValues).length) + expect(getHeaderSpy).to.have.been.callCount(Object.values(expectedValues).length) }).timeout(200000) it('CAVERJS-UNIT-TRANSACTION-196: fillTransaction should call klay_getTransactionCount to fill nonce when nonce is undefined', async () => { @@ -1016,6 +1020,7 @@ describe('TxTypeAccountUpdate', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce } expect(getNonceSpy).to.have.been.callCount(Object.values(expectedValues).length) @@ -1028,6 +1033,7 @@ describe('TxTypeAccountUpdate', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce } expect(getChainIdSpy).to.have.been.callCount(Object.values(expectedValues).length) diff --git a/test/packages/caver.transaction/cancel.js b/test/packages/caver.transaction/cancel.js index 60400fe0..ce868229 100644 --- a/test/packages/caver.transaction/cancel.js +++ b/test/packages/caver.transaction/cancel.js @@ -76,6 +76,7 @@ before(() => { describe('TxTypeCancel', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -87,6 +88,8 @@ describe('TxTypeCancel', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -699,7 +702,8 @@ describe('TxTypeCancel', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -710,6 +714,7 @@ describe('TxTypeCancel', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -720,6 +725,7 @@ describe('TxTypeCancel', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/chainDataAnchoring.js b/test/packages/caver.transaction/chainDataAnchoring.js index b9320651..90ec1d6b 100644 --- a/test/packages/caver.transaction/chainDataAnchoring.js +++ b/test/packages/caver.transaction/chainDataAnchoring.js @@ -81,6 +81,7 @@ before(() => { describe('TxTypeChainDataAnchoring', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -92,6 +93,8 @@ describe('TxTypeChainDataAnchoring', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -721,7 +724,8 @@ describe('TxTypeChainDataAnchoring', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -732,6 +736,7 @@ describe('TxTypeChainDataAnchoring', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -742,6 +747,7 @@ describe('TxTypeChainDataAnchoring', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/ethereumAccessList.js b/test/packages/caver.transaction/ethereumAccessList.js index 7e9007d7..a158b230 100644 --- a/test/packages/caver.transaction/ethereumAccessList.js +++ b/test/packages/caver.transaction/ethereumAccessList.js @@ -75,6 +75,7 @@ describe('TxTypeEthereumAccessList', () => { '0x7801f90109822710238505d21dba00829c4094c5fb1386b60160614a8151dcd4b0ae41325d1cb801b844a9059cbb0000000000000000000000008a4c9c443bb0645df646a2d5bb55def0ed1e885a0000000000000000000000000000000000000000000000000000000000003039f85bf859945430192ae264b3feff967fc08982b9c6f5694023f842a00000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000000701a05ac25e47591243af2d6b8e7f54d608e9e0e0aeb5194d34c17852bd7e376f4857a0095a40394f33e95cce9695d5badf4270f4cc8aff0b5395cefc3a0fe213be1f30' let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy @@ -119,6 +120,8 @@ describe('TxTypeEthereumAccessList', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -867,7 +870,8 @@ describe('TxTypeEthereumAccessList', () => { const tx = caver.transaction.ethereumAccessList.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/ethereumDynamicFee.js b/test/packages/caver.transaction/ethereumDynamicFee.js index cbdbff75..cdc6e5fe 100644 --- a/test/packages/caver.transaction/ethereumDynamicFee.js +++ b/test/packages/caver.transaction/ethereumDynamicFee.js @@ -127,7 +127,7 @@ describe('TxTypeEthereumDynamicFee', () => { getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') getChainIdSpy.returns('0x7e3') - baseFee = '0x0' + baseFee = '0x5d21dba00' getHeaderByNumberSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') getHeaderByNumberSpy.returns({ baseFeePerGas: baseFee }) maxPriorityFeePerGas = '0x5d21dba00' @@ -916,13 +916,7 @@ describe('TxTypeEthereumDynamicFee', () => { delete transactionObj.maxFeePerGas const tx = caver.transaction.ethereumDynamicFee.create(transactionObj) - let expectedMaxFeePerGas - const latestHeader = await caver.rpc.klay.getHeaderByNumber('latest') - if (latestHeader.baseFeePerGas && caver.utils.hexToNumber(latestHeader.baseFeePerGas) > 0) { - expectedMaxFeePerGas = caver.utils.toHex(caver.utils.hexToNumber(latestHeader.baseFeePerGas) * 2) - } else { - expectedMaxFeePerGas = await caver.rpc.klay.getGasPrice() - } + const expectedMaxFeePerGas = caver.utils.toHex(caver.utils.hexToNumber(baseFee) * 2) await tx.fillTransaction() diff --git a/test/packages/caver.transaction/feeDelegatedAccountUpdate.js b/test/packages/caver.transaction/feeDelegatedAccountUpdate.js index e26e835e..5a61f27b 100644 --- a/test/packages/caver.transaction/feeDelegatedAccountUpdate.js +++ b/test/packages/caver.transaction/feeDelegatedAccountUpdate.js @@ -330,6 +330,7 @@ before(() => { describe('TxTypeFeeDelegatedAccountUpdate', () => { let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy @@ -343,6 +344,8 @@ describe('TxTypeFeeDelegatedAccountUpdate', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1602,8 +1605,9 @@ describe('TxTypeFeeDelegatedAccountUpdate', () => { await tx.fillTransaction() expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce } - expect(getGasPriceSpy).to.have.been.callCount(Object.values(expectedValues).length) + expect(getHeaderSpy).to.have.been.callCount(Object.values(expectedValues).length) }).timeout(200000) it('CAVERJS-UNIT-TRANSACTIONFD-220: fillTransaction should call klay_getTransactionCount to fill nonce when nonce is undefined', async () => { @@ -1613,6 +1617,7 @@ describe('TxTypeFeeDelegatedAccountUpdate', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce } expect(getNonceSpy).to.have.been.callCount(Object.values(expectedValues).length) @@ -1625,6 +1630,7 @@ describe('TxTypeFeeDelegatedAccountUpdate', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce } expect(getChainIdSpy).to.have.been.callCount(Object.values(expectedValues).length) diff --git a/test/packages/caver.transaction/feeDelegatedAccountUpdateWithRatio.js b/test/packages/caver.transaction/feeDelegatedAccountUpdateWithRatio.js index d62c4195..df72e912 100644 --- a/test/packages/caver.transaction/feeDelegatedAccountUpdateWithRatio.js +++ b/test/packages/caver.transaction/feeDelegatedAccountUpdateWithRatio.js @@ -336,6 +336,7 @@ before(() => { describe('TxTypeFeeDelegatedAccountUpdateWithRatio', () => { let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy @@ -349,6 +350,8 @@ describe('TxTypeFeeDelegatedAccountUpdateWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1640,8 +1643,9 @@ describe('TxTypeFeeDelegatedAccountUpdateWithRatio', () => { await tx.fillTransaction() expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce } - expect(getGasPriceSpy).to.have.been.callCount(Object.values(expectedValues).length) + expect(getHeaderSpy).to.have.been.callCount(Object.values(expectedValues).length) }).timeout(200000) it('CAVERJS-UNIT-TRANSACTIONFDR-223: fillTransaction should call klay_getTransactionCount to fill nonce when nonce is undefined', async () => { @@ -1651,6 +1655,7 @@ describe('TxTypeFeeDelegatedAccountUpdateWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce } expect(getNonceSpy).to.have.been.callCount(Object.values(expectedValues).length) @@ -1663,6 +1668,7 @@ describe('TxTypeFeeDelegatedAccountUpdateWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce } expect(getChainIdSpy).to.have.been.callCount(Object.values(expectedValues).length) diff --git a/test/packages/caver.transaction/feeDelegatedCancel.js b/test/packages/caver.transaction/feeDelegatedCancel.js index d6f4e5f7..f6800681 100644 --- a/test/packages/caver.transaction/feeDelegatedCancel.js +++ b/test/packages/caver.transaction/feeDelegatedCancel.js @@ -86,6 +86,7 @@ before(() => { describe('TxTypeFeeDelegatedCancel', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -97,6 +98,8 @@ describe('TxTypeFeeDelegatedCancel', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1175,7 +1178,8 @@ describe('TxTypeFeeDelegatedCancel', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1186,6 +1190,7 @@ describe('TxTypeFeeDelegatedCancel', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1196,6 +1201,7 @@ describe('TxTypeFeeDelegatedCancel', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedCancelWIthRatio.js b/test/packages/caver.transaction/feeDelegatedCancelWIthRatio.js index bd58113d..e3ce7ce8 100644 --- a/test/packages/caver.transaction/feeDelegatedCancelWIthRatio.js +++ b/test/packages/caver.transaction/feeDelegatedCancelWIthRatio.js @@ -86,6 +86,7 @@ before(() => { describe('TxTypeFeeDelegatedCancelWithRatio', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -98,6 +99,8 @@ describe('TxTypeFeeDelegatedCancelWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1208,7 +1211,8 @@ describe('TxTypeFeeDelegatedCancelWithRatio', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1219,6 +1223,7 @@ describe('TxTypeFeeDelegatedCancelWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1229,6 +1234,7 @@ describe('TxTypeFeeDelegatedCancelWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedChainDataAnchoring.js b/test/packages/caver.transaction/feeDelegatedChainDataAnchoring.js index 37476c97..aea5c351 100644 --- a/test/packages/caver.transaction/feeDelegatedChainDataAnchoring.js +++ b/test/packages/caver.transaction/feeDelegatedChainDataAnchoring.js @@ -91,6 +91,7 @@ before(() => { describe('TxTypeFeeDelegatedChainDataAnchoring', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -102,6 +103,8 @@ describe('TxTypeFeeDelegatedChainDataAnchoring', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1187,7 +1190,8 @@ describe('TxTypeFeeDelegatedChainDataAnchoring', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1198,6 +1202,7 @@ describe('TxTypeFeeDelegatedChainDataAnchoring', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1208,6 +1213,7 @@ describe('TxTypeFeeDelegatedChainDataAnchoring', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedChainDataAnchoringWithRatio.js b/test/packages/caver.transaction/feeDelegatedChainDataAnchoringWithRatio.js index 162558b8..4945306d 100644 --- a/test/packages/caver.transaction/feeDelegatedChainDataAnchoringWithRatio.js +++ b/test/packages/caver.transaction/feeDelegatedChainDataAnchoringWithRatio.js @@ -92,6 +92,7 @@ before(() => { describe('TxTypeFeeDelegatedChainDataAnchoringWithRatio', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -104,6 +105,8 @@ describe('TxTypeFeeDelegatedChainDataAnchoringWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1221,7 +1224,8 @@ describe('TxTypeFeeDelegatedChainDataAnchoringWithRatio', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1232,6 +1236,7 @@ describe('TxTypeFeeDelegatedChainDataAnchoringWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1242,6 +1247,7 @@ describe('TxTypeFeeDelegatedChainDataAnchoringWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedSmartContractDeploy.js b/test/packages/caver.transaction/feeDelegatedSmartContractDeploy.js index 8ccdab7e..6ad04563 100644 --- a/test/packages/caver.transaction/feeDelegatedSmartContractDeploy.js +++ b/test/packages/caver.transaction/feeDelegatedSmartContractDeploy.js @@ -94,6 +94,7 @@ before(() => { describe('TxTypeFeeDelegatedSmartContractDeploy', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -105,6 +106,8 @@ describe('TxTypeFeeDelegatedSmartContractDeploy', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1215,7 +1218,8 @@ describe('TxTypeFeeDelegatedSmartContractDeploy', () => { const tx = caver.transaction.feeDelegatedSmartContractDeploy.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1227,6 +1231,7 @@ describe('TxTypeFeeDelegatedSmartContractDeploy', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1238,6 +1243,7 @@ describe('TxTypeFeeDelegatedSmartContractDeploy', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedSmartContractDeployWithRatio.js b/test/packages/caver.transaction/feeDelegatedSmartContractDeployWithRatio.js index 6112f4fd..5351cfb8 100644 --- a/test/packages/caver.transaction/feeDelegatedSmartContractDeployWithRatio.js +++ b/test/packages/caver.transaction/feeDelegatedSmartContractDeployWithRatio.js @@ -95,6 +95,7 @@ before(() => { describe('TxTypeFeeDelegatedSmartContractDeployWithRatio', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -107,6 +108,8 @@ describe('TxTypeFeeDelegatedSmartContractDeployWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1249,7 +1252,8 @@ describe('TxTypeFeeDelegatedSmartContractDeployWithRatio', () => { const tx = caver.transaction.feeDelegatedSmartContractDeployWithRatio.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1261,6 +1265,7 @@ describe('TxTypeFeeDelegatedSmartContractDeployWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1272,6 +1277,7 @@ describe('TxTypeFeeDelegatedSmartContractDeployWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedSmartContractExecution.js b/test/packages/caver.transaction/feeDelegatedSmartContractExecution.js index c3c73e56..15c2297b 100644 --- a/test/packages/caver.transaction/feeDelegatedSmartContractExecution.js +++ b/test/packages/caver.transaction/feeDelegatedSmartContractExecution.js @@ -91,6 +91,7 @@ before(() => { describe('TxTypeFeeDelegatedSmartContractExecution', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -103,6 +104,8 @@ describe('TxTypeFeeDelegatedSmartContractExecution', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1213,7 +1216,8 @@ describe('TxTypeFeeDelegatedSmartContractExecution', () => { const tx = caver.transaction.feeDelegatedSmartContractExecution.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1225,6 +1229,7 @@ describe('TxTypeFeeDelegatedSmartContractExecution', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1236,6 +1241,7 @@ describe('TxTypeFeeDelegatedSmartContractExecution', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedSmartContractExecutionWithRatio.js b/test/packages/caver.transaction/feeDelegatedSmartContractExecutionWithRatio.js index 5de1de9b..103c02d2 100644 --- a/test/packages/caver.transaction/feeDelegatedSmartContractExecutionWithRatio.js +++ b/test/packages/caver.transaction/feeDelegatedSmartContractExecutionWithRatio.js @@ -92,6 +92,7 @@ before(() => { describe('TxTypeFeeDelegatedSmartContractExecutionWithRatio', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -105,6 +106,8 @@ describe('TxTypeFeeDelegatedSmartContractExecutionWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1247,7 +1250,8 @@ describe('TxTypeFeeDelegatedSmartContractExecutionWithRatio', () => { const tx = caver.transaction.feeDelegatedSmartContractExecutionWithRatio.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1259,6 +1263,7 @@ describe('TxTypeFeeDelegatedSmartContractExecutionWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1270,6 +1275,7 @@ describe('TxTypeFeeDelegatedSmartContractExecutionWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedValueTransfer.js b/test/packages/caver.transaction/feeDelegatedValueTransfer.js index eb7391d1..91c53c83 100644 --- a/test/packages/caver.transaction/feeDelegatedValueTransfer.js +++ b/test/packages/caver.transaction/feeDelegatedValueTransfer.js @@ -91,6 +91,7 @@ before(() => { describe('TxTypeFeeDelegatedValueTransfer', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -103,6 +104,8 @@ describe('TxTypeFeeDelegatedValueTransfer', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1213,7 +1216,8 @@ describe('TxTypeFeeDelegatedValueTransfer', () => { const tx = caver.transaction.feeDelegatedValueTransfer.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1225,6 +1229,7 @@ describe('TxTypeFeeDelegatedValueTransfer', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1236,6 +1241,7 @@ describe('TxTypeFeeDelegatedValueTransfer', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedValueTransferMemo.js b/test/packages/caver.transaction/feeDelegatedValueTransferMemo.js index 6edf54e2..04841c21 100644 --- a/test/packages/caver.transaction/feeDelegatedValueTransferMemo.js +++ b/test/packages/caver.transaction/feeDelegatedValueTransferMemo.js @@ -92,6 +92,7 @@ before(() => { describe('TxTypeFeeDelegatedValueTransferMemo', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -105,6 +106,8 @@ describe('TxTypeFeeDelegatedValueTransferMemo', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1221,7 +1224,8 @@ describe('TxTypeFeeDelegatedValueTransferMemo', () => { const tx = caver.transaction.feeDelegatedValueTransferMemo.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1233,6 +1237,7 @@ describe('TxTypeFeeDelegatedValueTransferMemo', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1244,6 +1249,7 @@ describe('TxTypeFeeDelegatedValueTransferMemo', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedValueTransferMemoWithRatio.js b/test/packages/caver.transaction/feeDelegatedValueTransferMemoWithRatio.js index e39220c1..b634c7d1 100644 --- a/test/packages/caver.transaction/feeDelegatedValueTransferMemoWithRatio.js +++ b/test/packages/caver.transaction/feeDelegatedValueTransferMemoWithRatio.js @@ -93,6 +93,7 @@ before(() => { describe('TxTypeFeeDelegatedValueTransferMemoWithRatio', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -107,6 +108,8 @@ describe('TxTypeFeeDelegatedValueTransferMemoWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1255,7 +1258,8 @@ describe('TxTypeFeeDelegatedValueTransferMemoWithRatio', () => { const tx = caver.transaction.feeDelegatedValueTransferMemoWithRatio.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1267,6 +1271,7 @@ describe('TxTypeFeeDelegatedValueTransferMemoWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1278,6 +1283,7 @@ describe('TxTypeFeeDelegatedValueTransferMemoWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/feeDelegatedValueTransferWithRatio.js b/test/packages/caver.transaction/feeDelegatedValueTransferWithRatio.js index f0f4956d..5ba4ab6e 100644 --- a/test/packages/caver.transaction/feeDelegatedValueTransferWithRatio.js +++ b/test/packages/caver.transaction/feeDelegatedValueTransferWithRatio.js @@ -92,6 +92,7 @@ before(() => { describe('TxTypeFeeDelegatedValueTransferWithRatio', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -105,6 +106,8 @@ describe('TxTypeFeeDelegatedValueTransferWithRatio', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -1247,7 +1250,8 @@ describe('TxTypeFeeDelegatedValueTransferWithRatio', () => { const tx = caver.transaction.feeDelegatedValueTransferWithRatio.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1259,6 +1263,7 @@ describe('TxTypeFeeDelegatedValueTransferWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -1270,6 +1275,7 @@ describe('TxTypeFeeDelegatedValueTransferWithRatio', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/legacyTransaction.js b/test/packages/caver.transaction/legacyTransaction.js index af539ba4..c3b927fa 100644 --- a/test/packages/caver.transaction/legacyTransaction.js +++ b/test/packages/caver.transaction/legacyTransaction.js @@ -55,6 +55,7 @@ before(() => { describe('TxTypeLegacyTransaction', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -69,6 +70,8 @@ describe('TxTypeLegacyTransaction', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -774,7 +777,8 @@ describe('TxTypeLegacyTransaction', () => { const tx = caver.transaction.legacyTransaction.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -786,6 +790,7 @@ describe('TxTypeLegacyTransaction', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -797,6 +802,7 @@ describe('TxTypeLegacyTransaction', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/smartContractDeploy.js b/test/packages/caver.transaction/smartContractDeploy.js index a8ae52a2..ddff73e1 100644 --- a/test/packages/caver.transaction/smartContractDeploy.js +++ b/test/packages/caver.transaction/smartContractDeploy.js @@ -84,6 +84,7 @@ before(() => { describe('TxTypeSmartContractDeploy', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -95,6 +96,8 @@ describe('TxTypeSmartContractDeploy', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -737,7 +740,8 @@ describe('TxTypeSmartContractDeploy', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -748,6 +752,7 @@ describe('TxTypeSmartContractDeploy', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -758,6 +763,7 @@ describe('TxTypeSmartContractDeploy', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/smartContractExecution.js b/test/packages/caver.transaction/smartContractExecution.js index 2121c7d5..0a99cb8e 100644 --- a/test/packages/caver.transaction/smartContractExecution.js +++ b/test/packages/caver.transaction/smartContractExecution.js @@ -85,6 +85,7 @@ before(() => { describe('TxTypeSmartContractExecution', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -98,6 +99,8 @@ describe('TxTypeSmartContractExecution', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -740,7 +743,8 @@ describe('TxTypeSmartContractExecution', () => { delete tx._gasPrice await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -751,6 +755,7 @@ describe('TxTypeSmartContractExecution', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -761,6 +766,7 @@ describe('TxTypeSmartContractExecution', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/valueTransfer.js b/test/packages/caver.transaction/valueTransfer.js index 88aa383f..fa25b8b8 100644 --- a/test/packages/caver.transaction/valueTransfer.js +++ b/test/packages/caver.transaction/valueTransfer.js @@ -81,6 +81,7 @@ before(() => { describe('TxTypeValueTransfer', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -93,6 +94,8 @@ describe('TxTypeValueTransfer', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -740,7 +743,8 @@ describe('TxTypeValueTransfer', () => { const tx = caver.transaction.valueTransfer.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -752,6 +756,7 @@ describe('TxTypeValueTransfer', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -763,6 +768,7 @@ describe('TxTypeValueTransfer', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/packages/caver.transaction/valueTransferMemo.js b/test/packages/caver.transaction/valueTransferMemo.js index 4ad4e06a..5044bdaa 100644 --- a/test/packages/caver.transaction/valueTransferMemo.js +++ b/test/packages/caver.transaction/valueTransferMemo.js @@ -82,6 +82,7 @@ before(() => { describe('TxTypeValueTransferMemo', () => { let transactionObj let getGasPriceSpy + let getHeaderSpy let getNonceSpy let getChainIdSpy beforeEach(() => { @@ -95,6 +96,8 @@ describe('TxTypeValueTransferMemo', () => { getGasPriceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getGasPrice') getGasPriceSpy.returns('0x5d21dba00') + getHeaderSpy = sandbox.stub(caver.transaction.klaytnCall, 'getHeaderByNumber') + getHeaderSpy.returns({ baseFeePerGas: '0x5d21dba00' }) getNonceSpy = sandbox.stub(caver.transaction.klaytnCall, 'getTransactionCount') getNonceSpy.returns('0x3a') getChainIdSpy = sandbox.stub(caver.transaction.klaytnCall, 'getChainId') @@ -750,7 +753,8 @@ describe('TxTypeValueTransferMemo', () => { const tx = caver.transaction.valueTransferMemo.create(transactionObj) await tx.fillTransaction() - expect(getGasPriceSpy).to.have.been.calledOnce + expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -762,6 +766,7 @@ describe('TxTypeValueTransferMemo', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).to.have.been.calledOnce expect(getChainIdSpy).not.to.have.been.calledOnce }).timeout(200000) @@ -773,6 +778,7 @@ describe('TxTypeValueTransferMemo', () => { await tx.fillTransaction() expect(getGasPriceSpy).not.to.have.been.calledOnce + expect(getHeaderSpy).not.to.have.been.calledOnce expect(getNonceSpy).not.to.have.been.calledOnce expect(getChainIdSpy).to.have.been.calledOnce }).timeout(200000) diff --git a/test/sendSignedTransaction.js b/test/sendSignedTransaction.js index 0718d20b..cc090f0e 100644 --- a/test/sendSignedTransaction.js +++ b/test/sendSignedTransaction.js @@ -47,6 +47,44 @@ before(() => { receiver = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) +async function receiptKeyCheck(receipt) { + const keys = [ + 'blockHash', + 'blockNumber', + 'contractAddress', + 'from', + 'gas', + 'gasPrice', + 'gasUsed', + 'logs', + 'logsBloom', + 'nonce', + 'senderTxHash', + 'signatures', + 'status', + 'to', + 'transactionHash', + 'transactionIndex', + 'type', + 'typeInt', + 'value', + ] + if (!keys.every(k => Object.prototype.hasOwnProperty.call(receipt, k))) return false + + const baseFee = caver.utils.hexToNumber((await caver.rpc.klay.getHeader('latest')).baseFeePerGas || '0x0') + if (baseFee > 0 && !Object.prototype.hasOwnProperty.call(receipt, 'effectiveGasPrice')) return false + if (receipt.type.includes('FeeDelegated')) { + const fdKeys = ['feePayer', 'feePayerSignatures'] + if (receipt.type.includes('WithRatio')) fdKeys.push('feeRatio') + if (!fdKeys.every(k => Object.prototype.hasOwnProperty.call(receipt, k))) return false + } + if (receipt.type.includes('Legacy') || receipt.type.includes('Ethereum') || receipt.type.includes('Contract')) { + if (!Object.prototype.hasOwnProperty.call(receipt, 'input')) return false + } + + return true +} + describe('CAVERJS-UNIT-TX-581: caver.klay.sendSignedTransaction with valid non fee delegated transaction raw string', () => { it('should send successfully with valid rawTransaction', async () => { const txObj = { @@ -61,32 +99,9 @@ describe('CAVERJS-UNIT-TX-581: caver.klay.sendSignedTransaction with valid non f expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'input', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) @@ -107,33 +122,9 @@ describe('CAVERJS-UNIT-TX-582: caver.klay.sendSignedTransaction with valid fee d expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'feePayer', - 'feePayerSignatures', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).not.to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) @@ -151,32 +142,9 @@ describe('CAVERJS-UNIT-TX-583: caver.klay.sendSignedTransaction with object whic expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'input', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) @@ -197,33 +165,9 @@ describe('CAVERJS-UNIT-TX-584: caver.klay.sendSignedTransaction with object whic expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'feePayer', - 'feePayerSignatures', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).not.to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) @@ -243,32 +187,9 @@ describe('CAVERJS-UNIT-TX-585: caver.klay.sendSignedTransaction with transaction expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'input', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) @@ -293,33 +214,9 @@ describe('CAVERJS-UNIT-TX-586: caver.klay.sendSignedTransaction with transaction expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'feePayer', - 'feePayerSignatures', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).not.to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) @@ -346,32 +243,8 @@ describe('CAVERJS-UNIT-TX-587: caver.klay.sendSignedTransaction with fee payer t expect(receipt).not.to.null - const keys = [ - 'blockHash', - 'blockNumber', - 'contractAddress', - 'feePayer', - 'feePayerSignatures', - 'from', - 'gas', - 'gasPrice', - 'gasUsed', - 'logs', - 'logsBloom', - 'nonce', - 'senderTxHash', - 'signatures', - 'status', - 'to', - 'transactionHash', - 'transactionIndex', - 'type', - 'typeInt', - 'value', - ] - expect(Object.getOwnPropertyNames(receipt)).to.deep.equal(keys) - expect(receipt.status).to.equals(true) expect(receipt.senderTxHash).not.to.equals(receipt.transactionHash) + expect(await receiptKeyCheck(receipt)).to.be.true }).timeout(100000) }) diff --git a/test/transactionType/accountCreation.js b/test/transactionType/accountCreation.js deleted file mode 100644 index a642f271..00000000 --- a/test/transactionType/accountCreation.js +++ /dev/null @@ -1,2004 +0,0 @@ -/* - Copyright 2018 The caver-js Authors - This file is part of the caver-js library. - - The caver-js library is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - The caver-js library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the caver-js. If not, see . -*/ - -const { expect, assert } = require('../extendedChai') - -const testRPCURL = require('../testrpc') -const Caver = require('../../index') - -let caver -let senderPrvKey -let senderAddress -let testAccount - -before(() => { - caver = new Caver(testRPCURL) - senderPrvKey = - process.env.privateKey && String(process.env.privateKey).indexOf('0x') === -1 - ? `0x${process.env.privateKey}` - : process.env.privateKey - - caver.klay.accounts.wallet.add(senderPrvKey) - - const sender = caver.klay.accounts.privateKeyToAccount(senderPrvKey) - senderAddress = sender.address -}) - -describe('ACCOUNT_CREATION transaction', () => { - let accountCreationObject - const pubKey1 = - '0x82e50e05ae21d4d35cf41856ec665b70ddb65fa3570f71f50b236f221fbd57598cfac224fee0b41f6152484060a608110757caf4eb7e7fbbd7a097244539e2e7' - const pubKey2 = - '0x8e9cc1d6826761c492160378022740368d256a7d697e84875d268711702e084c165f4a4823d4a8256f8141df5f377344d9dfb6e684e3cb7e91b7e928010d6508' - const pubKey3 = - '0x6d545db2dcba5a9f4201e4199ac5308b3e4f31033a9be3ebc0944e2d2fb0b7622f903f53e0ea5d0e20ce748a3da08052e6533107acaad0c14aba8c54f40154a3' - const pubKey4 = - '0xdff805352a763474506f1d4d288f5e5484335e32b378d8f4436b34affe3af661047fd41074f863b2c4d157891b2574fce6a735743f0442ac5b1d86bd55ed67ae' - const multisig = { - threshold: 3, - keys: [ - { weight: 1, publicKey: pubKey1 }, - { weight: 1, publicKey: pubKey2 }, - { weight: 1, publicKey: pubKey3 }, - { weight: 1, publicKey: pubKey4 }, - ], - } - beforeEach(() => { - testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) - accountCreationObject = { - type: 'ACCOUNT_CREATION', - from: senderAddress, - to: testAccount.address, - value: 1, - gas: 900000, - } - }) - - // Error from missing - it('CAVERJS-UNIT-TX-109 : If transaction object missing from, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.from - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-109 : If transaction object missing from, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.from - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Error to missing - it('CAVERJS-UNIT-TX-110 : If transaction object missing to, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.to - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-110 : If transaction object missing to, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.to - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Error value missing - it('CAVERJS-UNIT-TX-111 : If transaction object missing value, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.value - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-111 : If transaction object missing value, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.value - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Error gas and gasLimit missing - it('CAVERJS-UNIT-TX-112 : If transaction object missing gas and gasLimit, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.gas - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-112 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - delete tx.gas - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // MissingKey - it('CAVERJS-UNIT-TX-113 : If transaction object missing key information, signTransaction should throw error', async () => { - const tx = { ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('Missing key information with ACCOUNT_CREATION transaction') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-113 : If transaction object missing key information, sendTransaction should throw error', () => { - const tx = { ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('Missing key information with ACCOUNT_CREATION transaction') - }).timeout(200000) - - // Creation with publicKey. - it('CAVERJS-UNIT-TX-114 : If transaction object has publicKey, create account with publicKey', async () => { - const tx = { publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay - .sendTransaction(tx) - .then(async () => { - await caver.klay - .getAccountKey(tx.to) - .then(key => { - expect(key.keyType).to.equals(2) - result = true - }) - .catch(() => (result = false)) - }) - .catch(() => (result = false)) - - expect(result).to.be.true - }).timeout(200000) - - // PublicKeyLength64 - it('CAVERJS-UNIT-TX-116 : If compressed publicKey length is not 64, signTransaction should return error', async () => { - const tx = { publicKey: caver.utils.randomHex(32), ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-116 : If compressed publicKey length is not 64, sendTransaction should return error', async () => { - const tx = { publicKey: caver.utils.randomHex(32), ...accountCreationObject } - - let result - await caver.klay - .sendTransaction(tx) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - // PublicKeyLength126 - it('CAVERJS-UNIT-TX-117 : If uncompressed publicKey length is 126, signTransaction should return error', async () => { - const tx = { publicKey: caver.utils.randomHex(63), ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-117 : If uncompressed publicKey length is 126, sendTransaction should return error', async () => { - const tx = { publicKey: caver.utils.randomHex(63), ...accountCreationObject } - - let result - await caver.klay - .sendTransaction(tx) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - // Creation with multisig. - it('CAVERJS-UNIT-TX-118 : If transaction object has multisig, create account with multisig', async () => { - const tx = { multisig, ...accountCreationObject } - - let result - await caver.klay - .sendTransaction(tx) - .then(async () => { - await caver.klay - .getAccountKey(tx.to) - .then(key => { - expect(key.keyType).to.equals(4) - result = true - }) - .catch(() => (result = false)) - }) - .catch(() => (result = false)) - - expect(result).to.be.true - }).timeout(200000) - - // Creation with multisig and publicKey. - it('CAVERJS-UNIT-TX-119 : If transaction object has multisig and publicKey, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-119 : If transaction object has multisig and publicKey, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Creation with roleTransactionKey. - it('CAVERJS-UNIT-TX-120 : If transaction object has roleTransactionKey, create account with roleTransactionKey', async () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, ...accountCreationObject } - - let result - await caver.klay - .sendTransaction(tx) - .then(async () => { - await caver.klay - .getAccountKey(tx.to) - .then(key => { - const expectedXY = caver.utils.xyPointFromPublicKey(pubKey1) - expect(key.keyType).to.equals(5) - expect(key.key.length).to.equals(1) - expect(key.key[0].keyType).to.equals(2) - expect(key.key[0].key.x).to.equals(expectedXY[0]) - expect(key.key[0].key.y).to.equals(expectedXY[1]) - result = true - }) - .catch((result = false)) - }) - .catch((result = false)) - - expect(result).to.be.true - }).timeout(200000) - - // Creation with roleTransactionKey and publicKey. - it('CAVERJS-UNIT-TX-121 : If transaction object has roleTransactionKey and publicKey, signTransaction should throw error', async () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-121 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Creation with roleTransactionKey and multisig. - it('CAVERJS-UNIT-TX-122 : If transaction object has roleTransactionKey and multisig, signTransaction should throw error', async () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-122 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Creation with roleTransactionKey and multisig and publicKey. - it('CAVERJS-UNIT-TX-123 : If transaction object has roleTransactionKey and multisig and publicKey, signTransaction should throw error', async () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, multisig, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-123 : If transaction object has roleTransactionKey and multisig and publicKey, sendTransaction should throw error', () => { - const tx = { roleTransactionKey: { publicKey: pubKey1 }, multisig, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey without roleTransactionKey - it('CAVERJS-UNIT-TX-124 : If transaction object has only roleAccountUpdateKey, signTransaction should throw error', async () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-124 : If transaction object has only roleAccountUpdateKey, sendTransaction should throw error', () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey with roleTransactionKey - it('CAVERJS-UNIT-TX-125 : If transaction object has roleAccountUpdateKey and roleTransactionKey, create account with roleTransactionKey and roleAccountUpdateKey', async () => { - const tx = { - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - ...accountCreationObject, - } - - let result - await caver.klay - .sendTransaction(tx) - .then(async receipt => { - expect(receipt.to).to.equals(tx.to) - await caver.klay - .getAccountKey(receipt.to) - .then(key => { - const expectedTransactionKey = caver.utils.xyPointFromPublicKey(pubKey1) - const expectedUpdateKey = caver.utils.xyPointFromPublicKey(pubKey2) - expect(key.keyType).to.equals(5) - expect(key.key.length).to.equals(2) - expect(key.key[0].keyType).to.equals(2) - expect(key.key[0].key.x).to.equals(expectedTransactionKey[0]) - expect(key.key[0].key.y).to.equals(expectedTransactionKey[1]) - expect(key.key[1].keyType).to.equals(2) - expect(key.key[1].key.x).to.equals(expectedUpdateKey[0]) - expect(key.key[1].key.y).to.equals(expectedUpdateKey[1]) - result = true - }) - .catch((result = false)) - }) - .catch((result = false)) - - expect(result).to.be.true - }).timeout(200000) - - // RoleAccountUpdateKey with publicKey - it('CAVERJS-UNIT-TX-126 : If transaction object has roleAccountUpdateKey and publicKey, signTransaction should throw error', async () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-126 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - // Throw error from formatter validation - - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey with multisig - it('CAVERJS-UNIT-TX-127 : If transaction object has roleAccountUpdateKey and multisig, signTransaction should throw error', async () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-127 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey with multisig and publicKey - it('CAVERJS-UNIT-TX-128 : If transaction object has roleAccountUpdateKey, multisig and publicKey, signTransaction should throw error', async () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, multisig, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-128 : If transaction object has roleAccountUpdateKey, multisig and publicKey, sendTransaction should throw error', () => { - const tx = { roleAccountUpdateKey: { publicKey: pubKey1 }, multisig, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey with roleTransactionKey and publicKey - it('CAVERJS-UNIT-TX-129 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, signTransaction should throw error', async () => { - const tx = { - roleAccountUpdateKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-129 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { - const tx = { - roleAccountUpdateKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey with roleTransactionKey and multisig - it('CAVERJS-UNIT-TX-130 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleAccountUpdateKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-130 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleAccountUpdateKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleAccountUpdateKey with roleTransactionKey, multisig and publicKey - it('CAVERJS-UNIT-TX-131 : If transaction object has roleAccountUpdateKey, roleTransactionKey, multisig and publicKey, signTransaction should throw error', async () => { - const tx = { - roleAccountUpdateKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - multisig, - publicKey: pubKey1, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-131 : If transaction object has roleAccountUpdateKey, roleTransactionKey, multisig and publicKey, sendTransaction should throw error', () => { - const tx = { - roleAccountUpdateKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - multisig, - publicKey: pubKey1, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey without roleTransactionKey and roleAccountUpdateKey - it('CAVERJS-UNIT-TX-132 : If transaction object has only roleFeePayerKey, signTransaction should throw error', async () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-132 : If transaction object has only roleFeePayerKey, sendTransaction should throw error', () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey - it('CAVERJS-UNIT-TX-133 : If transaction object has roleFeePayerKey and roleTransactionKey, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-133 : If transaction object has roleFeePayerKey and roleTransactionKey, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleAccountUpdateKey - it('CAVERJS-UNIT-TX-134 : If transaction object has roleFeePayerKey and roleAccountUpdateKey, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-134 : If transaction object has roleFeePayerKey and roleAccountUpdateKey, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleAccountUpdateKey and roleTransactionKey - it('CAVERJS-UNIT-TX-135 : If transaction object has roleFeePayerKey, roleTransactionKey and roleAccountUpdateKey, create account with roleTransactionKey, roleAccountUpdateKey and roleFeePayerKey', async () => { - const tx = { - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - ...accountCreationObject, - } - - let result - await caver.klay - .sendTransaction(tx) - .then(async receipt => { - expect(receipt.to).to.equals(tx.to) - await caver.klay - .getAccountKey(receipt.to) - .then(key => { - const expectedTransactionKey = caver.utils.xyPointFromPublicKey(pubKey1) - const expectedUpdateKey = caver.utils.xyPointFromPublicKey(pubKey2) - const expectedFeePayerKey = caver.utils.xyPointFromPublicKey(pubKey3) - expect(key.keyType).to.equals(5) - expect(key.key.length).to.equals(3) - expect(key.key[0].keyType).to.equals(2) - expect(key.key[0].key.x).to.equals(expectedTransactionKey[0]) - expect(key.key[0].key.y).to.equals(expectedTransactionKey[1]) - expect(key.key[1].keyType).to.equals(2) - expect(key.key[1].key.x).to.equals(expectedUpdateKey[0]) - expect(key.key[1].key.y).to.equals(expectedUpdateKey[1]) - expect(key.key[2].keyType).to.equals(2) - expect(key.key[2].key.x).to.equals(expectedFeePayerKey[0]) - expect(key.key[2].key.y).to.equals(expectedFeePayerKey[1]) - result = true - }) - .catch((result = false)) - }) - .catch((result = false)) - - expect(result).to.be.true - }).timeout(200000) - - // RoleFeePayerKey with publicKey - it('CAVERJS-UNIT-TX-136 : If transaction object has roleFeePayerKey and publicKey, signTransaction should throw error', async () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, publicKey: pubKey2, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-136 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, publicKey: pubKey2, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with multisig - it('CAVERJS-UNIT-TX-137 : If transaction object has roleFeePayerKey and publicKey, signTransaction should throw error', async () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-137 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with publicKey and multisig - it('CAVERJS-UNIT-TX-138 : If transaction object has roleFeePayerKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, multisig, publicKey: pubKey2, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-138 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { roleFeePayerKey: { publicKey: pubKey1 }, multisig, publicKey: pubKey2, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey and publicKey - it('CAVERJS-UNIT-TX-139 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-139 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey and multisig - it('CAVERJS-UNIT-TX-140 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-140 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey, publicKey and multisig - it('CAVERJS-UNIT-TX-141 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-141 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleAccountUpdateKey and publicKey - it('CAVERJS-UNIT-TX-142 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-142 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleAccountUpdateKey and multisig - it('CAVERJS-UNIT-TX-143 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-143 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleAccountUpdateKey, publicKey and multisig - it('CAVERJS-UNIT-TX-144 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-144 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey3, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey, roleAccountUpdateKey and publicKey - it('CAVERJS-UNIT-TX-145 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - roleAccountUpdateKey: { publicKey: pubKey3 }, - publicKey: pubKey4, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-145 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - roleAccountUpdateKey: { publicKey: pubKey3 }, - publicKey: pubKey4, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey, roleAccountUpdateKey and multisig - it('CAVERJS-UNIT-TX-146 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - roleAccountUpdateKey: { publicKey: pubKey3 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-146 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - roleAccountUpdateKey: { publicKey: pubKey3 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // RoleFeePayerKey with roleTransactionKey, roleAccountUpdateKey, publicKey and multisig - it('CAVERJS-UNIT-TX-147 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - roleAccountUpdateKey: { publicKey: pubKey3 }, - publicKey: pubKey4, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-147 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - roleFeePayerKey: { publicKey: pubKey1 }, - roleTransactionKey: { publicKey: pubKey2 }, - roleAccountUpdateKey: { publicKey: pubKey3 }, - publicKey: pubKey4, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Create account with failKey - it('CAVERJS-UNIT-TX-148 : If transaction object has only failKey, create account with failKey', async () => { - const tx = { failKey: true, ...accountCreationObject } - - let result - await caver.klay - .sendTransaction(tx) - .then(async receipt => { - expect(receipt.to).to.equals(tx.to) - await caver.klay - .getAccountKey(receipt.to) - .then(key => { - expect(key.keyType).to.equals(3) - result = true - }) - .catch((result = false)) - }) - .catch((result = false)) - - expect(result).to.be.true - }).timeout(200000) - - // FailKey with publicKey - it('CAVERJS-UNIT-TX-149 : If transaction object has failKey and publicKey, signTransaction should throw error', async () => { - const tx = { failKey: true, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-149 : If transaction object has failKey and publicKey, sendTransaction should throw error', () => { - const tx = { failKey: true, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with multisig - it('CAVERJS-UNIT-TX-150 : If transaction object has failKey and multisig, signTransaction should throw error', async () => { - const tx = { failKey: true, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-150 : If transaction object has failKey and multisig, sendTransaction should throw error', () => { - const tx = { failKey: true, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with publicKey and multisig - it('CAVERJS-UNIT-TX-151 : If transaction object has failKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { failKey: true, publicKey: pubKey1, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-151 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { failKey: true, publicKey: pubKey1, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey - it('CAVERJS-UNIT-TX-152 : If transaction object has failKey and roleTransactionKey, signTransaction should throw error', async () => { - const tx = { failKey: true, roleTransactionKey: { publicKey: pubKey1 }, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-152 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', () => { - const tx = { failKey: true, roleTransactionKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey and publicKey - it('CAVERJS-UNIT-TX-153 : If transaction object has failKey, roleTransactionKey and publicKey, signTransaction should throw error', async () => { - const tx = { failKey: true, roleTransactionKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-153 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { - const tx = { failKey: true, roleTransactionKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey and multisig - it('CAVERJS-UNIT-TX-154 : If transaction object has failKey, roleTransactionKey and multisig, signTransaction should throw error', async () => { - const tx = { failKey: true, roleTransactionKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-154 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { - const tx = { failKey: true, roleTransactionKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, publicKey and multisig - it('CAVERJS-UNIT-TX-155 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-155 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey - it('CAVERJS-UNIT-TX-156 : If transaction object has failKey and roleAccountUpdateKey, signTransaction should throw error', async () => { - const tx = { failKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-156 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', () => { - const tx = { failKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey and publicKey - it('CAVERJS-UNIT-TX-157 : If transaction object has failKey, roleAccountUpdateKey and publicKey, signTransaction should throw error', async () => { - const tx = { failKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-157 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { - const tx = { failKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey and multisig - it('CAVERJS-UNIT-TX-158 : If transaction object has failKey, roleAccountUpdateKey and multisig, signTransaction should throw error', async () => { - const tx = { failKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-158 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { - const tx = { failKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey, publicKey and multisig - it('CAVERJS-UNIT-TX-159 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey1 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-159 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey1 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleFeePayerKey - it('CAVERJS-UNIT-TX-160 : If transaction object has failKey and roleFeePayerKey, signTransaction should throw error', async () => { - const tx = { failKey: true, roleFeePayerKey: { publicKey: pubKey1 }, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-160 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', () => { - const tx = { failKey: true, roleFeePayerKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleFeePayerKey and publicKey - it('CAVERJS-UNIT-TX-161 : If transaction object has failKey, roleFeePayerKey and publicKey, signTransaction should throw error', async () => { - const tx = { failKey: true, roleFeePayerKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-161 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { - const tx = { failKey: true, roleFeePayerKey: { publicKey: pubKey1 }, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleFeePayerKey and multisig - it('CAVERJS-UNIT-TX-162 : If transaction object has failKey, roleFeePayerKey and multisig, signTransaction should throw error', async () => { - const tx = { failKey: true, roleFeePayerKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-162 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { - const tx = { failKey: true, roleFeePayerKey: { publicKey: pubKey1 }, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleFeePayerKey, publicKey and multisig - it('CAVERJS-UNIT-TX-163 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleFeePayerKey: { publicKey: pubKey1 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-163 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleFeePayerKey: { publicKey: pubKey1 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleAccountUpdateKey and publicKey - it('CAVERJS-UNIT-TX-164 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-164 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleAccountUpdateKey and multisig - it('CAVERJS-UNIT-TX-165 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-165 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleAccountUpdateKey, publicKey and multisig - it('CAVERJS-UNIT-TX-166 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-166 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleFeePayerKey and publicKey - it('CAVERJS-UNIT-TX-167 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleFeePayerKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-167 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleFeePayerKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleFeePayerKey and multisig - it('CAVERJS-UNIT-TX-168 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleFeePayerKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-168 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleFeePayerKey: { publicKey: pubKey2 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleFeePayerKey, publicKey and multisig - it('CAVERJS-UNIT-TX-169 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleFeePayerKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-169 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleFeePayerKey: { publicKey: pubKey2 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey, roleFeePayerKey and publicKey - it('CAVERJS-UNIT-TX-170 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-170 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey, roleFeePayerKey and multisig - it('CAVERJS-UNIT-TX-171 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-171 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig - it('CAVERJS-UNIT-TX-172 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-172 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey - it('CAVERJS-UNIT-TX-173 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-173 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig - it('CAVERJS-UNIT-TX-174 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-174 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // FailKey with roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig - it('CAVERJS-UNIT-TX-175 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, signTransaction should throw error', async () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-175 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { - const tx = { - failKey: true, - roleTransactionKey: { publicKey: pubKey1 }, - roleAccountUpdateKey: { publicKey: pubKey2 }, - roleFeePayerKey: { publicKey: pubKey3 }, - publicKey: pubKey1, - multisig, - ...accountCreationObject, - } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // UnnecessaryData - it('CAVERJS-UNIT-TX-176 : If transaction object has data, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, data: '0x68656c6c6f', ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-176 : If transaction object has data, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, data: '0x68656c6c6f', ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // UnnecessaryFeePayer - it('CAVERJS-UNIT-TX-177 : If transaction object has feePayer, signTransaction should throw error', async () => { - const payer = caver.klay.accounts.create() - const tx = { publicKey: pubKey1, feePayer: payer.address, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-177 : If transaction object has data, sendTransaction should throw error', () => { - const payer = caver.klay.accounts.create() - const tx = { publicKey: pubKey1, feePayer: payer.address, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // UnnecessaryFeeRatio - it('CAVERJS-UNIT-TX-178 : If transaction object has feeRatio, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, feeRatio: 20, ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-178 : If transaction object has feeRatio, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, feeRatio: 20, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // UnnecessaryCodeFormat - it('CAVERJS-UNIT-TX-179 : If transaction object has codeFormat, signTransaction should throw error', async () => { - const tx = { publicKey: pubKey1, codeFormat: 'EVM', ...accountCreationObject } - - let result - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => (result = false)) - .catch(() => (result = true)) - - expect(result).to.be.true - }).timeout(200000) - - it('CAVERJS-UNIT-TX-179 : If transaction object has codeFormat, sendTransaction should throw error', () => { - const tx = { publicKey: pubKey1, codeFormat: 'EVM', ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() - }).timeout(200000) - - // Create account with legacyKey - it('CAVERJS-UNIT-TX-180 : If transaction object has only legacyKey, create account with legacyKey', async () => { - const tx = { legacyKey: true, ...accountCreationObject } - - const receipt = await caver.klay.sendTransaction(tx) - expect(receipt.to).to.equals(tx.to) - - const key = await caver.klay.getAccountKey(receipt.to) - expect(key.keyType).to.equals(1) - }).timeout(200000) - - // LegacyKey with publicKey - it('CAVERJS-UNIT-TX-181 : If transaction object has legacyKey and publicKey, signTransaction should throw error', async () => { - const tx = { legacyKey: true, publicKey: pubKey1, ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-181 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', () => { - const tx = { legacyKey: true, publicKey: pubKey1, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }).timeout(200000) - - // LegacyKey with multisig - it('CAVERJS-UNIT-TX-182 : If transaction object has legacyKey and multisig, signTransaction should throw error', async () => { - const tx = { legacyKey: true, multisig, ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-182 : If transaction object has legacyKey and multisig, sendTransaction should throw error', () => { - const tx = { legacyKey: true, multisig, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }).timeout(200000) - - // LegacyKey with failKey - it('CAVERJS-UNIT-TX-183 : If transaction object has legacyKey and failKey, signTransaction should throw error', async () => { - const tx = { legacyKey: true, failKey: true, ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-183 : If transaction object has legacyKey and failKey, sendTransaction should throw error', () => { - const tx = { legacyKey: true, failKey: true, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }).timeout(200000) - - // LegacyKey with roleTransactionKey - it('CAVERJS-UNIT-TX-184 : If transaction object has legacyKey and roleTransactionKey, signTransaction should throw error', async () => { - const tx = { legacyKey: true, roleTransactionKey: { publicKey: pubKey1 }, ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-184 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', () => { - const tx = { legacyKey: true, roleTransactionKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }).timeout(200000) - - // LegacyKey with roleAccountUpdateKey - it('CAVERJS-UNIT-TX-185 : If transaction object has legacyKey and roleAccountUpdateKey, signTransaction should throw error', async () => { - const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-185 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', () => { - const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }).timeout(200000) - - // LegacyKey with roleFeePayerKey - it('CAVERJS-UNIT-TX-186 : If transaction object has legacyKey and roleFeePayerKey, signTransaction should throw error', async () => { - const tx = { legacyKey: true, roleFeePayerKey: { publicKey: pubKey1 }, ...accountCreationObject } - - await caver.klay.accounts - .signTransaction(tx, senderPrvKey) - .then(() => assert(false)) - .catch(err => { - expect(err.message).to.equals('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }) - }).timeout(200000) - - it('CAVERJS-UNIT-TX-186 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', () => { - const tx = { legacyKey: true, roleFeePayerKey: { publicKey: pubKey1 }, ...accountCreationObject } - - // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('The key parameter to be used for ACCOUNT_CREATION is duplicated.') - }).timeout(200000) -}) diff --git a/test/transactionType/accountUpdate.js b/test/transactionType/accountUpdate.js index ae89a9e8..ab331a07 100644 --- a/test/transactionType/accountUpdate.js +++ b/test/transactionType/accountUpdate.js @@ -26,7 +26,7 @@ let senderPrvKey let senderAddress let testAccount -describe('ACCOUNT_UPDATE transaction', () => { +describe('ACCOUNT_UPDATE transaction', async () => { let accountUpdateObject let publicKey let publicKey2 @@ -98,12 +98,12 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-187 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-187 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryTo @@ -119,11 +119,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-188 : If transaction object has to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-188 : If transaction object has to, sendTransaction should throw error', async () => { const tx = { publicKey, to: senderAddress, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryValue @@ -139,11 +139,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-189 : If transaction object has value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-189 : If transaction object has value, sendTransaction should throw error', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // MissingGas @@ -160,12 +160,12 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-190 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-190 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // MissingKey @@ -180,7 +180,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-191 : If transaction object missing key information, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-191 : If transaction object missing key information, sendTransaction should throw error', async () => { const tx = { ...accountUpdateObject } // Throw error from formatter validation @@ -287,11 +287,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-197 : If transaction object has multisig and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-197 : If transaction object has multisig and publicKey, sendTransaction should throw error', async () => { const tx = { publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleTransactionKey. @@ -337,11 +337,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-199 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-199 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleTransactionKey and multisig. @@ -357,11 +357,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-200 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-200 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleTransactionKey, publicKey and multisig. @@ -377,11 +377,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-201 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-201 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleAccountUpdateKey. @@ -457,11 +457,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-204 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-204 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleAccountUpdateKey and multisig. @@ -477,11 +477,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-205 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-205 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleAccountUpdateKey, publicKey and multisig. @@ -497,11 +497,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-206 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-206 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleAccountUpdateKey, roleTransactionKey and publicKey. @@ -517,11 +517,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-207 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-207 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleAccountUpdateKey, roleTransactionKey and multisig. @@ -537,11 +537,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-208 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-208 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleAccountUpdateKey, roleTransactionKey, publicKey and multisig. @@ -563,7 +563,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-209 : If transaction object has roleAccountUpdateKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-209 : If transaction object has roleAccountUpdateKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -573,7 +573,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey. @@ -713,11 +713,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-214 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-214 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey and multisig. @@ -733,11 +733,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-215 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-215 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, publicKey and multisig. @@ -753,11 +753,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-216 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-216 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey and publicKey. @@ -773,11 +773,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-217 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-217 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey and multisig. @@ -793,11 +793,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-218 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-218 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, publicKey and multisig. @@ -819,7 +819,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-219 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-219 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, @@ -829,7 +829,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleAccountUpdateKey and publicKey. @@ -845,11 +845,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-220 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-220 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleAccountUpdateKey and multisig. @@ -865,11 +865,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-221 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-221 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig. @@ -891,7 +891,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-222 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-222 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, @@ -901,7 +901,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey. @@ -923,7 +923,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-223 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-223 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -933,7 +933,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig. @@ -955,7 +955,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-224 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-224 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -965,7 +965,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig. @@ -988,7 +988,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-225 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-225 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -999,7 +999,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey. @@ -1027,11 +1027,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-227 : If transaction object has failKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-227 : If transaction object has failKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey and multisig. @@ -1047,11 +1047,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-228 : If transaction object has failKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-228 : If transaction object has failKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, publicKey and multisig. @@ -1067,11 +1067,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-229 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-229 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey and roleTransactionKey. @@ -1087,11 +1087,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-230 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-230 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey and publicKey. @@ -1107,11 +1107,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-231 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-231 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey and multisig. @@ -1127,11 +1127,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-232 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-232 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, publicKey and multisig. @@ -1147,11 +1147,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-233 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-233 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey and roleAccountUpdateKey. @@ -1167,11 +1167,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-234 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-234 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleAccountUpdateKey and publicKey. @@ -1187,11 +1187,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-235 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-235 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleAccountUpdateKey and multisig. @@ -1207,11 +1207,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-236 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-236 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleAccountUpdateKey, publicKey and multisig. @@ -1227,11 +1227,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-237 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-237 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey and roleFeePayerKey. @@ -1247,11 +1247,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-238 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-238 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleFeePayerKey and publicKey. @@ -1267,11 +1267,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-239 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-239 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleFeePayerKey and multisig. @@ -1287,11 +1287,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-240 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-240 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleFeePayerKey, publicKey and multisig. @@ -1307,11 +1307,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-241 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-241 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey and publicKey. @@ -1333,7 +1333,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-242 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-242 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1343,7 +1343,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey and multisig. @@ -1365,7 +1365,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-243 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-243 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1375,7 +1375,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig. @@ -1398,7 +1398,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-244 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-244 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1409,7 +1409,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleFeePayerKey and publicKey. @@ -1431,7 +1431,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-245 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-245 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1441,7 +1441,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleFeePayerKey and multisig. @@ -1463,7 +1463,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-246 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-246 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1473,7 +1473,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig. @@ -1496,7 +1496,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-247 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-247 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1507,7 +1507,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey. @@ -1529,7 +1529,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-248 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-248 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1539,7 +1539,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleAccountUpdateKey, roleFeePayerKey and multisig. @@ -1561,7 +1561,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-249 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-249 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1571,7 +1571,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig. @@ -1594,7 +1594,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-250 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-250 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1605,7 +1605,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey. @@ -1628,7 +1628,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-251 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-251 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1639,7 +1639,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig. @@ -1662,7 +1662,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-252 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-252 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1673,7 +1673,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig. @@ -1697,7 +1697,7 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-253 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-253 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1709,7 +1709,7 @@ describe('ACCOUNT_UPDATE transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryData @@ -1725,11 +1725,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-254 : If transaction object has data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-254 : If transaction object has data, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryFeePayer @@ -1745,11 +1745,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-255 : If transaction object has feePayer, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-255 : If transaction object has feePayer, sendTransaction should throw error', async () => { const tx = { feePayer: caver.klay.accounts.create().address, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryFeeRatio @@ -1765,11 +1765,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-256 : If transaction object has feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-256 : If transaction object has feeRatio, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryCodeFormat @@ -1785,11 +1785,11 @@ describe('ACCOUNT_UPDATE transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-257 : If transaction object has codeFormat, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-257 : If transaction object has codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Update account with legacyKey @@ -1827,7 +1827,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-259 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-259 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation @@ -1846,7 +1846,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-260 : If transaction object has legacyKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-260 : If transaction object has legacyKey and multisig, sendTransaction should throw error', async () => { const tx = { legacyKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation @@ -1865,7 +1865,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-261 : If transaction object has legacyKey and failKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-261 : If transaction object has legacyKey and failKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, failKey: true, ...accountUpdateObject } // Throw error from formatter validation @@ -1884,7 +1884,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-262 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-262 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation @@ -1903,7 +1903,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-263 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-263 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation @@ -1922,7 +1922,7 @@ describe('ACCOUNT_UPDATE transaction', () => { }) }).timeout(200000) - it('CAVERJS-UNIT-TX-264 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-264 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation @@ -1939,7 +1939,7 @@ describe('ACCOUNT_UPDATE transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-588: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-588: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } tx.from = 'invalidAddress' @@ -1958,7 +1958,7 @@ describe('ACCOUNT_UPDATE transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-589: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-589: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { publicKey, feePayerSignatures: [['0x01', '0x', '0x']], ...accountUpdateObject } const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` diff --git a/test/transactionType/cancelTransaction.js b/test/transactionType/cancelTransaction.js index d6d26e17..9fb799c8 100644 --- a/test/transactionType/cancelTransaction.js +++ b/test/transactionType/cancelTransaction.js @@ -41,7 +41,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('CANCEL transaction', () => { +describe('CANCEL transaction', async () => { let cancelObject beforeEach(() => { @@ -63,11 +63,11 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-511 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-511 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -80,10 +80,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-512 : If transaction object has unnecessary to field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-512 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryValue @@ -96,10 +96,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"value" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-513 : If transaction object has unnecessary value field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-513 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" cannot be used with CANCEL transaction') }).timeout(200000) // MissingGas @@ -113,11 +113,11 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-514 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-514 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // UnnecessaryData @@ -130,10 +130,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"data" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-515 : If transaction object has unnecessary data field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-515 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryFeePayer @@ -146,10 +146,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"feePayer" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-516 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-516 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feePayer" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feePayer" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryFeeRatio @@ -162,10 +162,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-517 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-517 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -182,14 +182,14 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"publicKey" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-518 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-518 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...cancelObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"publicKey" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"publicKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryMultisig @@ -227,7 +227,7 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"multisig" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-519 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-519 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -255,7 +255,7 @@ describe('CANCEL transaction', () => { } const tx = { multisig, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"multisig" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"multisig" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -272,14 +272,14 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"roleTransactionKey" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-520 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-520 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleTransactionKey" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"roleTransactionKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryRoleAccountUpdateKey @@ -296,14 +296,14 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"roleAccountUpdateKey" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-521 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-521 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleAccountUpdateKey" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"roleAccountUpdateKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryRoleFeePayerKey @@ -320,14 +320,14 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"roleFeePayerKey" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-522 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-522 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleFeePayerKey" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"roleFeePayerKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryFailKey @@ -340,10 +340,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-523 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-523 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"failKey" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"failKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -356,10 +356,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"codeFormat" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-524 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-524 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"codeFormat" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"codeFormat" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -372,10 +372,10 @@ describe('CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-525 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-525 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with CANCEL transaction') }).timeout(200000) // Invalid from address @@ -388,14 +388,14 @@ describe('CANCEL transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-590: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-590: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...cancelObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -407,13 +407,13 @@ describe('CANCEL transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-591: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-591: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { feePayerSignatures: [['0x01', '0x', '0x']], ...cancelObject } const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-712: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/contractDeploy.js b/test/transactionType/contractDeploy.js index 5adc36d8..3ebf1ef0 100644 --- a/test/transactionType/contractDeploy.js +++ b/test/transactionType/contractDeploy.js @@ -47,7 +47,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('SMART_CONTRACT_DEPLOY transaction', () => { +describe('SMART_CONTRACT_DEPLOY transaction', async () => { let deployObject beforeEach(() => { @@ -72,11 +72,11 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-423 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-423 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // MissingValue @@ -90,11 +90,11 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"value" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-424 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-424 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.value - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -108,11 +108,11 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-425 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-425 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingData @@ -126,11 +126,11 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"data" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-426 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-426 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.data - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') }).timeout(200000) // InvalidCodeFormat @@ -143,10 +143,10 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('The codeFormat(InvalidCodeFormat) is invalid.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-427 : If transaction object has invalid codeFormat, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-427 : If transaction object has invalid codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'InvalidCodeFormat', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('The codeFormat(InvalidCodeFormat) is invalid.') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The codeFormat(InvalidCodeFormat) is invalid.') }).timeout(200000) // UnnecessaryFeePayer @@ -159,11 +159,11 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"feePayer" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-428 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-428 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...deployObject } // This error return from formatter. Because in formatter discriminate fee delegation through feePayer and senderRawTransaction - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feePayer" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feePayer" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryFeeRatio @@ -176,10 +176,10 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-429 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-429 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -196,14 +196,14 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"publicKey" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-430 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-430 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...deployObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"publicKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"publicKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryMultisig @@ -241,7 +241,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"multisig" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-431 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-431 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -269,7 +269,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { } const tx = { multisig, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"multisig" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"multisig" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -286,14 +286,16 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"roleTransactionKey" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-432 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-432 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleTransactionKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"roleTransactionKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' + ) }).timeout(200000) // UnnecessaryRoleAccountUpdateKey @@ -310,14 +312,14 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"roleAccountUpdateKey" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-433 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-433 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -336,14 +338,16 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"roleFeePayerKey" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-434 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-434 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleFeePayerKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"roleFeePayerKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' + ) }).timeout(200000) // UnnecessaryFailKey @@ -356,10 +360,10 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-435 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-435 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"failKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"failKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -372,10 +376,10 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-436 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-436 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryTo @@ -388,10 +392,10 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-569 : If transaction object has unnecessary to field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-569 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" cannot be used with SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) it('CAVERJS-UNIT-TX-577: If data field of transaction is not 0x-hex prefixed, signTransaction should formatting and sign', async () => { @@ -423,14 +427,14 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-592: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-592: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...deployObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -442,13 +446,13 @@ describe('SMART_CONTRACT_DEPLOY transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-593: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-593: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { feePayerSignatures: [['0x01', '0x', '0x']], ...deployObject } const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-713: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/contractExecution.js b/test/transactionType/contractExecution.js index 9fa1e826..49f0ac78 100644 --- a/test/transactionType/contractExecution.js +++ b/test/transactionType/contractExecution.js @@ -26,7 +26,7 @@ let senderPrvKey let senderAddress let testAccount -describe('SMART_CONTRACT_EXECUTION transaction', () => { +describe('SMART_CONTRACT_EXECUTION transaction', async () => { let executionObject let contractAddress @@ -76,11 +76,11 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-467 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-467 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // MissingTo @@ -94,11 +94,11 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"to" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-468 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-468 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.to - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -112,11 +112,11 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-469 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-469 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingData @@ -130,11 +130,11 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"data" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-470 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-470 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.data - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') }).timeout(200000) // UnnecessaryFeePayer @@ -147,11 +147,13 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"feePayer" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-471 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-471 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...executionObject } // This error return from formatter. Because in formatter discriminate fee delegation through feePayer and senderRawTransaction - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feePayer" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"feePayer" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryFeeRatio @@ -164,10 +166,12 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-472 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-472 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"feeRatio" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryPublicKey @@ -184,14 +188,16 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"publicKey" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-473 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-473 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...executionObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"publicKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"publicKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryMultisig @@ -229,7 +235,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"multisig" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-474 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-474 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -257,7 +263,9 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { } const tx = { multisig, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"multisig" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"multisig" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -274,14 +282,14 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"roleTransactionKey" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-475 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-475 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleTransactionKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -300,14 +308,14 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"roleAccountUpdateKey" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-476 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-476 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -326,14 +334,16 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"roleFeePayerKey" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-477 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-477 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleFeePayerKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"roleFeePayerKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryFailKey @@ -346,10 +356,12 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-478 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-478 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"failKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"failKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryCodeFormat @@ -362,10 +374,12 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"codeFormat" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-479 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-479 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"codeFormat" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"codeFormat" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // UnnecessaryLegacyKey @@ -378,10 +392,12 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-480 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-480 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"legacyKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' + ) }).timeout(200000) // Invalid from address @@ -394,14 +410,14 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-594: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-594: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...executionObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -413,13 +429,13 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-595: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-595: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { feePayerSignatures: [['0x01', '0x', '0x']], ...executionObject } const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -433,7 +449,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-596: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-596: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...executionObject } tx.to = invalidTo @@ -441,7 +457,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-714: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/feeDelegatedAccountUpdate.js b/test/transactionType/feeDelegatedAccountUpdate.js index 4cb2fafd..0cdc0683 100644 --- a/test/transactionType/feeDelegatedAccountUpdate.js +++ b/test/transactionType/feeDelegatedAccountUpdate.js @@ -28,7 +28,7 @@ let senderAddress let payerAddress let testAccount -describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { +describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { let accountUpdateObject let publicKey let publicKey2 @@ -105,11 +105,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-265 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-265 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -122,10 +122,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-266 : If transaction object has to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-266 : If transaction object has to, sendTransaction should throw error', async () => { const tx = { publicKey, to: senderAddress, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // UnnecessaryValue @@ -138,10 +138,12 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-267 : If transaction object has value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-267 : If transaction object has value, sendTransaction should throw error', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' + ) }).timeout(200000) // MissingGas @@ -155,11 +157,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-268 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-268 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingKey @@ -172,10 +174,12 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-269 : If transaction object missing key information, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-269 : If transaction object missing key information, sendTransaction should throw error', async () => { const tx = { ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + 'Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE transaction' + ) }).timeout(200000) // PublicKey @@ -274,10 +278,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-275 : If transaction object has multisig and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-275 : If transaction object has multisig and publicKey, sendTransaction should throw error', async () => { const tx = { publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -329,10 +333,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-277 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-277 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -347,10 +351,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-278 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-278 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -365,10 +369,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-279 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-279 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -457,10 +461,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-282 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-282 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -475,10 +479,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-283 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-283 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -493,10 +497,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-284 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-284 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -511,10 +515,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-285 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-285 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -529,10 +533,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-286 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-286 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -553,7 +557,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-287 : If transaction object has roleAccountUpdateKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-287 : If transaction object has roleAccountUpdateKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -562,7 +566,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -728,10 +732,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-292 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-292 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -746,10 +750,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-293 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-293 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -764,10 +768,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-294 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-294 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -782,10 +786,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-295 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-295 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -800,10 +804,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-296 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-296 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -824,7 +828,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-297 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-297 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, @@ -833,7 +837,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -848,10 +852,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-298 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-298 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -866,10 +870,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-299 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-299 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -890,7 +894,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-300 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-300 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, @@ -899,7 +903,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -920,7 +924,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-301 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-301 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -929,7 +933,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -950,7 +954,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-302 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-302 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -959,7 +963,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -981,7 +985,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-303 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-303 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -991,7 +995,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1023,10 +1027,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-305 : If transaction object has failKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-305 : If transaction object has failKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1041,10 +1045,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-306 : If transaction object has failKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-306 : If transaction object has failKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1059,10 +1063,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-307 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-307 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1077,10 +1081,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-308 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-308 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1095,10 +1099,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-309 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-309 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1113,10 +1117,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-310 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-310 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1131,10 +1135,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-311 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-311 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1149,10 +1153,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-312 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-312 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1167,10 +1171,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-313 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-313 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1185,10 +1189,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-314 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-314 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1203,10 +1207,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-315 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-315 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1221,10 +1225,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-316 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-316 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1239,10 +1243,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-317 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-317 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1257,10 +1261,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-318 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-318 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1275,10 +1279,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-319 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-319 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1299,7 +1303,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-320 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-320 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1308,7 +1312,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1329,7 +1333,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-321 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-321 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1338,7 +1342,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1360,7 +1364,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-322 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-322 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1370,7 +1374,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1391,7 +1395,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-323 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-323 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1400,7 +1404,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1421,7 +1425,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-324 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-324 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1430,7 +1434,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1452,7 +1456,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-325 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-325 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1462,7 +1466,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1483,7 +1487,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-326 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-326 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1492,7 +1496,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1513,7 +1517,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-327 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-327 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1522,7 +1526,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1544,7 +1548,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-328 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-328 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1554,7 +1558,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1576,7 +1580,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-329 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-329 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1586,7 +1590,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1608,7 +1612,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-330 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-330 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1618,7 +1622,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1641,7 +1645,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-331 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-331 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1652,7 +1656,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1667,10 +1671,12 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-332 : If transaction object has data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-332 : If transaction object has data, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' + ) }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) @@ -1693,10 +1699,12 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-335 : If transaction object has feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-335 : If transaction object has feeRatio, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"feeRatio" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' + ) }).timeout(200000) // UnnecessaryCodeFormat @@ -1709,10 +1717,12 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-336 : If transaction object has codeFormat, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-336 : If transaction object has codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' + ) }).timeout(200000) // Update account with legacyKey @@ -1741,11 +1751,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-338 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-338 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1760,11 +1770,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-339 : If transaction object has legacyKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-339 : If transaction object has legacyKey and multisig, sendTransaction should throw error', async () => { const tx = { legacyKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1779,11 +1789,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-340 : If transaction object has legacyKey and failKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-340 : If transaction object has legacyKey and failKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, failKey: true, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1798,11 +1808,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-341 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-341 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1817,11 +1827,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-342 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-342 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1836,11 +1846,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { .catch(err => expect(err.message).to.equals('The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-343 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-343 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1855,14 +1865,14 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-597: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-597: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -1893,7 +1903,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -1926,7 +1936,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedAccountUpdateWithRatio.js b/test/transactionType/feeDelegatedAccountUpdateWithRatio.js index 36447fff..1b0e1a83 100644 --- a/test/transactionType/feeDelegatedAccountUpdateWithRatio.js +++ b/test/transactionType/feeDelegatedAccountUpdateWithRatio.js @@ -23,7 +23,7 @@ const Caver = require('../../index') let caver -describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { +describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { let accountUpdateObject let senderAddress @@ -108,11 +108,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-344 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-344 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -125,10 +125,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-345 : If transaction object has to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-345 : If transaction object has to, sendTransaction should throw error', async () => { const tx = { publicKey, to: senderAddress, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -143,10 +143,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-346 : If transaction object has value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-346 : If transaction object has value, sendTransaction should throw error', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -162,11 +162,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-347 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-347 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingKey @@ -179,10 +179,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-348 : If transaction object missing key information, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-348 : If transaction object missing key information, sendTransaction should throw error', async () => { const tx = { ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -285,10 +285,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-354 : If transaction object has multisig and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-354 : If transaction object has multisig and publicKey, sendTransaction should throw error', async () => { const tx = { publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -343,10 +343,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-356 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-356 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -363,10 +363,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-357 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-357 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -383,10 +383,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-358 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-358 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -479,10 +479,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-361 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-361 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -499,10 +499,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-362 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-362 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -519,10 +519,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-363 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-363 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -539,10 +539,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-364 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-364 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -559,10 +559,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-365 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-365 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -585,7 +585,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-366 : If transaction object has roleAccountUpdateKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-366 : If transaction object has roleAccountUpdateKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -594,7 +594,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -765,10 +765,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-371 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-371 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -785,10 +785,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-372 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-372 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -805,10 +805,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-373 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-373 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -825,10 +825,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-374 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-374 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -845,10 +845,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-375 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-375 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -871,7 +871,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-376 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-376 : If transaction object has roleFeePayerKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, @@ -880,7 +880,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -897,10 +897,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-377 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-377 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -917,10 +917,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-378 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-378 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -943,7 +943,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-379 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-379 : If transaction object has roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, @@ -952,7 +952,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -975,7 +975,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-380 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-380 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -984,7 +984,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1007,7 +1007,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-381 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-381 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -1016,7 +1016,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1040,7 +1040,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-382 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-382 : If transaction object has roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, @@ -1050,7 +1050,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1084,10 +1084,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-384 : If transaction object has failKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-384 : If transaction object has failKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1104,10 +1104,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-385 : If transaction object has failKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-385 : If transaction object has failKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1124,10 +1124,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-386 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-386 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1144,10 +1144,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-387 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-387 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1164,10 +1164,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-388 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-388 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1184,10 +1184,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-389 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-389 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1204,10 +1204,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-390 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-390 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1224,10 +1224,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-391 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-391 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1244,10 +1244,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-392 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-392 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1264,10 +1264,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-393 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-393 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1284,10 +1284,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-394 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-394 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1304,10 +1304,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-395 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-395 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1324,10 +1324,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-396 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-396 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1344,10 +1344,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-397 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-397 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1364,10 +1364,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-398 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-398 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1390,7 +1390,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-399 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-399 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1399,7 +1399,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1422,7 +1422,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-400 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-400 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1431,7 +1431,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1455,7 +1455,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-401 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-401 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1465,7 +1465,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1488,7 +1488,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-402 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-402 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1497,7 +1497,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1520,7 +1520,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-403 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-403 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1529,7 +1529,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1553,7 +1553,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-404 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-404 : If transaction object has failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1563,7 +1563,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1586,7 +1586,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-405 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-405 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1595,7 +1595,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1618,7 +1618,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-406 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-406 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1627,7 +1627,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1651,7 +1651,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-407 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-407 : If transaction object has failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, @@ -1661,7 +1661,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1685,7 +1685,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-408 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-408 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1695,7 +1695,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1719,7 +1719,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-409 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-409 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1729,7 +1729,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1754,7 +1754,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-410 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-410 : If transaction object has failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, @@ -1765,7 +1765,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ...accountUpdateObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1780,10 +1780,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-411 : If transaction object has data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-411 : If transaction object has data, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -1809,11 +1809,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-414 : If transaction object has feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-414 : If transaction object has feeRatio, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.feeRatio - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') }).timeout(200000) // UnnecessaryCodeFormat @@ -1828,10 +1828,10 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-415 : If transaction object has codeFormat, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-415 : If transaction object has codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -1864,11 +1864,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-417 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-417 : If transaction object has legacyKey and publicKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1885,11 +1885,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-418 : If transaction object has legacyKey and multisig, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-418 : If transaction object has legacyKey and multisig, sendTransaction should throw error', async () => { const tx = { legacyKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1906,11 +1906,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-419 : If transaction object has legacyKey and failKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-419 : If transaction object has legacyKey and failKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, failKey: true, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1927,11 +1927,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-420 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-420 : If transaction object has legacyKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1948,11 +1948,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-421 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-421 : If transaction object has legacyKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1969,11 +1969,11 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-422 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-422 : If transaction object has legacyKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { legacyKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1988,14 +1988,14 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-602: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-602: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { publicKey, ...accountUpdateObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -2026,7 +2026,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -2059,7 +2059,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedCancelTransaction.js b/test/transactionType/feeDelegatedCancelTransaction.js index 5fb45315..3df06aa8 100644 --- a/test/transactionType/feeDelegatedCancelTransaction.js +++ b/test/transactionType/feeDelegatedCancelTransaction.js @@ -45,7 +45,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_CANCEL transaction', () => { +describe('FEE_DELEGATED_CANCEL transaction', async () => { let cancelObject beforeEach(() => { @@ -67,11 +67,11 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-526 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-526 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -84,10 +84,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-527 : If transaction object has unnecessary to field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-527 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryValue @@ -100,10 +100,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"value" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-528 : If transaction object has unnecessary value field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-528 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // MissingGas @@ -117,11 +117,11 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-529 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-529 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // UnnecessaryData @@ -134,10 +134,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"data" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-530 : If transaction object has unnecessary data field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-530 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // MissingFeePayer @@ -162,10 +162,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-533 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-533 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -182,14 +182,14 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"publicKey" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-534 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-534 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...cancelObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"publicKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"publicKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryMultisig @@ -227,7 +227,7 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"multisig" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-535 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-535 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -255,7 +255,7 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { } const tx = { multisig, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"multisig" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"multisig" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -272,14 +272,16 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-536 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-536 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL transaction' + ) }).timeout(200000) // UnnecessaryRoleAccountUpdateKey @@ -296,14 +298,14 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-537 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-537 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL transaction' ) }).timeout(200000) @@ -322,14 +324,16 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-538 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-538 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL transaction' + ) }).timeout(200000) // UnnecessaryFailKey @@ -342,10 +346,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-539 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-539 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"failKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"failKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -358,10 +362,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"codeFormat" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-540 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-540 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"codeFormat" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"codeFormat" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -374,10 +378,10 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-541 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-541 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // Invalid from address @@ -390,14 +394,14 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-607: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-607: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...cancelObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -429,7 +433,7 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -463,7 +467,7 @@ describe('FEE_DELEGATED_CANCEL transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedCancelTransactionWithRatio.js b/test/transactionType/feeDelegatedCancelTransactionWithRatio.js index fb8e2610..c2d3b6c9 100644 --- a/test/transactionType/feeDelegatedCancelTransactionWithRatio.js +++ b/test/transactionType/feeDelegatedCancelTransactionWithRatio.js @@ -45,7 +45,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { +describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { let cancelObject beforeEach(() => { @@ -68,11 +68,11 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-542 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-542 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -85,10 +85,12 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-543 : If transaction object has unnecessary to field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-543 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"to" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' + ) }).timeout(200000) // UnnecessaryValue @@ -101,10 +103,12 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"value" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-544 : If transaction object has unnecessary value field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-544 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"value" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' + ) }).timeout(200000) // MissingGas @@ -118,11 +122,11 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-545 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-545 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // UnnecessaryData @@ -135,10 +139,12 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"data" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-546 : If transaction object has unnecessary data field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-546 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"data" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' + ) }).timeout(200000) // MissingFeePayer @@ -162,11 +168,11 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-549 : If transaction object missing feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-549 : If transaction object missing feeRatio, sendTransaction should throw error', async () => { const tx = { ...cancelObject } delete tx.feeRatio - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') }).timeout(200000) // UnnecessaryPublicKey @@ -183,14 +189,14 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"publicKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-550 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-550 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...cancelObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"publicKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -230,7 +236,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"multisig" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-551 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-551 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -258,7 +264,9 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { } const tx = { multisig, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"multisig" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"multisig" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' + ) }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -277,14 +285,14 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-552 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-552 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -305,14 +313,14 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-553 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-553 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -333,14 +341,14 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-554 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-554 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -355,10 +363,12 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-555 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-555 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"failKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"failKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' + ) }).timeout(200000) // UnnecessaryCodeFormat @@ -371,10 +381,10 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"codeFormat" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-556 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-556 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"codeFormat" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -389,10 +399,10 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-557 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-557 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -407,14 +417,14 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-612: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-612: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...cancelObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -445,7 +455,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -478,7 +488,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractDeploy.js b/test/transactionType/feeDelegatedContractDeploy.js index 08714f68..54e1851f 100644 --- a/test/transactionType/feeDelegatedContractDeploy.js +++ b/test/transactionType/feeDelegatedContractDeploy.js @@ -54,7 +54,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { +describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { let deployObject beforeEach(() => { @@ -79,11 +79,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-437 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-437 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // MissingValue @@ -97,11 +97,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"value" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-438 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-438 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.value - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -115,11 +115,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-439 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-439 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingData @@ -133,11 +133,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"data" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-440 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-440 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.data - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') }).timeout(200000) // InvalidCodeFormat @@ -150,10 +150,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('The codeFormat(InvalidCodeFormat) is invalid.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-441 : If transaction object has invalid codeFormat, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-441 : If transaction object has invalid codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'InvalidCodeFormat', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('The codeFormat(InvalidCodeFormat) is invalid.') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The codeFormat(InvalidCodeFormat) is invalid.') }).timeout(200000) // MissingFeePayer @@ -177,10 +177,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-444 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-444 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"feeRatio" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -199,14 +199,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-445 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-445 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...deployObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -246,7 +246,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-446 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-446 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -274,7 +274,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { } const tx = { multisig, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -295,14 +295,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-447 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-447 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -323,14 +323,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-448 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-448 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -351,14 +351,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-449 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-449 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -373,10 +373,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-450 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-450 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -391,10 +391,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-451 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-451 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -409,10 +409,12 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { .catch(err => expect(err.message).to.equals('"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-570 : If transaction object has unnecessary to field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-570 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' + ) }).timeout(200000) it('CAVERJS-UNIT-TX-579: If data field of transaction is not 0x-hex prefixed, signTransaction should formatting and sign', async () => { @@ -439,14 +441,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-617: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-617: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...deployObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -477,7 +479,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -510,7 +512,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractDeployWithRatio.js b/test/transactionType/feeDelegatedContractDeployWithRatio.js index a6dc7b02..12c06d4a 100644 --- a/test/transactionType/feeDelegatedContractDeployWithRatio.js +++ b/test/transactionType/feeDelegatedContractDeployWithRatio.js @@ -54,7 +54,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { +describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () => { let deployObject beforeEach(() => { @@ -80,11 +80,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-452 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-452 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // MissingValue @@ -98,11 +98,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"value" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-453 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-453 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.value - expect(() => caver.klay.sendTransaction(tx)).to.throws('"value" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -116,11 +116,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-454 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-454 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingData @@ -134,11 +134,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"data" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-455 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-455 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...deployObject } delete tx.data - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') }).timeout(200000) // InvalidCodeFormat @@ -151,10 +151,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('The codeFormat(InvalidCodeFormat) is invalid.')) }).timeout(200000) - it('CAVERJS-UNIT-TX-456 : If transaction object has invalid codeFormat, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-456 : If transaction object has invalid codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'InvalidCodeFormat', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('The codeFormat(InvalidCodeFormat) is invalid.') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The codeFormat(InvalidCodeFormat) is invalid.') }).timeout(200000) // MissingFeePayer @@ -179,11 +179,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { .catch(err => expect(err.message).to.equals('"feeRatio" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-459 : If transaction object missing feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-459 : If transaction object missing feeRatio field, sendTransaction should throw error', async () => { const tx = Object.assign(deployObject) delete tx.feeRatio - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') }).timeout(200000) // UnnecessaryPublicKey @@ -202,14 +202,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-460 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-460 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...deployObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -251,7 +251,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-461 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-461 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -279,7 +279,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { } const tx = { multisig, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -302,14 +302,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-462 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-462 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -332,14 +332,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-463 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-463 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -362,14 +362,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-464 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-464 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -386,10 +386,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-465 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-465 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -406,10 +406,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-466 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-466 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -426,10 +426,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-571 : If transaction object has unnecessary to field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-571 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -458,14 +458,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-622: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-622: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...deployObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -496,7 +496,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -529,7 +529,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractExecution.js b/test/transactionType/feeDelegatedContractExecution.js index b37f8e82..98796e5d 100644 --- a/test/transactionType/feeDelegatedContractExecution.js +++ b/test/transactionType/feeDelegatedContractExecution.js @@ -27,7 +27,7 @@ let senderPrvKey let payerPrvKey let testAccount -describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { +describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { let executionObject let contractAddress @@ -84,11 +84,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-481 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-481 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // MissingTo @@ -102,11 +102,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"to" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-482 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-482 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.to - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -120,11 +120,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-483 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-483 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingData @@ -138,11 +138,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"data" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-484 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-484 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.data - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') }).timeout(200000) // MissingFeePayer @@ -167,10 +167,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-487 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-487 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"feeRatio" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -191,14 +191,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-488 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-488 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...executionObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -240,7 +240,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-489 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-489 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -268,7 +268,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { } const tx = { multisig, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -289,14 +289,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-490 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-490 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -319,14 +319,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-491 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-491 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -347,14 +347,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-492 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-492 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -369,10 +369,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { .catch(err => expect(err.message).to.equals('"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-493 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-493 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -389,10 +389,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-494 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-494 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"codeFormat" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -409,10 +409,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-495 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-495 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -427,14 +427,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-627: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-627: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...executionObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -465,7 +465,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -498,7 +498,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -512,7 +512,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-630: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-630: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...executionObject } tx.to = invalidTo @@ -520,7 +520,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractExecutionWithRatio.js b/test/transactionType/feeDelegatedContractExecutionWithRatio.js index 25879013..a79151bf 100644 --- a/test/transactionType/feeDelegatedContractExecutionWithRatio.js +++ b/test/transactionType/feeDelegatedContractExecutionWithRatio.js @@ -27,7 +27,7 @@ let senderPrvKey let payerPrvKey let testAccount -describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => { +describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async () => { let executionObject let contractAddress @@ -85,11 +85,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => .catch(err => expect(err.message).to.equals('"from" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-496 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-496 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.from - expect(() => caver.klay.sendTransaction(tx)).to.throws('The send transactions "from" field must be defined!') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') }).timeout(200000) // MissingTo @@ -103,11 +103,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => .catch(err => expect(err.message).to.equals('"to" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-497 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-497 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.to - expect(() => caver.klay.sendTransaction(tx)).to.throws('"to" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -121,11 +121,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => .catch(err => expect(err.message).to.equals('"gas" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-498 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-498 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.gas - expect(() => caver.klay.sendTransaction(tx)).to.throws('"gas" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') }).timeout(200000) // MissingData @@ -139,11 +139,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => .catch(err => expect(err.message).to.equals('"data" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-499 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-499 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.data - expect(() => caver.klay.sendTransaction(tx)).to.throws('"data" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') }).timeout(200000) // MissingFeePayer @@ -167,11 +167,11 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => .catch(err => expect(err.message).to.equals('"feeRatio" is missing')) }).timeout(200000) - it('CAVERJS-UNIT-TX-502 : If transaction object missing feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-502 : If transaction object missing feeRatio, sendTransaction should throw error', async () => { const tx = { ...executionObject } delete tx.feeRatio - expect(() => caver.klay.sendTransaction(tx)).to.throws('"feeRatio" is missing') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') }).timeout(200000) // UnnecessaryPublicKey @@ -192,14 +192,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-503 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-503 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', ...executionObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -243,7 +243,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-504 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-504 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -271,7 +271,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => } const tx = { multisig, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -294,14 +294,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-505 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-505 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleTransactionKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -324,14 +324,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-506 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-506 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleAccountUpdateKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -354,14 +354,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-507 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-507 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', } const tx = { roleFeePayerKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -378,10 +378,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-508 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-508 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -400,10 +400,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-509 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-509 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"codeFormat" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -422,10 +422,10 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => ) }).timeout(200000) - it('CAVERJS-UNIT-TX-510 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-510 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -440,14 +440,14 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-633: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-633: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...executionObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -478,7 +478,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -511,7 +511,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -525,7 +525,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-636: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-636: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...executionObject } tx.to = invalidTo @@ -533,7 +533,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', () => const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransfer.js b/test/transactionType/feeDelegatedValueTransfer.js index 8badf3ab..c66f50d5 100644 --- a/test/transactionType/feeDelegatedValueTransfer.js +++ b/test/transactionType/feeDelegatedValueTransfer.js @@ -50,7 +50,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { +describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { let feeDelegatedValueTransferObject beforeEach(() => { @@ -97,12 +97,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-035 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-035 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error to missing @@ -118,12 +118,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-036 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-036 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } delete tx.to // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error value missing @@ -139,12 +139,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-037 : If transaction object missing value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-037 : If transaction object missing value, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } delete tx.value // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error gas and gasLimit missing @@ -160,16 +160,16 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-038 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-038 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-039 : If transaction object missing feePayer, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-039 : If transaction object missing feePayer, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(ret => { @@ -178,7 +178,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { }).timeout(200000) // Error senderRawTransaction missing (A check on the senderRawTransaction is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-040 : If transaction object missing senderRawTransaction, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-040 : If transaction object missing senderRawTransaction, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(() => { @@ -198,11 +198,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-041 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-041 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary publicKey @@ -221,7 +221,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-042 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-042 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -229,7 +229,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary multisig @@ -269,7 +269,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-043 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-043 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -298,7 +298,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const tx = { multisig, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -317,7 +317,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-044 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-044 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -325,7 +325,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -344,7 +344,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-045 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-045 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -352,7 +352,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -371,7 +371,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-046 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-046 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -379,7 +379,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary failKey @@ -394,11 +394,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-047 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-047 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary codeFormat @@ -413,11 +413,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-048 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-048 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary data @@ -434,13 +434,13 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-049 : If transaction object has unnecessary data field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-049 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const data = '0x6080604052348015600f57600080fd5b5060e98061001e6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063954ab4b2146044575b600080fd5b348015604f57600080fd5b5060566058565b005b7f90a042becc42ba1b13a5d545701bf5ceff20b24d9e5cc63b67f96ef814d80f0933604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15600a165627a7a723058200ebb53e9d575350ceb2d92263b7d4920888706b5221f024e7bbc10e3dbb8e18d0029' const tx = { data, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // UnnecessaryLegacyKey @@ -453,10 +453,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-560 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-560 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER transaction' + ) }).timeout(200000) // Invalid from address @@ -469,14 +471,14 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-639: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-639: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -507,7 +509,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -540,7 +542,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -554,7 +556,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-642: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-642: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...feeDelegatedValueTransferObject } tx.to = invalidTo @@ -562,7 +564,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransferMemo.js b/test/transactionType/feeDelegatedValueTransferMemo.js index 4c857957..41371e5c 100644 --- a/test/transactionType/feeDelegatedValueTransferMemo.js +++ b/test/transactionType/feeDelegatedValueTransferMemo.js @@ -50,7 +50,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { +describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { let feeDelegatedValueTransferMemoObject beforeEach(() => { @@ -98,12 +98,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-079 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-079 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error to missing @@ -120,12 +120,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-080 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-080 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } delete tx.to // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error value missing @@ -142,12 +142,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-081 : If transaction object missing value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-081 : If transaction object missing value, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } delete tx.value // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error gas and gasLimit missing @@ -164,12 +164,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-082 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-082 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error data missing @@ -186,16 +186,16 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-083 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-083 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } delete tx.data // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-084 : If transaction object missing feePayer, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-084 : If transaction object missing feePayer, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(ret => { @@ -204,7 +204,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { }).timeout(200000) // Error senderRawTransaction missing (A check on the senderRawTransaction is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-085 : If transaction object missing senderRawTransaction, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-085 : If transaction object missing senderRawTransaction, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(() => { @@ -225,11 +225,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-086 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-086 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary publicKey @@ -249,7 +249,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-087 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-087 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -257,7 +257,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary multisig @@ -298,7 +298,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-088 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-088 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -327,7 +327,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const tx = { multisig, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -347,7 +347,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-089 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-089 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -355,7 +355,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -375,7 +375,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-090 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-090 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -383,7 +383,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -403,7 +403,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-091 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-091 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -411,7 +411,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary failKey @@ -427,11 +427,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-092 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-092 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary codeFormat @@ -447,11 +447,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-093 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-093 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // UnnecessaryLegacyKey @@ -464,10 +464,10 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-563 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-563 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferMemoObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction' ) }).timeout(200000) @@ -482,14 +482,14 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-651: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-651: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -521,7 +521,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -554,7 +554,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -568,7 +568,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-654: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-654: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...feeDelegatedValueTransferMemoObject } tx.to = invalidTo @@ -576,7 +576,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js b/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js index 3fe52f5d..2b502546 100644 --- a/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js +++ b/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js @@ -50,7 +50,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { +describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => { let feeDelegatedValueTransferMemoWithRatioObject beforeEach(() => { @@ -99,12 +99,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-094 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-094 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error to missing @@ -121,12 +121,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-095 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-095 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } delete tx.to // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error value missing @@ -143,12 +143,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-096 : If transaction object missing value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-096 : If transaction object missing value, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } delete tx.value // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error gas and gasLimit missing @@ -165,12 +165,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-097 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-097 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error data missing @@ -187,16 +187,16 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-098 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-098 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } delete tx.data // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-099 : If transaction object missing feePayer, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-099 : If transaction object missing feePayer, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(ret => { @@ -205,7 +205,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { }).timeout(200000) // Error senderRawTransaction missing (A check on the senderRawTransaction is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-100 : If transaction object missing senderRawTransaction, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-100 : If transaction object missing senderRawTransaction, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(() => { @@ -227,12 +227,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-101 : If transaction object missing feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-101 : If transaction object missing feeRatio, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } delete tx.feeRatio // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary publicKey @@ -252,7 +252,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-102 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-102 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -260,7 +260,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary multisig @@ -301,7 +301,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-103 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-103 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -330,7 +330,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const tx = { multisig, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -350,7 +350,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-104 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-104 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -358,7 +358,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -378,7 +378,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-105 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-105 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -386,7 +386,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -406,7 +406,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-106 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-106 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -414,7 +414,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary failKey @@ -430,11 +430,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-107 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-107 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary codeFormat @@ -450,11 +450,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-108 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-108 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // UnnecessaryLegacyKey @@ -469,10 +469,10 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-564 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-564 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferMemoWithRatioObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction' ) }).timeout(200000) @@ -487,14 +487,14 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-657: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-657: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -526,7 +526,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -559,7 +559,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -573,7 +573,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-660: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-660: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...feeDelegatedValueTransferMemoWithRatioObject } tx.to = invalidTo @@ -581,7 +581,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransferWithRatio.js b/test/transactionType/feeDelegatedValueTransferWithRatio.js index dc3ed8b2..8b2f8a00 100644 --- a/test/transactionType/feeDelegatedValueTransferWithRatio.js +++ b/test/transactionType/feeDelegatedValueTransferWithRatio.js @@ -50,7 +50,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { +describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { let feeDelegatedValueTransferWithRatioObject beforeEach(() => { @@ -98,12 +98,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-050 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-050 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error to missing @@ -120,12 +120,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-051 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-051 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } delete tx.to // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error value missing @@ -142,12 +142,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-052 : If transaction object missing value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-052 : If transaction object missing value, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } delete tx.value // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error gas and gasLimit missing @@ -164,16 +164,16 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-053 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-053 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-054 : If transaction object missing feePayer, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-054 : If transaction object missing feePayer, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(ret => { @@ -182,7 +182,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { }).timeout(200000) // Error senderRawTransaction missing (A check on the senderRawTransaction is performed when the feePayer attempts to sign the rawTransaction after sender signed.) - it('CAVERJS-UNIT-TX-055 : If transaction object missing senderRawTransaction, signTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-055 : If transaction object missing senderRawTransaction, signTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } caver.klay.accounts.signTransaction(tx, senderPrvKey).then(() => { @@ -204,12 +204,12 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-056 : If transaction object missing feeRatio, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-056 : If transaction object missing feeRatio, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } delete tx.feeRatio // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary publicKey @@ -229,7 +229,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-057 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-057 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -237,7 +237,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary multisig @@ -278,7 +278,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-058 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-058 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -307,7 +307,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const tx = { multisig, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -327,7 +327,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-059 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-059 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -335,7 +335,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -355,7 +355,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-060 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-060 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -363,7 +363,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -383,7 +383,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-061 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-061 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -391,7 +391,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary failKey @@ -407,11 +407,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-062 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-062 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary codeFormat @@ -427,11 +427,11 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-063 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-063 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary data @@ -449,13 +449,13 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-064 : If transaction object has unnecessary data field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-064 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const data = '0x6080604052348015600f57600080fd5b5060e98061001e6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063954ab4b2146044575b600080fd5b348015604f57600080fd5b5060566058565b005b7f90a042becc42ba1b13a5d545701bf5ceff20b24d9e5cc63b67f96ef814d80f0933604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15600a165627a7a723058200ebb53e9d575350ceb2d92263b7d4920888706b5221f024e7bbc10e3dbb8e18d0029' const tx = { data, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // UnnecessaryLegacyKey @@ -470,10 +470,10 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { ) }).timeout(200000) - it('CAVERJS-UNIT-TX-561 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-561 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferWithRatioObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws( + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction' ) }).timeout(200000) @@ -488,14 +488,14 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-645: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-645: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...feeDelegatedValueTransferWithRatioObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -527,7 +527,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -560,7 +560,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -574,7 +574,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-648: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-648: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...feeDelegatedValueTransferWithRatioObject } tx.to = invalidTo @@ -582,7 +582,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/legacyTransaction.js b/test/transactionType/legacyTransaction.js index a63769d6..b4126b19 100644 --- a/test/transactionType/legacyTransaction.js +++ b/test/transactionType/legacyTransaction.js @@ -41,7 +41,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('LEGACY transaction', () => { +describe('LEGACY transaction', async () => { let legacyObject beforeEach(() => { @@ -93,12 +93,12 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-009 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-009 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...legacyObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error gas and gasLimit missing @@ -114,12 +114,12 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-010 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-010 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...legacyObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error to and data missing @@ -136,13 +136,13 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-011 : If transaction object missing to and data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-011 : If transaction object missing to and data, sendTransaction should throw error', async () => { const tx = { ...legacyObject } delete tx.to delete tx.data // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary feePayer @@ -157,11 +157,11 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-012 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-012 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary feeRatio @@ -176,11 +176,11 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-013 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-013 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary publicKey @@ -199,7 +199,7 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-014 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-014 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -207,7 +207,7 @@ describe('LEGACY transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary multisig @@ -247,7 +247,7 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-015 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-015 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -276,7 +276,7 @@ describe('LEGACY transaction', () => { const tx = { multisig, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -295,7 +295,7 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-016 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-016 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -303,7 +303,7 @@ describe('LEGACY transaction', () => { const tx = { roleTransactionKey, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -322,7 +322,7 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-017 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-017 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -330,7 +330,7 @@ describe('LEGACY transaction', () => { const tx = { roleAccountUpdateKey, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -349,7 +349,7 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-018 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-018 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -357,7 +357,7 @@ describe('LEGACY transaction', () => { const tx = { roleFeePayerKey, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary failKey @@ -372,11 +372,11 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-019 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-019 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary codeFormat @@ -391,11 +391,11 @@ describe('LEGACY transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-020 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-020 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // UnnecessaryLegacyKey @@ -408,11 +408,11 @@ describe('LEGACY transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with LEGACY transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-558 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-558 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...legacyObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with LEGACY transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with LEGACY transaction') }).timeout(200000) // Invalid from address @@ -425,14 +425,14 @@ describe('LEGACY transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-663: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-663: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...legacyObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -444,13 +444,13 @@ describe('LEGACY transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-664: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-664: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { feePayerSignatures: [['0x01', '0x', '0x']], ...legacyObject } const expectedError = '"feePayerSignatures" cannot be used with LEGACY transaction' // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -464,7 +464,7 @@ describe('LEGACY transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-665: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-665: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...legacyObject } tx.to = invalidTo @@ -472,6 +472,6 @@ describe('LEGACY transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) }) diff --git a/test/transactionType/valueTransfer.js b/test/transactionType/valueTransfer.js index 01efb759..d391f3a3 100644 --- a/test/transactionType/valueTransfer.js +++ b/test/transactionType/valueTransfer.js @@ -79,12 +79,12 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-021 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-021 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...valueTransferObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error to missing @@ -100,12 +100,12 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-022 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-022 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...valueTransferObject } delete tx.to // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error value missing @@ -121,12 +121,12 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-023 : If transaction object missing value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-023 : If transaction object missing value, sendTransaction should throw error', async () => { const tx = { ...valueTransferObject } delete tx.value // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error gas and gasLimit missing @@ -142,12 +142,12 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-024 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-024 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...valueTransferObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary feePayer @@ -162,11 +162,11 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-025 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-025 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary feeRatio @@ -181,11 +181,11 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-026 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-026 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary publicKey @@ -204,7 +204,7 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-027 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-027 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -212,7 +212,7 @@ describe('VALUE_TRANSFER transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary multisig @@ -252,7 +252,7 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-028 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-028 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -281,7 +281,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { multisig, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary roleTransactionKey @@ -300,7 +300,7 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-029 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-029 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -308,7 +308,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { roleTransactionKey, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -327,7 +327,7 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-030 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-030 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -335,7 +335,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { roleAccountUpdateKey, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -354,7 +354,7 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-031 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-031 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -362,7 +362,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { roleFeePayerKey, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary failKey @@ -377,11 +377,11 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-032 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-032 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary codeFormat @@ -396,11 +396,11 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-033 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-033 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // Error unnecessary data @@ -417,13 +417,13 @@ describe('VALUE_TRANSFER transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-034 : If transaction object has unnecessary data field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-034 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const data = '0x6080604052348015600f57600080fd5b5060e98061001e6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063954ab4b2146044575b600080fd5b348015604f57600080fd5b5060566058565b005b7f90a042becc42ba1b13a5d545701bf5ceff20b24d9e5cc63b67f96ef814d80f0933604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15600a165627a7a723058200ebb53e9d575350ceb2d92263b7d4920888706b5221f024e7bbc10e3dbb8e18d0029' const tx = { data, ...valueTransferObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejected }).timeout(200000) // UnnecessaryLegacyKey @@ -436,10 +436,10 @@ describe('VALUE_TRANSFER transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with VALUE_TRANSFER transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-559 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-559 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...valueTransferObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with VALUE_TRANSFER transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with VALUE_TRANSFER transaction') }).timeout(200000) // Invalid from address @@ -452,14 +452,14 @@ describe('VALUE_TRANSFER transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-666: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-666: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...valueTransferObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -468,16 +468,16 @@ describe('VALUE_TRANSFER transaction', () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` - await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-667: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-667: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { feePayerSignatures: [['0x01', '0x', '0x']], ...valueTransferObject } const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -491,7 +491,7 @@ describe('VALUE_TRANSFER transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-668: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-668: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...valueTransferObject } tx.to = invalidTo @@ -499,7 +499,7 @@ describe('VALUE_TRANSFER transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-727: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/valueTransferWithMemo.js b/test/transactionType/valueTransferWithMemo.js index 4abfdf54..de5aeb7c 100644 --- a/test/transactionType/valueTransferWithMemo.js +++ b/test/transactionType/valueTransferWithMemo.js @@ -41,7 +41,7 @@ before(() => { testAccount = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) }) -describe('VALUE_TRANSFER_MEMO transaction', () => { +describe('VALUE_TRANSFER_MEMO transaction', async () => { let valueTransferMemoObject beforeEach(() => { @@ -79,12 +79,12 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-065 : If transaction object missing from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-065 : If transaction object missing from, sendTransaction should throw error', async () => { const tx = { ...valueTransferMemoObject } delete tx.from // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error to missing @@ -100,12 +100,12 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-066 : If transaction object missing to, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-066 : If transaction object missing to, sendTransaction should throw error', async () => { const tx = { ...valueTransferMemoObject } delete tx.to // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error value missing @@ -121,12 +121,12 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-067 : If transaction object missing value, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-067 : If transaction object missing value, sendTransaction should throw error', async () => { const tx = { ...valueTransferMemoObject } delete tx.value // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error gas and gasLimit missing @@ -142,12 +142,12 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-068 : If transaction object missing gas and gasLimit, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-068 : If transaction object missing gas and gasLimit, sendTransaction should throw error', async () => { const tx = { ...valueTransferMemoObject } delete tx.gas // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error data missing @@ -163,12 +163,12 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-069 : If transaction object missing data, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-069 : If transaction object missing data, sendTransaction should throw error', async () => { const tx = { ...valueTransferMemoObject } delete tx.data // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary feePayer @@ -183,11 +183,11 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-070 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-070 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary feeRatio @@ -202,11 +202,11 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-071 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-071 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary publicKey @@ -225,7 +225,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-072 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-072 : If transaction object has unnecessary publicKey field, sendTransaction should throw error', async () => { const tx = { publicKey: '0x006dc19d50bbc8a8e4b0f26c0dd3e78978f5f691a6161c41e3b0e4d1aa2d60fad62f37912b59f484b2e05bd3c9c3b4d93b0ca570d6d4421eee544e7da99e9de4', @@ -233,7 +233,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary multisig @@ -273,7 +273,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-073 : If transaction object has unnecessary multisig field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-073 : If transaction object has unnecessary multisig field, sendTransaction should throw error', async () => { const multisig = { threshold: 3, keys: [ @@ -302,7 +302,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { const tx = { multisig, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -321,7 +321,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-074 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-074 : If transaction object has unnecessary roleTransactionKey field, sendTransaction should throw error', async () => { const roleTransactionKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -329,7 +329,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { const tx = { roleTransactionKey, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -348,7 +348,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-075 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-075 : If transaction object has unnecessary roleAccountUpdateKey field, sendTransaction should throw error', async () => { const roleAccountUpdateKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -356,7 +356,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { const tx = { roleAccountUpdateKey, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -375,7 +375,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-076 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-076 : If transaction object has unnecessary roleFeePayerKey field, sendTransaction should throw error', async () => { const roleFeePayerKey = { publicKey: '0xf4fa613bf44e5fa7505ad196605a1f32d3eb695f41916fb50f6c3ce65d345a059ebc2dc69629808c2a7c98eb0f2daad68f0b39f0a49141318fe59b777e6b8d1c', @@ -383,7 +383,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { const tx = { roleFeePayerKey, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary failKey @@ -398,11 +398,11 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-077 : If transaction object has unnecessary failKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-077 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // Error unnecessary codeFormat @@ -417,11 +417,11 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { expect(result).to.be.true }).timeout(200000) - it('CAVERJS-UNIT-TX-078 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-078 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...valueTransferMemoObject } // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws() + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() }).timeout(200000) // UnnecessaryLegacyKey @@ -434,10 +434,10 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { .catch(err => expect(err.message).to.equals('"legacyKey" cannot be used with VALUE_TRANSFER_MEMO transaction')) }).timeout(200000) - it('CAVERJS-UNIT-TX-562 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-562 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...valueTransferMemoObject } - expect(() => caver.klay.sendTransaction(tx)).to.throws('"legacyKey" cannot be used with VALUE_TRANSFER_MEMO transaction') + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with VALUE_TRANSFER_MEMO transaction') }).timeout(200000) // Invalid from address @@ -450,14 +450,14 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-669: If transaction object has invalid from, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-669: If transaction object has invalid from, sendTransaction should throw error', async () => { const tx = { ...valueTransferMemoObject } tx.from = 'invalidAddress' const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -469,13 +469,13 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, testAccount.privateKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-670: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-670: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const tx = { feePayerSignatures: [['0x01', '0x', '0x']], ...valueTransferMemoObject } const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) // InvalidTo @@ -489,7 +489,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { await expect(caver.klay.accounts.signTransaction(tx, senderPrvKey)).to.be.rejectedWith(expectedError) }).timeout(200000) - it('CAVERJS-UNIT-TX-671: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', () => { + it('CAVERJS-UNIT-TX-671: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { const invalidTo = 'invalid' const tx = { ...valueTransferMemoObject } tx.to = invalidTo @@ -497,7 +497,7 @@ describe('VALUE_TRANSFER_MEMO transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - expect(() => caver.klay.sendTransaction(tx)).to.throws(expectedError) + await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-728: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { From 2d3af9a5542b3a7634b019c8c2c5c6ad5e0f4787 Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Jul 2022 10:14:56 +0900 Subject: [PATCH 3/6] Use callback function in the method --- packages/caver-core-method/src/index.js | 62 +++++++++++++------------ 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/packages/caver-core-method/src/index.js b/packages/caver-core-method/src/index.js index fb631c98..48531240 100644 --- a/packages/caver-core-method/src/index.js +++ b/packages/caver-core-method/src/index.js @@ -449,7 +449,7 @@ const buildSendRequestFunc = (defer, sendSignedTx, sendTxCallback) => (payload, return method.requestManager.send(payload, sendTxCallback) } -const buildSendFunc = (method, isSendTx) => async (...args) => { +const buildSendFunc = (method, isSendTx) => (...args) => { const defer = utils.promiEvent(!isSendTx) const payload = method.toPayload(args) @@ -496,38 +496,42 @@ const buildSendFunc = (method, isSendTx) => async (...args) => { params: 0, }).createFunction(method.requestManager) - const header = await getHeader('latest') - const bf = utils.hexToNumber(header.baseFeePerGas || '0x0') - - // The baseFeePerGas is bigger than 0 means that Klaytn uses dynamic gas price. - if (bf > 0) { - if (!isDynamicFeeTx) { - payload.params[0].gasPrice = bf * 2 - } else { - // If maxFeePerGas is undefined, set maxFeePerGas with `baseFee * 2`. - payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || bf * 2 - // If maxPriorityFeePerGas is undefined, call `klay_maxPriorityFeePerGas`. - if (payload.params[0].maxPriorityFeePerGas === undefined) { - const maxPriorityFeePerGas = await getMaxPriorityFeePerGas() - payload.params[0].maxPriorityFeePerGas = maxPriorityFeePerGas + getHeader('latest', (err, header) => { + // Get baseFee(`baseFeePerGas`) from block header + const baseFee = utils.hexToNumber(header.baseFeePerGas || '0x0') + + // The baseFeePerGas is bigger than 0 means that Klaytn uses dynamic gas price. + if (baseFee > 0) { + if (!isDynamicFeeTx) { + payload.params[0].gasPrice = baseFee * 2 + } else { + // If maxFeePerGas is undefined, set maxFeePerGas with `baseFee * 2`. + payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || baseFee * 2 + // If maxPriorityFeePerGas is undefined, call `klay_maxPriorityFeePerGas`. + if (payload.params[0].maxPriorityFeePerGas === undefined) { + getMaxPriorityFeePerGas((err, maxPriorityFeePerGas) => { + payload.params[0].maxPriorityFeePerGas = maxPriorityFeePerGas + }) + } } - } - } else { - // If baseFeePerGas is not defined or 0, we need to use unit price for the `gasPrice` field. - const gp = await getGasPrice() - // The TxTypeEthereumDynamicFee transaction does not use the gasPrice field, - // so the gas price default is not set for TxTypeEthereumDynamicFee. - if (!isDynamicFeeTx) { - payload.params[0].gasPrice = payload.params[0].gasPrice || gp } else { - payload.params[0].maxPriorityFeePerGas = payload.params[0].maxPriorityFeePerGas || gp - payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || gp + // If baseFeePerGas is not defined or 0, we need to use unit price for the `gasPrice` field. + getGasPrice((err, gp) => { + // The TxTypeEthereumDynamicFee transaction does not use the gasPrice field, + // so the gas price default is not set for TxTypeEthereumDynamicFee. + if (!isDynamicFeeTx) { + payload.params[0].gasPrice = payload.params[0].gasPrice || gp + } else { + payload.params[0].maxPriorityFeePerGas = payload.params[0].maxPriorityFeePerGas || gp + payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || gp + } + }) } - } + // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) + formatGasParametersToHex(payload.params[0]) + sendRequest(payload, method) + }) - // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) - formatGasParametersToHex(payload.params[0]) - sendRequest(payload, method) /** * attaching `.on('receipt')` is possible by returning defer.eventEmitter */ From be40982150c0e7f212886d0f6c6bf9f5ca7e70a5 Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Jul 2022 11:02:00 +0900 Subject: [PATCH 4/6] Put SendRequest in the callback function --- packages/caver-core-method/src/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/caver-core-method/src/index.js b/packages/caver-core-method/src/index.js index 48531240..81240eda 100644 --- a/packages/caver-core-method/src/index.js +++ b/packages/caver-core-method/src/index.js @@ -509,14 +509,17 @@ const buildSendFunc = (method, isSendTx) => (...args) => { payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || baseFee * 2 // If maxPriorityFeePerGas is undefined, call `klay_maxPriorityFeePerGas`. if (payload.params[0].maxPriorityFeePerGas === undefined) { - getMaxPriorityFeePerGas((err, maxPriorityFeePerGas) => { + return getMaxPriorityFeePerGas((err, maxPriorityFeePerGas) => { payload.params[0].maxPriorityFeePerGas = maxPriorityFeePerGas + // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) + formatGasParametersToHex(payload.params[0]) + sendRequest(payload, method) }) } } } else { // If baseFeePerGas is not defined or 0, we need to use unit price for the `gasPrice` field. - getGasPrice((err, gp) => { + return getGasPrice((err, gp) => { // The TxTypeEthereumDynamicFee transaction does not use the gasPrice field, // so the gas price default is not set for TxTypeEthereumDynamicFee. if (!isDynamicFeeTx) { @@ -525,6 +528,9 @@ const buildSendFunc = (method, isSendTx) => (...args) => { payload.params[0].maxPriorityFeePerGas = payload.params[0].maxPriorityFeePerGas || gp payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || gp } + // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) + formatGasParametersToHex(payload.params[0]) + sendRequest(payload, method) }) } // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) From 3fa5eb1ae4fa0cd33a055e09420500f4ea7431bf Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Jul 2022 12:04:29 +0900 Subject: [PATCH 5/6] Rollback to original test code --- test/getTransactionReceipt.js | 4 +- test/transactionType/accountUpdate.js | 114 +++++++-------- test/transactionType/cancelTransaction.js | 34 ++--- test/transactionType/contractDeploy.js | 34 ++--- test/transactionType/contractExecution.js | 34 ++--- .../feeDelegatedAccountUpdate.js | 132 +++++++++--------- .../feeDelegatedAccountUpdateWithRatio.js | 132 +++++++++--------- .../feeDelegatedCancelTransaction.js | 34 ++--- .../feeDelegatedCancelTransactionWithRatio.js | 34 ++--- .../feeDelegatedContractDeploy.js | 34 ++--- .../feeDelegatedContractDeployWithRatio.js | 34 ++--- .../feeDelegatedContractExecution.js | 34 ++--- .../feeDelegatedContractExecutionWithRatio.js | 34 ++--- .../feeDelegatedValueTransfer.js | 36 ++--- .../feeDelegatedValueTransferMemo.js | 36 ++--- .../feeDelegatedValueTransferMemoWithRatio.js | 36 ++--- .../feeDelegatedValueTransferWithRatio.js | 36 ++--- test/transactionType/legacyTransaction.js | 32 ++--- test/transactionType/valueTransfer.js | 38 ++--- test/transactionType/valueTransferWithMemo.js | 36 ++--- 20 files changed, 469 insertions(+), 469 deletions(-) diff --git a/test/getTransactionReceipt.js b/test/getTransactionReceipt.js index 7813366a..1d711f0b 100644 --- a/test/getTransactionReceipt.js +++ b/test/getTransactionReceipt.js @@ -63,8 +63,8 @@ describe('get transaction receipt', () => { .catch(() => done()) }).timeout(100000) - it('should throw an error without parameter', async () => { - await expect(caver.klay.getTransactionReceipt()).to.be.rejected + it('should throw an error without parameter', () => { + expect(() => caver.klay.getTransactionReceipt()).to.throw() }).timeout(100000) it('CAVERJS-UNIT-TX-567 : After sending transction, getTransactionReceipt should return transaction infromation', async () => { diff --git a/test/transactionType/accountUpdate.js b/test/transactionType/accountUpdate.js index ab331a07..e056544c 100644 --- a/test/transactionType/accountUpdate.js +++ b/test/transactionType/accountUpdate.js @@ -103,7 +103,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryTo @@ -123,7 +123,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { publicKey, to: senderAddress, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryValue @@ -143,7 +143,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // MissingGas @@ -165,7 +165,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // MissingKey @@ -291,7 +291,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleTransactionKey. @@ -341,7 +341,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleTransactionKey and multisig. @@ -361,7 +361,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleTransactionKey, publicKey and multisig. @@ -381,7 +381,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleAccountUpdateKey. @@ -461,7 +461,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleAccountUpdateKey and multisig. @@ -481,7 +481,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleAccountUpdateKey, publicKey and multisig. @@ -501,7 +501,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleAccountUpdateKey, roleTransactionKey and publicKey. @@ -521,7 +521,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleAccountUpdateKey, roleTransactionKey and multisig. @@ -541,7 +541,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleAccountUpdateKey, roleTransactionKey, publicKey and multisig. @@ -573,7 +573,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey. @@ -717,7 +717,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey and multisig. @@ -737,7 +737,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, publicKey and multisig. @@ -757,7 +757,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey and publicKey. @@ -777,7 +777,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey and multisig. @@ -797,7 +797,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, publicKey and multisig. @@ -829,7 +829,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleAccountUpdateKey and publicKey. @@ -849,7 +849,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleAccountUpdateKey and multisig. @@ -869,7 +869,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleAccountUpdateKey, publicKey and multisig. @@ -901,7 +901,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and publicKey. @@ -933,7 +933,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey and multisig. @@ -965,7 +965,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with roleFeePayerKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig. @@ -999,7 +999,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey. @@ -1031,7 +1031,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey and multisig. @@ -1051,7 +1051,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, publicKey and multisig. @@ -1071,7 +1071,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey and roleTransactionKey. @@ -1091,7 +1091,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey and publicKey. @@ -1111,7 +1111,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey and multisig. @@ -1131,7 +1131,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, publicKey and multisig. @@ -1151,7 +1151,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey and roleAccountUpdateKey. @@ -1171,7 +1171,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleAccountUpdateKey and publicKey. @@ -1191,7 +1191,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleAccountUpdateKey and multisig. @@ -1211,7 +1211,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleAccountUpdateKey, publicKey and multisig. @@ -1231,7 +1231,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey and roleFeePayerKey. @@ -1251,7 +1251,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleFeePayerKey and publicKey. @@ -1271,7 +1271,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleFeePayerKey and multisig. @@ -1291,7 +1291,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleFeePayerKey, publicKey and multisig. @@ -1311,7 +1311,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey and publicKey. @@ -1343,7 +1343,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey and multisig. @@ -1375,7 +1375,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, publicKey and multisig. @@ -1409,7 +1409,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleFeePayerKey and publicKey. @@ -1441,7 +1441,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleFeePayerKey and multisig. @@ -1473,7 +1473,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleFeePayerKey, publicKey and multisig. @@ -1507,7 +1507,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleAccountUpdateKey, roleFeePayerKey and publicKey. @@ -1539,7 +1539,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleAccountUpdateKey, roleFeePayerKey and multisig. @@ -1571,7 +1571,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig. @@ -1605,7 +1605,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and publicKey. @@ -1639,7 +1639,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey and multisig. @@ -1673,7 +1673,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update with failKey, roleTransactionKey, roleAccountUpdateKey, roleFeePayerKey, publicKey and multisig. @@ -1709,7 +1709,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryData @@ -1729,7 +1729,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryFeePayer @@ -1749,7 +1749,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { feePayer: caver.klay.accounts.create().address, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryFeeRatio @@ -1769,7 +1769,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { feeRatio: 20, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryCodeFormat @@ -1789,7 +1789,7 @@ describe('ACCOUNT_UPDATE transaction', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Update account with legacyKey diff --git a/test/transactionType/cancelTransaction.js b/test/transactionType/cancelTransaction.js index 9fb799c8..9d75969c 100644 --- a/test/transactionType/cancelTransaction.js +++ b/test/transactionType/cancelTransaction.js @@ -67,7 +67,7 @@ describe('CANCEL transaction', async () => { const tx = { ...cancelObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -83,7 +83,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-512 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryValue @@ -99,7 +99,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-513 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" cannot be used with CANCEL transaction') }).timeout(200000) // MissingGas @@ -117,7 +117,7 @@ describe('CANCEL transaction', async () => { const tx = { ...cancelObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // UnnecessaryData @@ -133,7 +133,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-515 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryFeePayer @@ -149,7 +149,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-516 : If transaction object has unnecessary feePayer field, sendTransaction should throw error', async () => { const tx = { feePayer: testAccount.address, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feePayer" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feePayer" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryFeeRatio @@ -165,7 +165,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-517 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -189,7 +189,7 @@ describe('CANCEL transaction', async () => { ...cancelObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"publicKey" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"publicKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryMultisig @@ -255,7 +255,7 @@ describe('CANCEL transaction', async () => { } const tx = { multisig, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"multisig" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"multisig" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -279,7 +279,7 @@ describe('CANCEL transaction', async () => { } const tx = { roleTransactionKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"roleTransactionKey" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleTransactionKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryRoleAccountUpdateKey @@ -303,7 +303,7 @@ describe('CANCEL transaction', async () => { } const tx = { roleAccountUpdateKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"roleAccountUpdateKey" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleAccountUpdateKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryRoleFeePayerKey @@ -327,7 +327,7 @@ describe('CANCEL transaction', async () => { } const tx = { roleFeePayerKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"roleFeePayerKey" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleFeePayerKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryFailKey @@ -343,7 +343,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-523 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"failKey" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"failKey" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -359,7 +359,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-524 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"codeFormat" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"codeFormat" cannot be used with CANCEL transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -375,7 +375,7 @@ describe('CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-525 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with CANCEL transaction') }).timeout(200000) // Invalid from address @@ -395,7 +395,7 @@ describe('CANCEL transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -413,7 +413,7 @@ describe('CANCEL transaction', async () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-712: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/contractDeploy.js b/test/transactionType/contractDeploy.js index 3ebf1ef0..4b5192df 100644 --- a/test/transactionType/contractDeploy.js +++ b/test/transactionType/contractDeploy.js @@ -76,7 +76,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // MissingValue @@ -94,7 +94,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.value - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -112,7 +112,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingData @@ -130,7 +130,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.data - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" is missing') }).timeout(200000) // InvalidCodeFormat @@ -146,7 +146,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-427 : If transaction object has invalid codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'InvalidCodeFormat', ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The codeFormat(InvalidCodeFormat) is invalid.') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The codeFormat(InvalidCodeFormat) is invalid.') }).timeout(200000) // UnnecessaryFeePayer @@ -163,7 +163,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { feePayer: testAccount.address, ...deployObject } // This error return from formatter. Because in formatter discriminate fee delegation through feePayer and senderRawTransaction - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feePayer" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feePayer" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryFeeRatio @@ -179,7 +179,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-429 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -203,7 +203,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { ...deployObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"publicKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"publicKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryMultisig @@ -269,7 +269,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { multisig, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"multisig" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"multisig" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -293,7 +293,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleTransactionKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -319,7 +319,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleAccountUpdateKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -345,7 +345,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleFeePayerKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -363,7 +363,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-435 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"failKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"failKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -379,7 +379,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-436 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryTo @@ -395,7 +395,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-569 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with SMART_CONTRACT_DEPLOY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) it('CAVERJS-UNIT-TX-577: If data field of transaction is not 0x-hex prefixed, signTransaction should formatting and sign', async () => { @@ -434,7 +434,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -452,7 +452,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-713: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/contractExecution.js b/test/transactionType/contractExecution.js index 49f0ac78..53948078 100644 --- a/test/transactionType/contractExecution.js +++ b/test/transactionType/contractExecution.js @@ -80,7 +80,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // MissingTo @@ -98,7 +98,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.to - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -116,7 +116,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingData @@ -134,7 +134,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.data - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" is missing') }).timeout(200000) // UnnecessaryFeePayer @@ -151,7 +151,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { feePayer: testAccount.address, ...executionObject } // This error return from formatter. Because in formatter discriminate fee delegation through feePayer and senderRawTransaction - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"feePayer" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -169,7 +169,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-472 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"feeRatio" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -195,7 +195,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { ...executionObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"publicKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -263,7 +263,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { multisig, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"multisig" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -289,7 +289,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleTransactionKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -315,7 +315,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleAccountUpdateKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -341,7 +341,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleFeePayerKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -359,7 +359,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-478 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"failKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -377,7 +377,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-479 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"codeFormat" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -395,7 +395,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-480 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -417,7 +417,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -435,7 +435,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -457,7 +457,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-714: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/feeDelegatedAccountUpdate.js b/test/transactionType/feeDelegatedAccountUpdate.js index 0cdc0683..01323773 100644 --- a/test/transactionType/feeDelegatedAccountUpdate.js +++ b/test/transactionType/feeDelegatedAccountUpdate.js @@ -109,7 +109,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -125,7 +125,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-266 : If transaction object has to, sendTransaction should throw error', async () => { const tx = { publicKey, to: senderAddress, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // UnnecessaryValue @@ -141,7 +141,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-267 : If transaction object has value, sendTransaction should throw error', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' ) }).timeout(200000) @@ -161,7 +161,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingKey @@ -177,7 +177,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-269 : If transaction object missing key information, sendTransaction should throw error', async () => { const tx = { ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE transaction' ) }).timeout(200000) @@ -281,7 +281,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-275 : If transaction object has multisig and publicKey, sendTransaction should throw error', async () => { const tx = { publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -336,7 +336,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-277 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -354,7 +354,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-278 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -372,7 +372,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-279 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -464,7 +464,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-282 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -482,7 +482,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-283 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -500,7 +500,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-284 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -518,7 +518,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-285 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -536,7 +536,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-286 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -566,7 +566,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -735,7 +735,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-292 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -753,7 +753,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-293 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -771,7 +771,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-294 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -789,7 +789,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-295 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -807,7 +807,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-296 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -837,7 +837,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -855,7 +855,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-298 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -873,7 +873,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-299 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -903,7 +903,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -933,7 +933,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -963,7 +963,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -995,7 +995,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1030,7 +1030,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-305 : If transaction object has failKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1048,7 +1048,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-306 : If transaction object has failKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1066,7 +1066,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-307 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1084,7 +1084,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-308 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1102,7 +1102,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-309 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1120,7 +1120,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-310 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1138,7 +1138,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-311 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1156,7 +1156,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-312 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1174,7 +1174,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-313 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1192,7 +1192,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-314 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1210,7 +1210,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-315 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1228,7 +1228,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-316 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1246,7 +1246,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-317 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1264,7 +1264,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-318 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1282,7 +1282,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-319 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1312,7 +1312,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1342,7 +1342,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1374,7 +1374,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1404,7 +1404,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1434,7 +1434,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1466,7 +1466,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1496,7 +1496,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1526,7 +1526,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1558,7 +1558,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1590,7 +1590,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1622,7 +1622,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1656,7 +1656,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1674,7 +1674,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-332 : If transaction object has data, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' ) }).timeout(200000) @@ -1702,7 +1702,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-335 : If transaction object has feeRatio, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"feeRatio" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' ) }).timeout(200000) @@ -1720,7 +1720,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-336 : If transaction object has codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' ) }).timeout(200000) @@ -1755,7 +1755,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { legacyKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1774,7 +1774,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { legacyKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1793,7 +1793,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { legacyKey: true, failKey: true, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1812,7 +1812,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { legacyKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1831,7 +1831,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1850,7 +1850,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const tx = { legacyKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE is duplicated.' ) }).timeout(200000) @@ -1872,7 +1872,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -1903,7 +1903,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -1936,7 +1936,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedAccountUpdateWithRatio.js b/test/transactionType/feeDelegatedAccountUpdateWithRatio.js index 1b0e1a83..1c58560f 100644 --- a/test/transactionType/feeDelegatedAccountUpdateWithRatio.js +++ b/test/transactionType/feeDelegatedAccountUpdateWithRatio.js @@ -112,7 +112,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -128,7 +128,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-345 : If transaction object has to, sendTransaction should throw error', async () => { const tx = { publicKey, to: senderAddress, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"to" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -146,7 +146,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-346 : If transaction object has value, sendTransaction should throw error', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -166,7 +166,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingKey @@ -182,7 +182,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-348 : If transaction object missing key information, sendTransaction should throw error', async () => { const tx = { ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -288,7 +288,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-354 : If transaction object has multisig and publicKey, sendTransaction should throw error', async () => { const tx = { publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -346,7 +346,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-356 : If transaction object has roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -366,7 +366,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-357 : If transaction object has roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -386,7 +386,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-358 : If transaction object has roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -482,7 +482,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-361 : If transaction object has roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -502,7 +502,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-362 : If transaction object has roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -522,7 +522,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-363 : If transaction object has roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -542,7 +542,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-364 : If transaction object has roleAccountUpdateKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -562,7 +562,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-365 : If transaction object has roleAccountUpdateKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -594,7 +594,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -768,7 +768,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-371 : If transaction object has roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -788,7 +788,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-372 : If transaction object has roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -808,7 +808,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-373 : If transaction object has roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -828,7 +828,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-374 : If transaction object has roleFeePayerKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -848,7 +848,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-375 : If transaction object has roleFeePayerKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { roleTransactionKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -880,7 +880,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -900,7 +900,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-377 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -920,7 +920,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-378 : If transaction object has roleFeePayerKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { roleAccountUpdateKey: { publicKey }, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -952,7 +952,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -984,7 +984,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1016,7 +1016,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1050,7 +1050,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1087,7 +1087,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-384 : If transaction object has failKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1107,7 +1107,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-385 : If transaction object has failKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1127,7 +1127,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-386 : If transaction object has failKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1147,7 +1147,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-387 : If transaction object has failKey and roleTransactionKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1167,7 +1167,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-388 : If transaction object has failKey, roleTransactionKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1187,7 +1187,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-389 : If transaction object has failKey, roleTransactionKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1207,7 +1207,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-390 : If transaction object has failKey, roleTransactionKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleTransactionKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1227,7 +1227,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-391 : If transaction object has failKey and roleAccountUpdateKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1247,7 +1247,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-392 : If transaction object has failKey, roleAccountUpdateKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1267,7 +1267,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-393 : If transaction object has failKey, roleAccountUpdateKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1287,7 +1287,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-394 : If transaction object has failKey, roleAccountUpdateKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleAccountUpdateKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1307,7 +1307,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-395 : If transaction object has failKey and roleFeePayerKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1327,7 +1327,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-396 : If transaction object has failKey, roleFeePayerKey and publicKey, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1347,7 +1347,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-397 : If transaction object has failKey, roleFeePayerKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1367,7 +1367,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-398 : If transaction object has failKey, roleFeePayerKey, publicKey and multisig, sendTransaction should throw error', async () => { const tx = { failKey: true, roleFeePayerKey: { publicKey }, publicKey, multisig, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1399,7 +1399,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1431,7 +1431,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1465,7 +1465,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1497,7 +1497,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1529,7 +1529,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1563,7 +1563,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1595,7 +1595,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1627,7 +1627,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1661,7 +1661,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1695,7 +1695,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1729,7 +1729,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1765,7 +1765,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { ...accountUpdateObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1783,7 +1783,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-411 : If transaction object has data, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -1813,7 +1813,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { publicKey, ...accountUpdateObject } delete tx.feeRatio - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" is missing') }).timeout(200000) // UnnecessaryCodeFormat @@ -1831,7 +1831,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-415 : If transaction object has codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction' ) }).timeout(200000) @@ -1868,7 +1868,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { legacyKey: true, publicKey, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1889,7 +1889,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { legacyKey: true, multisig, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1910,7 +1910,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { legacyKey: true, failKey: true, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1931,7 +1931,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { legacyKey: true, roleTransactionKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1952,7 +1952,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { legacyKey: true, roleAccountUpdateKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1973,7 +1973,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const tx = { legacyKey: true, roleFeePayerKey: { publicKey }, ...accountUpdateObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( 'The key parameter to be used for FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO is duplicated.' ) }).timeout(200000) @@ -1995,7 +1995,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -2026,7 +2026,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -2059,7 +2059,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE_WITH_RATIO transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedCancelTransaction.js b/test/transactionType/feeDelegatedCancelTransaction.js index 3df06aa8..4c7b7e50 100644 --- a/test/transactionType/feeDelegatedCancelTransaction.js +++ b/test/transactionType/feeDelegatedCancelTransaction.js @@ -71,7 +71,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { const tx = { ...cancelObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -87,7 +87,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-527 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryValue @@ -103,7 +103,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-528 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // MissingGas @@ -121,7 +121,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { const tx = { ...cancelObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // UnnecessaryData @@ -137,7 +137,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-530 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // MissingFeePayer @@ -165,7 +165,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-533 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -189,7 +189,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { ...cancelObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"publicKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"publicKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryMultisig @@ -255,7 +255,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { multisig, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"multisig" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"multisig" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -279,7 +279,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { roleTransactionKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL transaction' ) }).timeout(200000) @@ -305,7 +305,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { roleAccountUpdateKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL transaction' ) }).timeout(200000) @@ -331,7 +331,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { roleFeePayerKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL transaction' ) }).timeout(200000) @@ -349,7 +349,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-539 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"failKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"failKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -365,7 +365,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-540 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"codeFormat" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"codeFormat" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -381,7 +381,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { it('CAVERJS-UNIT-TX-541 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // Invalid from address @@ -401,7 +401,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -433,7 +433,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -467,7 +467,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedCancelTransactionWithRatio.js b/test/transactionType/feeDelegatedCancelTransactionWithRatio.js index c2d3b6c9..a89e0259 100644 --- a/test/transactionType/feeDelegatedCancelTransactionWithRatio.js +++ b/test/transactionType/feeDelegatedCancelTransactionWithRatio.js @@ -72,7 +72,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { const tx = { ...cancelObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // UnnecessaryTo @@ -88,7 +88,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-543 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"to" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -106,7 +106,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-544 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"value" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -126,7 +126,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { const tx = { ...cancelObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // UnnecessaryData @@ -142,7 +142,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-546 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"data" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -172,7 +172,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { const tx = { ...cancelObject } delete tx.feeRatio - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" is missing') }).timeout(200000) // UnnecessaryPublicKey @@ -196,7 +196,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { ...cancelObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"publicKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -264,7 +264,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { } const tx = { multisig, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"multisig" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -292,7 +292,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { } const tx = { roleTransactionKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -320,7 +320,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { } const tx = { roleAccountUpdateKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -348,7 +348,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { } const tx = { roleFeePayerKey, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -366,7 +366,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-555 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"failKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -384,7 +384,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-556 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"codeFormat" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -402,7 +402,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-557 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' ) }).timeout(200000) @@ -424,7 +424,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -455,7 +455,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -488,7 +488,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractDeploy.js b/test/transactionType/feeDelegatedContractDeploy.js index 54e1851f..c43606f4 100644 --- a/test/transactionType/feeDelegatedContractDeploy.js +++ b/test/transactionType/feeDelegatedContractDeploy.js @@ -83,7 +83,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // MissingValue @@ -101,7 +101,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.value - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -119,7 +119,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingData @@ -137,7 +137,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const tx = { ...deployObject } delete tx.data - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" is missing') }).timeout(200000) // InvalidCodeFormat @@ -153,7 +153,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-441 : If transaction object has invalid codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'InvalidCodeFormat', ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The codeFormat(InvalidCodeFormat) is invalid.') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The codeFormat(InvalidCodeFormat) is invalid.') }).timeout(200000) // MissingFeePayer @@ -180,7 +180,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-444 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"feeRatio" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -206,7 +206,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { ...deployObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -274,7 +274,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { multisig, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -302,7 +302,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleTransactionKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -330,7 +330,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleAccountUpdateKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -358,7 +358,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleFeePayerKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -376,7 +376,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-450 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -394,7 +394,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-451 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -412,7 +412,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-570 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' ) }).timeout(200000) @@ -448,7 +448,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -479,7 +479,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -512,7 +512,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractDeployWithRatio.js b/test/transactionType/feeDelegatedContractDeployWithRatio.js index 12c06d4a..90cae1be 100644 --- a/test/transactionType/feeDelegatedContractDeployWithRatio.js +++ b/test/transactionType/feeDelegatedContractDeployWithRatio.js @@ -84,7 +84,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const tx = { ...deployObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // MissingValue @@ -102,7 +102,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const tx = { ...deployObject } delete tx.value - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"value" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -120,7 +120,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const tx = { ...deployObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingData @@ -138,7 +138,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const tx = { ...deployObject } delete tx.data - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" is missing') }).timeout(200000) // InvalidCodeFormat @@ -154,7 +154,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () it('CAVERJS-UNIT-TX-456 : If transaction object has invalid codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'InvalidCodeFormat', ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The codeFormat(InvalidCodeFormat) is invalid.') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The codeFormat(InvalidCodeFormat) is invalid.') }).timeout(200000) // MissingFeePayer @@ -183,7 +183,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const tx = Object.assign(deployObject) delete tx.feeRatio - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" is missing') }).timeout(200000) // UnnecessaryPublicKey @@ -209,7 +209,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () ...deployObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -279,7 +279,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () } const tx = { multisig, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -309,7 +309,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () } const tx = { roleTransactionKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -339,7 +339,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () } const tx = { roleAccountUpdateKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -369,7 +369,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () } const tx = { roleFeePayerKey, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -389,7 +389,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () it('CAVERJS-UNIT-TX-465 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -409,7 +409,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () it('CAVERJS-UNIT-TX-466 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -429,7 +429,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () it('CAVERJS-UNIT-TX-571 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction' ) }).timeout(200000) @@ -465,7 +465,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -496,7 +496,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -529,7 +529,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY_WITH_RATIO transaction', async () const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractExecution.js b/test/transactionType/feeDelegatedContractExecution.js index 98796e5d..c6e57413 100644 --- a/test/transactionType/feeDelegatedContractExecution.js +++ b/test/transactionType/feeDelegatedContractExecution.js @@ -88,7 +88,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // MissingTo @@ -106,7 +106,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.to - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -124,7 +124,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingData @@ -142,7 +142,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { ...executionObject } delete tx.data - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" is missing') }).timeout(200000) // MissingFeePayer @@ -170,7 +170,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-487 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"feeRatio" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -198,7 +198,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { ...executionObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -268,7 +268,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { multisig, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -296,7 +296,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleTransactionKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -326,7 +326,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleAccountUpdateKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -354,7 +354,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleFeePayerKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -372,7 +372,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-493 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -392,7 +392,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-494 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"codeFormat" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -412,7 +412,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-495 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction' ) }).timeout(200000) @@ -434,7 +434,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -465,7 +465,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -498,7 +498,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -520,7 +520,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedContractExecutionWithRatio.js b/test/transactionType/feeDelegatedContractExecutionWithRatio.js index a79151bf..d90ee793 100644 --- a/test/transactionType/feeDelegatedContractExecutionWithRatio.js +++ b/test/transactionType/feeDelegatedContractExecutionWithRatio.js @@ -89,7 +89,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const tx = { ...executionObject } delete tx.from - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('The send transactions "from" field must be defined!') + expect(() => caver.klay.sendTransaction(tx)).to.throw('The send transactions "from" field must be defined!') }).timeout(200000) // MissingTo @@ -107,7 +107,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const tx = { ...executionObject } delete tx.to - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"to" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" is missing') }).timeout(200000) // Missing gas and gasLimit @@ -125,7 +125,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const tx = { ...executionObject } delete tx.gas - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"gas" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"gas" is missing') }).timeout(200000) // MissingData @@ -143,7 +143,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const tx = { ...executionObject } delete tx.data - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"data" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" is missing') }).timeout(200000) // MissingFeePayer @@ -171,7 +171,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const tx = { ...executionObject } delete tx.feeRatio - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"feeRatio" is missing') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" is missing') }).timeout(200000) // UnnecessaryPublicKey @@ -199,7 +199,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async ...executionObject, } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"publicKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -271,7 +271,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async } const tx = { multisig, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"multisig" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -301,7 +301,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async } const tx = { roleTransactionKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleTransactionKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -331,7 +331,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async } const tx = { roleAccountUpdateKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -361,7 +361,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async } const tx = { roleFeePayerKey, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"roleFeePayerKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -381,7 +381,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async it('CAVERJS-UNIT-TX-508 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"failKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -403,7 +403,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async it('CAVERJS-UNIT-TX-509 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"codeFormat" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -425,7 +425,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async it('CAVERJS-UNIT-TX-510 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction' ) }).timeout(200000) @@ -447,7 +447,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -478,7 +478,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -511,7 +511,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -533,7 +533,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_EXECUTION_WITH_RATIO transaction', async const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransfer.js b/test/transactionType/feeDelegatedValueTransfer.js index c66f50d5..2e4c672c 100644 --- a/test/transactionType/feeDelegatedValueTransfer.js +++ b/test/transactionType/feeDelegatedValueTransfer.js @@ -102,7 +102,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error to missing @@ -123,7 +123,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { delete tx.to // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error value missing @@ -144,7 +144,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { delete tx.value // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error gas and gasLimit missing @@ -165,7 +165,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) @@ -202,7 +202,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { feeRatio: 20, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary publicKey @@ -229,7 +229,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary multisig @@ -298,7 +298,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { multisig, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -325,7 +325,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -352,7 +352,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -379,7 +379,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary failKey @@ -398,7 +398,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary codeFormat @@ -417,7 +417,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary data @@ -440,7 +440,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const tx = { data, ...feeDelegatedValueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // UnnecessaryLegacyKey @@ -456,7 +456,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { it('CAVERJS-UNIT-TX-560 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER transaction' ) }).timeout(200000) @@ -478,7 +478,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -509,7 +509,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -542,7 +542,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -564,7 +564,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransferMemo.js b/test/transactionType/feeDelegatedValueTransferMemo.js index 41371e5c..ca85459e 100644 --- a/test/transactionType/feeDelegatedValueTransferMemo.js +++ b/test/transactionType/feeDelegatedValueTransferMemo.js @@ -103,7 +103,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error to missing @@ -125,7 +125,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { delete tx.to // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error value missing @@ -147,7 +147,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { delete tx.value // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error gas and gasLimit missing @@ -169,7 +169,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error data missing @@ -191,7 +191,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { delete tx.data // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) @@ -229,7 +229,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { feeRatio: 20, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary publicKey @@ -257,7 +257,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary multisig @@ -327,7 +327,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { multisig, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -355,7 +355,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -383,7 +383,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -411,7 +411,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary failKey @@ -431,7 +431,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary codeFormat @@ -451,7 +451,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // UnnecessaryLegacyKey @@ -467,7 +467,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { it('CAVERJS-UNIT-TX-563 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferMemoObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction' ) }).timeout(200000) @@ -489,7 +489,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -521,7 +521,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -554,7 +554,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -576,7 +576,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js b/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js index 2b502546..77d67e36 100644 --- a/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js +++ b/test/transactionType/feeDelegatedValueTransferMemoWithRatio.js @@ -104,7 +104,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error to missing @@ -126,7 +126,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => delete tx.to // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error value missing @@ -148,7 +148,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => delete tx.value // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error gas and gasLimit missing @@ -170,7 +170,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error data missing @@ -192,7 +192,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => delete tx.data // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) @@ -232,7 +232,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => delete tx.feeRatio // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary publicKey @@ -260,7 +260,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary multisig @@ -330,7 +330,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const tx = { multisig, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -358,7 +358,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const tx = { roleTransactionKey, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -386,7 +386,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -414,7 +414,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const tx = { roleFeePayerKey, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary failKey @@ -434,7 +434,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const tx = { failKey: true, ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary codeFormat @@ -454,7 +454,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferMemoWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // UnnecessaryLegacyKey @@ -472,7 +472,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => it('CAVERJS-UNIT-TX-564 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferMemoWithRatioObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction' ) }).timeout(200000) @@ -494,7 +494,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -526,7 +526,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -559,7 +559,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -581,7 +581,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_MEMO_WITH_RATIO transaction', async () => const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/feeDelegatedValueTransferWithRatio.js b/test/transactionType/feeDelegatedValueTransferWithRatio.js index 8b2f8a00..8ed3903c 100644 --- a/test/transactionType/feeDelegatedValueTransferWithRatio.js +++ b/test/transactionType/feeDelegatedValueTransferWithRatio.js @@ -103,7 +103,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error to missing @@ -125,7 +125,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { delete tx.to // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error value missing @@ -147,7 +147,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { delete tx.value // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error gas and gasLimit missing @@ -169,7 +169,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) @@ -209,7 +209,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { delete tx.feeRatio // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary publicKey @@ -237,7 +237,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary multisig @@ -307,7 +307,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { multisig, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -335,7 +335,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { roleTransactionKey, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -363,7 +363,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { roleAccountUpdateKey, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -391,7 +391,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { roleFeePayerKey, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary failKey @@ -411,7 +411,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { failKey: true, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary codeFormat @@ -431,7 +431,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { codeFormat: 'EVM', ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary data @@ -455,7 +455,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const tx = { data, ...feeDelegatedValueTransferWithRatioObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // UnnecessaryLegacyKey @@ -473,7 +473,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-561 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferWithRatioObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith( + expect(() => caver.klay.sendTransaction(tx)).to.throw( '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction' ) }).timeout(200000) @@ -495,7 +495,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error feePayer missing when feePayerSignatures is defined in transaction object @@ -527,7 +527,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const expectedError = '"feePayer" is missing: feePayer must be defined with feePayerSignatures.' // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error with invalid feePayer missing when feePayerSignatures is defined in transaction object @@ -560,7 +560,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const expectedError = `Invalid address of fee payer: ${invalidFeePayer}` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -582,7 +582,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER_WITH_RATIO transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // Error when feePayer is not defined with fee payer transaction format diff --git a/test/transactionType/legacyTransaction.js b/test/transactionType/legacyTransaction.js index b4126b19..1fca3b9b 100644 --- a/test/transactionType/legacyTransaction.js +++ b/test/transactionType/legacyTransaction.js @@ -98,7 +98,7 @@ describe('LEGACY transaction', async () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error gas and gasLimit missing @@ -119,7 +119,7 @@ describe('LEGACY transaction', async () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error to and data missing @@ -142,7 +142,7 @@ describe('LEGACY transaction', async () => { delete tx.data // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary feePayer @@ -161,7 +161,7 @@ describe('LEGACY transaction', async () => { const tx = { feePayer: testAccount.address, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary feeRatio @@ -180,7 +180,7 @@ describe('LEGACY transaction', async () => { const tx = { feeRatio: 20, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary publicKey @@ -207,7 +207,7 @@ describe('LEGACY transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary multisig @@ -276,7 +276,7 @@ describe('LEGACY transaction', async () => { const tx = { multisig, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -303,7 +303,7 @@ describe('LEGACY transaction', async () => { const tx = { roleTransactionKey, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -330,7 +330,7 @@ describe('LEGACY transaction', async () => { const tx = { roleAccountUpdateKey, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -357,7 +357,7 @@ describe('LEGACY transaction', async () => { const tx = { roleFeePayerKey, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary failKey @@ -376,7 +376,7 @@ describe('LEGACY transaction', async () => { const tx = { failKey: true, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary codeFormat @@ -395,7 +395,7 @@ describe('LEGACY transaction', async () => { const tx = { codeFormat: 'EVM', ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // UnnecessaryLegacyKey @@ -412,7 +412,7 @@ describe('LEGACY transaction', async () => { const tx = { legacyKey: true, ...legacyObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with LEGACY transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with LEGACY transaction') }).timeout(200000) // Invalid from address @@ -432,7 +432,7 @@ describe('LEGACY transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -450,7 +450,7 @@ describe('LEGACY transaction', async () => { const expectedError = '"feePayerSignatures" cannot be used with LEGACY transaction' // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -472,6 +472,6 @@ describe('LEGACY transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) }) diff --git a/test/transactionType/valueTransfer.js b/test/transactionType/valueTransfer.js index d391f3a3..169ecf64 100644 --- a/test/transactionType/valueTransfer.js +++ b/test/transactionType/valueTransfer.js @@ -84,7 +84,7 @@ describe('VALUE_TRANSFER transaction', () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error to missing @@ -105,7 +105,7 @@ describe('VALUE_TRANSFER transaction', () => { delete tx.to // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error value missing @@ -126,7 +126,7 @@ describe('VALUE_TRANSFER transaction', () => { delete tx.value // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error gas and gasLimit missing @@ -147,7 +147,7 @@ describe('VALUE_TRANSFER transaction', () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary feePayer @@ -166,7 +166,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { feePayer: testAccount.address, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary feeRatio @@ -185,7 +185,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { feeRatio: 20, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary publicKey @@ -212,7 +212,7 @@ describe('VALUE_TRANSFER transaction', () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary multisig @@ -281,7 +281,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { multisig, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary roleTransactionKey @@ -308,7 +308,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { roleTransactionKey, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -335,7 +335,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { roleAccountUpdateKey, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -362,7 +362,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { roleFeePayerKey, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary failKey @@ -381,7 +381,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { failKey: true, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary codeFormat @@ -400,7 +400,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { codeFormat: 'EVM', ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // Error unnecessary data @@ -423,7 +423,7 @@ describe('VALUE_TRANSFER transaction', () => { const tx = { data, ...valueTransferObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejected + expect(() => caver.klay.sendTransaction(tx)).to.throw }).timeout(200000) // UnnecessaryLegacyKey @@ -439,7 +439,7 @@ describe('VALUE_TRANSFER transaction', () => { it('CAVERJS-UNIT-TX-559 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...valueTransferObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with VALUE_TRANSFER transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with VALUE_TRANSFER transaction') }).timeout(200000) // Invalid from address @@ -459,7 +459,7 @@ describe('VALUE_TRANSFER transaction', () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -468,7 +468,7 @@ describe('VALUE_TRANSFER transaction', () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-667: If transaction object has unnecessary feePayerSignatures, sendTransaction should throw error', async () => { @@ -477,7 +477,7 @@ describe('VALUE_TRANSFER transaction', () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -499,7 +499,7 @@ describe('VALUE_TRANSFER transaction', () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-727: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { diff --git a/test/transactionType/valueTransferWithMemo.js b/test/transactionType/valueTransferWithMemo.js index de5aeb7c..9c15b92d 100644 --- a/test/transactionType/valueTransferWithMemo.js +++ b/test/transactionType/valueTransferWithMemo.js @@ -84,7 +84,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { delete tx.from // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error to missing @@ -105,7 +105,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { delete tx.to // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error value missing @@ -126,7 +126,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { delete tx.value // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error gas and gasLimit missing @@ -147,7 +147,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { delete tx.gas // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error data missing @@ -168,7 +168,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { delete tx.data // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary feePayer @@ -187,7 +187,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { feePayer: testAccount.address, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary feeRatio @@ -206,7 +206,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { feeRatio: 20, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary publicKey @@ -233,7 +233,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary multisig @@ -302,7 +302,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { multisig, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleTransactionKey @@ -329,7 +329,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { roleTransactionKey, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleAccountUpdateKey @@ -356,7 +356,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { roleAccountUpdateKey, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary roleFeePayerKey @@ -383,7 +383,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { roleFeePayerKey, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary failKey @@ -402,7 +402,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { failKey: true, ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // Error unnecessary codeFormat @@ -421,7 +421,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const tx = { codeFormat: 'EVM', ...valueTransferMemoObject } // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith() + expect(() => caver.klay.sendTransaction(tx)).to.throw() }).timeout(200000) // UnnecessaryLegacyKey @@ -437,7 +437,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { it('CAVERJS-UNIT-TX-562 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...valueTransferMemoObject } - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith('"legacyKey" cannot be used with VALUE_TRANSFER_MEMO transaction') + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with VALUE_TRANSFER_MEMO transaction') }).timeout(200000) // Invalid from address @@ -457,7 +457,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = `Provided address "${tx.from}" is invalid, the capitalization checksum test failed` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // UnnecessaryFeePayerSignatures @@ -475,7 +475,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = `"feePayerSignatures" cannot be used with ${tx.type} transaction` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) // InvalidTo @@ -497,7 +497,7 @@ describe('VALUE_TRANSFER_MEMO transaction', async () => { const expectedError = `Provided address "${tx.to}" is invalid, the capitalization checksum test failed.` // Throw error from formatter validation - await expect(caver.klay.sendTransaction(tx)).to.be.rejectedWith(expectedError) + expect(() => caver.klay.sendTransaction(tx)).to.throw(expectedError) }).timeout(200000) it('CAVERJS-UNIT-TX-728: sendTransaction should throw error when try to use an account in Node with not LEGACY transaction', async () => { From 8abe34ad2782bd9f677e0a62336972dbfe9affde Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 8 Jul 2022 12:42:41 +0900 Subject: [PATCH 6/6] Fixed lint error --- packages/caver-core-method/src/index.js | 4 +-- test/transactionType/contractDeploy.js | 8 ++--- test/transactionType/contractExecution.js | 32 +++++-------------- .../feeDelegatedAccountUpdate.js | 20 +++--------- .../feeDelegatedCancelTransaction.js | 12 ++----- .../feeDelegatedCancelTransactionWithRatio.js | 28 ++++------------ .../feeDelegatedContractDeploy.js | 4 +-- .../feeDelegatedValueTransfer.js | 4 +-- 8 files changed, 29 insertions(+), 83 deletions(-) diff --git a/packages/caver-core-method/src/index.js b/packages/caver-core-method/src/index.js index 81240eda..175ec39c 100644 --- a/packages/caver-core-method/src/index.js +++ b/packages/caver-core-method/src/index.js @@ -509,7 +509,7 @@ const buildSendFunc = (method, isSendTx) => (...args) => { payload.params[0].maxFeePerGas = payload.params[0].maxFeePerGas || baseFee * 2 // If maxPriorityFeePerGas is undefined, call `klay_maxPriorityFeePerGas`. if (payload.params[0].maxPriorityFeePerGas === undefined) { - return getMaxPriorityFeePerGas((err, maxPriorityFeePerGas) => { + return getMaxPriorityFeePerGas((e, maxPriorityFeePerGas) => { payload.params[0].maxPriorityFeePerGas = maxPriorityFeePerGas // Format gas price parameters(gasPrice, maxPriorityFeePerGas, maxFeePerGas) formatGasParametersToHex(payload.params[0]) @@ -519,7 +519,7 @@ const buildSendFunc = (method, isSendTx) => (...args) => { } } else { // If baseFeePerGas is not defined or 0, we need to use unit price for the `gasPrice` field. - return getGasPrice((err, gp) => { + return getGasPrice((e, gp) => { // The TxTypeEthereumDynamicFee transaction does not use the gasPrice field, // so the gas price default is not set for TxTypeEthereumDynamicFee. if (!isDynamicFeeTx) { diff --git a/test/transactionType/contractDeploy.js b/test/transactionType/contractDeploy.js index 4b5192df..472fa5d2 100644 --- a/test/transactionType/contractDeploy.js +++ b/test/transactionType/contractDeploy.js @@ -293,9 +293,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleTransactionKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"roleTransactionKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleTransactionKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryRoleAccountUpdateKey @@ -345,9 +343,7 @@ describe('SMART_CONTRACT_DEPLOY transaction', async () => { } const tx = { roleFeePayerKey, ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"roleFeePayerKey" cannot be used with SMART_CONTRACT_DEPLOY transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleFeePayerKey" cannot be used with SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) // UnnecessaryFailKey diff --git a/test/transactionType/contractExecution.js b/test/transactionType/contractExecution.js index 53948078..b18fe36f 100644 --- a/test/transactionType/contractExecution.js +++ b/test/transactionType/contractExecution.js @@ -151,9 +151,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { const tx = { feePayer: testAccount.address, ...executionObject } // This error return from formatter. Because in formatter discriminate fee delegation through feePayer and senderRawTransaction - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"feePayer" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feePayer" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryFeeRatio @@ -169,9 +167,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-472 : If transaction object has unnecessary feeRatio field, sendTransaction should throw error', async () => { const tx = { feeRatio: 10, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"feeRatio" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryPublicKey @@ -195,9 +191,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { ...executionObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"publicKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"publicKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryMultisig @@ -263,9 +257,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { multisig, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"multisig" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"multisig" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -341,9 +333,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { } const tx = { roleFeePayerKey, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"roleFeePayerKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleFeePayerKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryFailKey @@ -359,9 +349,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-478 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"failKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"failKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -377,9 +365,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-479 : If transaction object has unnecessary codeFormat field, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"codeFormat" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"codeFormat" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // UnnecessaryLegacyKey @@ -395,9 +381,7 @@ describe('SMART_CONTRACT_EXECUTION transaction', async () => { it('CAVERJS-UNIT-TX-480 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...executionObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"legacyKey" cannot be used with SMART_CONTRACT_EXECUTION transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with SMART_CONTRACT_EXECUTION transaction') }).timeout(200000) // Invalid from address diff --git a/test/transactionType/feeDelegatedAccountUpdate.js b/test/transactionType/feeDelegatedAccountUpdate.js index 01323773..533275b6 100644 --- a/test/transactionType/feeDelegatedAccountUpdate.js +++ b/test/transactionType/feeDelegatedAccountUpdate.js @@ -141,9 +141,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-267 : If transaction object has value, sendTransaction should throw error', async () => { const tx = { publicKey, value: 1, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // MissingGas @@ -177,9 +175,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-269 : If transaction object missing key information, sendTransaction should throw error', async () => { const tx = { ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - 'Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('Missing key information with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // PublicKey @@ -1674,9 +1670,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-332 : If transaction object has data, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // Error feePayer missing (A check on the feePayer is performed when the feePayer attempts to sign the rawTransaction after sender signed.) @@ -1702,9 +1696,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-335 : If transaction object has feeRatio, sendTransaction should throw error', async () => { const tx = { feeRatio: 20, publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"feeRatio" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"feeRatio" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -1720,9 +1712,7 @@ describe('FEE_DELEGATED_ACCOUNT_UPDATE transaction', async () => { it('CAVERJS-UNIT-TX-336 : If transaction object has codeFormat, sendTransaction should throw error', async () => { const tx = { codeFormat: 'EVM', publicKey, ...accountUpdateObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"codeFormat" cannot be used with FEE_DELEGATED_ACCOUNT_UPDATE transaction') }).timeout(200000) // Update account with legacyKey diff --git a/test/transactionType/feeDelegatedCancelTransaction.js b/test/transactionType/feeDelegatedCancelTransaction.js index 4c7b7e50..e4aa086a 100644 --- a/test/transactionType/feeDelegatedCancelTransaction.js +++ b/test/transactionType/feeDelegatedCancelTransaction.js @@ -279,9 +279,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { roleTransactionKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleTransactionKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryRoleAccountUpdateKey @@ -305,9 +303,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { roleAccountUpdateKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleAccountUpdateKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryRoleFeePayerKey @@ -331,9 +327,7 @@ describe('FEE_DELEGATED_CANCEL transaction', async () => { } const tx = { roleFeePayerKey, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"roleFeePayerKey" cannot be used with FEE_DELEGATED_CANCEL transaction') }).timeout(200000) // UnnecessaryFailKey diff --git a/test/transactionType/feeDelegatedCancelTransactionWithRatio.js b/test/transactionType/feeDelegatedCancelTransactionWithRatio.js index a89e0259..f3a313f6 100644 --- a/test/transactionType/feeDelegatedCancelTransactionWithRatio.js +++ b/test/transactionType/feeDelegatedCancelTransactionWithRatio.js @@ -88,9 +88,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-543 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: testAccount.address, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"to" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // UnnecessaryValue @@ -106,9 +104,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-544 : If transaction object has unnecessary value field, sendTransaction should throw error', async () => { const tx = { value: 1, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"value" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"value" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // MissingGas @@ -142,9 +138,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-546 : If transaction object has unnecessary data field, sendTransaction should throw error', async () => { const tx = { data: '0x68656c6c6f', ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"data" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"data" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // MissingFeePayer @@ -196,9 +190,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { ...cancelObject, } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"publicKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"publicKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // UnnecessaryMultisig @@ -264,9 +256,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { } const tx = { multisig, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"multisig" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"multisig" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // UnnecessaryRoleTransactionKey @@ -366,9 +356,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-555 : If transaction object has unnecessary failKey field, sendTransaction should throw error', async () => { const tx = { failKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"failKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"failKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // UnnecessaryCodeFormat @@ -402,9 +390,7 @@ describe('FEE_DELEGATED_CANCEL_WITH_RATIO transaction', async () => { it('CAVERJS-UNIT-TX-557 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...cancelObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"legacyKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with FEE_DELEGATED_CANCEL_WITH_RATIO transaction') }).timeout(200000) // Invalid from address diff --git a/test/transactionType/feeDelegatedContractDeploy.js b/test/transactionType/feeDelegatedContractDeploy.js index c43606f4..7a18247b 100644 --- a/test/transactionType/feeDelegatedContractDeploy.js +++ b/test/transactionType/feeDelegatedContractDeploy.js @@ -412,9 +412,7 @@ describe('FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction', async () => { it('CAVERJS-UNIT-TX-570 : If transaction object has unnecessary to field, sendTransaction should throw error', async () => { const tx = { to: '0x5e008646fde91fb6eda7b1fdabc7d84649125cf5', ...deployObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"to" cannot be used with FEE_DELEGATED_SMART_CONTRACT_DEPLOY transaction') }).timeout(200000) it('CAVERJS-UNIT-TX-579: If data field of transaction is not 0x-hex prefixed, signTransaction should formatting and sign', async () => { diff --git a/test/transactionType/feeDelegatedValueTransfer.js b/test/transactionType/feeDelegatedValueTransfer.js index 2e4c672c..c05868b6 100644 --- a/test/transactionType/feeDelegatedValueTransfer.js +++ b/test/transactionType/feeDelegatedValueTransfer.js @@ -456,9 +456,7 @@ describe('FEE_DELEGATED_VALUE_TRANSFER transaction', async () => { it('CAVERJS-UNIT-TX-560 : If transaction object has unnecessary legacyKey field, sendTransaction should throw error', async () => { const tx = { legacyKey: true, ...feeDelegatedValueTransferObject } - expect(() => caver.klay.sendTransaction(tx)).to.throw( - '"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER transaction' - ) + expect(() => caver.klay.sendTransaction(tx)).to.throw('"legacyKey" cannot be used with FEE_DELEGATED_VALUE_TRANSFER transaction') }).timeout(200000) // Invalid from address