@xelis/sdk 0.11.15 → 0.11.17
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/cjs/address/bech32.js +47 -56
- package/dist/cjs/address/index.js +20 -21
- package/dist/cjs/config.js +26 -38
- package/dist/cjs/contract/contract.js +178 -0
- package/dist/cjs/contract/typed_contract.js +259 -0
- package/dist/cjs/contract/xvm_serializer.js +170 -0
- package/dist/cjs/daemon/rpc.js +157 -168
- package/dist/cjs/daemon/types.js +4 -1
- package/dist/cjs/daemon/websocket.js +170 -181
- package/dist/cjs/data/element.js +39 -41
- package/dist/cjs/data/value.js +106 -111
- package/dist/cjs/react/daemon.js +33 -43
- package/dist/cjs/rpc/http.js +75 -132
- package/dist/cjs/rpc/parse_json/parse_json.js +4 -4
- package/dist/cjs/rpc/types.js +1 -1
- package/dist/cjs/rpc/websocket.js +131 -201
- package/dist/cjs/wallet/rpc.js +98 -117
- package/dist/cjs/wallet/types.js +1 -1
- package/dist/cjs/wallet/websocket.js +105 -126
- package/dist/cjs/xswd/relayer/app.js +57 -36
- package/dist/cjs/xswd/relayer/index.js +25 -27
- package/dist/cjs/xswd/types.js +1 -1
- package/dist/cjs/xswd/websocket.js +15 -33
- package/dist/esm/address/bech32.js +46 -55
- package/dist/esm/address/index.js +16 -17
- package/dist/esm/config.js +25 -37
- package/dist/esm/contract/contract.js +172 -0
- package/dist/esm/contract/typed_contract.js +251 -0
- package/dist/esm/contract/xvm_serializer.js +163 -0
- package/dist/esm/daemon/rpc.js +153 -165
- package/dist/esm/daemon/types.js +3 -0
- package/dist/esm/daemon/websocket.js +166 -179
- package/dist/esm/data/element.js +37 -40
- package/dist/esm/data/value.js +104 -112
- package/dist/esm/react/daemon.js +30 -40
- package/dist/esm/rpc/http.js +73 -131
- package/dist/esm/rpc/parse_json/parse_json.js +1 -1
- package/dist/esm/rpc/websocket.js +126 -197
- package/dist/esm/wallet/rpc.js +93 -113
- package/dist/esm/wallet/websocket.js +101 -124
- package/dist/esm/xswd/relayer/app.js +54 -34
- package/dist/esm/xswd/relayer/index.js +22 -24
- package/dist/esm/xswd/websocket.js +10 -29
- package/dist/types/contract/contract.d.ts +80 -0
- package/dist/types/contract/typed_contract.d.ts +94 -0
- package/dist/types/contract/xvm_serializer.d.ts +69 -0
- package/dist/types/daemon/rpc.d.ts +5 -2
- package/dist/types/daemon/types.d.ts +97 -18
- package/dist/types/daemon/websocket.d.ts +5 -2
- package/package.json +1 -1
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
import { App } from './app.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_this.app.setError("timeout occured (did not receive any message)");
|
|
2
|
+
class Relayer {
|
|
3
|
+
constructor(props) {
|
|
4
|
+
this.onOpen = (e) => {
|
|
5
|
+
this.message_timeout = window.setTimeout(() => {
|
|
6
|
+
this.app.setError("timeout occured (did not receive any message)");
|
|
8
7
|
}, 3000);
|
|
9
8
|
};
|
|
10
|
-
this.onMessage =
|
|
11
|
-
window.clearTimeout(
|
|
9
|
+
this.onMessage = (e) => {
|
|
10
|
+
window.clearTimeout(this.message_timeout);
|
|
12
11
|
try {
|
|
13
12
|
console.log(e);
|
|
14
|
-
|
|
13
|
+
const data = JSON.parse(e.data);
|
|
15
14
|
if (data.channel_id) {
|
|
16
|
-
|
|
15
|
+
this.app.setQRCode(data.channel_id);
|
|
17
16
|
}
|
|
18
17
|
else {
|
|
19
|
-
|
|
18
|
+
this.app.setError("channel id not found");
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
catch (e) {
|
|
23
|
-
|
|
22
|
+
this.app.setError("invalid data format");
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
this.onError =
|
|
27
|
-
|
|
25
|
+
this.onError = (e) => {
|
|
26
|
+
this.app.setError("connection failed");
|
|
28
27
|
};
|
|
29
|
-
this.onClose =
|
|
30
|
-
|
|
28
|
+
this.onClose = (e) => {
|
|
29
|
+
this.app.setError("connection closed");
|
|
31
30
|
};
|
|
32
31
|
this.props = props;
|
|
33
32
|
this.app = new App(this);
|
|
34
33
|
this.ws = new WebSocket(this.props.url);
|
|
35
|
-
this.ws.addEventListener(
|
|
36
|
-
this.ws.addEventListener(
|
|
37
|
-
this.ws.addEventListener(
|
|
38
|
-
this.ws.addEventListener(
|
|
34
|
+
this.ws.addEventListener(`open`, this.onOpen);
|
|
35
|
+
this.ws.addEventListener(`message`, this.onMessage);
|
|
36
|
+
this.ws.addEventListener(`error`, this.onError);
|
|
37
|
+
this.ws.addEventListener(`close`, this.onClose);
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
close() {
|
|
41
40
|
this.ws.close();
|
|
42
41
|
this.app.element.remove();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
46
44
|
export default Relayer;
|
|
@@ -1,35 +1,16 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
1
|
import { WSRPC } from '../rpc/websocket.js';
|
|
17
2
|
import { DaemonMethods } from '../daemon/websocket.js';
|
|
18
3
|
import { WalletMethods } from '../wallet/websocket.js';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_this.wallet = new WalletMethods(_this, "wallet.");
|
|
26
|
-
return _this;
|
|
4
|
+
export class WS extends WSRPC {
|
|
5
|
+
constructor(endpoint) {
|
|
6
|
+
super(endpoint);
|
|
7
|
+
this.callTimeout = 0; // xswd needs user input for confirmation - timeout should not be used
|
|
8
|
+
this.daemon = new DaemonMethods(this, "node.");
|
|
9
|
+
this.wallet = new WalletMethods(this, "wallet.");
|
|
27
10
|
}
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
authorize(app) {
|
|
12
|
+
const data = JSON.stringify(app);
|
|
30
13
|
return this.rawCall(0, data);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}(WSRPC));
|
|
34
|
-
export { WS };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
35
16
|
export default WS;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface ABIParam {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ABIEntry {
|
|
6
|
+
chunk_id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
outputs?: string;
|
|
9
|
+
params: ABIParam[];
|
|
10
|
+
type: 'entry' | 'view';
|
|
11
|
+
}
|
|
12
|
+
export interface ABI {
|
|
13
|
+
data: ABIEntry[];
|
|
14
|
+
version: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ContractCallParams {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
maxGas?: number;
|
|
19
|
+
deposits?: Record<string, number | bigint>;
|
|
20
|
+
}
|
|
21
|
+
export interface IContract {
|
|
22
|
+
readonly address: string;
|
|
23
|
+
readonly abi: ABI;
|
|
24
|
+
invoke(methodName: string, params?: ContractCallParams): Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
type GenerateContractMethods<T extends ABI> = {
|
|
27
|
+
[K in T['data'][number]['name']]: (params?: ContractCallParams) => Record<string, any>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Contract class that dynamically generates methods based on ABI
|
|
31
|
+
*/
|
|
32
|
+
export declare class Contract<T extends ABI = ABI> implements IContract {
|
|
33
|
+
readonly address: string;
|
|
34
|
+
readonly abi: T;
|
|
35
|
+
private readonly methods;
|
|
36
|
+
constructor(address: string, abi: T);
|
|
37
|
+
/**
|
|
38
|
+
* Creates a dynamic method on the contract instance
|
|
39
|
+
*/
|
|
40
|
+
private createDynamicMethod;
|
|
41
|
+
/**
|
|
42
|
+
* Invoke a contract method by name
|
|
43
|
+
* @param methodName - Name of the method from the ABI
|
|
44
|
+
* @param params - Parameters for the method call
|
|
45
|
+
*/
|
|
46
|
+
invoke(methodName: string, params?: ContractCallParams): Record<string, any>;
|
|
47
|
+
/**
|
|
48
|
+
* Get list of available methods
|
|
49
|
+
*/
|
|
50
|
+
getMethods(): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Get method signature information
|
|
53
|
+
*/
|
|
54
|
+
getMethodSignature(methodName: string): ABIEntry | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Validate parameters for a method without creating the transaction
|
|
57
|
+
*/
|
|
58
|
+
validateParams(methodName: string, params: ContractCallParams): boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Helper function to create a typed contract instance
|
|
62
|
+
* This provides better TypeScript support when the ABI is known at compile time
|
|
63
|
+
*/
|
|
64
|
+
export declare function createContract<T extends ABI>(address: string, abi: T): Contract<T> & GenerateContractMethods<T>;
|
|
65
|
+
/**
|
|
66
|
+
* Factory for creating multiple contracts with the same ABI
|
|
67
|
+
*/
|
|
68
|
+
export declare class ContractFactory<T extends ABI = ABI> {
|
|
69
|
+
private readonly abi;
|
|
70
|
+
constructor(abi: T);
|
|
71
|
+
/**
|
|
72
|
+
* Create a new contract instance at the specified address
|
|
73
|
+
*/
|
|
74
|
+
at(address: string): Contract<T> & GenerateContractMethods<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the ABI
|
|
77
|
+
*/
|
|
78
|
+
getABI(): T;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export interface ABIParam {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
optional?: boolean;
|
|
5
|
+
default?: any;
|
|
6
|
+
}
|
|
7
|
+
export interface ABIEntry {
|
|
8
|
+
chunk_id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
outputs?: string | string[];
|
|
11
|
+
params: ABIParam[];
|
|
12
|
+
type: 'entry' | 'view';
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export type ABI = {
|
|
16
|
+
data: ABIEntry[];
|
|
17
|
+
version: string;
|
|
18
|
+
};
|
|
19
|
+
type ParamType<T extends string> = T extends 'Hash' ? string : T extends 'Address' ? string : T extends 'PublicKey' ? string : T extends 'Blob' ? string : T extends 'String' | 'string' ? string : T extends 'Boolean' | 'boolean' | 'bool' ? boolean : T extends 'U256' | 'u256' ? bigint | number : T extends 'U128' | 'u128' ? bigint | number : T extends 'U64' | 'u64' ? bigint | number : T extends 'U32' | 'u32' ? number : T extends 'U16' | 'u16' ? number : T extends 'U8' | 'u8' ? number : any;
|
|
20
|
+
type ExtractParams<T extends ABIEntry> = {
|
|
21
|
+
[K in T['params'][number] as K['name']]: K extends {
|
|
22
|
+
optional: true;
|
|
23
|
+
} ? ParamType<K['type']> | undefined : ParamType<K['type']>;
|
|
24
|
+
} & {
|
|
25
|
+
maxGas?: number;
|
|
26
|
+
deposits?: Record<string, number | bigint>;
|
|
27
|
+
};
|
|
28
|
+
type MethodFromEntry<T extends ABIEntry> = (params: ExtractParams<T>) => Record<string, any>;
|
|
29
|
+
type MethodsFromABI<T extends ABI> = {
|
|
30
|
+
[K in T['data'][number] as K['name']]: MethodFromEntry<K>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Strongly typed contract class
|
|
34
|
+
*/
|
|
35
|
+
export declare class TypedContract<T extends ABI> {
|
|
36
|
+
readonly address: string;
|
|
37
|
+
readonly abi: T;
|
|
38
|
+
private readonly methods;
|
|
39
|
+
constructor(address: string, abi: T);
|
|
40
|
+
/**
|
|
41
|
+
* Internal method to invoke contract functions
|
|
42
|
+
*/
|
|
43
|
+
invokeUnsafe(methodName: string, params?: any): Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* Type-safe invoke method
|
|
46
|
+
*/
|
|
47
|
+
invoke<K extends T['data'][number]['name']>(methodName: K, params: K extends T['data'][number]['name'] ? T['data'][number] extends infer E ? E extends ABIEntry ? E['name'] extends K ? ExtractParams<E> : never : never : never : never): Record<string, any>;
|
|
48
|
+
/**
|
|
49
|
+
* Get list of available methods
|
|
50
|
+
*/
|
|
51
|
+
getMethods(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Get method signature information
|
|
54
|
+
*/
|
|
55
|
+
getMethodSignature(methodName: string): ABIEntry | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Generate TypeScript interface for the contract
|
|
58
|
+
*/
|
|
59
|
+
generateInterface(): string;
|
|
60
|
+
private getTypeScriptType;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a typed contract instance with full TypeScript support
|
|
64
|
+
*/
|
|
65
|
+
export declare function createTypedContract<T extends ABI>(address: string, abi: T): TypedContract<T> & MethodsFromABI<T>;
|
|
66
|
+
/**
|
|
67
|
+
* Contract factory with strong typing
|
|
68
|
+
*/
|
|
69
|
+
export declare class TypedContractFactory<T extends ABI> {
|
|
70
|
+
private readonly abi;
|
|
71
|
+
private readonly contractName;
|
|
72
|
+
constructor(abi: T, contractName?: string);
|
|
73
|
+
/**
|
|
74
|
+
* Create a new contract instance at the specified address
|
|
75
|
+
*/
|
|
76
|
+
at(address: string): TypedContract<T> & MethodsFromABI<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Get the ABI
|
|
79
|
+
*/
|
|
80
|
+
getABI(): T;
|
|
81
|
+
/**
|
|
82
|
+
* Generate TypeScript definitions for this contract
|
|
83
|
+
*/
|
|
84
|
+
generateTypeDefinitions(): string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Utility to validate ABI structure
|
|
88
|
+
*/
|
|
89
|
+
export declare function validateABI(abi: any): abi is ABI;
|
|
90
|
+
/**
|
|
91
|
+
* Helper to create a contract from JSON ABI
|
|
92
|
+
*/
|
|
93
|
+
export declare function createContractFromJSON(address: string, abiPath: string): Promise<TypedContract<ABI> & MethodsFromABI<ABI>>;
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface VMParameter {
|
|
2
|
+
type: string;
|
|
3
|
+
value: any;
|
|
4
|
+
}
|
|
5
|
+
declare const TYPE_VALIDATORS: {
|
|
6
|
+
readonly u256: (v: any) => number;
|
|
7
|
+
readonly u128: (v: any) => number;
|
|
8
|
+
readonly u64: (v: any) => number;
|
|
9
|
+
readonly u32: (v: any) => number;
|
|
10
|
+
readonly u16: (v: any) => number;
|
|
11
|
+
readonly u8: (v: any) => number;
|
|
12
|
+
readonly boolean: (v: any) => boolean;
|
|
13
|
+
readonly string: (v: any) => string;
|
|
14
|
+
readonly Hash: (v: any) => string;
|
|
15
|
+
readonly Address: (v: any) => string;
|
|
16
|
+
readonly PublicKey: (v: any) => string;
|
|
17
|
+
readonly Blob: (v: any) => string;
|
|
18
|
+
};
|
|
19
|
+
export type ValidationType = keyof typeof TYPE_VALIDATORS;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a VM-compatible parameter object
|
|
22
|
+
* @param value - The value to wrap
|
|
23
|
+
* @param type - The type string (e.g., 'u64', 'Hash', 'string')
|
|
24
|
+
* @param validate - Whether to validate and convert the value (default: true)
|
|
25
|
+
*/
|
|
26
|
+
export declare function createVMParameter(value: any, type: ValidationType, validate?: boolean): VMParameter;
|
|
27
|
+
/**
|
|
28
|
+
* Convenience functions for common types
|
|
29
|
+
*/
|
|
30
|
+
export declare const vmParam: {
|
|
31
|
+
hash: (value: string) => VMParameter;
|
|
32
|
+
address: (value: string) => VMParameter;
|
|
33
|
+
publicKey: (value: string) => VMParameter;
|
|
34
|
+
blob: (value: string) => VMParameter;
|
|
35
|
+
u64: (value: number | bigint) => VMParameter;
|
|
36
|
+
u32: (value: number) => VMParameter;
|
|
37
|
+
u16: (value: number) => VMParameter;
|
|
38
|
+
u8: (value: number) => VMParameter;
|
|
39
|
+
string: (value: string) => VMParameter;
|
|
40
|
+
boolean: (value: boolean) => VMParameter;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Creates a deposits object for contract calls
|
|
44
|
+
* @param deposits - Object mapping token hashes to amounts
|
|
45
|
+
*/
|
|
46
|
+
export declare function createDeposits(deposits: Record<string, number | bigint>): Record<string, {
|
|
47
|
+
amount: number | bigint;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a contract invocation object
|
|
51
|
+
*/
|
|
52
|
+
export interface ContractInvocationParams {
|
|
53
|
+
contract: string;
|
|
54
|
+
chunkId: number;
|
|
55
|
+
parameters?: VMParameter[];
|
|
56
|
+
deposits?: Record<string, number | bigint>;
|
|
57
|
+
maxGas?: number;
|
|
58
|
+
}
|
|
59
|
+
export declare function createContractInvocation(params: ContractInvocationParams): Record<string, any>;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a contract deployment object
|
|
62
|
+
*/
|
|
63
|
+
export interface ContractDeploymentParams {
|
|
64
|
+
bytecode: string;
|
|
65
|
+
hasConstructor?: boolean;
|
|
66
|
+
maxGas?: number;
|
|
67
|
+
}
|
|
68
|
+
export declare function createContractDeployment(params: ContractDeploymentParams): Record<string, any>;
|
|
69
|
+
export {};
|
|
@@ -58,9 +58,12 @@ export declare class RPC extends HttpRPC {
|
|
|
58
58
|
getMultisig(params: types.GetMultisigParams): Promise<types.GetMultisigResult>;
|
|
59
59
|
hasMultisig(params: types.HasMultisigParams): Promise<boolean>;
|
|
60
60
|
hasMultisigAtTopoheight(params: types.HasMultisigAtTopoheightParams): Promise<boolean>;
|
|
61
|
-
|
|
61
|
+
getContractLogs(params: types.GetContractLogsParams): Promise<types.ContractLog[]>;
|
|
62
|
+
getContractScheduledExecutionsAtTopoheight(params: types.GetContractScheduledExecutionsAtTopoheightParams): Promise<types.ScheduledExecution[]>;
|
|
63
|
+
getContractRegisteredExecutionsAtTopoheight(params: types.GetContractScheduledExecutionsAtTopoheightParams): Promise<[number, string][]>;
|
|
64
|
+
getContractOutputs(params: types.GetContractOutputsParams): Promise<types.ContractOutputs>;
|
|
62
65
|
getContractModule(params: types.GetContractModuleParams): Promise<types.GetContractModuleResult>;
|
|
63
|
-
getContractData(params: types.
|
|
66
|
+
getContractData(params: types.GetContractDataParams): Promise<unknown>;
|
|
64
67
|
getContractDataAtTopoheight(params: types.GetContractDataAtTopoheightParams): Promise<unknown>;
|
|
65
68
|
getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
|
|
66
69
|
getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
|
|
@@ -174,7 +174,7 @@ export interface Burn {
|
|
|
174
174
|
amount: number;
|
|
175
175
|
}
|
|
176
176
|
export interface MultiSigPayload {
|
|
177
|
-
participants:
|
|
177
|
+
participants: number[];
|
|
178
178
|
threshold: number;
|
|
179
179
|
}
|
|
180
180
|
export interface ContractDeposit {
|
|
@@ -456,12 +456,13 @@ export interface HasMultisigParams {
|
|
|
456
456
|
topoheight?: number;
|
|
457
457
|
}
|
|
458
458
|
export interface GetContractOutputsParams {
|
|
459
|
-
|
|
459
|
+
address: string;
|
|
460
|
+
topoheight: number;
|
|
460
461
|
}
|
|
461
462
|
export interface GetContractModuleParams {
|
|
462
463
|
contract: string;
|
|
463
464
|
}
|
|
464
|
-
export interface
|
|
465
|
+
export interface GetContractDataParams {
|
|
465
466
|
contract: string;
|
|
466
467
|
key: any;
|
|
467
468
|
}
|
|
@@ -509,20 +510,6 @@ export interface GetContractBalanceResult {
|
|
|
509
510
|
amount: number;
|
|
510
511
|
previous_topoheight: number | null;
|
|
511
512
|
}
|
|
512
|
-
export interface ContractOutputRefundGas {
|
|
513
|
-
amount: number;
|
|
514
|
-
}
|
|
515
|
-
export interface ContractOutputTransfer {
|
|
516
|
-
amount: number;
|
|
517
|
-
asset: string;
|
|
518
|
-
destination: string;
|
|
519
|
-
}
|
|
520
|
-
export interface ContractOutputExitCode {
|
|
521
|
-
exit_code: number;
|
|
522
|
-
}
|
|
523
|
-
export interface ContractOutputRefundDeposits {
|
|
524
|
-
}
|
|
525
|
-
export type ContractOutput = ContractOutputRefundGas | ContractOutputTransfer | ContractOutputExitCode | ContractOutputRefundDeposits;
|
|
526
513
|
export interface TransactionResponse extends Transaction {
|
|
527
514
|
in_mempool: boolean;
|
|
528
515
|
blocks?: string[];
|
|
@@ -559,7 +546,7 @@ export interface InvokeContract {
|
|
|
559
546
|
block_hash: string;
|
|
560
547
|
tx_hash: string;
|
|
561
548
|
topoheight: number;
|
|
562
|
-
contract_outputs:
|
|
549
|
+
contract_outputs: ContractLog[];
|
|
563
550
|
}
|
|
564
551
|
export interface NewContract {
|
|
565
552
|
contract: string;
|
|
@@ -587,6 +574,95 @@ export interface ContractTransfer {
|
|
|
587
574
|
export interface ContractEvent {
|
|
588
575
|
data: any;
|
|
589
576
|
}
|
|
577
|
+
export interface GetContractLogsParams {
|
|
578
|
+
caller: string;
|
|
579
|
+
}
|
|
580
|
+
export interface GetContractScheduledExecutionsAtTopoheightParams {
|
|
581
|
+
topoheight: number;
|
|
582
|
+
max?: number;
|
|
583
|
+
min?: number;
|
|
584
|
+
}
|
|
585
|
+
export interface ScheduledExecution {
|
|
586
|
+
hash: string;
|
|
587
|
+
contract: string;
|
|
588
|
+
chunk_id: number;
|
|
589
|
+
params: any[];
|
|
590
|
+
max_gas: number;
|
|
591
|
+
}
|
|
592
|
+
export interface ContractLogRefundGas {
|
|
593
|
+
type: "refund_gas";
|
|
594
|
+
value: {
|
|
595
|
+
amount: number;
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
export interface ContractLogTransfer {
|
|
599
|
+
type: "transfer";
|
|
600
|
+
value: {
|
|
601
|
+
contract: string;
|
|
602
|
+
amount: number;
|
|
603
|
+
asset: string;
|
|
604
|
+
destination: string;
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
export interface ContractLogTransferContract {
|
|
608
|
+
type: "transfer_contract";
|
|
609
|
+
value: {
|
|
610
|
+
contract: string;
|
|
611
|
+
amount: number;
|
|
612
|
+
asset: string;
|
|
613
|
+
destination: string;
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
export interface ContractLogMint {
|
|
617
|
+
type: "mint";
|
|
618
|
+
value: {
|
|
619
|
+
contract: string;
|
|
620
|
+
asset: string;
|
|
621
|
+
amount: number;
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
export interface ContractLogBurn {
|
|
625
|
+
type: "burn";
|
|
626
|
+
value: {
|
|
627
|
+
contract: string;
|
|
628
|
+
asset: string;
|
|
629
|
+
amount: number;
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
export interface ContractLogNewAsset {
|
|
633
|
+
type: "new_asset";
|
|
634
|
+
value: {
|
|
635
|
+
contract: string;
|
|
636
|
+
asset: string;
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
export interface ContractLogExitCode {
|
|
640
|
+
type: "exit_code";
|
|
641
|
+
value?: number;
|
|
642
|
+
}
|
|
643
|
+
export interface ContractLogRefundDeposits {
|
|
644
|
+
type: "refund_deposits";
|
|
645
|
+
}
|
|
646
|
+
export interface ContractLogGasInjection {
|
|
647
|
+
type: "gas_injection";
|
|
648
|
+
value: {
|
|
649
|
+
contract: string;
|
|
650
|
+
amount: number;
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
export interface ContractLogScheduledExecution {
|
|
654
|
+
type: "scheduled_execution";
|
|
655
|
+
value: {
|
|
656
|
+
contract: string;
|
|
657
|
+
hash: string;
|
|
658
|
+
kind: "topo_height" | "block_end";
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
export type ContractLog = ContractLogRefundGas | ContractLogTransfer | ContractLogTransferContract | ContractLogMint | ContractLogBurn | ContractLogNewAsset | ContractLogExitCode | ContractLogRefundDeposits | ContractLogGasInjection | ContractLogScheduledExecution;
|
|
662
|
+
export interface ContractOutputs {
|
|
663
|
+
caller: string;
|
|
664
|
+
outputs: ContractLog[];
|
|
665
|
+
}
|
|
590
666
|
export declare enum RPCMethod {
|
|
591
667
|
GetVersion = "get_version",
|
|
592
668
|
GetHeight = "get_height",
|
|
@@ -645,6 +721,9 @@ export declare enum RPCMethod {
|
|
|
645
721
|
GetMultisig = "get_multisig",
|
|
646
722
|
HasMultisig = "has_multisig",
|
|
647
723
|
HasMultisigAtTopoheight = "has_multisig_at_topoheight",
|
|
724
|
+
GetContractLogs = "get_contract_logs",
|
|
725
|
+
GetContractScheduledExecutionsAtTopoheight = "get_contract_scheduled_executions_at_topoheight",
|
|
726
|
+
GetContractRegisteredExecutionsAtTopoheight = "get_contract_registered_executions_at_topoheight",
|
|
648
727
|
GetContractOutputs = "get_contract_outputs",
|
|
649
728
|
GetContractModule = "get_contract_module",
|
|
650
729
|
GetContractData = "get_contract_data",
|
|
@@ -86,9 +86,12 @@ export declare class DaemonMethods {
|
|
|
86
86
|
getMultisig(params: types.GetMultisigParams): Promise<types.GetMultisigResult>;
|
|
87
87
|
hasMultisig(params: types.HasMultisigParams): Promise<boolean>;
|
|
88
88
|
hasMultisigAtTopoheight(params: types.HasMultisigAtTopoheightParams): Promise<boolean>;
|
|
89
|
-
|
|
89
|
+
getContractLogs(params: types.GetContractLogsParams): Promise<types.ContractLog[]>;
|
|
90
|
+
getContractScheduledExecutionsAtTopoheight(params: types.GetContractScheduledExecutionsAtTopoheightParams): Promise<types.ScheduledExecution[]>;
|
|
91
|
+
getContractRegisteredExecutionsAtTopoheight(params: types.GetContractScheduledExecutionsAtTopoheightParams): Promise<[number, string][]>;
|
|
92
|
+
getContractOutputs(params: types.GetContractOutputsParams): Promise<types.ContractOutputs>;
|
|
90
93
|
getContractModule(params: types.GetContractModuleParams): Promise<types.GetContractModuleResult>;
|
|
91
|
-
getContractData(params: types.
|
|
94
|
+
getContractData(params: types.GetContractDataParams): Promise<unknown>;
|
|
92
95
|
getContractDataAtTopoheight(params: types.GetContractDataAtTopoheightParams): Promise<unknown>;
|
|
93
96
|
getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
|
|
94
97
|
getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
|
package/package.json
CHANGED