Skip to content

Commit

Permalink
tests: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Mar 12, 2024
1 parent f5648dd commit 5fcf998
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
strategy:
matrix:
typescript-version: ['5.0.4', '5.1.6', '5.2.2', 'latest']
viem-version: ['2.0.0', 'latest']
viem-version: ['2.8.3', 'latest']

steps:
- name: Clone repository
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"sherif": "^0.8.1",
"simple-git-hooks": "^2.9.0",
"typescript": "5.3.2",
"viem": "2.8.2",
"viem": "2.8.3",
"vitest": "^0.34.5"
},
"packageManager": "pnpm@8.10.5",
Expand Down
86 changes: 43 additions & 43 deletions packages/core/src/actions/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ test('nonce too low', async () => {
nonce: 0,
}),
).rejects.toThrowErrorMatchingInlineSnapshot(`
"Nonce provided for the transaction is lower than the current nonce of the account.
Try increasing the nonce or find the latest nonce with \`getTransactionCount\`.
"Nonce provided for the transaction is lower than the current nonce of the account.
Try increasing the nonce or find the latest nonce with \`getTransactionCount\`.
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
data: 0x06fdde03
nonce: 0
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
data: 0x06fdde03
nonce: 0
Details: nonce too low
Version: viem@2.0.0"
Details: nonce too low
Version: viem@2.8.2"
`)
})

Expand All @@ -86,24 +86,24 @@ test('insufficient funds', async () => {
value: parseEther('100000'),
}),
).rejects.toThrowErrorMatchingInlineSnapshot(`
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.
This error could arise when the account does not have enough funds to:
- pay for the total gas fee,
- pay for the value to send.
The cost of the transaction is calculated as \`gas * gas fee + value\`, where:
- \`gas\` is the amount of gas needed for transaction to execute,
- \`gas fee\` is the gas fee,
- \`value\` is the amount of ether to send to the recipient.
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8
value: 100000 ETH
Details: Insufficient funds for gas * price + value
Version: viem@2.0.0"
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.
This error could arise when the account does not have enough funds to:
- pay for the total gas fee,
- pay for the value to send.
The cost of the transaction is calculated as \`gas * gas fee + value\`, where:
- \`gas\` is the amount of gas needed for transaction to execute,
- \`gas fee\` is the gas fee,
- \`value\` is the amount of ether to send to the recipient.
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8
value: 100000 ETH
Details: Insufficient funds for gas * price + value
Version: viem@2.8.2"
`)
})

Expand All @@ -117,16 +117,16 @@ test('maxFeePerGas less than maxPriorityFeePerGas', async () => {
maxPriorityFeePerGas: parseGwei('22'),
}),
).rejects.toThrowErrorMatchingInlineSnapshot(`
"The provided tip (\`maxPriorityFeePerGas\` = 22 gwei) cannot be higher than the fee cap (\`maxFeePerGas\` = 20 gwei).
"The provided tip (\`maxPriorityFeePerGas\` = 22 gwei) cannot be higher than the fee cap (\`maxFeePerGas\` = 20 gwei).
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
data: 0x06fdde03
maxFeePerGas: 20 gwei
maxPriorityFeePerGas: 22 gwei
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
data: 0x06fdde03
maxFeePerGas: 20 gwei
maxPriorityFeePerGas: 22 gwei
Version: viem@2.0.0"
Version: viem@2.8.2"
`)
})

