@lfdecentralizedtrust/paladin-sdk 0.13.0-rc.1

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.
Files changed (88) hide show
  1. package/README.md +21 -0
  2. package/build/domains/abis/INoto.json +448 -0
  3. package/build/domains/abis/INotoPrivate.json +347 -0
  4. package/build/domains/abis/IZetoFungible.json +197 -0
  5. package/build/domains/abis/PentePrivacyGroup.json +613 -0
  6. package/build/domains/abis/Zeto_Anon.json +1263 -0
  7. package/build/domains/noto.d.ts +117 -0
  8. package/build/domains/noto.js +292 -0
  9. package/build/domains/pente.d.ts +84 -0
  10. package/build/domains/pente.js +191 -0
  11. package/build/domains/zeto.d.ts +83 -0
  12. package/build/domains/zeto.js +201 -0
  13. package/build/index.d.ts +9 -0
  14. package/build/index.js +28 -0
  15. package/build/interfaces/algorithms.d.ts +3 -0
  16. package/build/interfaces/algorithms.js +9 -0
  17. package/build/interfaces/blockchainevent.d.ts +15 -0
  18. package/build/interfaces/blockchainevent.js +2 -0
  19. package/build/interfaces/blockindex.d.ts +30 -0
  20. package/build/interfaces/blockindex.js +2 -0
  21. package/build/interfaces/domains.d.ts +9 -0
  22. package/build/interfaces/domains.js +2 -0
  23. package/build/interfaces/index.d.ts +15 -0
  24. package/build/interfaces/index.js +31 -0
  25. package/build/interfaces/keymanager.d.ts +32 -0
  26. package/build/interfaces/keymanager.js +2 -0
  27. package/build/interfaces/logger.d.ts +8 -0
  28. package/build/interfaces/logger.js +2 -0
  29. package/build/interfaces/paladin.d.ts +14 -0
  30. package/build/interfaces/paladin.js +2 -0
  31. package/build/interfaces/privacygroups.d.ts +76 -0
  32. package/build/interfaces/privacygroups.js +2 -0
  33. package/build/interfaces/query.d.ts +33 -0
  34. package/build/interfaces/query.js +2 -0
  35. package/build/interfaces/registry.d.ts +26 -0
  36. package/build/interfaces/registry.js +2 -0
  37. package/build/interfaces/states.d.ts +61 -0
  38. package/build/interfaces/states.js +2 -0
  39. package/build/interfaces/transaction.d.ts +159 -0
  40. package/build/interfaces/transaction.js +12 -0
  41. package/build/interfaces/transport.d.ts +32 -0
  42. package/build/interfaces/transport.js +2 -0
  43. package/build/interfaces/verifiers.d.ts +6 -0
  44. package/build/interfaces/verifiers.js +10 -0
  45. package/build/interfaces/websocket.d.ts +57 -0
  46. package/build/interfaces/websocket.js +2 -0
  47. package/build/paladin.d.ts +265 -0
  48. package/build/paladin.js +739 -0
  49. package/build/transaction.d.ts +8 -0
  50. package/build/transaction.js +17 -0
  51. package/build/utils.d.ts +5 -0
  52. package/build/utils.js +49 -0
  53. package/build/verifier.d.ts +16 -0
  54. package/build/verifier.js +24 -0
  55. package/build/websocket.d.ts +35 -0
  56. package/build/websocket.js +177 -0
  57. package/build.gradle +75 -0
  58. package/package.json +32 -0
  59. package/scripts/abi.mjs +19 -0
  60. package/scripts/contracts.mjs +20 -0
  61. package/scripts/download.mjs +27 -0
  62. package/scripts/util.mjs +42 -0
  63. package/src/domains/noto.ts +420 -0
  64. package/src/domains/pente.ts +287 -0
  65. package/src/domains/zeto.ts +282 -0
  66. package/src/index.ts +10 -0
  67. package/src/interfaces/algorithms.ts +6 -0
  68. package/src/interfaces/blockchainevent.ts +18 -0
  69. package/src/interfaces/blockindex.ts +33 -0
  70. package/src/interfaces/domains.ts +10 -0
  71. package/src/interfaces/index.ts +15 -0
  72. package/src/interfaces/keymanager.ts +35 -0
  73. package/src/interfaces/logger.ts +8 -0
  74. package/src/interfaces/paladin.ts +17 -0
  75. package/src/interfaces/privacygroups.ts +86 -0
  76. package/src/interfaces/query.ts +37 -0
  77. package/src/interfaces/registry.ts +27 -0
  78. package/src/interfaces/states.ts +77 -0
  79. package/src/interfaces/transaction.ts +179 -0
  80. package/src/interfaces/transport.ts +35 -0
  81. package/src/interfaces/verifiers.ts +6 -0
  82. package/src/interfaces/websocket.ts +67 -0
  83. package/src/paladin.ts +1295 -0
  84. package/src/transaction.ts +17 -0
  85. package/src/utils.ts +24 -0
  86. package/src/verifier.ts +27 -0
  87. package/src/websocket.ts +217 -0
  88. package/tsconfig.json +14 -0
