Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 8768b1f

Browse files
authored
Merge branch 'main' into debug_namespace
2 parents 230c2be + 4d8cbf5 commit 8768b1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2959
-6783
lines changed

.mocharc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"bail": true,
44
"colors": true,
55
"exit": true,
6-
"file": "test/testSetup.ts"
6+
"file": [
7+
"test/soloNodeSetup.ts",
8+
"test/testSetup.ts"
9+
]
710
}

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const txId = await provider.request({
5858
### Working with `web3.js`:
5959
```ts
6060
import { ProviderWeb3 } from '@vechain/web3-providers-connex'
61-
import Web3 from 'web3'
61+
import { Web3 } from 'web3'
6262

6363
const provider = new ProviderWeb3({ connex: connexObj })
6464
const web3 = new Web3(provider)
@@ -69,8 +69,11 @@ import * as thor from '@vechain/web3-providers-connex'
6969
import { ethers } from 'ethers'
7070

7171
const provider = thor.ethers.modifyProvider(
72-
new ethers.providers.Web3Provider(
73-
new thor.Provider({ connex: connexObj })
72+
new ethers.BrowserProvider(
73+
new thor.Provider({
74+
connex: connexObj,
75+
wallet: walletObj, // MUST provide to call [getSigner] method
76+
})
7477
)
7578
)
7679
```
@@ -83,16 +86,20 @@ Deploying a contract
8386
const factory = thor.ethers.modifyFactory(
8487
new ethers.ContractFactory(abi, bin, signer)
8588
)
86-
const contract = await factory.deploy(...args)
89+
const base = await factory.deploy(...args)
90+
await base.waitForDeployment()
91+
92+
const contractAddress = await base.getAddress()
93+
const contract = new ethers.Contract(contractAddress, abi, signer)
8794
```
88-
Methods `modifyProvider` and `modifyFactory` are used to bypass the Ethereum contract address computation that is incompatible with the Thor protocol.
95+
Methods `modifyProvider` and `modifyFactory` are used to patch the original code of [ethers.js](https://github.com/ethers-io/ethers.js) that is incompatible with the Thor protocol.
8996

9097
### Request at a particular block hight
91-
APIs `eth_getBalance`, `eth_getCode`, `et_getStorageAt` and `eth_call` allow users to specify a particular block height [1]. To do that, we need to provide a `Net` object when creating a provider:
98+
APIs `eth_getBalance`, `eth_getCode`, `eth_getStorageAt` and `eth_call` allow users to specify a particular block height [1]. To do that, we need to provide a `Net` object when creating a provider:
9299
```ts
93100
import { SimpleNet } from '@vechain/connex-driver'
94101
import * as thor from '@vechain/web3-providers-connex'
95-
import Web3 from 'web3'
102+
import { Web3 } from 'web3'
96103
import { ethers } from 'ethers'
97104

98105
const provider = new thor.Provider({
@@ -108,7 +115,7 @@ const web3 = new Web3(
108115
)
109116

110117
const providerEthers = thor.ethers.modifyProvider(
111-
new ethers.providers.Web3Provider(
118+
new ethers.BrowserProvider(
112119
new thor.Provider({
113120
connex: connexObj,
114121
net: netObj
@@ -161,6 +168,7 @@ Returning `0x0`
161168
Returning `0x0`
162169
##### `eth_getTransactionReceipt`
163170
##### `eth_isSyncing`
171+
##### `eth_requestAccounts`
164172
##### `eth_sendRawTransaction`
165173
Requiring passing a `Net` object when constructing an instance of `Provider` or `ProviderWeb3`
166174
##### `eth_sendTransaction`

0 commit comments

Comments
 (0)