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

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<ContractApi['types']['ChainApi']>;
8
- constructor(client: ISubstrateClient<ContractApi['types']['ChainApi']>, metadata: LooseContractMetadata | string, address: ContractAddress, options?: ExecutionOptions);
7
+ readonly client: ISubstrateClient<any, any>;
8
+ constructor(client: ISubstrateClient<any, any>, 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<ContractApi['types']['ChainApi']>;
8
- constructor(client: ISubstrateClient<ContractApi['types']['ChainApi']>, metadata: LooseContractMetadata | string, codeHashOrCode: Hash | Uint8Array | string, options?: ExecutionOptions);
7
+ readonly client: ISubstrateClient<any, any>;
8
+ constructor(client: ISubstrateClient<any, any>, 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,7 +8,8 @@ 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) {
11
+ function ensurePalletPresence(_client, registry) {
12
+ const client = _client;
12
13
  if (registry.isRevive()) {
13
14
  try {
14
15
  !!client.call.reviveApi.call.meta && !!client.tx.revive.call.meta;
@@ -27,10 +28,14 @@ function ensurePalletPresence(client, registry) {
27
28
  }
28
29
  }
29
30
  exports.ensurePalletPresence = ensurePalletPresence;
30
- async function ensureContractPresence(client, registry, address) {
31
- const contractInfo = await (() => {
31
+ async function ensureContractPresence(_client, registry, address) {
32
+ const client = _client;
33
+ const contractInfo = await (async () => {
32
34
  if (registry.isRevive()) {
33
- return client.query.revive.contractInfoOf(address);
35
+ const accountInfo = await client.query.revive.accountInfoOf(address);
36
+ if (accountInfo?.accountType && accountInfo?.accountType?.type === 'Contract') {
37
+ return accountInfo.accountType.value;
38
+ }
34
39
  }
35
40
  else {
36
41
  return client.query.contracts.contractInfoOf(address);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedot/contracts",
3
- "version": "0.16.0",
3
+ "version": "0.16.1-next.fa430c5d.7+fa430c5d",
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.0",
22
- "@dedot/codecs": "0.16.0",
23
- "@dedot/types": "0.16.0",
24
- "@dedot/utils": "0.16.0",
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",
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": "3e78a8eebb8977de0c5fb956154e5b09c4448f31",
35
+ "gitHead": "fa430c5d862bc45ec959cb5272619515172ab54b",
36
36
  "module": "./index.js",
37
37
  "types": "./index.d.ts",
38
38
  "exports": {
package/utils/ensure.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import { ISubstrateClient } from '@dedot/api';
2
- import { SubstrateApi } from '@dedot/api/chaintypes';
3
2
  import { Hash } from '@dedot/codecs';
4
- import { RpcVersion } from '@dedot/types';
5
3
  import { TypinkRegistry } from 'src/TypinkRegistry';
6
4
  import { ContractAddress, LooseContractMetadata } from 'src/types';
7
5
  export declare const ensureStorageApiSupports: (version: string | number) => 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>;
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>;
10
8
  export declare function ensureValidContractAddress(address: ContractAddress, registry: TypinkRegistry): void;
11
9
  export declare function ensureValidCodeHashOrCode(codeHashOrCode: Hash | Uint8Array | string, registry: TypinkRegistry): void;
12
10
  export declare function ensureSupportedContractMetadataVersion(metadata: LooseContractMetadata): void;
package/utils/ensure.js CHANGED
@@ -4,7 +4,8 @@ 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) {
7
+ export function ensurePalletPresence(_client, registry) {
8
+ const client = _client;
8
9
  if (registry.isRevive()) {
9
10
  try {
10
11
  !!client.call.reviveApi.call.meta && !!client.tx.revive.call.meta;
@@ -22,10 +23,14 @@ export function ensurePalletPresence(client, registry) {
22
23
  }
23
24
  }
24
25
  }
25
- export async function ensureContractPresence(client, registry, address) {
26
- const contractInfo = await (() => {
26
+ export async function ensureContractPresence(_client, registry, address) {
27
+ const client = _client;
28
+ const contractInfo = await (async () => {
27
29
  if (registry.isRevive()) {
28
- return client.query.revive.contractInfoOf(address);
30
+ const accountInfo = await client.query.revive.accountInfoOf(address);
31
+ if (accountInfo?.accountType && accountInfo?.accountType?.type === 'Contract') {
32
+ return accountInfo.accountType.value;
33
+ }
29
34
  }
30
35
  else {
31
36
  return client.query.contracts.contractInfoOf(address);