@@ -0,0 +1,282 @@
1
+ import { TransactionType } from "../interfaces";
2
+ import PaladinClient from "../paladin";
3
+ import { TransactionFuture } from "../transaction";
4
+ import { PaladinVerifier } from "../verifier";
5
+ import * as zetoPrivateJSON from "./abis/IZetoFungible.json";
6
+ import * as zetoPublicJSON from "./abis/Zeto_Anon.json";
7
+
8
+ // Algorithm/verifier types specific to Zeto
9
+ export const algorithmZetoSnarkBJJ = (domainName: string) =>
10
+ `domain:${domainName}:snark:babyjubjub`;
11
+ export const IDEN3_PUBKEY_BABYJUBJUB_COMPRESSED_0X =
12
+ "iden3_pubkey_babyjubjub_compressed_0x";
13
+
14
+ const zetoAbi = zetoPrivateJSON.abi;
15
+ const zetoPublicAbi = zetoPublicJSON.abi;
16
+
17
+ export const zetoConstructorABI = {
18
+ type: "constructor",
19
+ inputs: [{ name: "tokenName", type: "string" }],
20
+ };
21
+
22
+ export interface ZetoConstructorParams {
23
+ tokenName: string;
24
+ }
25
+
26
+ export interface ZetoMintParams {
27
+ mints: ZetoTransfer[];
28
+ }
29
+
30
+ export interface ZetoTransferParams {
31
+ transfers: ZetoTransfer[];
32
+ }
33
+
34
+ export interface ZetoLockParams {
35
+ amount: number;
36
+ delegate: string;
37
+ }
38
+
39
+ export interface ZetoTransferLockedParams {
40
+ lockedInputs: string[];
41
+ delegate: string;
42
+ transfers: ZetoTransfer[];
43
+ }
44
+
45
+ export interface ZetoDelegateLockParams {
46
+ utxos: string[];
47
+ delegate: string;
48
+ }
49
+
50
+ export interface ZetoSetERC20Params {
51
+ erc20: string;
52
+ }
53
+
54
+ export interface ZetoTransfer {
55
+ to: PaladinVerifier;
56
+ amount: string | number;
57
+ data: string;
58
+ }
59
+
60
+ export interface ZetoDepositParams {
61
+ amount: string | number;
62
+ }
63
+
64
+ export interface ZetoWithdrawParams {
65
+ amount: string | number;
66
+ }
67
+
68
+ export interface ZetoBalanceOfParams {
69
+ account: string;
70
+ }
71
+
72
+ export interface ZetoBalanceOfResult {
73
+ totalBalance: string;
74
+ totalStates: string;
75
+ overflow: boolean;
76
+ }
77
+
78
+ // Represents an in-flight Zeto deployment
79
+ export class ZetoFuture extends TransactionFuture {
80
+ async waitForDeploy(waitMs?: number) {
81
+ const receipt = await this.waitForReceipt(waitMs);
82
+ return receipt?.contractAddress
83
+ ? new ZetoInstance(this.paladin, receipt.contractAddress)
84
+ : undefined;
85
+ }
86
+ }
87
+
88
+ export class ZetoFactory {
89
+ constructor(private paladin: PaladinClient, public readonly domain: string) {}
90
+
91
+ using(paladin: PaladinClient) {
92
+ return new ZetoFactory(paladin, this.domain);
93
+ }
94
+
95
+ newZeto(from: PaladinVerifier, data: ZetoConstructorParams) {
96
+ return new ZetoFuture(
97
+ this.paladin,
98
+ this.paladin.sendTransaction({
99
+ type: TransactionType.PRIVATE,
100
+ domain: this.domain,
101
+ abi: [zetoConstructorABI],
102
+ function: "",
103
+ from: from.lookup,
104
+ data,
105
+ })
106
+ );
107
+ }
108
+ }
109
+
110
+ export class ZetoInstance {
111
+ private erc20?: string;
112
+
113
+ constructor(
114
+ private paladin: PaladinClient,
115
+ public readonly address: string
116
+ ) {}
117
+
118
+ using(paladin: PaladinClient) {
119
+ const zeto = new ZetoInstance(paladin, this.address);
120
+ zeto.erc20 = this.erc20;
121
+ return zeto;
122
+ }
123
+
124
+ mint(from: PaladinVerifier, data: ZetoMintParams) {
125
+ const params = {
126
+ mints: data.mints.map((t) => ({ ...t, to: t.to.lookup })),
127
+ };
128
+ return new TransactionFuture(
129
+ this.paladin,
130
+ this.paladin.sendTransaction({
131
+ type: TransactionType.PRIVATE,
132
+ abi: zetoAbi,
133
+ function: "mint",
134
+ to: this.address,
135
+ from: from.lookup,
136
+ data: params,
137
+ })
138
+ );
139
+ }
140
+
141
+ transfer(from: PaladinVerifier, data: ZetoTransferParams) {
142
+ return new TransactionFuture(
143
+ this.paladin,
144
+ this.paladin.sendTransaction({
145
+ type: TransactionType.PRIVATE,
146
+ abi: zetoAbi,
147
+ function: "transfer",
148
+ to: this.address,
149
+ from: from.lookup,
150
+ data: {
151
+ transfers: data.transfers.map((t) => ({ ...t, to: t.to.lookup })),
152
+ },
153
+ })
154
+ );
155
+ }
156
+
157
+ transferLocked(from: PaladinVerifier, data: ZetoTransferLockedParams) {
158
+ return new TransactionFuture(
159
+ this.paladin,
160
+ this.paladin.sendTransaction({
161
+ type: TransactionType.PRIVATE,
162
+ abi: zetoAbi,
163
+ function: "transferLocked",
164
+ to: this.address,
165
+ from: from.lookup,
166
+ data: {
167
+ lockedInputs: data.lockedInputs,
168
+ delegate: data.delegate,
169
+ transfers: data.transfers.map((t) => ({ ...t, to: t.to.lookup })),
170
+ },
171
+ })
172
+ );
173
+ }
174
+
175
+ prepareTransferLocked(from: PaladinVerifier, data: ZetoTransferLockedParams) {
176
+ return new TransactionFuture(
177
+ this.paladin,
178
+ this.paladin.prepareTransaction({
179
+ type: TransactionType.PRIVATE,
180
+ abi: zetoAbi,
181
+ function: "transferLocked",
182
+ to: this.address,
183
+ from: from.lookup,
184
+ data: {
185
+ lockedInputs: data.lockedInputs,
186
+ delegate: data.delegate,
187
+ transfers: data.transfers.map((t) => ({ ...t, to: t.to.lookup })),
188
+ },
189
+ })
190
+ );
191
+ }
192
+
193
+ lock(from: PaladinVerifier, data: ZetoLockParams) {
194
+ return new TransactionFuture(
195
+ this.paladin,
196
+ this.paladin.sendTransaction({
197
+ type: TransactionType.PRIVATE,
198
+ abi: zetoAbi,
199
+ function: "lock",
200
+ to: this.address,
201
+ from: from.lookup,
202
+ data,
203
+ })
204
+ );
205
+ }
206
+
207
+ delegateLock(from: PaladinVerifier, data: ZetoDelegateLockParams) {
208
+ return new TransactionFuture(
209
+ this.paladin,
210
+ this.paladin.sendTransaction({
211
+ type: TransactionType.Public,
212
+ abi: zetoPublicAbi,
213
+ function: "delegateLock",
214
+ to: this.address,
215
+ from: from.lookup,
216
+ data: {
217
+ data: "0x",
218
+ utxos: data.utxos,
219
+ delegate: data.delegate,
220
+ },
221
+ })
222
+ );
223
+ }
224
+
225
+ setERC20(from: PaladinVerifier, data: ZetoSetERC20Params) {
226
+ this.erc20 = data.erc20;
227
+ return new TransactionFuture(
228
+ this.paladin,
229
+ this.paladin.sendTransaction({
230
+ type: TransactionType.PUBLIC,
231
+ abi: zetoAbi,
232
+ function: "setERC20",
233
+ to: this.address,
234
+ from: from.lookup,
235
+ data,
236
+ })
237
+ );
238
+ }
239
+
240
+ deposit(from: PaladinVerifier, data: ZetoDepositParams) {
241
+ return new TransactionFuture(
242
+ this.paladin,
243
+ this.paladin.sendTransaction({
244
+ type: TransactionType.PRIVATE,
245
+ abi: zetoAbi,
246
+ function: "deposit",
247
+ to: this.address,
248
+ from: from.lookup,
249
+ data,
250
+ })
251
+ );
252
+ }
253
+
254
+ withdraw(from: PaladinVerifier, data: ZetoWithdrawParams) {
255
+ return new TransactionFuture(
256
+ this.paladin,
257
+ this.paladin.sendTransaction({
258
+ type: TransactionType.PRIVATE,
259
+ abi: zetoAbi,
260
+ function: "withdraw",
261
+ to: this.address,
262
+ from: from.lookup,
263
+ data,
264
+ })
265
+ );
266
+ }
267
+
268
+ async balanceOf(
269
+ from: PaladinVerifier,
270
+ data: ZetoBalanceOfParams
271
+ ): Promise<ZetoBalanceOfResult> {
272
+ return await this.paladin.call({
273
+ type: TransactionType.PRIVATE,
274
+ domain: "zeto",
275
+ abi: zetoPrivateJSON.abi,
276
+ function: "balanceOf",
277
+ to: this.address,
278
+ from: from.lookup,
279
+ data,
280
+ });
281
+ }
282
+ }
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ import PaladinClient from "./paladin";
2
+ export default PaladinClient;
3
+
4
+ export * from "./interfaces/index";
5
+ export * from "./utils";
6
+ export * from "./verifier";
7
+ export * from "./websocket";
8
+ export * from "./domains/noto";
9
+ export * from "./domains/pente";
10
+ export * from "./domains/zeto";
@@ -0,0 +1,6 @@
1
+ const Prefix_ECDSA = "ecdsa";
2
+ const Curve_SECP256K1 = "secp256k1";
3
+
4
+ export enum Algorithms {
5
+ ECDSA_SECP256K1 = Prefix_ECDSA + ":" + Curve_SECP256K1,
6
+ }
@@ -0,0 +1,18 @@
1
+ import { ethers } from "ethers";
2
+
3
+ export interface IBlockchainEventListener {
4
+ name: string;
5
+ sources: IBlockchainEventListenerSource[];
6
+ options?: IBlockchainEventListenerOptions;
7
+ }
8
+
9
+ export interface IBlockchainEventListenerOptions {
10
+ batchSize?: number;
11
+ batchTimeout?: string;
12
+ fromBlock?: string;
13
+ }
14
+
15
+ export interface IBlockchainEventListenerSource {
16
+ abi: ethers.JsonFragment[];
17
+ address?: string;
18
+ }
@@ -0,0 +1,33 @@
1
+ export interface IIndexedBlock {
2
+ number: number;
3
+ hash: string;
4
+ timestamp: number;
5
+ }
6
+
7
+ export interface IIndexedTransaction {
8
+ hash: string;
9
+ blockNumber: number;
10
+ transactionIndex: number;
11
+ from?: string;
12
+ to?: string;
13
+ nonce: number;
14
+ contractAddress?: string;
15
+ result?: "failure" | "success";
16
+ block?: IIndexedBlock;
17
+ }
18
+
19
+ export interface IIndexedEvent {
20
+ blockNumber: number;
21
+ transactionIndex: number;
22
+ logIndex: number;
23
+ transactionHash: string;
24
+ signature: string;
25
+ transaction?: IIndexedTransaction;
26
+ block?: IIndexedBlock;
27
+ }
28
+
29
+ export interface IEventWithData extends IIndexedEvent {
30
+ soliditySignature: string;
31
+ address: string;
32
+ data: any;
33
+ }
@@ -0,0 +1,10 @@
1
+ export interface IDomain {
2
+ name: string;
3
+ registryAddress: string;
4
+ }
5
+
6
+ export interface IDomainSmartContract {
7
+ domainName: string;
8
+ domainAddress: string;
9
+ address: string;
10
+ }
@@ -0,0 +1,15 @@
1
+ export * from "./algorithms";
2
+ export * from "./blockindex";
3
+ export * from "./blockchainevent";
4
+ export * from "./domains";
5
+ export * from "./keymanager";
6
+ export * from "./logger";
7
+ export * from "./paladin";
8
+ export * from "./privacygroups";
9
+ export * from "./query";
10
+ export * from "./registry";
11
+ export * from "./states";
12
+ export * from "./transaction";
13
+ export * from "./transport";
14
+ export * from "./verifiers";
15
+ export * from "./websocket";
@@ -0,0 +1,35 @@
1
+ export interface IWalletInfo {
2
+ name: string;
3
+ type: string;
4
+ description: string;
5
+ }
6
+
7
+ export interface IKeyMappingAndVerifier {
8
+ identifier: string;
9
+ keyHandle: string;
10
+ path: {
11
+ index: number;
12
+ name: string;
13
+ }[];
14
+ verifier: {
15
+ verifier: string;
16
+ type: string;
17
+ algorithm: string;
18
+ };
19
+ wallet: string;
20
+ }
21
+
22
+ export interface IEthAddress {
23
+ address: string;
24
+ }
25
+
26
+ export interface IKeyQueryEntry {
27
+ identifier: string;
28
+ keyHandle: string;
29
+ wallet: string;
30
+ verifiers: {
31
+ verifier: string;
32
+ type: string;
33
+ algorithm: string;
34
+ }[];
35
+ }
@@ -0,0 +1,8 @@
1
+ export interface Logger {
2
+ log(message: any, ...optionalParams: any[]): any;
3
+ error(message: any, ...optionalParams: any[]): any;
4
+ warn(message: any, ...optionalParams: any[]): any;
5
+ debug?(message: any, ...optionalParams: any[]): any;
6
+ verbose?(message: any, ...optionalParams: any[]): any;
7
+ fatal?(message: any, ...optionalParams: any[]): any;
8
+ }
@@ -0,0 +1,17 @@
1
+ import { AxiosError, AxiosRequestConfig } from "axios";
2
+ import { Logger } from "./logger";
3
+
4
+ export interface PaladinConfig {
5
+ url: string;
6
+ requestConfig?: AxiosRequestConfig;
7
+ logger?: Logger;
8
+ onError?: PaladinErrorHandler;
9
+ }
10
+
11
+ export interface PaladinErrorHandler {
12
+ (method: string, err: AxiosError): void | Promise<void>;
13
+ }
14
+
15
+ export interface JsonRpcResult<T> {
16
+ result: T;
17
+ }
@@ -0,0 +1,86 @@
1
+ import { BigNumberish, ethers } from "ethers";
2
+ import { HexString } from "ethers/lib.commonjs/utils/data";
3
+ import { PublicTxOptions } from ".";
4
+
5
+ export interface IPrivacyGroupInput {
6
+ domain: string;
7
+ members: string[];
8
+ name?: string;
9
+ configuration?: Record<string, string | undefined>;
10
+ properties?: Record<string, string | undefined>;
11
+ transactionOptions?: IPrivacyGroupTXOptions;
12
+ }
13
+
14
+ export interface IPrivacyGroupResume {
15
+ id: string;
16
+ }
17
+
18
+ export interface IPrivacyGroupTXOptions extends PublicTxOptions {
19
+ idempotencyKey?: string;
20
+ }
21
+
22
+ export interface IPrivacyGroup {
23
+ id: string;
24
+ domain: string;
25
+ created: string;
26
+ name: string;
27
+ members: string[];
28
+ properties: Record<string, string>;
29
+ configuration: Record<string, string>;
30
+ contractAddress?: string;
31
+ genesisTransaction?: string;
32
+ genesisSchema?: string;
33
+ genesisSalt?: string;
34
+ }
35
+
36
+ export interface IPrivacyGroupEVMTX {
37
+ from: string;
38
+ to?: string;
39
+ gas?: BigNumberish;
40
+ value?: BigNumberish;
41
+ input?: unknown;
42
+ function?: ethers.JsonFragment;
43
+ bytecode?: HexString;
44
+ }
45
+
46
+ export interface IPrivacyGroupEVMTXInput extends IPrivacyGroupEVMTX {
47
+ idempotencyKey?: string;
48
+ domain: string;
49
+ group: string;
50
+ publicTxOptions?: PublicTxOptions;
51
+ }
52
+
53
+ export interface IPrivacyGroupEVMCall extends IPrivacyGroupEVMTX {
54
+ domain: string;
55
+ group: string;
56
+ dataFormat?: string;
57
+ }
58
+
59
+ export interface IPrivacyGroupMessageListener {
60
+ name: string;
61
+ filters?: {
62
+ sequenceAbove?: number;
63
+ domain?: string;
64
+ group?: string;
65
+ topic?: string;
66
+ };
67
+ options?: {
68
+ excludeLocal?: boolean;
69
+ };
70
+ }
71
+
72
+ export interface IPrivacyGroupMessageInput {
73
+ correlationId?: string;
74
+ domain: string;
75
+ group: string;
76
+ topic: string;
77
+ data: any;
78
+ }
79
+
80
+ export interface IPrivacyGroupMessage extends IPrivacyGroupMessageInput {
81
+ id: string;
82
+ localSequence: number;
83
+ sent: string;
84
+ received: string;
85
+ node: string;
86
+ }
@@ -0,0 +1,37 @@
1
+ export interface IQueryOp {
2
+ not?: boolean;
3
+ caseInsensitive?: boolean;
4
+ field: string;
5
+ }
6
+
7
+ export interface IQueryOpSingleVal extends IQueryOp {
8
+ value: any;
9
+ }
10
+
11
+ export interface IQueryOpMultiVal extends IQueryOp {
12
+ values: any[];
13
+ }
14
+
15
+ export interface IQueryStatements {
16
+ or?: IQueryStatements[];
17
+ equal?: IQueryOpSingleVal[];
18
+ eq?: IQueryOpSingleVal[];
19
+ neq?: IQueryOpSingleVal[];
20
+ like?: IQueryOpSingleVal[];
21
+ lessThan?: IQueryOpSingleVal[];
22
+ lt?: IQueryOpSingleVal[];
23
+ lessThanOrEqual?: IQueryOpSingleVal[];
24
+ lte?: IQueryOpSingleVal[];
25
+ greaterThan?: IQueryOpSingleVal[];
26
+ gt?: IQueryOpSingleVal[];
27
+ greaterThanOrEqual?: IQueryOpSingleVal[];
28
+ gte?: IQueryOpSingleVal[];
29
+ in?: IQueryOpMultiVal[];
30
+ nin?: IQueryOpMultiVal[];
31
+ null?: IQueryOp;
32
+ }
33
+
34
+ export interface IQuery extends IQueryStatements {
35
+ limit?: number;
36
+ sort?: string[];
37
+ }
@@ -0,0 +1,27 @@
1
+ export interface IRegistryEntry {
2
+ registry: string;
3
+ id: string;
4
+ name: string;
5
+ parentId?: string;
6
+ blockNumber?: number;
7
+ transactionIndex?: number;
8
+ logIndex?: number;
9
+ active?: boolean;
10
+ }
11
+
12
+ export interface IRegistryProperty {
13
+ registry: string;
14
+ entryId: string;
15
+ name: string;
16
+ value: string;
17
+ blockNumber?: number;
18
+ transactionIndex?: number;
19
+ logIndex?: number;
20
+ active?: boolean;
21
+ }
22
+
23
+ export interface IRegistryEntryWithProperties extends IRegistryEntry {
24
+ properties: { [key: string]: string };
25
+ }
26
+
27
+ export type ActiveFilter = "active" | "inactive" | "any";
@@ -0,0 +1,77 @@
1
+ export interface ISchema {
2
+ id: string;
3
+ created: string;
4
+ domain: string;
5
+ type: SchemaType;
6
+ signature: string;
7
+ definition: object;
8
+ labels: string[];
9
+ }
10
+
11
+ export type SchemaType = "abi";
12
+
13
+ export interface IStateBase {
14
+ id: string;
15
+ created: string;
16
+ domain: string;
17
+ schema: string;
18
+ contractAddress: string;
19
+ data: object;
20
+ }
21
+
22
+ export interface IStateEncoded {
23
+ id: string;
24
+ domain: string;
25
+ schema: string;
26
+ contractAddress: string;
27
+ data: string;
28
+ }
29
+
30
+ export interface IState extends IStateBase {
31
+ confirmed?: IStateConfirm;
32
+ spent?: IStateSpend;
33
+ locks?: IStateLock[];
34
+ nullifier?: IStateNullifier;
35
+ }
36
+
37
+ export interface IStateLabel {
38
+ domainName: string;
39
+ state: string;
40
+ label: string;
41
+ value: string;
42
+ }
43
+
44
+ export interface IStateInt64Label {
45
+ domainName: string;
46
+ state: string;
47
+ label: string;
48
+ value: number;
49
+ }
50
+
51
+ export interface IStateConfirm {
52
+ transaction: string;
53
+ }
54
+
55
+ export interface IStateSpend {
56
+ transaction: string;
57
+ }
58
+
59
+ type StateLockType = "create" | "read" | "spend";
60
+
61
+ export interface IStateLock {
62
+ transaction: string;
63
+ type: StateLockType;
64
+ }
65
+
66
+ export interface IStateNullifier {
67
+ domain: string;
68
+ id: string;
69
+ spent?: IStateSpend;
70
+ }
71
+
72
+ export type StateStatus =
73
+ | "available"
74
+ | "confirmed"
75
+ | "unconfirmed"
76
+ | "spent"
77
+ | "all";