@dedot/contracts 0.16.1-next.fa430c5d.7 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Contract.d.ts CHANGED
@@ -4,8 +4,8 @@ import { TypinkRegistry } from './TypinkRegistry.js';
4
4
  import { ContractAddress, ContractEvent, ContractMetadata, ExecutionOptions, GenericContractApi, LooseContractMetadata } from './types/index.js';
5
5
  export declare class Contract<ContractApi extends GenericContractApi = GenericContractApi> {
6
6
  #private;
7
- readonly client: ISubstrateClient<any, any>;
8
- constructor(client: ISubstrateClient<any, any>, metadata: LooseContractMetadata | string, address: ContractAddress, options?: ExecutionOptions);
7
+ readonly client: ISubstrateClient<ContractApi['types']['ChainApi']>;
8
+ constructor(client: ISubstrateClient<ContractApi['types']['ChainApi']>, metadata: LooseContractMetadata | string, address: ContractAddress, options?: ExecutionOptions);
9
9
  decodeEvent(eventRecord: IEventRecord): ContractEvent;
10
10
  decodeEvents(eventRecords: IEventRecord[]): ContractEvent[];
11
11
  get metadata(): ContractMetadata;
@@ -4,8 +4,8 @@ import { TypinkRegistry } from './TypinkRegistry.js';
4
4
  import { ContractMetadata, ExecutionOptions, GenericContractApi, LooseContractMetadata } from './types/index.js';
5
5
  export declare class ContractDeployer<ContractApi extends GenericContractApi = GenericContractApi> {
6
6
  #private;
7
- readonly client: ISubstrateClient<any, any>;
8
- constructor(client: ISubstrateClient<any, any>, metadata: LooseContractMetadata | string, codeHashOrCode: Hash | Uint8Array | string, options?: ExecutionOptions);
7
+ readonly client: ISubstrateClient<ContractApi['types']['ChainApi']>;
8
+ constructor(client: ISubstrateClient<ContractApi['types']['ChainApi']>, metadata: LooseContractMetadata | string, codeHashOrCode: Hash | Uint8Array | string, options?: ExecutionOptions);
9
9
  get metadata(): ContractMetadata;
10
10
  get registry(): TypinkRegistry;
11
11
  get tx(): ContractApi['constructorTx'];
@@ -8,8 +8,7 @@ const ensureStorageApiSupports = (version) => {
8
8
  (0, utils_1.assert)(numberedVersion >= 5, `Contract Storage Api Only Available for metadata version >= 5, current version: ${version}`);
9
9
  };
10
10
  exports.ensureStorageApiSupports = ensureStorageApiSupports;
11
- function ensurePalletPresence(_client, registry) {
12
- const client = _client;
11
+ function ensurePalletPresence(client, registry) {
13
12
  if (registry.isRevive()) {
14
13
  try {
15
14
  !!client.call.reviveApi.call.meta && !!client.tx.revive.call.meta;
@@ -28,8 +27,7 @@ function ensurePalletPresence(_client, registry) {
28
27
  }
29
28
  }
30
29
  exports.ensurePalletPresence = ensurePalletPresence;
31
- async function ensureContractPresence(_client, registry, address) {
32
- const client = _client;
30
+ async function ensureContractPresence(client, registry, address) {
33
31
  const contractInfo = await (async () => {
34
32
  if (registry.isRevive()) {
35
33
  const accountInfo = await client.query.revive.accountInfoOf(address);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/contracts",
3
- "version": "0.16.1-next.fa430c5d.7+fa430c5d",
3
+ "version": "0.17.0",
4
4
  "description": "Delightful ink! Contract APIs",
5
5
  "author": "Tung Vu <tung@dedot.dev>",
6
6
  "homepage": "https://dedot.dev",
@@ -18,10 +18,10 @@
18
18
  "test": "npx vitest --watch=false"
19
19
  },
20
20
  "dependencies": {
21
- "@dedot/api": "0.16.1-next.fa430c5d.7+fa430c5d",
22
- "@dedot/codecs": "0.16.1-next.fa430c5d.7+fa430c5d",
23
- "@dedot/types": "0.16.1-next.fa430c5d.7+fa430c5d",
24
- "@dedot/utils": "0.16.1-next.fa430c5d.7+fa430c5d",
21
+ "@dedot/api": "0.17.0",
22
+ "@dedot/codecs": "0.17.0",
23
+ "@dedot/types": "0.17.0",
24
+ "@dedot/utils": "0.17.0",
25
25
  "@ethereumjs/rlp": "^10.0.0"
26
26
  },
27
27
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  "node": ">=18"
33
33
  },
34
34
  "license": "Apache-2.0",
35
- "gitHead": "fa430c5d862bc45ec959cb5272619515172ab54b",
35
+ "gitHead": "77e751248ad7bca0cb374e17e65afef791fb3e4d",
36
36
  "module": "./index.js",
37
37
  "types": "./index.d.ts",
38
38
  "exports": {
package/utils/ensure.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
+ import { SubstrateApi } from '@dedot/api/chaintypes';
2
3
  import { Hash } from '@dedot/codecs';
4
+ import { RpcVersion } from '@dedot/types';
3
5
  import { TypinkRegistry } from 'src/TypinkRegistry';
4
6
  import { ContractAddress, LooseContractMetadata } from 'src/types';
5
7
  export declare const ensureStorageApiSupports: (version: string | number) => void;
6
- export declare function ensurePalletPresence(_client: ISubstrateClient<any, any>, registry: TypinkRegistry): void;
7
- export declare function ensureContractPresence(_client: ISubstrateClient<any, any>, registry: TypinkRegistry, address: ContractAddress): Promise<void>;
8
+ export declare function ensurePalletPresence(client: ISubstrateClient<SubstrateApi[RpcVersion]>, registry: TypinkRegistry): void;
9
+ export declare function ensureContractPresence(client: ISubstrateClient<SubstrateApi[RpcVersion]>, registry: TypinkRegistry, address: ContractAddress): Promise<void>;
8
10
  export declare function ensureValidContractAddress(address: ContractAddress, registry: TypinkRegistry): void;
9
11
  export declare function ensureValidCodeHashOrCode(codeHashOrCode: Hash | Uint8Array | string, registry: TypinkRegistry): void;
10
12
  export declare function ensureSupportedContractMetadataVersion(metadata: LooseContractMetadata): void;
package/utils/ensure.js CHANGED
@@ -4,8 +4,7 @@ export const ensureStorageApiSupports = (version) => {
4
4
  const numberedVersion = typeof version === 'number' ? version : parseInt(version);
5
5
  assert(numberedVersion >= 5, `Contract Storage Api Only Available for metadata version >= 5, current version: ${version}`);
6
6
  };
7
- export function ensurePalletPresence(_client, registry) {
8
- const client = _client;
7
+ export function ensurePalletPresence(client, registry) {
9
8
  if (registry.isRevive()) {
10
9
  try {
11
10
  !!client.call.reviveApi.call.meta && !!client.tx.revive.call.meta;
@@ -23,8 +22,7 @@ export function ensurePalletPresence(_client, registry) {
23
22
  }
24
23
  }
25
24
  }
26
- export async function ensureContractPresence(_client, registry, address) {
27
- const client = _client;
25
+ export async function ensureContractPresence(client, registry, address) {
28
26
  const contractInfo = await (async () => {
29
27
  if (registry.isRevive()) {
30
28
  const accountInfo = await client.query.revive.accountInfoOf(address);