diff --git a/src/contracts/AccessList.ts b/src/contracts/AccessList.ts index 7ac3baa10..3b058505b 100644 --- a/src/contracts/AccessList.ts +++ b/src/contracts/AccessList.ts @@ -4,7 +4,6 @@ import { sendTx } from '../utils' import { AbiItem, ReceiptOrEstimate } from '../@types' import { Config } from '../config' import { SmartContractWithAddress } from './SmartContractWithAddress' -import * as sapphire from '@oasisprotocol/sapphire-paratime' export class AccessListContract extends SmartContractWithAddress { public abiEnterprise: AbiItem[] @@ -99,9 +98,7 @@ export class AccessListContract extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.mint, user, @@ -126,9 +123,7 @@ export class AccessListContract extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.batchMint, users, @@ -151,9 +146,7 @@ export class AccessListContract extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.burn, tokenId @@ -175,9 +168,7 @@ export class AccessListContract extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.transferOwnership, newOwner @@ -197,9 +188,7 @@ export class AccessListContract extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.renounceOwnership ) diff --git a/src/contracts/AccessListFactory.ts b/src/contracts/AccessListFactory.ts index 5bb14222f..672e450f5 100644 --- a/src/contracts/AccessListFactory.ts +++ b/src/contracts/AccessListFactory.ts @@ -4,7 +4,6 @@ import AccessListFactory from '@oceanprotocol/contracts/artifacts/contracts/acce import { generateDtName, sendTx, getEventFromTx, ZERO_ADDRESS } from '../utils' import { AbiItem, ReceiptOrEstimate } from '../@types' import { SmartContractWithAddress } from './SmartContractWithAddress' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for Access List Factory contract @@ -71,9 +70,7 @@ export class AccesslistFactory extends SmartContractWithAddress { try { const tx = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.deployAccessListContract, nameAccessList, @@ -149,9 +146,7 @@ export class AccesslistFactory extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.functions.changeTemplateAddress, templateAddress diff --git a/src/contracts/Datatoken.ts b/src/contracts/Datatoken.ts index 25d28695b..8b24ba7bc 100644 --- a/src/contracts/Datatoken.ts +++ b/src/contracts/Datatoken.ts @@ -18,7 +18,6 @@ import { import { Nft } from './NFT' import { Config } from '../config' import { SmartContract } from './SmartContract' -import * as sapphire from '@oasisprotocol/sapphire-paratime' export class Datatoken extends SmartContract { public abiEnterprise: AbiItem[] @@ -71,9 +70,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.approve, spender, @@ -126,9 +123,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.createFixedRate, fixedRateParams.fixedRateAddress, @@ -187,9 +182,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.createDispenser, dispenserAddress, @@ -232,9 +225,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.mint, toAddress || address, @@ -271,9 +262,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.addMinter, minter @@ -307,9 +296,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.removeMinter, minter @@ -343,9 +330,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.addPaymentManager, paymentManager @@ -379,9 +364,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.removePaymentManager, paymentManager @@ -423,9 +406,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.setPaymentCollector, paymentCollector @@ -486,9 +467,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.transfer, toAddress, @@ -533,9 +512,7 @@ export class Datatoken extends SmartContract { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.startOrder, consumer, @@ -568,9 +545,7 @@ export class Datatoken extends SmartContract { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.reuseOrder, orderTxId, @@ -604,9 +579,7 @@ export class Datatoken extends SmartContract { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.buyFromFreAndOrder, orderParams, @@ -638,9 +611,7 @@ export class Datatoken extends SmartContract { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.buyFromDispenserAndOrder, orderParams, @@ -676,9 +647,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.setData, valueHex @@ -709,9 +678,7 @@ export class Datatoken extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.cleanPermissions ) @@ -877,9 +844,7 @@ export class Datatoken extends SmartContract { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.setPublishingMarketFee, publishMarketFeeAddress, diff --git a/src/contracts/Datatoken4.ts b/src/contracts/Datatoken4.ts index c2f7a8f0c..e7bc937a3 100644 --- a/src/contracts/Datatoken4.ts +++ b/src/contracts/Datatoken4.ts @@ -6,7 +6,6 @@ import { AbiItem, ReceiptOrEstimate } from '../@types' import { AccessListContract } from './AccessList' import { Config } from '../config' import { sendTx } from '../utils' -import * as sapphire from '@oasisprotocol/sapphire-paratime' export class Datatoken4 extends Datatoken { public accessList: AccessListContract @@ -85,9 +84,7 @@ export class Datatoken4 extends Datatoken { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.functions.setAllowListContract, address @@ -121,9 +118,7 @@ export class Datatoken4 extends Datatoken { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.functions.setDenyListContract, address @@ -154,9 +149,7 @@ export class Datatoken4 extends Datatoken { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, dtContract.functions.setFilesObject, this.fileObject diff --git a/src/contracts/Dispenser.ts b/src/contracts/Dispenser.ts index af2487357..93b48ba83 100644 --- a/src/contracts/Dispenser.ts +++ b/src/contracts/Dispenser.ts @@ -4,7 +4,6 @@ import { sendTx } from '../utils' import { Datatoken } from './Datatoken' import { SmartContractWithAddress } from './SmartContractWithAddress' import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types' -import * as sapphire from '@oasisprotocol/sapphire-paratime' export class Dispenser extends SmartContractWithAddress { getDefaultAbi() { @@ -62,9 +61,7 @@ export class Dispenser extends SmartContractWithAddress { // Call createFixedRate contract method const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.create, dtAddress, @@ -99,9 +96,7 @@ export class Dispenser extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.activate, dtAddress, @@ -126,9 +121,7 @@ export class Dispenser extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.deactivate, dtAddress @@ -156,9 +149,7 @@ export class Dispenser extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.setAllowedSwapper, dtAddress, @@ -191,9 +182,7 @@ export class Dispenser extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.dispense, dtAddress, @@ -217,9 +206,7 @@ export class Dispenser extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.ownerWithdraw, dtAddress diff --git a/src/contracts/FixedRateExchange.ts b/src/contracts/FixedRateExchange.ts index 568272579..a79effb2a 100644 --- a/src/contracts/FixedRateExchange.ts +++ b/src/contracts/FixedRateExchange.ts @@ -8,7 +8,6 @@ import { AbiItem } from '../@types' import { SmartContractWithAddress } from './SmartContractWithAddress' -import * as sapphire from '@oasisprotocol/sapphire-paratime' export class FixedRateExchange extends SmartContractWithAddress { getDefaultAbi() { @@ -67,9 +66,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.buyDT, exchangeId, @@ -122,9 +119,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.sellDT, exchangeId, @@ -164,9 +159,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.setRate, exchangeId, @@ -195,9 +188,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.setAllowedSwapper, exchangeId, @@ -223,9 +214,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.toggleExchangeState, exchangeId @@ -251,9 +240,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.toggleExchangeState, exchangeId @@ -478,9 +465,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.toggleMintState, exchangeId, @@ -507,9 +492,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.toggleMintState, exchangeId, @@ -544,9 +527,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.collectBT, exchangeId, @@ -581,9 +562,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.collectDT, exchangeId, @@ -609,9 +588,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.collectMarketFee, exchangeId @@ -637,9 +614,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.collectOceanFee, exchangeId @@ -695,9 +670,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.updateMarketFee, exchangeId, @@ -726,9 +699,7 @@ export class FixedRateExchange extends SmartContractWithAddress { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.updateMarketFeeCollector, exchangeId, diff --git a/src/contracts/NFT.ts b/src/contracts/NFT.ts index 21056d06f..ada38fe56 100644 --- a/src/contracts/NFT.ts +++ b/src/contracts/NFT.ts @@ -13,7 +13,6 @@ import { calculateActiveTemplateIndex, getOceanArtifactsAdressesByChainId } from '../utils/Assets' -import * as sapphire from '@oasisprotocol/sapphire-paratime' export class Nft extends SmartContract { getDefaultAbi() { @@ -105,9 +104,7 @@ export class Nft extends SmartContract { const tx = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.createERC20, templateIndex, @@ -149,9 +146,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.addManager, manager @@ -185,9 +180,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.removeManager, manager @@ -222,9 +215,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.addToCreateERC20List, datatokenDeployer @@ -263,9 +254,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.removeFromCreateERC20List, datatokenDeployer @@ -299,9 +288,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.addToMetadataList, metadataUpdater @@ -337,9 +324,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.removeFromMetadataList, metadataUpdater @@ -372,9 +357,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.addTo725StoreList, storeUpdater @@ -411,9 +394,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.removeFrom725StoreList, storeUpdater @@ -447,9 +428,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.cleanPermissions ) @@ -490,9 +469,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.transferFrom, nftOwner, @@ -536,9 +513,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.safeTransferFrom, nftOwner, @@ -670,9 +645,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.setMetaDataState, metadataState @@ -698,9 +671,7 @@ export class Nft extends SmartContract { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.setTokenURI, '1', @@ -786,9 +757,7 @@ export class Nft extends SmartContract { if (estimateGas) return >estGas const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, nftContract.setNewData, keyHash, diff --git a/src/contracts/NFTFactory.ts b/src/contracts/NFTFactory.ts index 1d1443557..68dfc4232 100644 --- a/src/contracts/NFTFactory.ts +++ b/src/contracts/NFTFactory.ts @@ -19,7 +19,6 @@ import { ReceiptOrEstimate } from '../@types' import { SmartContractWithAddress } from './SmartContractWithAddress' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for NFT Factory contract @@ -72,9 +71,7 @@ export class NftFactory extends SmartContractWithAddress { try { const tx = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.deployERC721Contract, nftData.name, @@ -216,9 +213,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.add721TokenTemplate, templateAddress @@ -254,9 +249,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.disable721TokenTemplate, templateIndex @@ -295,9 +288,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.reactivate721TokenTemplate, templateIndex @@ -330,9 +321,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.addTokenTemplate, templateAddress @@ -372,9 +361,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.disableTokenTemplate, templateIndex @@ -414,9 +401,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.reactivateTokenTemplate, templateIndex @@ -449,9 +434,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.startMultipleTokenOrder, orders @@ -483,9 +466,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.createNftWithErc20, nftCreateData, @@ -522,9 +503,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.createNftWithErc20WithFixedRate, nftCreateData, @@ -573,9 +552,7 @@ export class NftFactory extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.createNftWithErc20WithDispenser, nftCreateData, diff --git a/src/contracts/Router.ts b/src/contracts/Router.ts index 365a10a36..0fe161bbb 100644 --- a/src/contracts/Router.ts +++ b/src/contracts/Router.ts @@ -2,7 +2,6 @@ import FactoryRouter from '@oceanprotocol/contracts/artifacts/contracts/pools/Fa import { sendTx } from '../utils' import { Operation, ReceiptOrEstimate, AbiItem } from '../@types' import { SmartContractWithAddress } from './SmartContractWithAddress' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for FactoryRouter contract @@ -29,9 +28,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.buyDTBatch, operations @@ -96,9 +93,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.addApprovedToken, tokenAddress @@ -128,9 +123,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.removeApprovedToken, tokenAddress @@ -159,9 +152,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.addFixedRateContract, tokenAddress @@ -191,9 +182,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.removeFixedRateContract, tokenAddress @@ -223,9 +212,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.addDispenserContract, tokenAddress @@ -254,9 +241,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.removeDispenserContract, tokenAddress @@ -310,9 +295,7 @@ export class Router extends SmartContractWithAddress { const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.updateOPCFee, newSwapOceanFee, diff --git a/src/contracts/SmartContract.ts b/src/contracts/SmartContract.ts index 8eaa95a6e..422918ffe 100644 --- a/src/contracts/SmartContract.ts +++ b/src/contracts/SmartContract.ts @@ -7,6 +7,7 @@ import { setContractDefaults, unitsToAmount } from '../utils' +import * as sapphire from '@oasisprotocol/sapphire-paratime' export abstract class SmartContract { public signer: Signer @@ -33,6 +34,12 @@ export abstract class SmartContract { this.abi = abi || this.getDefaultAbi() } + protected getSignerAccordingSdk() { + return this.config && 'sdk' in this.config && this.config.sdk === 'oasis' + ? sapphire.wrap(this.signer) + : this.signer + } + /** * Converts an amount of tokens to units * @param {string} token - The token to convert diff --git a/src/contracts/df/DfRewards.ts b/src/contracts/df/DfRewards.ts index fab404346..f3f96ee01 100644 --- a/src/contracts/df/DfRewards.ts +++ b/src/contracts/df/DfRewards.ts @@ -2,7 +2,6 @@ import dfRewardsABI from '@oceanprotocol/contracts/artifacts/contracts/df/DFRewa import { sendTx } from '../../utils' import { SmartContractWithAddress } from '../SmartContractWithAddress' import { AbiItem, ReceiptOrEstimate } from '../../@types' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for DFRewards contract @@ -44,9 +43,7 @@ export class DfRewards extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.claimFor, userAddress, @@ -81,9 +78,7 @@ export class DfRewards extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.allocate, userAddresses, diff --git a/src/contracts/df/DfStrategyV1.ts b/src/contracts/df/DfStrategyV1.ts index 850416d0a..7868e591b 100644 --- a/src/contracts/df/DfStrategyV1.ts +++ b/src/contracts/df/DfStrategyV1.ts @@ -2,7 +2,6 @@ import dfStrategyV1ABI from '@oceanprotocol/contracts/artifacts/contracts/df/DFS import { sendTx } from '../../utils' import { SmartContractWithAddress } from '../SmartContractWithAddress' import { ReceiptOrEstimate, AbiItem } from '../../@types' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for dfStrategyV1 contract */ @@ -47,9 +46,7 @@ export class DfStrategyV1 extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas, - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.claimMultiple, userAddress, diff --git a/src/contracts/ve/VeAllocate.ts b/src/contracts/ve/VeAllocate.ts index 81ef75f98..3f9da1e0e 100644 --- a/src/contracts/ve/VeAllocate.ts +++ b/src/contracts/ve/VeAllocate.ts @@ -2,7 +2,6 @@ import veAllocateABI from '@oceanprotocol/contracts/artifacts/contracts/ve/veAll import { sendTx } from '../../utils' import { SmartContractWithAddress } from '../SmartContractWithAddress' import { ReceiptOrEstimate, AbiItem } from '../../@types' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for veOcean contract */ @@ -31,9 +30,7 @@ export class VeAllocate extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.setAllocation, amount, @@ -66,9 +63,7 @@ export class VeAllocate extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.setBatchAllocation, amount, diff --git a/src/contracts/ve/VeFeeDistributor.ts b/src/contracts/ve/VeFeeDistributor.ts index c0be6f027..5a272c6f3 100644 --- a/src/contracts/ve/VeFeeDistributor.ts +++ b/src/contracts/ve/VeFeeDistributor.ts @@ -2,7 +2,6 @@ import veFeeABI from '@oceanprotocol/contracts/artifacts/contracts/ve/veFeeDistr import { sendTx } from '../../utils' import { SmartContractWithAddress } from '../SmartContractWithAddress' import { ReceiptOrEstimate, AbiItem } from '../../@types' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for veOcean contract */ @@ -30,9 +29,7 @@ export class VeFeeDistributor extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.claim ) @@ -57,9 +54,7 @@ export class VeFeeDistributor extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.claim_many, addresses diff --git a/src/contracts/ve/VeOcean.ts b/src/contracts/ve/VeOcean.ts index 397c45da5..ed5efd7f3 100644 --- a/src/contracts/ve/VeOcean.ts +++ b/src/contracts/ve/VeOcean.ts @@ -2,7 +2,6 @@ import veOceanABI from '@oceanprotocol/contracts/artifacts/contracts/ve/veOCEAN. import { sendTx } from '../../utils' import { SmartContractWithAddress } from '../SmartContractWithAddress' import { ReceiptOrEstimate, AbiItem } from '../../@types' -import * as sapphire from '@oasisprotocol/sapphire-paratime' /** * Provides an interface for veOcean contract */ @@ -32,9 +31,7 @@ export class VeOcean extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.create_lock, amountFormatted, @@ -62,9 +59,7 @@ export class VeOcean extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.deposit_for, toAddress, @@ -89,9 +84,7 @@ export class VeOcean extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.increase_amount, amountFormatted @@ -114,9 +107,7 @@ export class VeOcean extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.increase_unlock_time, unlockTime @@ -137,9 +128,7 @@ export class VeOcean extends SmartContractWithAddress { // Invoke function of the contract const trxReceipt = await sendTx( estGas.add(20000), - this.config && 'sdk' in this.config && this.config.sdk === 'oasis' - ? sapphire.wrap(this.signer) - : this.signer, + this.getSignerAccordingSdk(), this.config?.gasFeeMultiplier, this.contract.withdraw )