wative-core 1.2.1 → 2.2.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/CHANGELOG.md +136 -0
- package/LICENSE +55 -0
- package/README.md +496 -0
- package/dist/artifacts/evm/index.cjs +1 -0
- package/dist/artifacts/evm/index.d.cts +6 -0
- package/dist/artifacts/evm/index.d.ts +6 -0
- package/dist/artifacts/evm/index.js +1 -0
- package/dist/artifacts/svm/index.cjs +1 -0
- package/dist/artifacts/svm/index.d.cts +9 -0
- package/dist/artifacts/svm/index.d.ts +9 -0
- package/dist/artifacts/svm/index.js +1 -0
- package/dist/container-provider-C59yqd5Z.d.ts +48 -0
- package/dist/container-provider-i614LDE1.d.cts +48 -0
- package/dist/evm-BLml33LX.d.cts +34 -0
- package/dist/evm-DTzqGlL6.d.ts +34 -0
- package/dist/file-sink-B73MuigK.d.cts +44 -0
- package/dist/file-sink-LS4hyXXi.d.ts +44 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +194 -0
- package/dist/index.d.ts +194 -0
- package/dist/index.js +1 -0
- package/dist/index.node.cjs +1 -0
- package/dist/index.node.d.cts +6 -0
- package/dist/index.node.d.ts +6 -0
- package/dist/index.node.js +1 -0
- package/dist/node/index.cjs +1 -0
- package/dist/node/index.d.cts +7 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +1 -0
- package/dist/svm-CCzqNAWM.d.cts +59 -0
- package/dist/svm-DieFbh9k.d.ts +59 -0
- package/dist/workspace-CamTHxso.d.cts +737 -0
- package/dist/workspace-CamTHxso.d.ts +737 -0
- package/package.json +85 -37
- package/tests/01-quick-start.test.cjs +37 -0
- package/tests/02-hd-account.test.cjs +71 -0
- package/tests/03-pk-account.test.cjs +59 -0
- package/tests/04-network-management.test.cjs +94 -0
- package/tests/05-asset-management.test.cjs +117 -0
- package/tests/06-address-signing.test.cjs +55 -0
- package/tests/07-custom-provider.test.cjs +164 -0
- package/tests/08-persistence.test.cjs +105 -0
- package/tests/09-workspace-filter.test.cjs +84 -0
- package/tests/10-default-network.test.cjs +70 -0
- package/tests/11-subpath-imports.test.cjs +21 -0
- package/tests/12-logger.test.cjs +44 -0
- package/tests/13-workspace-config.test.cjs +43 -0
- package/tests/14-esm-runtime.test.mjs +81 -0
- package/tests/15-package-resolution.test.cjs +76 -0
- package/tests/16-known-answer-vectors.test.cjs +141 -0
- package/tests/17-locked-state.test.cjs +162 -0
- package/tests/README.md +72 -0
- package/lib/account.d.ts +0 -69
- package/lib/index.d.ts +0 -6
- package/lib/index.esm.js +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/mnemonic.d.ts +0 -3
- package/lib/utils.d.ts +0 -21
- package/src/account.ts +0 -749
- package/src/index.ts +0 -11
- package/src/mnemonic.ts +0 -2084
- package/src/utils.ts +0 -132
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { P as Provider, Y as ContainerState, w as RecordType, z as Slug, R as Record } from './workspace-CamTHxso.js';
|
|
2
|
+
|
|
3
|
+
interface ContainerEntry {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly data: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
declare abstract class ContainerProvider extends Provider {
|
|
8
|
+
#private;
|
|
9
|
+
protected constructor(rootDescriptor: string);
|
|
10
|
+
|
|
11
|
+
protected get _rootPrefix(): string;
|
|
12
|
+
|
|
13
|
+
protected _join(base: string, segment: string): string;
|
|
14
|
+
|
|
15
|
+
protected _prepareUnlock(): Promise<void>;
|
|
16
|
+
|
|
17
|
+
unlockContainer(password: string): Promise<boolean>;
|
|
18
|
+
lockContainer(): Promise<void>;
|
|
19
|
+
isContainerUnlocked(): boolean;
|
|
20
|
+
|
|
21
|
+
inspectContainer(): Promise<ContainerState>;
|
|
22
|
+
loadRecord<T>(type: RecordType, slug?: Slug): Promise<Record<T>>;
|
|
23
|
+
loadRecords<T>(type: RecordType): Promise<ReadonlyArray<Record<T>>>;
|
|
24
|
+
writeRecord<T>(type: RecordType, slug: Slug, value: T): Promise<void>;
|
|
25
|
+
dropRecord(type: RecordType, slug: Slug): Promise<void>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
|
|
28
|
+
exportContainer(): Promise<ReadonlyArray<ContainerEntry>>;
|
|
29
|
+
|
|
30
|
+
importContainer(entries: ReadonlyArray<ContainerEntry>, opts?: {
|
|
31
|
+
overwrite?: boolean;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
protected get _configKey(): string;
|
|
34
|
+
protected get _accountsDir(): string;
|
|
35
|
+
protected _keyFor(type: RecordType, slug?: Slug): string;
|
|
36
|
+
protected _defaultSlug(type: RecordType, slug?: Slug): Slug;
|
|
37
|
+
protected _requireUnlocked(): void;
|
|
38
|
+
protected _hydrate<T>(type: RecordType, slug: Slug, key: string): Promise<Record<T>>;
|
|
39
|
+
protected _encryptValue<T>(value: T, password: string, type: RecordType, slug: string): Uint8Array;
|
|
40
|
+
|
|
41
|
+
protected _encryptBlob(plaintext: Uint8Array, password: string, type: RecordType, slug: string): Uint8Array;
|
|
42
|
+
|
|
43
|
+
protected _decryptBlob(blob: Uint8Array, password: string, type: RecordType, slug: string): Uint8Array;
|
|
44
|
+
|
|
45
|
+
passwordTanren(userInputPassword: string, salt: Uint8Array): Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { type ContainerEntry as C, ContainerProvider as a };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { P as Provider, Y as ContainerState, w as RecordType, z as Slug, R as Record } from './workspace-CamTHxso.cjs';
|
|
2
|
+
|
|
3
|
+
interface ContainerEntry {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly data: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
declare abstract class ContainerProvider extends Provider {
|
|
8
|
+
#private;
|
|
9
|
+
protected constructor(rootDescriptor: string);
|
|
10
|
+
|
|
11
|
+
protected get _rootPrefix(): string;
|
|
12
|
+
|
|
13
|
+
protected _join(base: string, segment: string): string;
|
|
14
|
+
|
|
15
|
+
protected _prepareUnlock(): Promise<void>;
|
|
16
|
+
|
|
17
|
+
unlockContainer(password: string): Promise<boolean>;
|
|
18
|
+
lockContainer(): Promise<void>;
|
|
19
|
+
isContainerUnlocked(): boolean;
|
|
20
|
+
|
|
21
|
+
inspectContainer(): Promise<ContainerState>;
|
|
22
|
+
loadRecord<T>(type: RecordType, slug?: Slug): Promise<Record<T>>;
|
|
23
|
+
loadRecords<T>(type: RecordType): Promise<ReadonlyArray<Record<T>>>;
|
|
24
|
+
writeRecord<T>(type: RecordType, slug: Slug, value: T): Promise<void>;
|
|
25
|
+
dropRecord(type: RecordType, slug: Slug): Promise<void>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
|
|
28
|
+
exportContainer(): Promise<ReadonlyArray<ContainerEntry>>;
|
|
29
|
+
|
|
30
|
+
importContainer(entries: ReadonlyArray<ContainerEntry>, opts?: {
|
|
31
|
+
overwrite?: boolean;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
protected get _configKey(): string;
|
|
34
|
+
protected get _accountsDir(): string;
|
|
35
|
+
protected _keyFor(type: RecordType, slug?: Slug): string;
|
|
36
|
+
protected _defaultSlug(type: RecordType, slug?: Slug): Slug;
|
|
37
|
+
protected _requireUnlocked(): void;
|
|
38
|
+
protected _hydrate<T>(type: RecordType, slug: Slug, key: string): Promise<Record<T>>;
|
|
39
|
+
protected _encryptValue<T>(value: T, password: string, type: RecordType, slug: string): Uint8Array;
|
|
40
|
+
|
|
41
|
+
protected _encryptBlob(plaintext: Uint8Array, password: string, type: RecordType, slug: string): Uint8Array;
|
|
42
|
+
|
|
43
|
+
protected _decryptBlob(blob: Uint8Array, password: string, type: RecordType, slug: string): Uint8Array;
|
|
44
|
+
|
|
45
|
+
passwordTanren(userInputPassword: string, salt: Uint8Array): Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { type ContainerEntry as C, ContainerProvider as a };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { c as Address, m as EvmTxBuildParams, l as EvmTransaction } from './workspace-CamTHxso.cjs';
|
|
2
|
+
|
|
3
|
+
interface AbiItem {
|
|
4
|
+
type?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
inputs?: ReadonlyArray<{
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
components?: unknown[];
|
|
10
|
+
}>;
|
|
11
|
+
outputs?: ReadonlyArray<{
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
components?: unknown[];
|
|
15
|
+
}>;
|
|
16
|
+
stateMutability?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare class Contract {
|
|
20
|
+
#private;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly abi: ReadonlyArray<AbiItem>;
|
|
23
|
+
constructor(name: string, abi: ReadonlyArray<unknown>);
|
|
24
|
+
|
|
25
|
+
static load(name: string): Contract | null;
|
|
26
|
+
|
|
27
|
+
encode(functionName: string, args: ReadonlyArray<unknown>): string;
|
|
28
|
+
|
|
29
|
+
decode(functionName: string, encoded: string): ReadonlyArray<unknown>;
|
|
30
|
+
|
|
31
|
+
call(from: Address, contractAddress: string, functionName: string, args: ReadonlyArray<unknown>, opts?: Partial<EvmTxBuildParams>): EvmTransaction;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Contract as C };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { c as Address, m as EvmTxBuildParams, l as EvmTransaction } from './workspace-CamTHxso.js';
|
|
2
|
+
|
|
3
|
+
interface AbiItem {
|
|
4
|
+
type?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
inputs?: ReadonlyArray<{
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
components?: unknown[];
|
|
10
|
+
}>;
|
|
11
|
+
outputs?: ReadonlyArray<{
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
components?: unknown[];
|
|
15
|
+
}>;
|
|
16
|
+
stateMutability?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare class Contract {
|
|
20
|
+
#private;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly abi: ReadonlyArray<AbiItem>;
|
|
23
|
+
constructor(name: string, abi: ReadonlyArray<unknown>);
|
|
24
|
+
|
|
25
|
+
static load(name: string): Contract | null;
|
|
26
|
+
|
|
27
|
+
encode(functionName: string, args: ReadonlyArray<unknown>): string;
|
|
28
|
+
|
|
29
|
+
decode(functionName: string, encoded: string): ReadonlyArray<unknown>;
|
|
30
|
+
|
|
31
|
+
call(from: Address, contractAddress: string, functionName: string, args: ReadonlyArray<unknown>, opts?: Partial<EvmTxBuildParams>): EvmTransaction;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Contract as C };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Y as ContainerState, p as LogSink, L as LogLevel, o as LogRecord } from './workspace-CamTHxso.cjs';
|
|
2
|
+
import { a as ContainerProvider } from './container-provider-i614LDE1.cjs';
|
|
3
|
+
|
|
4
|
+
declare class HybridProvider extends ContainerProvider {
|
|
5
|
+
#private;
|
|
6
|
+
readonly rootPath: string;
|
|
7
|
+
constructor(rootPath: string);
|
|
8
|
+
protected _exist(path: string): Promise<boolean>;
|
|
9
|
+
protected _listItems(path: string): Promise<string[]>;
|
|
10
|
+
protected _read(path: string): Promise<Uint8Array>;
|
|
11
|
+
|
|
12
|
+
protected _write(path: string, data: Uint8Array): Promise<void>;
|
|
13
|
+
protected _remove(path: string): Promise<void>;
|
|
14
|
+
protected _ensureDir(path: string): Promise<void>;
|
|
15
|
+
|
|
16
|
+
protected _prepareUnlock(): Promise<void>;
|
|
17
|
+
|
|
18
|
+
protected get _rootPrefix(): string;
|
|
19
|
+
|
|
20
|
+
protected _join(base: string, segment: string): string;
|
|
21
|
+
|
|
22
|
+
static probe(rootPath: string): Promise<boolean>;
|
|
23
|
+
|
|
24
|
+
inspectContainer(): Promise<ContainerState>;
|
|
25
|
+
|
|
26
|
+
static get kdfIterations(): number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface FileSinkOptions {
|
|
30
|
+
dir: string;
|
|
31
|
+
filePrefix?: string;
|
|
32
|
+
maxFileSize?: number;
|
|
33
|
+
maxFiles?: number;
|
|
34
|
+
minLevel?: LogLevel;
|
|
35
|
+
}
|
|
36
|
+
declare class FileSink implements LogSink {
|
|
37
|
+
#private;
|
|
38
|
+
constructor(opts: FileSinkOptions);
|
|
39
|
+
write(record: LogRecord): void;
|
|
40
|
+
flush(): Promise<void>;
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { FileSink as F, HybridProvider as H, type FileSinkOptions as a };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Y as ContainerState, p as LogSink, L as LogLevel, o as LogRecord } from './workspace-CamTHxso.js';
|
|
2
|
+
import { a as ContainerProvider } from './container-provider-C59yqd5Z.js';
|
|
3
|
+
|
|
4
|
+
declare class HybridProvider extends ContainerProvider {
|
|
5
|
+
#private;
|
|
6
|
+
readonly rootPath: string;
|
|
7
|
+
constructor(rootPath: string);
|
|
8
|
+
protected _exist(path: string): Promise<boolean>;
|
|
9
|
+
protected _listItems(path: string): Promise<string[]>;
|
|
10
|
+
protected _read(path: string): Promise<Uint8Array>;
|
|
11
|
+
|
|
12
|
+
protected _write(path: string, data: Uint8Array): Promise<void>;
|
|
13
|
+
protected _remove(path: string): Promise<void>;
|
|
14
|
+
protected _ensureDir(path: string): Promise<void>;
|
|
15
|
+
|
|
16
|
+
protected _prepareUnlock(): Promise<void>;
|
|
17
|
+
|
|
18
|
+
protected get _rootPrefix(): string;
|
|
19
|
+
|
|
20
|
+
protected _join(base: string, segment: string): string;
|
|
21
|
+
|
|
22
|
+
static probe(rootPath: string): Promise<boolean>;
|
|
23
|
+
|
|
24
|
+
inspectContainer(): Promise<ContainerState>;
|
|
25
|
+
|
|
26
|
+
static get kdfIterations(): number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface FileSinkOptions {
|
|
30
|
+
dir: string;
|
|
31
|
+
filePrefix?: string;
|
|
32
|
+
maxFileSize?: number;
|
|
33
|
+
maxFiles?: number;
|
|
34
|
+
minLevel?: LogLevel;
|
|
35
|
+
}
|
|
36
|
+
declare class FileSink implements LogSink {
|
|
37
|
+
#private;
|
|
38
|
+
constructor(opts: FileSinkOptions);
|
|
39
|
+
write(record: LogRecord): void;
|
|
40
|
+
flush(): Promise<void>;
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { FileSink as F, HybridProvider as H, type FileSinkOptions as a };
|