From 940d84a7ee258bd1d8301c323573101f0800570d Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Fri, 14 Jan 2022 11:04:21 +0900 Subject: [PATCH 1/9] Copy the parameter to avoid race condition --- .../src/subscription.js | 6 +- test/subscription.js | 73 +++++++++++++++---- 2 files changed, 64 insertions(+), 15 deletions(-) diff --git a/packages/caver-core-subscriptions/src/subscription.js b/packages/caver-core-subscriptions/src/subscription.js index e1a14da6..ac2e1e2b 100644 --- a/packages/caver-core-subscriptions/src/subscription.js +++ b/packages/caver-core-subscriptions/src/subscription.js @@ -235,10 +235,14 @@ Subscription.prototype.subscribe = function() { isFinite(payload.params[1].fromBlock) ) { // send the subscription request + + // copy the params to avoid race-condition with deletion below this block + const blockParams = Object.assign({}, payload.params[1]); + this.options.requestManager.send( { method: 'klay_getLogs', - params: [payload.params[1]], + params: [blockParams], }, function(err, logs) { if (!err) { diff --git a/test/subscription.js b/test/subscription.js index 9be820e5..05928aa7 100644 --- a/test/subscription.js +++ b/test/subscription.js @@ -26,6 +26,8 @@ const caver = new Caver(websocketURL) let senderPrvKey let senderAddress let receiver +let contractAddress +let contractAbi // If you are using websocket provider, subscribe the 'newBlockHeaders' event through the subscriptions object after sending the transaction. // When receiving the 'newBlockHeaders' event, it queries the transaction receipt. @@ -42,19 +44,38 @@ let receiver // -> [request] klay_getTransactionReceipt // -> [response] receipt -before(() => { - senderPrvKey = - process.env.privateKey && String(process.env.privateKey).indexOf('0x') === -1 - ? `0x${process.env.privateKey}` - : process.env.privateKey +async function prepareContractTesting() { + const kip7 = await caver.kct.kip7.deploy({ + name: 'Jamie', + symbol: 'JME', + decimals: 18, + initialSupply: '1000000000000' + }, senderAddress) + contractAddress = kip7.options.address + contractAbi = kip7.options.jsonInterface - senderAddress = caver.klay.accounts.wallet.add(senderPrvKey).address + return kip7.transfer(receiver.address, 1000, { from: senderAddress }) +} - receiver = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) -}) +describe('subscription should work well with websocket connection', () => { + before(function(done) { + this.timeout(200000) + + senderPrvKey = + process.env.privateKey && String(process.env.privateKey).indexOf('0x') === -1 + ? `0x${process.env.privateKey}` + : process.env.privateKey + + senderAddress = caver.klay.accounts.wallet.add(senderPrvKey).address + caver.wallet.add(caver.wallet.keyring.createFromPrivateKey(senderPrvKey)) + + receiver = caver.klay.accounts.wallet.add(caver.klay.accounts.create()) + caver.wallet.add(caver.wallet.keyring.createFromPrivateKey(receiver.privateKey)) -describe('get transaction', () => { - it('CAVERJS-UNIT-ETC-094: getTransaction should return information of transaction.', async () => { + prepareContractTesting().then(() => done()) + }) + + it('CAVERJS-UNIT-ETC-094: sendTransaction should return a transaction receipt.', async () => { const txObj = { from: senderAddress, to: receiver.address, @@ -83,17 +104,41 @@ describe('get transaction', () => { expect(receipt.typeInt).not.to.undefined expect(receipt.value).not.to.undefined }).timeout(10000) -}) -describe('Subscribe test throught contract event', () => { it('CAVERJS-UNIT-ETC-262: should emit subscription id when subscription is created', done => { - caver.wallet.add(caver.wallet.keyring.createFromPrivateKey(senderPrvKey)).address caver.kct.kip17.deploy({ name: 'Jasmine', symbol: 'JAS' }, senderAddress).then(deployed => { deployed.events.MinterAdded({}).on('connected', subscriptionId => { expect(subscriptionId).not.to.be.undefined - caver.currentProvider.connection.close() done() }) }) }).timeout(30000) + + // Regression test for a race-condition where a fresh caver instance + // subscribing to past events would have its call parameters deleted while it + // made initial Websocket handshake and return an incorrect response. + it('CAVERJS-UNIT-ETC-: should immediately listen for events in the past', async () => { + const freshCaver = new Caver(websocketURL) + const contract = freshCaver.contract.create(contractAbi, contractAddress) + + let counter = 0; + const latestBlock = await caver.rpc.klay.getBlockNumber() + caver.currentProvider.connection.close() + + await new Promise(async resolve => { + contract.events.allEvents({ + fromBlock: 0 + }) + .on('data', function(event) { + counter++; + expect(event.blockNumber < latestBlock).to.be.true + + if (counter === 2){ + this.removeAllListeners() + freshCaver.currentProvider.connection.close() + resolve() + } + }) + }) + }).timeout(30000) }) From f8355d6503b1a8b136f75bf22c91a156ea26afcf Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Fri, 14 Jan 2022 11:04:29 +0900 Subject: [PATCH 2/9] Updated versio to v1.6.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e175a559..7054c7b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "caver-js", - "version": "1.6.6", + "version": "1.6.7", "description": "caver-js is a JavaScript API library that allows developers to interact with a Klaytn node", "main": "index.js", "types": "types/index.d.ts", From 9b2d882fb5588532283da0f8e29591d34133cc92 Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Fri, 14 Jan 2022 11:07:26 +0900 Subject: [PATCH 3/9] Added TC numbering --- test/subscription.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/subscription.js b/test/subscription.js index 05928aa7..289567c8 100644 --- a/test/subscription.js +++ b/test/subscription.js @@ -117,7 +117,7 @@ describe('subscription should work well with websocket connection', () => { // Regression test for a race-condition where a fresh caver instance // subscribing to past events would have its call parameters deleted while it // made initial Websocket handshake and return an incorrect response. - it('CAVERJS-UNIT-ETC-: should immediately listen for events in the past', async () => { + it('CAVERJS-UNIT-ETC-398: should immediately listen for events in the past', async () => { const freshCaver = new Caver(websocketURL) const contract = freshCaver.contract.create(contractAbi, contractAddress) From 73baebc7500a65717e4c8ef5471d3d4502c4df1e Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Fri, 14 Jan 2022 11:12:09 +0900 Subject: [PATCH 4/9] Fixed the lint errors --- .../src/subscription.js | 2 +- test/subscription.js | 46 ++++++++++--------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/packages/caver-core-subscriptions/src/subscription.js b/packages/caver-core-subscriptions/src/subscription.js index ac2e1e2b..557ea1c4 100644 --- a/packages/caver-core-subscriptions/src/subscription.js +++ b/packages/caver-core-subscriptions/src/subscription.js @@ -237,7 +237,7 @@ Subscription.prototype.subscribe = function() { // send the subscription request // copy the params to avoid race-condition with deletion below this block - const blockParams = Object.assign({}, payload.params[1]); + const blockParams = { ...payload.params[1] } this.options.requestManager.send( { diff --git a/test/subscription.js b/test/subscription.js index 289567c8..12308eb5 100644 --- a/test/subscription.js +++ b/test/subscription.js @@ -45,12 +45,15 @@ let contractAbi // -> [response] receipt async function prepareContractTesting() { - const kip7 = await caver.kct.kip7.deploy({ - name: 'Jamie', - symbol: 'JME', - decimals: 18, - initialSupply: '1000000000000' - }, senderAddress) + const kip7 = await caver.kct.kip7.deploy( + { + name: 'Jamie', + symbol: 'JME', + decimals: 18, + initialSupply: '1000000000000', + }, + senderAddress + ) contractAddress = kip7.options.address contractAbi = kip7.options.jsonInterface @@ -121,24 +124,25 @@ describe('subscription should work well with websocket connection', () => { const freshCaver = new Caver(websocketURL) const contract = freshCaver.contract.create(contractAbi, contractAddress) - let counter = 0; + let counter = 0 const latestBlock = await caver.rpc.klay.getBlockNumber() caver.currentProvider.connection.close() - await new Promise(async resolve => { - contract.events.allEvents({ - fromBlock: 0 - }) - .on('data', function(event) { - counter++; - expect(event.blockNumber < latestBlock).to.be.true - - if (counter === 2){ - this.removeAllListeners() - freshCaver.currentProvider.connection.close() - resolve() - } - }) + await new Promise(resolve => { + contract.events + .allEvents({ + fromBlock: 0, + }) + .on('data', function(event) { + counter++ + expect(event.blockNumber < latestBlock).to.be.true + + if (counter === 2) { + this.removeAllListeners() + freshCaver.currentProvider.connection.close() + resolve() + } + }) }) }).timeout(30000) }) From 6d2a6bbafb0d19288353e7f0b1f4bb5feac717bd Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Tue, 18 Jan 2022 14:15:43 +0900 Subject: [PATCH 5/9] Added troubleshooting contents in readme and deleted an unused file --- README.md | 54 +++++++++++++++- test.js | 183 ------------------------------------------------------ 2 files changed, 53 insertions(+), 184 deletions(-) delete mode 100644 test.js diff --git a/README.md b/README.md index 2f67a6b1..d22616f5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,10 @@ # caver-js caver-js is a JavaScript API library that allows developers to interact with a -Klaytn node using a HTTP or Websocket connection. +Klaytn node using a HTTP or Websocket connection. + +**NOTE** It is recommended to use [caver-js v1.4.1](https://www.npmjs.com/package/caver-js/v/1.4.1) version when working with Kaikas Web Extension Wallet. +See [Trouble shooting and known issues](#connect-with-kaikas-web-extension) for more details. ## Table of contents @@ -22,6 +25,7 @@ Klaytn node using a HTTP or Websocket connection. * [Error Code Improvement](#error-code-improvement) * [Sample Projects](#sample-projects) * [Github Repository](#github-repository) + * [Trouble shooting and known issues](#trouble-shooting-and-known-issues) * [Related Projects](#related-projects) ## Requirements @@ -296,6 +300,54 @@ The BApp (Blockchain Application) Development sample projects using caver-js are * [Count BApp](https://docs.klaytn.com/bapp/tutorials/count-bapp) * [Klaystagram](https://docs.klaytn.com/bapp/tutorials/klaystagram) +## Trouble shooting and known issues + +### Connect with Kaikas Web Extension + +Kaikas Web Extension Wallet works well only up to [caver-js v1.4.1](https://www.npmjs.com/package/caver-js/v/1.4.1). +Features provided in later versions (caver-js v1.5.0~) may not work with Kaikas Web Extension Wallet. +If the error below occurs when connecting to Kaikas, use caver-js v1.4.1. + +``` +Kaikas only processes one transaction at a time. Open Kaikas and refresh the pending transaction. If the service doesn’t process your transaction for a while, cancel the pending transaction. +``` + +``` +Kaikas는 한 번에 하나의 트랜잭션만 처리합니다. Kaikas를 열어 대기 중인 트랜잭션을 새로고침 해주세요. 만약 대기 상태가 계속된다면 이용 중인 서비스가 트랜잭션을 처리하지 않는 것이니 트랜잭션을 취소바랍니다. +``` + +Although the above error is mostly the case, other errors may occur besides the above error, so if you are using Kaikas Web Extension Wallet, please use caver-js v1.4.1. + +For documents up to caver-js v1.4.1, refer to [here](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). + +### Using webpack >= 5 + +Node.js module polyfills are not provided by default in webpack v5 and later. +Therefore, you need to install the missing modules and add them to the `resolve.fallback` property of the webpack.config.js file in the form below. + +``` +module.exports = { + ... + resolve: { + fallback: { + fs: false, + net: false, + stream: require.resolve('stream-browserify'), + crypto: require.resolve('crypto-browserify'), + http: require.resolve('stream-http'), + https: require.resolve('https-browserify'), + os: require.resolve('os-browserify/browser'), + ... + }, + }, +} +``` + +More information on migrating to webpack v5 can be found [here](https://webpack.js.org/migrate/5/#clean-up-configuration). + +If you are implementing an app using [create-react-app](https://create-react-app.dev/), you can use [react-app-rewired](https://www.npmjs.com/package/react-app-rewired) to add the above polyfills to the webpack.config.js file used by [CRA](https://create-react-app.dev/). +More information on using react-app-rewired with create-react-app can be found [here](https://www.npmjs.com/package/react-app-rewired). + ## Github Repository * [caver-js](https://github.com/klaytn/caver-js) diff --git a/test.js b/test.js deleted file mode 100644 index 50f13fc0..00000000 --- a/test.js +++ /dev/null @@ -1,183 +0,0 @@ -const Caver = require('./index') -// console.log(flatten(Caver)) - -// const provider = new Caver.providers.HttpProvider('https://internal.baobab.klaytn.net:8651', { timeout: 2000 }) -const providerwoTimeout = new Caver.providers.HttpProvider('https://internal.baobab.klaytn.net:8651') -const caver = new Caver(providerwoTimeout) - -async function test() { - const keyring = caver.wallet.keyring.createFromPrivateKey('0x0c66be6f6a0c539be9e99d883e897cdc10cb016a958c9a61485ae57cace5d7bf') - caver.wallet.add(keyring) - - // const kip7 = await caver.kct.kip7.deploy({ - // name: 'Jasmine', - // symbol: 'JAS', - // decimals: 18, - // initialSupply: '100000000' - // }, keyring.address) - - // console.log(kip7) - - // const kip7 = caver.kct.kip7.create('0xf0c398035a88c0dffe23a71bc991a247a24da4d5') - // const receipt = await kip7.transfer(keyring.address, 1000, { from: keyring.address }) - // console.log(receipt) - // console.log(receipt.events.Transfer) - - // const tx = caver.transaction.valueTransfer.create({ - // from: keyring.address, - // to: keyring.address, - // value: 1, - // gas: 250000, - // }) - // await caver.wallet.sign(keyring.address, tx) - // console.log(tx) - - // caver.setProvider(provider) - - // caver.rpc.klay.sendRawTransaction(tx).on('transactionHash', (hash) => { - // console.log(hash) - // }) - - console.log( - caver.abi.decodeLog( - [ - { indexed: true, name: 'from', type: 'address' }, - { indexed: true, name: 'to', type: 'address' }, - { indexed: false, name: 'value', type: 'uint256' }, - ], - '0x00000000000000000000000000000000000000000000000000000000000003e8', - [ - '0x00000000000000000000000060498fefbf1705a3db8d7bb5c80d5238956343e5', - '0x00000000000000000000000060498fefbf1705a3db8d7bb5c80d5238956343e5', - ] - ) - ) -} - -test() - -// const caver = new Caver(`http://141.164.51.33:8551`) -// //// ABI & ByteCode -// const abi = require('./packages/caver-kct/src/kctHelper').kip7JsonInterface // 컨트랙트 ABI -// const byteCode = require(`./packages/caver-kct/src/kctHelper`).kip7ByteCode // 컨트랙트 bytecode -// //// GLOBAL -// let keyring = undefined -// let nonce = undefined -// let curNonce = undefined -// let txMap = {} - -// /** -// * ms 단위로 딜레이를 준다. -// * @param {*} ms 딜레이 타임 (ms) -// */ -// let delay = function(ms) { -// return new Promise(resolve => setTimeout(resolve, ms)) -// } - -// /** -// * @notice deploy tx 생성함수 -// * @param keyring address keyring 정보 -// * @param nonce address 논스값 -// * @param index 호출 인덱스 -// * @author jhhong -// */ -// let makeTxDeploy = async function(keyring, nonce, index) { -// try { -// let name = 'My ERC20 Token' -// let symbol = 'MET' -// let decimals = 18 -// let totalSupply = '100000000000000000000000000' -// let myErc20 = caver.contract.create(abi) -// let data = await myErc20.deploy({ data: byteCode, arguments: [name, symbol, decimals, totalSupply] }).encodeABI() -// let gas = 2000000 -// let rawTx = { from: keyring.address, gas: gas, nonce: nonce, data: data } -// const tx = caver.transaction.smartContractDeploy.create(rawTx) -// await caver.wallet.sign(keyring.address, tx) -// console.log(`트랜잭션 생성 Idx:[${index}], nonce:[${nonce}]`) -// let obj = new Object() -// obj.contents = tx -// obj.created = true -// obj.index = index -// txMap[nonce] = obj -// } catch (error) { -// console.log(error) -// return false -// } -// } - -// /** -// * @notice sendKlay transaction 전송함수 -// * @param nonce 트랜젝션 논스 -// * @param obj 서명된 트랜젝션이 포함된 구조체 -// * @author jhhong -// */ -// let sendTxDeploy = function(nonce, obj) { -// console.log(`트랜잭션 전송 Idx:[${obj.index}], nonce:[${nonce}]`) -// caver.rpc.klay -// .sendRawTransaction(obj.contents) -// .on('transactionHash', function(txHash) { -// console.log(`[transactionHash] Idx:[${obj.index}], Deploy TX:['${txHash}']`) -// }) -// .on('receipt', function(receipt) { -// console.log( -// 'DEBUG', -// `[receipt] Idx:[${obj.index}], Deploy TX:['${receipt.transactionHash}'], BlockNumber:[${parseInt(receipt.blockNumber)}]` -// ) -// delete obj -// }) -// } - -// process.on('deploy-event', function(index) { -// console.log(`Receive deploy-event! index:[%s]`, index) -// if (nonce == undefined) { -// console.log(`nonce does not initialized`) -// return -// } -// let param = nonce++ -// process.emit('proc-deploy', index, param) -// }) - -// /** -// * @notice 테스트 함수 -// * @author jhhong -// */ -// let RunProc = async function() { -// try { -// keyring = await caver.wallet.keyring.createFromPrivateKey('3614732543faf2726ffff58b3243ac8f653e047963edaa6b46b15bcbc6dcd9c4') -// nonce = await caver.rpc.klay.getTransactionCount(keyring.address) -// curNonce = parseInt(nonce) -// await caver.wallet.add(keyring) - -// /** -// * @notice proce-deploy 이벤트 처리함수 -// * @param idx 인덱스 번호 -// * @param nonce keyring address 논스값 -// * @author jhhong -// */ -// process.on('proc-deploy', async function(idx, nonce) { -// try { -// console.log(`start proc-deploy :[${idx}], nonce:[${nonce}]`) -// await makeTxDeploy(keyring, nonce, idx) -// console.log(`nonce:[${nonce}], curNonce:[${curNonce}]`) -// if (nonce == curNonce) { -// while (txMap[curNonce]) { -// sendTxDeploy(curNonce, txMap[curNonce]) -// curNonce++ -// } -// } -// } catch (error) { -// console.log('ERROR', `${error}`) -// process.exit(1) -// } -// }) - -// for (let i = 0; i < 2000; i++) { -// process.emit('deploy-event', i) -// } -// await delay(100000) -// } catch (error) { -// console.log('ERROR', `${error}`) -// process.exit(1) -// } -// } -// RunProc() From 41c7818e6bc4f07311d6aac2c7bf620467dd65b7 Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Tue, 18 Jan 2022 17:17:04 +0900 Subject: [PATCH 6/9] Added more documentation link --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d22616f5..623590c2 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ caver-js is a JavaScript API library that allows developers to interact with a Klaytn node using a HTTP or Websocket connection. **NOTE** It is recommended to use [caver-js v1.4.1](https://www.npmjs.com/package/caver-js/v/1.4.1) version when working with Kaikas Web Extension Wallet. +For documents up to caver-js v1.4.1, refer to [caver-js ~v1.4.1 Documentation](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). See [Trouble shooting and known issues](#connect-with-kaikas-web-extension) for more details. ## Table of contents @@ -318,7 +319,7 @@ Kaikas는 한 번에 하나의 트랜잭션만 처리합니다. Kaikas를 열어 Although the above error is mostly the case, other errors may occur besides the above error, so if you are using Kaikas Web Extension Wallet, please use caver-js v1.4.1. -For documents up to caver-js v1.4.1, refer to [here](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). +For documents up to caver-js v1.4.1, refer to [caver-js ~v1.4.1 Documentation](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). ### Using webpack >= 5 From bb8412cb028fe561d1b1d8f7a0a47815d3277126 Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Wed, 19 Jan 2022 10:02:55 +0900 Subject: [PATCH 7/9] Disabled deprecate warning event --- packages/caver-klay/src/index.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/caver-klay/src/index.js b/packages/caver-klay/src/index.js index 28600343..ee392f7f 100644 --- a/packages/caver-klay/src/index.js +++ b/packages/caver-klay/src/index.js @@ -168,13 +168,13 @@ const Klay = function Klay(...args) { this.KIP7._klayAccounts = this.accounts this.KIP7.currentProvider = this._requestManager.provider - const kip7Deprecated = - '`caver.klay.KIP7` has been deprecated. `caver.klay.KIP7` works using only `caver.klay.accounts.wallet`. If you are using `caver.wallet` then use `caver.kct.kip7`.' - // Overwrite constructor with deprecate warning - this.KIP7 = util.deprecate(this.KIP7, kip7Deprecated) + // const kip7Deprecated = + // '`caver.klay.KIP7` has been deprecated. `caver.klay.KIP7` works using only `caver.klay.accounts.wallet`. If you are using `caver.wallet` then use `caver.kct.kip7`.' + // // Overwrite constructor with deprecate warning + // this.KIP7 = util.deprecate(this.KIP7, kip7Deprecated) - // Overwrite static deloy method with deprecate warning - this.KIP7.deploy = util.deprecate(this.KIP7.deploy, kip7Deprecated) + // // Overwrite static deloy method with deprecate warning + // this.KIP7.deploy = util.deprecate(this.KIP7.deploy, kip7Deprecated) this.KIP17 = KIP17 this.KIP17.defaultAccount = this.defaultAccount @@ -183,13 +183,13 @@ const Klay = function Klay(...args) { this.KIP17._klayAccounts = this.accounts this.KIP17.currentProvider = this._requestManager.provider - const kip17Deprecated = - '`caver.klay.KIP17` has been deprecated. `caver.klay.KIP17` works using only `caver.klay.accounts.wallet`. If you are using `caver.wallet` then use `caver.kct.kip17`.' - // Overwrite constructor with deprecate warning - this.KIP17 = util.deprecate(KIP17, kip17Deprecated) + // const kip17Deprecated = + // '`caver.klay.KIP17` has been deprecated. `caver.klay.KIP17` works using only `caver.klay.accounts.wallet`. If you are using `caver.wallet` then use `caver.kct.kip17`.' + // // Overwrite constructor with deprecate warning + // this.KIP17 = util.deprecate(KIP17, kip17Deprecated) - // Overwrite static deloy method with deprecate warning - this.KIP17.deploy = util.deprecate(this.KIP17.deploy, kip17Deprecated) + // // Overwrite static deloy method with deprecate warning + // this.KIP17.deploy = util.deprecate(this.KIP17.deploy, kip17Deprecated) // add IBAN this.Iban = utils.Iban From 505b9d89c54de38301fc26a12017185c145e739f Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Wed, 19 Jan 2022 10:14:14 +0900 Subject: [PATCH 8/9] Modified readme contents --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 623590c2..1b9a3cfa 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,10 @@ caver-js is a JavaScript API library that allows developers to interact with a Klaytn node using a HTTP or Websocket connection. -**NOTE** It is recommended to use [caver-js v1.4.1](https://www.npmjs.com/package/caver-js/v/1.4.1) version when working with Kaikas Web Extension Wallet. -For documents up to caver-js v1.4.1, refer to [caver-js ~v1.4.1 Documentation](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). -See [Trouble shooting and known issues](#connect-with-kaikas-web-extension) for more details. +**NOTE** +Kaikas Web Extension Wallet is recommended to be used with [features prior to common architecture](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). New features provided in caver-js v1.5.0 (introduced common architecrue) or later are currently not compatible with Kaikas. +Kaikas web extension wallet works fine with functions prior to common architecture, so please use [functions prior to common architecture](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). +Even in the latest version of caver-js, [functions prior to common architecture](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1) are provided for backward compatibility. See [Trouble shooting and known issues](#connect-with-kaikas-web-extension) for more details. ## Table of contents @@ -305,9 +306,11 @@ The BApp (Blockchain Application) Development sample projects using caver-js are ### Connect with Kaikas Web Extension -Kaikas Web Extension Wallet works well only up to [caver-js v1.4.1](https://www.npmjs.com/package/caver-js/v/1.4.1). +Kaikas Web Extension Wallet works normally with [functions prior to common architecture](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). Features provided in later versions (caver-js v1.5.0~) may not work with Kaikas Web Extension Wallet. -If the error below occurs when connecting to Kaikas, use caver-js v1.4.1. + +If the following error occurs when using with Kaikas, it must be modified to use the [functions supported by caver-js v1.4.1](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). +For compatibility with the latest version, the same [functions provided by caver-js v1.4.0](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1) are provided. ``` Kaikas only processes one transaction at a time. Open Kaikas and refresh the pending transaction. If the service doesn’t process your transaction for a while, cancel the pending transaction. @@ -317,9 +320,10 @@ Kaikas only processes one transaction at a time. Open Kaikas and refresh the pen Kaikas는 한 번에 하나의 트랜잭션만 처리합니다. Kaikas를 열어 대기 중인 트랜잭션을 새로고침 해주세요. 만약 대기 상태가 계속된다면 이용 중인 서비스가 트랜잭션을 처리하지 않는 것이니 트랜잭션을 취소바랍니다. ``` -Although the above error is mostly the case, other errors may occur besides the above error, so if you are using Kaikas Web Extension Wallet, please use caver-js v1.4.1. +Although the above error is mostly the case, other errors may occur besides the above error, so if you are using Kaikas Web Extension Wallet, please use the [functions supported by caver-js v1.4.1](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). +Keep in mind that you **cannot mix features** before and after common architecture. -For documents up to caver-js v1.4.1, refer to [caver-js ~v1.4.1 Documentation](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). +For documents for the functions supported by caver-js v1.4.1, refer to [caver-js ~v1.4.1 Documentation](https://docs.klaytn.com/dapp/sdk/caver-js/v1.4.1). ### Using webpack >= 5 From 6b2075745c31de30f58149234c7f3f6d3fa17911 Mon Sep 17 00:00:00 2001 From: Jasmine/kimjimin Date: Wed, 19 Jan 2022 10:16:56 +0900 Subject: [PATCH 9/9] Fixed lint error --- packages/caver-klay/src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/caver-klay/src/index.js b/packages/caver-klay/src/index.js index ee392f7f..b1ffefce 100644 --- a/packages/caver-klay/src/index.js +++ b/packages/caver-klay/src/index.js @@ -25,7 +25,6 @@ */ const _ = require('lodash') -const util = require('util') const core = require('../../caver-core') const { formatters } = require('../../caver-core-helpers')