Expand All @@ -146,7 +146,7 @@ test('contract revert (contract error)', async () => {
data: 0xa0712d6800000000000000000000000000000000000000000000000000000000000001a4
Details: execution reverted: revert: Token ID is taken
Version: viem@2.0.0"
Version: viem@2.8.2"
`)
})

Expand All @@ -158,14 +158,14 @@ test('contract revert (insufficient params)', async () => {
to: address.wagmiMintExample,
}),
).rejects.toThrowErrorMatchingInlineSnapshot(`
"Execution reverted for an unknown reason.
"Execution reverted for an unknown reason.
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
data: 0xa0712d68
Raw Call Arguments:
from: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
to: 0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
data: 0xa0712d68
Details: execution reverted
Version: viem@2.0.0"
Details: execution reverted
Version: viem@2.8.2"
`)
})
2 changes: 1 addition & 1 deletion packages/core/src/actions/connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test('behavior: user rejected request', async () => {
[UserRejectedRequestError: User rejected the request.
Details: Failed to connect.
Version: viem@2.0.0]
Version: viem@2.8.2]
`)
})

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/getBalance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ describe('getBalance', () => {
).resolves.toMatchInlineSnapshot(`
{
"decimals": 18,
"formatted": "3989.559062564299199392",
"formatted": "0.559062564299199392",
"symbol": "DAI",
"value": 3989559062564299199392n,
"value": 559062564299199392n,
}
`)
})
Expand Down
160 changes: 81 additions & 79 deletions packages/core/src/actions/getBlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,126 +16,128 @@ test('args: blockNumber', async () => {
)
expect(block).toMatchInlineSnapshot(`
{
"baseFeePerGas": 31986155981n,
"baseFeePerGas": 24076814055n,
"blobGasUsed": undefined,
"chainId": 1,
"difficulty": 0n,
"extraData": "0x626f62612d6275696c6465722e636f6d",
"excessBlobGas": undefined,
"extraData": "0x546974616e2028746974616e6275696c6465722e78797a29",
"gasLimit": 30000000n,
"gasUsed": 10413493n,
"hash": "0x03a96587556ab955c3456f809368bd2f7a190964ff00962a586c246ef39c93f5",
"logsBloom": "0x103141420cb0c3103b2013128c89300b12070c417c06810cb009102443524b02702dc1c8089006080a033bc3188495060a118242c82168030200df2948aa01012642d68a49a38e292d07413a880909a2c92000195064ce8415359412ec2023a07e5205000a14082182ce6488182a2ac3251064338499dea8420d0cba774aa221277307500c8298b1485c8879824250005040102d810018fb4e20684208126880e2a1894019916814234244c008b20ca004110e88004090282c640e0e1002036011d20002c25012140031708209ff008048c0c2ea80e04a166a1fe30a8203b10021f0600810810180180520a08e215aa88f043430e24841401419101c2440164b",
"miner": "0x3b64216ad1a58f61538b4fa1b27327675ab7ed67",
"mixHash": "0xdac10159cb5c8251f8ca656d74c5c32c08ef13b10cabc8bb09908a404d52eecf",
"gasUsed": 26325393n,
"hash": "0xcfa5df46abf1521f68ae72a7f7c4661949f4fb08a3d1296fe8082f6580a414e0",
"logsBloom": "0x2df3b5a24d2d57e7d73f96dbfea3577b1d5fbaacfcb9b5fb86db74d2e4ffd1e48bba050c33edada84fe477213937158c1e95d3da9f457f6f36e3ff0afdffcb667c5ee5f9e3ddffa9db1af6bbf15fcbbca5139717d5eedab4daa63cd8bb7dfa3e976b1e7023e2dc4586cef3caa0b73d6ff2ba3afb989c9f58f6b67bb4ed596c5aeb78cef51f69ad3675df70ffbd2aa6576d7c9e3debd00cccec3b69fc617b8568bfe588f7e126ef591f34ddd0d8b68c28b7ed45b46af3a7bb75c0e2fe4bec54fb772c87ae6f7efcdfb13139b758cfda4d98dffe426fef6d1c2e55f36b5bb1f0a2aef7bcbdf83d31ea646cf6ef3fe9d8b9af2ad4197f7ea2de462bd029fdef7e6f",
"miner": "0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97",
"mixHash": "0x92ac9cd6e57bacd7c7d3e9b087c3907b1c085e284eec2dce7379a847cb4c9940",
"nonce": "0x0000000000000000",
"number": 18677381n,
"parentHash": "0x26b6b1583f45019f38f62a3bfa026e2b3213d92a3996a527d23554d5d71e29fd",
"receiptsRoot": "0xc4d6b5c42258d5a6861e25e99f2929bb8a7456d52ac6e6a96e5c3bcd8bfe2e0a",
"number": 19258213n,
"parentHash": "0x40cb7885ad596d0397d664a4dc9ef5c2011c09e9a62b386f838f5f5362582ebb",
"receiptsRoot": "0x910a69ba396ab4f59c2c77aa413e941fc4da97a021b8d8bbf12c125bfc42d9d3",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": 141249n,
"stateRoot": "0x01cb576afed4f3f56c86529507ed9951b2849d8895c02fa9a35ab7771695b26c",
"timestamp": 1701262235n,
"size": 158252n,
"stateRoot": "0x6e27207d219b0251dbc2fde71f3cde8e33703261f032056453c27275500dddbc",
"timestamp": 1708302299n,
"totalDifficulty": 58750003716598352816469n,
"transactionsRoot": "0xd99b2a58709a3690d962f9cb8d6b941455143c5fe24fc5540bd6ff4d06e6d7ea",
"transactionsRoot": "0x897dba26a3a940b62f86da6e5fec5f71312ad7c871a4031db79dee67442c9d1e",
"uncles": [],
"withdrawals": [
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1053ffc",
"index": "0x190fb46",
"validatorIndex": "0xf3ab6",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x112da72",
"index": "0x21ec946",
"validatorIndex": "0x5cd8e",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x103ec51",
"index": "0x190fb47",
"validatorIndex": "0xf3ab7",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x1119345",
"index": "0x21ec947",
"validatorIndex": "0x5cd8f",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1052bbc",
"index": "0x190fb48",
"validatorIndex": "0xf3ab8",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x110e2ca",
"index": "0x21ec948",
"validatorIndex": "0x5cd90",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1041aee",
"index": "0x190fb49",
"validatorIndex": "0xf3ab9",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x1119245",
"index": "0x21ec949",
"validatorIndex": "0x5cd91",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x104e073",
"index": "0x190fb4a",
"validatorIndex": "0xf3aba",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x1115a03",
"index": "0x21ec94a",
"validatorIndex": "0x5cd92",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x10480de",
"index": "0x190fb4b",
"validatorIndex": "0xf3abb",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x111cf3f",
"index": "0x21ec94b",
"validatorIndex": "0x5cd93",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x104ab57",
"index": "0x190fb4c",
"validatorIndex": "0xf3abc",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x1106006",
"index": "0x21ec94c",
"validatorIndex": "0x5cd94",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x383fece",
"index": "0x190fb4d",
"validatorIndex": "0xf3abd",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x1115bb3",
"index": "0x21ec94d",
"validatorIndex": "0x5cd95",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1057082",
"index": "0x190fb4e",
"validatorIndex": "0xf3abe",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x111e0d9",
"index": "0x21ec94e",
"validatorIndex": "0x5cd96",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1048c65",
"index": "0x190fb4f",
"validatorIndex": "0xf3abf",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x110829f",
"index": "0x21ec94f",
"validatorIndex": "0x5cd97",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x10405de",
"index": "0x190fb50",
"validatorIndex": "0xf3ac0",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x11029ab",
"index": "0x21ec950",
"validatorIndex": "0x5cd98",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x105e565",
"index": "0x190fb51",
"validatorIndex": "0xf3ac1",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x11140a6",
"index": "0x21ec951",
"validatorIndex": "0x5cd99",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1041e0e",
"index": "0x190fb52",
"validatorIndex": "0xf3ac2",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x111396c",
"index": "0x21ec952",
"validatorIndex": "0x5cd9a",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x1048d6e",
"index": "0x190fb53",
"validatorIndex": "0xf3ac3",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x110de16",
"index": "0x21ec953",
"validatorIndex": "0x5cd9b",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x104db30",
"index": "0x190fb54",
"validatorIndex": "0xf3ac4",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x1121062",
"index": "0x21ec954",
"validatorIndex": "0x5cd9c",
},
{
"address": "0xf20b338752976878754518183873602902360704",
"amount": "0x10421f6",
"index": "0x190fb55",
"validatorIndex": "0xf3ac5",
"address": "0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f",
"amount": "0x11188bc",
"index": "0x21ec955",
"validatorIndex": "0x5cd9d",
},
],
"withdrawalsRoot": "0xd67d00f01ac780dd7292e464f0873611c0b9cfaf7d630400ed04abf312cb53f4",
"withdrawalsRoot": "0x26638497bd55075025ac2362d92bd789ac1232fd50c4b3866565280318027950",
}
`)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/getToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test('behavior: bogus token', async () => {
address: 0xa0cf798816d4b9b9866b5330eea46a18382f251e
function: decimals()
Docs: https://viem.sh/docs/contract/multicall.html
Version: viem@2.0.0"
Docs: https://viem.sh/docs/contract/multicall
Version: viem@2.8.2"
`)
})
Loading

0 comments on commit 5fcf998

Please sign in to comment.