Skip to content

Commit 4208330

Browse files
committed
wip: lazy assets wip
1 parent 4f1d70c commit 4208330

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

integration/nevermined/AssetLazyRegistration.ts

+20-12
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ describe('Lazy registration of assets', () => {
6464
fragment = await registryContract[functionName].getFragment(...functionArgs)
6565
assert.isDefined(fragment)
6666

67-
unsignedTx = await registryContract[functionName].populateTransaction(...functionArgs)
67+
unsignedTx = await registryContract[functionName].populateTransaction(...functionArgs)
6868
assert.isDefined(unsignedTx)
6969

70+
// unsignedTx.from = relayer.getId()
7071
console.log(`unsignedTx: `, unsignedTx)
7172

7273
signedTx = await publisherSigner.signTransaction(unsignedTx)
@@ -80,27 +81,34 @@ describe('Lazy registration of assets', () => {
8081

8182
const gasLimit = await registryContract[functionName].estimateGas(...functionArgs, {
8283
from: relayer.getId(),
83-
})
84-
const feeData = await nevermined.utils.contractHandler.getFeeData()
84+
})
8585

86-
// const feeData = await nevermined.web3.getFeeData()
86+
console.log(`Relayer ETH balance: `, await relayer.getEtherBalance())
8787

88+
const feeData = await nevermined.utils.contractHandler.getFeeData()
89+
console.log(`Fee Data: `, feeData)
90+
// const feeData = await nevermined.web3.getFeeData()
91+
8892
tx.chainId = await nevermined.keeper.getNetworkId()
8993
tx.type = 2
9094
tx.nonce = await relayerSigner.getNonce()
9195
tx.gasLimit = gasLimit
92-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
93-
if (Object.keys(feeData).includes('gasPrice'))
94-
tx.gasPrice = Object.values(feeData)['gasPrice']!
95-
else {
96-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
97-
tx.maxFeePerGas = Object.values(feeData)['maxFeePerGas']!
98-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
99-
tx.maxPriorityFeePerGas = Object.values(feeData)['maxPriorityFeePerGas']!
96+
// tx.value = ethers.parseEther("0.01")
97+
98+
if (Object.keys(feeData).includes('gasPrice')) {
99+
tx.gasPrice = feeData['gasPrice']! // eslint-disable-line @typescript-eslint/no-non-null-assertion
100+
} else {
101+
102+
// tx.maxFeePerGas = ethers.parseUnits(Math.ceil(Number(feeData['maxFeePerGas']!)) + '', 'wei')
103+
tx.maxFeePerGas = feeData['maxFeePerGas']! // eslint-disable-line @typescript-eslint/no-non-null-assertion
104+
105+
// tx.maxPriorityFeePerGas = ethers.parseUnits(Math.ceil(Number(feeData['maxPriorityFeePerGas']!)) + '', 'wei')
106+
tx.maxPriorityFeePerGas = feeData['maxPriorityFeePerGas']! // eslint-disable-line @typescript-eslint/no-non-null-assertion
100107
}
101108

102109
console.log(`Deserialized tx: `, JSON.stringify(tx))
103110

111+
// const txResponse = await publisherSigner.sendTransaction(tx)
104112
const txResponse = await nevermined.web3.broadcastTransaction(tx.serialized)
105113

106114
// const txResponse = await provider.sendTransaction(Transaction.from(signedTx))

0 commit comments

Comments
 (0)