From ca39593f061fbc532823c6fa01393fe22046f08f Mon Sep 17 00:00:00 2001 From: Johann BICH <2253470+kalote@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:07:26 +0100 Subject: [PATCH] change default gas value to 1_000_000 & update interface --- docs/classes/ERC725.md | 2 +- docs/getting-started.md | 2 +- src/constants/constants.ts | 2 +- src/index.ts | 2 +- src/provider/providerWrapper.test.ts | 2 +- src/types/Config.ts | 6 ++++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index 48985771..bf276aca 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -1446,7 +1446,7 @@ On non instantiated class, you should provide an `options` object. | :-------- | :----- | :------------------------------------------------------------------- | | `address` | string | Address of the smart contract to check against a certain interface. | | `rpcUrl` | string | RPC URL to connect to the network the smart contract is deployed to. | -| `gas` | number | Optional: gas parameter to use. Default: 2_000_000. | +| `gas` | number | Optional: gas parameter to use. Default: 1_000_000. | #### Returns diff --git a/docs/getting-started.md b/docs/getting-started.md index 71b05e92..e2e0a4ed 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -61,7 +61,7 @@ const address = '0x0Dc07C77985fE31996Ed612F568eb441afe5768D'; const RPC_URL = 'https://rpc.testnet.lukso.network'; const config = { ipfsGateway: 'https://YOUR-IPFS-GATEWAY/ipfs/', - gas: 20_000_000, // optional, default is 2_000_000 + gas: 20_000_000, // optional, default is 1_000_000 }; const erc725 = new ERC725(schemas, address, RPC_URL, config); diff --git a/src/constants/constants.ts b/src/constants/constants.ts index c9948fc9..5a9ce435 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -172,4 +172,4 @@ export const LSP6_ALL_PERMISSIONS = export const COMPACT_BYTES_ARRAY_STRING = '[CompactBytesArray]'; -export const DEFAULT_GAS_VALUE = 2_000_000; +export const DEFAULT_GAS_VALUE = 1_000_000; diff --git a/src/index.ts b/src/index.ts index ec12ebbe..4d37d9be 100644 --- a/src/index.ts +++ b/src/index.ts @@ -81,7 +81,7 @@ export { encodeData } from './lib/utils'; * */ export class ERC725 { - options: ERC725Options & ERC725Config; + options: ERC725Options; /** * Creates an instance of ERC725. diff --git a/src/provider/providerWrapper.test.ts b/src/provider/providerWrapper.test.ts index 75e8ed94..fa655712 100644 --- a/src/provider/providerWrapper.test.ts +++ b/src/provider/providerWrapper.test.ts @@ -3,7 +3,7 @@ import assert from 'assert'; import { ProviderWrapper } from './providerWrapper'; const erc725AccountAddress = '0x214be121bB52e6909c5158579b3458f8760f1b2f'; -const defaultGas = 2_000_000; +const defaultGas = 1_000_000; describe('ProviderWrapper', () => { describe('#getOwner', () => { diff --git a/src/types/Config.ts b/src/types/Config.ts index 15707591..dd592c49 100644 --- a/src/types/Config.ts +++ b/src/types/Config.ts @@ -5,13 +5,13 @@ export interface ERC725Config { * ```js title=Example * const config = { * ipfsGateway: 'https://ipfs.lukso.network/ipfs/' - * gas: 20_000_000 // Optional, default 2_000_000 + * gas: 20_000_000 // Optional, default 0 * }; * ``` * Make sure to use the following format: `/ipfs/`.
* Another example: `https://cloudflare-ipfs.com/ipfs/` */ - ipfsGateway: string; + ipfsGateway?: string; gas?: number; } @@ -19,4 +19,6 @@ export interface ERC725Options { schemas: ERC725JSONSchema[]; address?: string; provider?; + ipfsGateway: string; + gas: number; }