Storage deposit limit changes (#4370)
This commit is contained in:
@@ -56,9 +56,9 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
return this.#tx;
|
||||
}
|
||||
|
||||
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
|
||||
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
|
||||
const hasStorageDeposit = this.api.tx.contracts.instantiate.meta.args.length === 6;
|
||||
const storageDepositLimit = null;
|
||||
|
||||
const tx = hasStorageDeposit
|
||||
? this.api.tx.contracts.instantiate(value, gasLimit, storageDepositLimit, this.codeHash, this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt))
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
||||
@@ -61,9 +61,9 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
return this.#tx;
|
||||
}
|
||||
|
||||
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
|
||||
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
|
||||
const hasStorageDeposit = this.api.tx.contracts.instantiateWithCode.meta.args.length === 6;
|
||||
const storageDepositLimit = null;
|
||||
|
||||
const tx = hasStorageDeposit
|
||||
? this.api.tx.contracts.instantiateWithCode(value, gasLimit, storageDepositLimit, compactAddLength(this.code), this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt))
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
||||
@@ -106,9 +106,9 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
: gasLimit;
|
||||
};
|
||||
|
||||
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
|
||||
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
|
||||
const hasStorageDeposit = this.api.tx.contracts.call.meta.args.length === 5;
|
||||
const storageDepositLimit = null;
|
||||
|
||||
const tx = hasStorageDeposit
|
||||
? this.api.tx.contracts.call(this.address, value, this.#getGas(gasLimit), storageDepositLimit, this.abi.findMessage(messageOrId).toU8a(params))
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
@@ -133,7 +133,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
);
|
||||
};
|
||||
|
||||
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
|
||||
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
|
||||
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
|
||||
|
||||
const message = this.abi.findMessage(messageOrId);
|
||||
@@ -143,7 +143,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
send: this._decorateMethod((origin: string | AccountId | Uint8Array) => {
|
||||
const hasStorageDeposit = this.api.tx.contracts.call.meta.args.length === 5;
|
||||
const rpc = hasStorageDeposit
|
||||
? this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData: message.toU8a(params), origin, value })
|
||||
? this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData: message.toU8a(params), origin, storageDepositLimit, value })
|
||||
: this.api.rx.rpc.contracts.call({ dest: this.address, gasLimit: this.#getGas(gasLimit, true), inputData: message.toU8a(params), origin, value });
|
||||
|
||||
const mapFn = ({ debugMessage, gasConsumed, gasRequired, result }: ContractExecResult): ContractCallOutcome => ({
|
||||
|
||||
@@ -70,13 +70,12 @@ export interface DecodedMessage {
|
||||
message: AbiMessage;
|
||||
}
|
||||
|
||||
export interface BlueprintOptions {
|
||||
gasLimit?: bigint | string | number | BN;
|
||||
salt?: Uint8Array | string | null;
|
||||
value?: bigint | string | number | BN;
|
||||
}
|
||||
|
||||
export interface ContractOptions {
|
||||
gasLimit?: bigint | BN | string | number;
|
||||
gasLimit?: bigint | string | number | BN;
|
||||
storageDepositLimit?: bigint | string | number | BN | null;
|
||||
value?: bigint | BN | string | number;
|
||||
}
|
||||
|
||||
export interface BlueprintOptions extends ContractOptions {
|
||||
salt?: Uint8Array | string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user