@@ -30,7 +30,7 @@ import {
3030 getTokenDecimals
3131} from "@oceanprotocol/lib" ;
3232import { Asset } from '@oceanprotocol/ddo-js' ;
33- import { Signer , ethers } from "ethers" ;
33+ import { Signer , ethers , getAddress } from "ethers" ;
3434import { interactiveFlow } from "./interactiveFlow.js" ;
3535import { publishAsset } from "./publishAsset.js" ;
3636import chalk from 'chalk' ;
@@ -231,7 +231,7 @@ export class Commands {
231231 dataDdo . id ,
232232 dataDdo . services [ 0 ] . id ,
233233 0 ,
234- orderTx . transactionHash ,
234+ orderTx . hash ,
235235 this . oceanNodeUrl ,
236236 this . signer
237237 ) ;
@@ -400,7 +400,7 @@ export class Commands {
400400 ) ;
401401 return ;
402402 }
403- const chainId = await this . signer . getChainId ( )
403+ const { chainId } = await this . signer . provider . getNetwork ( )
404404 if ( ! Object . keys ( computeEnv . fees ) . includes ( chainId . toString ( ) ) ) {
405405 console . error (
406406 "Error starting paid compute using dataset DID " +
@@ -453,7 +453,8 @@ export class Commands {
453453 supportedMaxJobDuration ,
454454 providerURI ,
455455 this . signer , // V1 was this.signer.getAddress()
456- parsedResources
456+ parsedResources ,
457+ Number ( chainId )
457458 ) ;
458459 if (
459460 ! providerInitializeComputeJob ||
@@ -596,7 +597,7 @@ export class Commands {
596597 console . log ( "Ordering algorithm: " , args [ 2 ] ) ;
597598 const datatoken = new Datatoken (
598599 this . signer ,
599- ( await this . signer . provider . getNetwork ( ) ) . chainId ,
600+ ( await this . signer . provider . getNetwork ( ) ) . chainId . toString ( ) ,
600601 this . config
601602 ) ;
602603 algo . transferTxId = await handleComputeOrder (
@@ -667,7 +668,7 @@ export class Commands {
667668 if ( maxJobDuration > computeEnv . maxJobDuration ) {
668669 supportedMaxJobDuration = computeEnv . maxJobDuration ;
669670 }
670- const chainId = await this . signer . getChainId ( )
671+ const { chainId } = await this . signer . provider . getNetwork ( )
671672 const paymentToken = args [ 6 ]
672673 if ( ! paymentToken ) {
673674 console . error (
@@ -723,10 +724,11 @@ export class Commands {
723724 }
724725
725726 const escrow = new EscrowContract (
726- ethers . utils . getAddress ( parsedProviderInitializeComputeJob . payment . escrowAddress ) ,
727+ getAddress ( parsedProviderInitializeComputeJob . payment . escrowAddress ) ,
727728 this . signer
728729 )
729730 console . log ( "Verifying payment..." ) ;
731+ await new Promise ( resolve => setTimeout ( resolve , 3000 ) )
730732 const validationEscrow = await escrow . verifyFundsForEscrowPayment (
731733 paymentToken ,
732734 computeEnv . consumerAddress ,
@@ -785,7 +787,9 @@ export class Commands {
785787 supportedMaxJobDuration ,
786788 paymentToken ,
787789 JSON . parse ( resources ) ,
788- await this . signer . getChainId ( ) ,
790+ Number ( ( await this . signer . provider . getNetwork ( ) ) . chainId ) ,
791+ null ,
792+ null ,
789793 // additionalDatasets, only c2d v1
790794 output ,
791795 ) ;
@@ -964,6 +968,8 @@ export class Commands {
964968 assets , // assets[0] // only c2d v1,
965969 algo ,
966970 null ,
971+ null ,
972+ null ,
967973 output
968974 ) ;
969975
@@ -991,20 +997,12 @@ export class Commands {
991997 ) ;
992998 return ;
993999 }
994- const hasAgreementId = args . length === 4 ;
9951000
9961001 const jobId = args [ 2 ] ;
997- let agreementId = null ;
998- if ( hasAgreementId ) {
999- agreementId = args [ 3 ] ;
1000- }
10011002 const jobStatus = await ProviderInstance . computeStop (
1002- args [ 1 ] ,
1003- await this . signer . getAddress ( ) ,
10041003 jobId ,
10051004 this . oceanNodeUrl ,
10061005 this . signer ,
1007- agreementId
10081006 ) ;
10091007 console . log ( jobStatus ) ;
10101008 }
@@ -1275,7 +1273,7 @@ export class Commands {
12751273 minAbi ,
12761274 this . signer
12771275 ) ;
1278- const estGasPublisher = await tokenContract . estimateGas . mint (
1276+ const estGasPublisher = await tokenContract . mint . estimateGas (
12791277 await this . signer . getAddress ( ) ,
12801278 await amountToUnits ( null , null , "1000" , 18 )
12811279 ) ;
@@ -1319,7 +1317,7 @@ export class Commands {
13191317 public async getEscrowBalance ( token : string ) : Promise < number > {
13201318 const config = await getConfigByChainId ( Number ( this . config . chainId ) ) ;
13211319 const escrow = new EscrowContract (
1322- ethers . utils . getAddress ( config . Escrow ) ,
1320+ getAddress ( config . Escrow ) ,
13231321 this . signer ,
13241322 Number ( this . config . chainId )
13251323 ) ;
@@ -1339,7 +1337,7 @@ export class Commands {
13391337 public async withdrawFromEscrow ( token : string , amount : string ) : Promise < void > {
13401338 const config = await getConfigByChainId ( Number ( this . config . chainId ) ) ;
13411339 const escrow = new EscrowContract (
1342- ethers . utils . getAddress ( config . Escrow ) ,
1340+ getAddress ( config . Escrow ) ,
13431341 this . signer ,
13441342 Number ( this . config . chainId )
13451343 ) ;
@@ -1368,7 +1366,7 @@ export class Commands {
13681366 ) ;
13691367
13701368 const escrow = new EscrowContract (
1371- ethers . utils . getAddress ( escrowAddress ) ,
1369+ getAddress ( escrowAddress ) ,
13721370 signer ,
13731371 chainId
13741372 ) ;
@@ -1402,14 +1400,14 @@ export class Commands {
14021400 const escrowAddress = config . Escrow ;
14031401
14041402 const escrow = new EscrowContract (
1405- ethers . utils . getAddress ( escrowAddress ) ,
1403+ getAddress ( escrowAddress ) ,
14061404 this . signer
14071405 ) ;
14081406
14091407 console . log ( "Authorizing payee..." ) ;
14101408 const authorizeTx = await escrow . authorize (
1411- ethers . utils . getAddress ( token ) ,
1412- ethers . utils . getAddress ( payee ) ,
1409+ getAddress ( token ) ,
1410+ getAddress ( payee ) ,
14131411 maxLockedAmount ,
14141412 maxLockSeconds ,
14151413 maxLockCounts
@@ -1427,12 +1425,12 @@ export class Commands {
14271425 public async getAuthorizationsEscrow ( token : string , payee : string ) {
14281426 const config = await getConfigByChainId ( Number ( this . config . chainId ) ) ;
14291427 const payer = await this . signer . getAddress ( ) ;
1430- const tokenAddress = ethers . utils . getAddress ( token ) ;
1431- const payerAddress = ethers . utils . getAddress ( payer ) ;
1432- const payeeAddress = ethers . utils . getAddress ( payee ) ;
1428+ const tokenAddress = getAddress ( token ) ;
1429+ const payerAddress = getAddress ( payer ) ;
1430+ const payeeAddress = getAddress ( payee ) ;
14331431 const decimals = await getTokenDecimals ( this . signer , token ) ;
14341432 const escrow = new EscrowContract (
1435- ethers . utils . getAddress ( config . Escrow ) ,
1433+ getAddress ( config . Escrow ) ,
14361434 this . signer ,
14371435 Number ( this . config . chainId )
14381436 ) ;
0 commit comments