Remove createBlueprint (use createContract) (#3300)
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||||
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||||
import type { EventRecord, Hash } from '@polkadot/types/interfaces';
|
import type { EventRecord } from '@polkadot/types/interfaces';
|
||||||
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
||||||
import type { AbiConstructor, BlueprintOptions } from '../types';
|
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||||
import type { MapConstructorExec } from './types';
|
import type { MapConstructorExec } from './types';
|
||||||
@@ -55,18 +55,8 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public get tx (): MapConstructorExec<ApiType> {
|
||||||
* @description Deploy the code bundle, creating a Blueprint.
|
return this.#tx;
|
||||||
* @deprecated Use the `code.tx.<constructor>(...) format to put code and deploy
|
|
||||||
*/
|
|
||||||
public createBlueprint (): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
|
|
||||||
return this.api.tx.contracts
|
|
||||||
.putCode(compactAddLength(this.code))
|
|
||||||
.withResultTransform((result: ISubmittableResult) =>
|
|
||||||
new CodeSubmittableResult(result, applyOnEvent(result, ['CodeStored'], ([record]: EventRecord[]) =>
|
|
||||||
new Blueprint<ApiType>(this.api, this.abi, record.event.data[0] as Hash, this._decorateMethod)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,10 +67,6 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
return this.#instantiate(constructorOrId, options, params);
|
return this.#instantiate(constructorOrId, options, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get tx (): MapConstructorExec<ApiType> {
|
|
||||||
return this.#tx;
|
|
||||||
}
|
|
||||||
|
|
||||||
#instantiate = (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
|
#instantiate = (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
|
||||||
return isFunction(this.api.tx.contracts.instantiateWithCode)
|
return isFunction(this.api.tx.contracts.instantiateWithCode)
|
||||||
? this.#instantiateSingle(constructorOrId, options, params)
|
? this.#instantiateSingle(constructorOrId, options, params)
|
||||||
|
|||||||
Reference in New Issue
Block a user