@dashevo/evo-sdk 2.1.0-dev.4
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/dist/contracts/facade.d.ts +33 -0
- package/dist/contracts/facade.js +42 -0
- package/dist/documents/facade.d.ts +73 -0
- package/dist/documents/facade.js +59 -0
- package/dist/dpns/facade.d.ts +27 -0
- package/dist/dpns/facade.js +54 -0
- package/dist/epoch/facade.d.ts +39 -0
- package/dist/epoch/facade.js +43 -0
- package/dist/group/facade.d.ts +41 -0
- package/dist/group/facade.js +23 -0
- package/dist/identities/facade.d.ts +48 -0
- package/dist/identities/facade.js +49 -0
- package/dist/protocol/facade.d.ts +15 -0
- package/dist/protocol/facade.js +15 -0
- package/dist/sdk.d.ts +60 -0
- package/dist/sdk.js +2 -0
- package/dist/sdk.js.map +1 -0
- package/dist/system/facade.d.ts +14 -0
- package/dist/system/facade.js +12 -0
- package/dist/tokens/facade.d.ts +109 -0
- package/dist/tokens/facade.js +126 -0
- package/dist/util.d.ts +1 -0
- package/dist/util.js +7 -0
- package/dist/voting/facade.d.ts +59 -0
- package/dist/voting/facade.js +42 -0
- package/dist/wasm.d.ts +3 -0
- package/dist/wasm.js +12 -0
- package/package.json +70 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as wasm from '../wasm.js';
|
|
2
|
+
import type { EvoSDK } from '../sdk.js';
|
|
3
|
+
export declare class ContractsFacade {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: EvoSDK);
|
|
6
|
+
fetch(contractId: string): Promise<wasm.DataContractWasm>;
|
|
7
|
+
fetchWithProof(contractId: string): Promise<any>;
|
|
8
|
+
getHistory(args: {
|
|
9
|
+
contractId: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
startAtMs?: number | bigint;
|
|
12
|
+
}): Promise<any>;
|
|
13
|
+
getHistoryWithProof(args: {
|
|
14
|
+
contractId: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
startAtMs?: number | bigint;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
getMany(contractIds: string[]): Promise<any>;
|
|
19
|
+
getManyWithProof(contractIds: string[]): Promise<any>;
|
|
20
|
+
create(args: {
|
|
21
|
+
ownerId: string;
|
|
22
|
+
definition: unknown;
|
|
23
|
+
privateKeyWif: string;
|
|
24
|
+
keyId?: number;
|
|
25
|
+
}): Promise<any>;
|
|
26
|
+
update(args: {
|
|
27
|
+
contractId: string;
|
|
28
|
+
ownerId: string;
|
|
29
|
+
updates: unknown;
|
|
30
|
+
privateKeyWif: string;
|
|
31
|
+
keyId?: number;
|
|
32
|
+
}): Promise<any>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { asJsonString } from '../util.js';
|
|
2
|
+
export class ContractsFacade {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
async fetch(contractId) {
|
|
7
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
8
|
+
return w.getDataContract(contractId);
|
|
9
|
+
}
|
|
10
|
+
async fetchWithProof(contractId) {
|
|
11
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
12
|
+
return w.getDataContractWithProofInfo(contractId);
|
|
13
|
+
}
|
|
14
|
+
async getHistory(args) {
|
|
15
|
+
const { contractId, limit, startAtMs } = args;
|
|
16
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
17
|
+
return w.getDataContractHistory(contractId, limit ?? null, null, startAtMs != null ? BigInt(startAtMs) : null);
|
|
18
|
+
}
|
|
19
|
+
async getHistoryWithProof(args) {
|
|
20
|
+
const { contractId, limit, startAtMs } = args;
|
|
21
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
22
|
+
return w.getDataContractHistoryWithProofInfo(contractId, limit ?? null, null, startAtMs != null ? BigInt(startAtMs) : null);
|
|
23
|
+
}
|
|
24
|
+
async getMany(contractIds) {
|
|
25
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
26
|
+
return w.getDataContracts(contractIds);
|
|
27
|
+
}
|
|
28
|
+
async getManyWithProof(contractIds) {
|
|
29
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
30
|
+
return w.getDataContractsWithProofInfo(contractIds);
|
|
31
|
+
}
|
|
32
|
+
async create(args) {
|
|
33
|
+
const { ownerId, definition, privateKeyWif, keyId } = args;
|
|
34
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
35
|
+
return w.contractCreate(ownerId, asJsonString(definition), privateKeyWif, keyId ?? null);
|
|
36
|
+
}
|
|
37
|
+
async update(args) {
|
|
38
|
+
const { contractId, ownerId, updates, privateKeyWif, keyId } = args;
|
|
39
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
40
|
+
return w.contractUpdate(contractId, ownerId, asJsonString(updates), privateKeyWif, keyId ?? null);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { EvoSDK } from '../sdk.js';
|
|
2
|
+
export declare class DocumentsFacade {
|
|
3
|
+
private sdk;
|
|
4
|
+
constructor(sdk: EvoSDK);
|
|
5
|
+
query(params: {
|
|
6
|
+
contractId: string;
|
|
7
|
+
type: string;
|
|
8
|
+
where?: unknown;
|
|
9
|
+
orderBy?: unknown;
|
|
10
|
+
limit?: number;
|
|
11
|
+
startAfter?: string;
|
|
12
|
+
startAt?: string;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
queryWithProof(params: {
|
|
15
|
+
contractId: string;
|
|
16
|
+
type: string;
|
|
17
|
+
where?: unknown;
|
|
18
|
+
orderBy?: unknown;
|
|
19
|
+
limit?: number;
|
|
20
|
+
startAfter?: string;
|
|
21
|
+
startAt?: string;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
get(contractId: string, type: string, documentId: string): Promise<any>;
|
|
24
|
+
getWithProof(contractId: string, type: string, documentId: string): Promise<any>;
|
|
25
|
+
create(args: {
|
|
26
|
+
contractId: string;
|
|
27
|
+
type: string;
|
|
28
|
+
ownerId: string;
|
|
29
|
+
data: unknown;
|
|
30
|
+
entropyHex: string;
|
|
31
|
+
privateKeyWif: string;
|
|
32
|
+
}): Promise<any>;
|
|
33
|
+
replace(args: {
|
|
34
|
+
contractId: string;
|
|
35
|
+
type: string;
|
|
36
|
+
documentId: string;
|
|
37
|
+
ownerId: string;
|
|
38
|
+
data: unknown;
|
|
39
|
+
revision: number | bigint;
|
|
40
|
+
privateKeyWif: string;
|
|
41
|
+
}): Promise<any>;
|
|
42
|
+
delete(args: {
|
|
43
|
+
contractId: string;
|
|
44
|
+
type: string;
|
|
45
|
+
documentId: string;
|
|
46
|
+
ownerId: string;
|
|
47
|
+
privateKeyWif: string;
|
|
48
|
+
}): Promise<any>;
|
|
49
|
+
transfer(args: {
|
|
50
|
+
contractId: string;
|
|
51
|
+
type: string;
|
|
52
|
+
documentId: string;
|
|
53
|
+
ownerId: string;
|
|
54
|
+
recipientId: string;
|
|
55
|
+
privateKeyWif: string;
|
|
56
|
+
}): Promise<any>;
|
|
57
|
+
purchase(args: {
|
|
58
|
+
contractId: string;
|
|
59
|
+
type: string;
|
|
60
|
+
documentId: string;
|
|
61
|
+
buyerId: string;
|
|
62
|
+
price: number | bigint | string;
|
|
63
|
+
privateKeyWif: string;
|
|
64
|
+
}): Promise<any>;
|
|
65
|
+
setPrice(args: {
|
|
66
|
+
contractId: string;
|
|
67
|
+
type: string;
|
|
68
|
+
documentId: string;
|
|
69
|
+
ownerId: string;
|
|
70
|
+
price: number | bigint | string;
|
|
71
|
+
privateKeyWif: string;
|
|
72
|
+
}): Promise<any>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { asJsonString } from '../util.js';
|
|
2
|
+
export class DocumentsFacade {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
// Query many documents
|
|
7
|
+
async query(params) {
|
|
8
|
+
const { contractId, type, where, orderBy, limit, startAfter, startAt } = params;
|
|
9
|
+
const whereJson = asJsonString(where);
|
|
10
|
+
const orderJson = asJsonString(orderBy);
|
|
11
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
12
|
+
return w.getDocuments(contractId, type, whereJson ?? null, orderJson ?? null, limit ?? null, startAfter ?? null, startAt ?? null);
|
|
13
|
+
}
|
|
14
|
+
async queryWithProof(params) {
|
|
15
|
+
const { contractId, type, where, orderBy, limit, startAfter, startAt } = params;
|
|
16
|
+
const whereJson = asJsonString(where);
|
|
17
|
+
const orderJson = asJsonString(orderBy);
|
|
18
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
19
|
+
return w.getDocumentsWithProofInfo(contractId, type, whereJson ?? null, orderJson ?? null, limit ?? null, startAfter ?? null, startAt ?? null);
|
|
20
|
+
}
|
|
21
|
+
async get(contractId, type, documentId) {
|
|
22
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
23
|
+
return w.getDocument(contractId, type, documentId);
|
|
24
|
+
}
|
|
25
|
+
async getWithProof(contractId, type, documentId) {
|
|
26
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
27
|
+
return w.getDocumentWithProofInfo(contractId, type, documentId);
|
|
28
|
+
}
|
|
29
|
+
async create(args) {
|
|
30
|
+
const { contractId, type, ownerId, data, entropyHex, privateKeyWif } = args;
|
|
31
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
32
|
+
return w.documentCreate(contractId, type, ownerId, asJsonString(data), entropyHex, privateKeyWif);
|
|
33
|
+
}
|
|
34
|
+
async replace(args) {
|
|
35
|
+
const { contractId, type, documentId, ownerId, data, revision, privateKeyWif } = args;
|
|
36
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
37
|
+
return w.documentReplace(contractId, type, documentId, ownerId, asJsonString(data), BigInt(revision), privateKeyWif);
|
|
38
|
+
}
|
|
39
|
+
async delete(args) {
|
|
40
|
+
const { contractId, type, documentId, ownerId, privateKeyWif } = args;
|
|
41
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
42
|
+
return w.documentDelete(contractId, type, documentId, ownerId, privateKeyWif);
|
|
43
|
+
}
|
|
44
|
+
async transfer(args) {
|
|
45
|
+
const { contractId, type, documentId, ownerId, recipientId, privateKeyWif } = args;
|
|
46
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
47
|
+
return w.documentTransfer(contractId, type, documentId, ownerId, recipientId, privateKeyWif);
|
|
48
|
+
}
|
|
49
|
+
async purchase(args) {
|
|
50
|
+
const { contractId, type, documentId, buyerId, price, privateKeyWif } = args;
|
|
51
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
52
|
+
return w.documentPurchase(contractId, type, documentId, buyerId, BigInt(price), privateKeyWif);
|
|
53
|
+
}
|
|
54
|
+
async setPrice(args) {
|
|
55
|
+
const { contractId, type, documentId, ownerId, price, privateKeyWif } = args;
|
|
56
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
57
|
+
return w.documentSetPrice(contractId, type, documentId, ownerId, BigInt(price), privateKeyWif);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EvoSDK } from '../sdk.js';
|
|
2
|
+
export declare class DpnsFacade {
|
|
3
|
+
private sdk;
|
|
4
|
+
constructor(sdk: EvoSDK);
|
|
5
|
+
convertToHomographSafe(input: string): string;
|
|
6
|
+
isValidUsername(label: string): boolean;
|
|
7
|
+
isContestedUsername(label: string): boolean;
|
|
8
|
+
isNameAvailable(label: string): Promise<boolean>;
|
|
9
|
+
resolveName(name: string): Promise<any>;
|
|
10
|
+
registerName(args: {
|
|
11
|
+
label: string;
|
|
12
|
+
identityId: string;
|
|
13
|
+
publicKeyId: number;
|
|
14
|
+
privateKeyWif: string;
|
|
15
|
+
onPreorder?: Function;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
usernames(identityId: string, opts?: {
|
|
18
|
+
limit?: number;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
username(identityId: string): Promise<any>;
|
|
21
|
+
usernamesWithProof(identityId: string, opts?: {
|
|
22
|
+
limit?: number;
|
|
23
|
+
}): Promise<any>;
|
|
24
|
+
usernameWithProof(identityId: string): Promise<any>;
|
|
25
|
+
getUsernameByName(username: string): Promise<any>;
|
|
26
|
+
getUsernameByNameWithProof(username: string): Promise<any>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as wasm from '../wasm.js';
|
|
2
|
+
export class DpnsFacade {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
convertToHomographSafe(input) {
|
|
7
|
+
return wasm.WasmSdk.dpnsConvertToHomographSafe(input);
|
|
8
|
+
}
|
|
9
|
+
isValidUsername(label) {
|
|
10
|
+
return wasm.WasmSdk.dpnsIsValidUsername(label);
|
|
11
|
+
}
|
|
12
|
+
isContestedUsername(label) {
|
|
13
|
+
return wasm.WasmSdk.dpnsIsContestedUsername(label);
|
|
14
|
+
}
|
|
15
|
+
async isNameAvailable(label) {
|
|
16
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
17
|
+
return w.dpnsIsNameAvailable(label);
|
|
18
|
+
}
|
|
19
|
+
async resolveName(name) {
|
|
20
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
21
|
+
return w.dpnsResolveName(name);
|
|
22
|
+
}
|
|
23
|
+
async registerName(args) {
|
|
24
|
+
const { label, identityId, publicKeyId, privateKeyWif, onPreorder } = args;
|
|
25
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
26
|
+
return w.dpnsRegisterName(label, identityId, publicKeyId, privateKeyWif, onPreorder ?? null);
|
|
27
|
+
}
|
|
28
|
+
async usernames(identityId, opts = {}) {
|
|
29
|
+
const { limit } = opts;
|
|
30
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
31
|
+
return w.getDpnsUsernames(identityId, limit ?? null);
|
|
32
|
+
}
|
|
33
|
+
async username(identityId) {
|
|
34
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
35
|
+
return w.getDpnsUsername(identityId);
|
|
36
|
+
}
|
|
37
|
+
async usernamesWithProof(identityId, opts = {}) {
|
|
38
|
+
const { limit } = opts;
|
|
39
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
40
|
+
return w.getDpnsUsernamesWithProofInfo(identityId, limit ?? null);
|
|
41
|
+
}
|
|
42
|
+
async usernameWithProof(identityId) {
|
|
43
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
44
|
+
return w.getDpnsUsernameWithProofInfo(identityId);
|
|
45
|
+
}
|
|
46
|
+
async getUsernameByName(username) {
|
|
47
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
48
|
+
return w.getDpnsUsernameByName(username);
|
|
49
|
+
}
|
|
50
|
+
async getUsernameByNameWithProof(username) {
|
|
51
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
52
|
+
return w.getDpnsUsernameByNameWithProofInfo(username);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { EvoSDK } from '../sdk.js';
|
|
2
|
+
export declare class EpochFacade {
|
|
3
|
+
private sdk;
|
|
4
|
+
constructor(sdk: EvoSDK);
|
|
5
|
+
epochsInfo(params?: {
|
|
6
|
+
startEpoch?: number;
|
|
7
|
+
count?: number;
|
|
8
|
+
ascending?: boolean;
|
|
9
|
+
}): Promise<any>;
|
|
10
|
+
epochsInfoWithProof(params?: {
|
|
11
|
+
startEpoch?: number;
|
|
12
|
+
count?: number;
|
|
13
|
+
ascending?: boolean;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
finalizedInfos(params?: {
|
|
16
|
+
startEpoch?: number;
|
|
17
|
+
count?: number;
|
|
18
|
+
ascending?: boolean;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
finalizedInfosWithProof(params?: {
|
|
21
|
+
startEpoch?: number;
|
|
22
|
+
count?: number;
|
|
23
|
+
ascending?: boolean;
|
|
24
|
+
}): Promise<any>;
|
|
25
|
+
current(): Promise<any>;
|
|
26
|
+
currentWithProof(): Promise<any>;
|
|
27
|
+
evonodesProposedBlocksByIds(epoch: number, ids: string[]): Promise<any>;
|
|
28
|
+
evonodesProposedBlocksByIdsWithProof(epoch: number, ids: string[]): Promise<any>;
|
|
29
|
+
evonodesProposedBlocksByRange(epoch: number, opts?: {
|
|
30
|
+
limit?: number;
|
|
31
|
+
startAfter?: string;
|
|
32
|
+
orderAscending?: boolean;
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
evonodesProposedBlocksByRangeWithProof(epoch: number, opts?: {
|
|
35
|
+
limit?: number;
|
|
36
|
+
startAfter?: string;
|
|
37
|
+
orderAscending?: boolean;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class EpochFacade {
|
|
2
|
+
constructor(sdk) { this.sdk = sdk; }
|
|
3
|
+
async epochsInfo(params = {}) {
|
|
4
|
+
const { startEpoch, count, ascending } = params;
|
|
5
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
6
|
+
return w.getEpochsInfo(startEpoch ?? null, count ?? null, ascending ?? null);
|
|
7
|
+
}
|
|
8
|
+
async epochsInfoWithProof(params = {}) {
|
|
9
|
+
const { startEpoch, count, ascending } = params;
|
|
10
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
11
|
+
return w.getEpochsInfoWithProofInfo(startEpoch ?? null, count ?? null, ascending ?? null);
|
|
12
|
+
}
|
|
13
|
+
async finalizedInfos(params = {}) {
|
|
14
|
+
const { startEpoch, count, ascending } = params;
|
|
15
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
16
|
+
return w.getFinalizedEpochInfos(startEpoch ?? null, count ?? null, ascending ?? null);
|
|
17
|
+
}
|
|
18
|
+
async finalizedInfosWithProof(params = {}) {
|
|
19
|
+
const { startEpoch, count, ascending } = params;
|
|
20
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
21
|
+
return w.getFinalizedEpochInfosWithProofInfo(startEpoch ?? null, count ?? null, ascending ?? null);
|
|
22
|
+
}
|
|
23
|
+
async current() { const w = await this.sdk.getWasmSdkConnected(); return w.getCurrentEpoch(); }
|
|
24
|
+
async currentWithProof() { const w = await this.sdk.getWasmSdkConnected(); return w.getCurrentEpochWithProofInfo(); }
|
|
25
|
+
async evonodesProposedBlocksByIds(epoch, ids) {
|
|
26
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
27
|
+
return w.getEvonodesProposedEpochBlocksByIds(epoch, ids);
|
|
28
|
+
}
|
|
29
|
+
async evonodesProposedBlocksByIdsWithProof(epoch, ids) {
|
|
30
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
31
|
+
return w.getEvonodesProposedEpochBlocksByIdsWithProofInfo(epoch, ids);
|
|
32
|
+
}
|
|
33
|
+
async evonodesProposedBlocksByRange(epoch, opts = {}) {
|
|
34
|
+
const { limit, startAfter, orderAscending } = opts;
|
|
35
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
36
|
+
return w.getEvonodesProposedEpochBlocksByRange(epoch, limit ?? null, startAfter ?? null, orderAscending ?? null);
|
|
37
|
+
}
|
|
38
|
+
async evonodesProposedBlocksByRangeWithProof(epoch, opts = {}) {
|
|
39
|
+
const { limit, startAfter, orderAscending } = opts;
|
|
40
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
41
|
+
return w.getEvonodesProposedEpochBlocksByRangeWithProofInfo(epoch, limit ?? null, startAfter ?? null, orderAscending ?? null);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { EvoSDK } from '../sdk.js';
|
|
2
|
+
export declare class GroupFacade {
|
|
3
|
+
private sdk;
|
|
4
|
+
constructor(sdk: EvoSDK);
|
|
5
|
+
contestedResources(params: {
|
|
6
|
+
documentTypeName: string;
|
|
7
|
+
contractId: string;
|
|
8
|
+
indexName: string;
|
|
9
|
+
startAtValue?: Uint8Array;
|
|
10
|
+
limit?: number;
|
|
11
|
+
orderAscending?: boolean;
|
|
12
|
+
}): Promise<any>;
|
|
13
|
+
contestedResourcesWithProof(params: {
|
|
14
|
+
documentTypeName: string;
|
|
15
|
+
contractId: string;
|
|
16
|
+
indexName: string;
|
|
17
|
+
startAtValue?: Uint8Array;
|
|
18
|
+
limit?: number;
|
|
19
|
+
orderAscending?: boolean;
|
|
20
|
+
}): Promise<any>;
|
|
21
|
+
contestedResourceVotersForIdentity(params: {
|
|
22
|
+
contractId: string;
|
|
23
|
+
documentTypeName: string;
|
|
24
|
+
indexName: string;
|
|
25
|
+
indexValues: any[];
|
|
26
|
+
contestantId: string;
|
|
27
|
+
startAtVoterInfo?: string;
|
|
28
|
+
limit?: number;
|
|
29
|
+
orderAscending?: boolean;
|
|
30
|
+
}): Promise<any>;
|
|
31
|
+
contestedResourceVotersForIdentityWithProof(params: {
|
|
32
|
+
contractId: string;
|
|
33
|
+
documentTypeName: string;
|
|
34
|
+
indexName: string;
|
|
35
|
+
indexValues: any[];
|
|
36
|
+
contestantId: string;
|
|
37
|
+
startAtIdentifierInfo?: string;
|
|
38
|
+
count?: number;
|
|
39
|
+
orderAscending?: boolean;
|
|
40
|
+
}): Promise<any>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class GroupFacade {
|
|
2
|
+
constructor(sdk) { this.sdk = sdk; }
|
|
3
|
+
async contestedResources(params) {
|
|
4
|
+
const { documentTypeName, contractId, indexName, startAtValue, limit, orderAscending } = params;
|
|
5
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
6
|
+
return w.getContestedResources(documentTypeName, contractId, indexName, startAtValue ?? null, limit ?? null, null, orderAscending ?? null);
|
|
7
|
+
}
|
|
8
|
+
async contestedResourcesWithProof(params) {
|
|
9
|
+
const { documentTypeName, contractId, indexName, startAtValue, limit, orderAscending } = params;
|
|
10
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
11
|
+
return w.getContestedResourcesWithProofInfo(documentTypeName, contractId, indexName, startAtValue ?? null, limit ?? null, null, orderAscending ?? null);
|
|
12
|
+
}
|
|
13
|
+
async contestedResourceVotersForIdentity(params) {
|
|
14
|
+
const { contractId, documentTypeName, indexName, indexValues, contestantId, startAtVoterInfo, limit, orderAscending } = params;
|
|
15
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
16
|
+
return w.getContestedResourceVotersForIdentity(contractId, documentTypeName, indexName, indexValues, contestantId, startAtVoterInfo ?? null, limit ?? null, orderAscending ?? null);
|
|
17
|
+
}
|
|
18
|
+
async contestedResourceVotersForIdentityWithProof(params) {
|
|
19
|
+
const { contractId, documentTypeName, indexName, indexValues, contestantId, startAtIdentifierInfo, count, orderAscending } = params;
|
|
20
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
21
|
+
return w.getContestedResourceVotersForIdentityWithProofInfo(contractId, documentTypeName, indexName, indexValues, contestantId, startAtIdentifierInfo ?? null, count ?? null, orderAscending ?? null);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as wasm from '../wasm.js';
|
|
2
|
+
import type { EvoSDK } from '../sdk.js';
|
|
3
|
+
export declare class IdentitiesFacade {
|
|
4
|
+
private sdk;
|
|
5
|
+
constructor(sdk: EvoSDK);
|
|
6
|
+
fetch(identityId: string): Promise<wasm.IdentityWasm>;
|
|
7
|
+
fetchWithProof(identityId: string): Promise<any>;
|
|
8
|
+
fetchUnproved(identityId: string): Promise<wasm.IdentityWasm>;
|
|
9
|
+
getKeys(args: {
|
|
10
|
+
identityId: string;
|
|
11
|
+
keyRequestType: 'all' | 'specific' | 'search';
|
|
12
|
+
specificKeyIds?: number[];
|
|
13
|
+
searchPurposeMap?: unknown;
|
|
14
|
+
limit?: number;
|
|
15
|
+
offset?: number;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
create(args: {
|
|
18
|
+
assetLockProof: unknown;
|
|
19
|
+
assetLockPrivateKeyWif: string;
|
|
20
|
+
publicKeys: unknown[];
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
topUp(args: {
|
|
23
|
+
identityId: string;
|
|
24
|
+
assetLockProof: unknown;
|
|
25
|
+
assetLockPrivateKeyWif: string;
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
creditTransfer(args: {
|
|
28
|
+
senderId: string;
|
|
29
|
+
recipientId: string;
|
|
30
|
+
amount: number | bigint | string;
|
|
31
|
+
privateKeyWif: string;
|
|
32
|
+
keyId?: number;
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
creditWithdrawal(args: {
|
|
35
|
+
identityId: string;
|
|
36
|
+
toAddress: string;
|
|
37
|
+
amount: number | bigint | string;
|
|
38
|
+
coreFeePerByte?: number;
|
|
39
|
+
privateKeyWif: string;
|
|
40
|
+
keyId?: number;
|
|
41
|
+
}): Promise<any>;
|
|
42
|
+
update(args: {
|
|
43
|
+
identityId: string;
|
|
44
|
+
addPublicKeys?: unknown[];
|
|
45
|
+
disablePublicKeyIds?: number[];
|
|
46
|
+
privateKeyWif: string;
|
|
47
|
+
}): Promise<any>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { asJsonString } from '../util.js';
|
|
2
|
+
export class IdentitiesFacade {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
async fetch(identityId) {
|
|
7
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
8
|
+
return w.getIdentity(identityId);
|
|
9
|
+
}
|
|
10
|
+
async fetchWithProof(identityId) {
|
|
11
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
12
|
+
return w.getIdentityWithProofInfo(identityId);
|
|
13
|
+
}
|
|
14
|
+
async fetchUnproved(identityId) {
|
|
15
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
16
|
+
return w.getIdentityUnproved(identityId);
|
|
17
|
+
}
|
|
18
|
+
async getKeys(args) {
|
|
19
|
+
const { identityId, keyRequestType, specificKeyIds, searchPurposeMap, limit, offset } = args;
|
|
20
|
+
const mapJson = asJsonString(searchPurposeMap);
|
|
21
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
22
|
+
return w.getIdentityKeys(identityId, keyRequestType, specificKeyIds ? Uint32Array.from(specificKeyIds) : null, mapJson ?? null, limit ?? null, offset ?? null);
|
|
23
|
+
}
|
|
24
|
+
async create(args) {
|
|
25
|
+
const { assetLockProof, assetLockPrivateKeyWif, publicKeys } = args;
|
|
26
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
27
|
+
return w.identityCreate(asJsonString(assetLockProof), assetLockPrivateKeyWif, asJsonString(publicKeys));
|
|
28
|
+
}
|
|
29
|
+
async topUp(args) {
|
|
30
|
+
const { identityId, assetLockProof, assetLockPrivateKeyWif } = args;
|
|
31
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
32
|
+
return w.identityTopUp(identityId, asJsonString(assetLockProof), assetLockPrivateKeyWif);
|
|
33
|
+
}
|
|
34
|
+
async creditTransfer(args) {
|
|
35
|
+
const { senderId, recipientId, amount, privateKeyWif, keyId } = args;
|
|
36
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
37
|
+
return w.identityCreditTransfer(senderId, recipientId, BigInt(amount), privateKeyWif, keyId ?? null);
|
|
38
|
+
}
|
|
39
|
+
async creditWithdrawal(args) {
|
|
40
|
+
const { identityId, toAddress, amount, coreFeePerByte = 1, privateKeyWif, keyId } = args;
|
|
41
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
42
|
+
return w.identityCreditWithdrawal(identityId, toAddress, BigInt(amount), coreFeePerByte ?? null, privateKeyWif, keyId ?? null);
|
|
43
|
+
}
|
|
44
|
+
async update(args) {
|
|
45
|
+
const { identityId, addPublicKeys, disablePublicKeyIds, privateKeyWif } = args;
|
|
46
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
47
|
+
return w.identityUpdate(identityId, addPublicKeys ? asJsonString(addPublicKeys) : null, disablePublicKeyIds ? Uint32Array.from(disablePublicKeyIds) : null, privateKeyWif);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EvoSDK } from '../sdk.js';
|
|
2
|
+
export declare class ProtocolFacade {
|
|
3
|
+
private sdk;
|
|
4
|
+
constructor(sdk: EvoSDK);
|
|
5
|
+
versionUpgradeState(): Promise<any>;
|
|
6
|
+
versionUpgradeStateWithProof(): Promise<any>;
|
|
7
|
+
versionUpgradeVoteStatus(params: {
|
|
8
|
+
startProTxHash: string;
|
|
9
|
+
count: number;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
versionUpgradeVoteStatusWithProof(params: {
|
|
12
|
+
startProTxHash: string;
|
|
13
|
+
count: number;
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class ProtocolFacade {
|
|
2
|
+
constructor(sdk) { this.sdk = sdk; }
|
|
3
|
+
async versionUpgradeState() { const w = await this.sdk.getWasmSdkConnected(); return w.getProtocolVersionUpgradeState(); }
|
|
4
|
+
async versionUpgradeStateWithProof() { const w = await this.sdk.getWasmSdkConnected(); return w.getProtocolVersionUpgradeStateWithProofInfo(); }
|
|
5
|
+
async versionUpgradeVoteStatus(params) {
|
|
6
|
+
const { startProTxHash, count } = params;
|
|
7
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
8
|
+
return w.getProtocolVersionUpgradeVoteStatus(startProTxHash, count);
|
|
9
|
+
}
|
|
10
|
+
async versionUpgradeVoteStatusWithProof(params) {
|
|
11
|
+
const { startProTxHash, count } = params;
|
|
12
|
+
const w = await this.sdk.getWasmSdkConnected();
|
|
13
|
+
return w.getProtocolVersionUpgradeVoteStatusWithProofInfo(startProTxHash, count);
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as wasm from './wasm.js';
|
|
2
|
+
import { DocumentsFacade } from './documents/facade.js';
|
|
3
|
+
import { IdentitiesFacade } from './identities/facade.js';
|
|
4
|
+
import { ContractsFacade } from './contracts/facade.js';
|
|
5
|
+
import { TokensFacade } from './tokens/facade.js';
|
|
6
|
+
import { DpnsFacade } from './dpns/facade.js';
|
|
7
|
+
import { EpochFacade } from './epoch/facade.js';
|
|
8
|
+
import { ProtocolFacade } from './protocol/facade.js';
|
|
9
|
+
import { SystemFacade } from './system/facade.js';
|
|
10
|
+
import { GroupFacade } from './group/facade.js';
|
|
11
|
+
import { VotingFacade } from './voting/facade.js';
|
|
12
|
+
export interface ConnectionOptions {
|
|
13
|
+
version?: number;
|
|
14
|
+
proofs?: boolean;
|
|
15
|
+
logs?: string;
|
|
16
|
+
settings?: {
|
|
17
|
+
connectTimeoutMs?: number;
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
retries?: number;
|
|
20
|
+
banFailedAddress?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface EvoSDKOptions extends ConnectionOptions {
|
|
24
|
+
network?: 'testnet' | 'mainnet';
|
|
25
|
+
trusted?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class EvoSDK {
|
|
28
|
+
private wasmSdk?;
|
|
29
|
+
private options;
|
|
30
|
+
documents: DocumentsFacade;
|
|
31
|
+
identities: IdentitiesFacade;
|
|
32
|
+
contracts: ContractsFacade;
|
|
33
|
+
tokens: TokensFacade;
|
|
34
|
+
dpns: DpnsFacade;
|
|
35
|
+
epoch: EpochFacade;
|
|
36
|
+
protocol: ProtocolFacade;
|
|
37
|
+
system: SystemFacade;
|
|
38
|
+
group: GroupFacade;
|
|
39
|
+
voting: VotingFacade;
|
|
40
|
+
constructor(options?: EvoSDKOptions);
|
|
41
|
+
get wasm(): wasm.WasmSdk;
|
|
42
|
+
get isConnected(): boolean;
|
|
43
|
+
getWasmSdkConnected(): Promise<wasm.WasmSdk>;
|
|
44
|
+
connect(): Promise<void>;
|
|
45
|
+
static fromWasm(wasmSdk: wasm.WasmSdk): EvoSDK;
|
|
46
|
+
static testnet(options?: ConnectionOptions): EvoSDK;
|
|
47
|
+
static mainnet(options?: ConnectionOptions): EvoSDK;
|
|
48
|
+
static testnetTrusted(options?: ConnectionOptions): EvoSDK;
|
|
49
|
+
static mainnetTrusted(options?: ConnectionOptions): EvoSDK;
|
|
50
|
+
}
|
|
51
|
+
export { DocumentsFacade } from './documents/facade.js';
|
|
52
|
+
export { IdentitiesFacade } from './identities/facade.js';
|
|
53
|
+
export { ContractsFacade } from './contracts/facade.js';
|
|
54
|
+
export { TokensFacade } from './tokens/facade.js';
|
|
55
|
+
export { DpnsFacade } from './dpns/facade.js';
|
|
56
|
+
export { EpochFacade } from './epoch/facade.js';
|
|
57
|
+
export { ProtocolFacade } from './protocol/facade.js';
|
|
58
|
+
export { SystemFacade } from './system/facade.js';
|
|
59
|
+
export { GroupFacade } from './group/facade.js';
|
|
60
|
+
export { VotingFacade } from './voting/facade.js';
|