@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.
- package/README.md +21 -0
- package/build/domains/abis/INoto.json +448 -0
- package/build/domains/abis/INotoPrivate.json +347 -0
- package/build/domains/abis/IZetoFungible.json +197 -0
- package/build/domains/abis/PentePrivacyGroup.json +613 -0
- package/build/domains/abis/Zeto_Anon.json +1263 -0
- package/build/domains/noto.d.ts +117 -0
- package/build/domains/noto.js +292 -0
- package/build/domains/pente.d.ts +84 -0
- package/build/domains/pente.js +191 -0
- package/build/domains/zeto.d.ts +83 -0
- package/build/domains/zeto.js +201 -0
- package/build/index.d.ts +9 -0
- package/build/index.js +28 -0
- package/build/interfaces/algorithms.d.ts +3 -0
- package/build/interfaces/algorithms.js +9 -0
- package/build/interfaces/blockchainevent.d.ts +15 -0
- package/build/interfaces/blockchainevent.js +2 -0
- package/build/interfaces/blockindex.d.ts +30 -0
- package/build/interfaces/blockindex.js +2 -0
- package/build/interfaces/domains.d.ts +9 -0
- package/build/interfaces/domains.js +2 -0
- package/build/interfaces/index.d.ts +15 -0
- package/build/interfaces/index.js +31 -0
- package/build/interfaces/keymanager.d.ts +32 -0
- package/build/interfaces/keymanager.js +2 -0
- package/build/interfaces/logger.d.ts +8 -0
- package/build/interfaces/logger.js +2 -0
- package/build/interfaces/paladin.d.ts +14 -0
- package/build/interfaces/paladin.js +2 -0
- package/build/interfaces/privacygroups.d.ts +76 -0
- package/build/interfaces/privacygroups.js +2 -0
- package/build/interfaces/query.d.ts +33 -0
- package/build/interfaces/query.js +2 -0
- package/build/interfaces/registry.d.ts +26 -0
- package/build/interfaces/registry.js +2 -0
- package/build/interfaces/states.d.ts +61 -0
- package/build/interfaces/states.js +2 -0
- package/build/interfaces/transaction.d.ts +159 -0
- package/build/interfaces/transaction.js +12 -0
- package/build/interfaces/transport.d.ts +32 -0
- package/build/interfaces/transport.js +2 -0
- package/build/interfaces/verifiers.d.ts +6 -0
- package/build/interfaces/verifiers.js +10 -0
- package/build/interfaces/websocket.d.ts +57 -0
- package/build/interfaces/websocket.js +2 -0
- package/build/paladin.d.ts +265 -0
- package/build/paladin.js +739 -0
- package/build/transaction.d.ts +8 -0
- package/build/transaction.js +17 -0
- package/build/utils.d.ts +5 -0
- package/build/utils.js +49 -0
- package/build/verifier.d.ts +16 -0
- package/build/verifier.js +24 -0
- package/build/websocket.d.ts +35 -0
- package/build/websocket.js +177 -0
- package/build.gradle +75 -0
- package/package.json +32 -0
- package/scripts/abi.mjs +19 -0
- package/scripts/contracts.mjs +20 -0
- package/scripts/download.mjs +27 -0
- package/scripts/util.mjs +42 -0
- package/src/domains/noto.ts +420 -0
- package/src/domains/pente.ts +287 -0
- package/src/domains/zeto.ts +282 -0
- package/src/index.ts +10 -0
- package/src/interfaces/algorithms.ts +6 -0
- package/src/interfaces/blockchainevent.ts +18 -0
- package/src/interfaces/blockindex.ts +33 -0
- package/src/interfaces/domains.ts +10 -0
- package/src/interfaces/index.ts +15 -0
- package/src/interfaces/keymanager.ts +35 -0
- package/src/interfaces/logger.ts +8 -0
- package/src/interfaces/paladin.ts +17 -0
- package/src/interfaces/privacygroups.ts +86 -0
- package/src/interfaces/query.ts +37 -0
- package/src/interfaces/registry.ts +27 -0
- package/src/interfaces/states.ts +77 -0
- package/src/interfaces/transaction.ts +179 -0
- package/src/interfaces/transport.ts +35 -0
- package/src/interfaces/verifiers.ts +6 -0
- package/src/interfaces/websocket.ts +67 -0
- package/src/paladin.ts +1295 -0
- package/src/transaction.ts +17 -0
- package/src/utils.ts +24 -0
- package/src/verifier.ts +27 -0
- package/src/websocket.ts +217 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import PaladinClient from "../paladin";
|
|
2
|
+
import { TransactionFuture } from "../transaction";
|
|
3
|
+
import { PaladinVerifier } from "../verifier";
|
|
4
|
+
export declare const algorithmZetoSnarkBJJ: (domainName: string) => string;
|
|
5
|
+
export declare const IDEN3_PUBKEY_BABYJUBJUB_COMPRESSED_0X = "iden3_pubkey_babyjubjub_compressed_0x";
|
|
6
|
+
export declare const zetoConstructorABI: {
|
|
7
|
+
type: string;
|
|
8
|
+
inputs: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export interface ZetoConstructorParams {
|
|
14
|
+
tokenName: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ZetoMintParams {
|
|
17
|
+
mints: ZetoTransfer[];
|
|
18
|
+
}
|
|
19
|
+
export interface ZetoTransferParams {
|
|
20
|
+
transfers: ZetoTransfer[];
|
|
21
|
+
}
|
|
22
|
+
export interface ZetoLockParams {
|
|
23
|
+
amount: number;
|
|
24
|
+
delegate: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ZetoTransferLockedParams {
|
|
27
|
+
lockedInputs: string[];
|
|
28
|
+
delegate: string;
|
|
29
|
+
transfers: ZetoTransfer[];
|
|
30
|
+
}
|
|
31
|
+
export interface ZetoDelegateLockParams {
|
|
32
|
+
utxos: string[];
|
|
33
|
+
delegate: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ZetoSetERC20Params {
|
|
36
|
+
erc20: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ZetoTransfer {
|
|
39
|
+
to: PaladinVerifier;
|
|
40
|
+
amount: string | number;
|
|
41
|
+
data: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ZetoDepositParams {
|
|
44
|
+
amount: string | number;
|
|
45
|
+
}
|
|
46
|
+
export interface ZetoWithdrawParams {
|
|
47
|
+
amount: string | number;
|
|
48
|
+
}
|
|
49
|
+
export interface ZetoBalanceOfParams {
|
|
50
|
+
account: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ZetoBalanceOfResult {
|
|
53
|
+
totalBalance: string;
|
|
54
|
+
totalStates: string;
|
|
55
|
+
overflow: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare class ZetoFuture extends TransactionFuture {
|
|
58
|
+
waitForDeploy(waitMs?: number): Promise<ZetoInstance | undefined>;
|
|
59
|
+
}
|
|
60
|
+
export declare class ZetoFactory {
|
|
61
|
+
private paladin;
|
|
62
|
+
readonly domain: string;
|
|
63
|
+
constructor(paladin: PaladinClient, domain: string);
|
|
64
|
+
using(paladin: PaladinClient): ZetoFactory;
|
|
65
|
+
newZeto(from: PaladinVerifier, data: ZetoConstructorParams): ZetoFuture;
|
|
66
|
+
}
|
|
67
|
+
export declare class ZetoInstance {
|
|
68
|
+
private paladin;
|
|
69
|
+
readonly address: string;
|
|
70
|
+
private erc20?;
|
|
71
|
+
constructor(paladin: PaladinClient, address: string);
|
|
72
|
+
using(paladin: PaladinClient): ZetoInstance;
|
|
73
|
+
mint(from: PaladinVerifier, data: ZetoMintParams): TransactionFuture;
|
|
74
|
+
transfer(from: PaladinVerifier, data: ZetoTransferParams): TransactionFuture;
|
|
75
|
+
transferLocked(from: PaladinVerifier, data: ZetoTransferLockedParams): TransactionFuture;
|
|
76
|
+
prepareTransferLocked(from: PaladinVerifier, data: ZetoTransferLockedParams): TransactionFuture;
|
|
77
|
+
lock(from: PaladinVerifier, data: ZetoLockParams): TransactionFuture;
|
|
78
|
+
delegateLock(from: PaladinVerifier, data: ZetoDelegateLockParams): TransactionFuture;
|
|
79
|
+
setERC20(from: PaladinVerifier, data: ZetoSetERC20Params): TransactionFuture;
|
|
80
|
+
deposit(from: PaladinVerifier, data: ZetoDepositParams): TransactionFuture;
|
|
81
|
+
withdraw(from: PaladinVerifier, data: ZetoWithdrawParams): TransactionFuture;
|
|
82
|
+
balanceOf(from: PaladinVerifier, data: ZetoBalanceOfParams): Promise<ZetoBalanceOfResult>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ZetoInstance = exports.ZetoFactory = exports.ZetoFuture = exports.zetoConstructorABI = exports.IDEN3_PUBKEY_BABYJUBJUB_COMPRESSED_0X = exports.algorithmZetoSnarkBJJ = void 0;
|
|
27
|
+
const interfaces_1 = require("../interfaces");
|
|
28
|
+
const transaction_1 = require("../transaction");
|
|
29
|
+
const zetoPrivateJSON = __importStar(require("./abis/IZetoFungible.json"));
|
|
30
|
+
const zetoPublicJSON = __importStar(require("./abis/Zeto_Anon.json"));
|
|
31
|
+
// Algorithm/verifier types specific to Zeto
|
|
32
|
+
const algorithmZetoSnarkBJJ = (domainName) => `domain:${domainName}:snark:babyjubjub`;
|
|
33
|
+
exports.algorithmZetoSnarkBJJ = algorithmZetoSnarkBJJ;
|
|
34
|
+
exports.IDEN3_PUBKEY_BABYJUBJUB_COMPRESSED_0X = "iden3_pubkey_babyjubjub_compressed_0x";
|
|
35
|
+
const zetoAbi = zetoPrivateJSON.abi;
|
|
36
|
+
const zetoPublicAbi = zetoPublicJSON.abi;
|
|
37
|
+
exports.zetoConstructorABI = {
|
|
38
|
+
type: "constructor",
|
|
39
|
+
inputs: [{ name: "tokenName", type: "string" }],
|
|
40
|
+
};
|
|
41
|
+
// Represents an in-flight Zeto deployment
|
|
42
|
+
class ZetoFuture extends transaction_1.TransactionFuture {
|
|
43
|
+
async waitForDeploy(waitMs) {
|
|
44
|
+
const receipt = await this.waitForReceipt(waitMs);
|
|
45
|
+
return receipt?.contractAddress
|
|
46
|
+
? new ZetoInstance(this.paladin, receipt.contractAddress)
|
|
47
|
+
: undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ZetoFuture = ZetoFuture;
|
|
51
|
+
class ZetoFactory {
|
|
52
|
+
constructor(paladin, domain) {
|
|
53
|
+
this.paladin = paladin;
|
|
54
|
+
this.domain = domain;
|
|
55
|
+
}
|
|
56
|
+
using(paladin) {
|
|
57
|
+
return new ZetoFactory(paladin, this.domain);
|
|
58
|
+
}
|
|
59
|
+
newZeto(from, data) {
|
|
60
|
+
return new ZetoFuture(this.paladin, this.paladin.sendTransaction({
|
|
61
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
62
|
+
domain: this.domain,
|
|
63
|
+
abi: [exports.zetoConstructorABI],
|
|
64
|
+
function: "",
|
|
65
|
+
from: from.lookup,
|
|
66
|
+
data,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ZetoFactory = ZetoFactory;
|
|
71
|
+
class ZetoInstance {
|
|
72
|
+
constructor(paladin, address) {
|
|
73
|
+
this.paladin = paladin;
|
|
74
|
+
this.address = address;
|
|
75
|
+
}
|
|
76
|
+
using(paladin) {
|
|
77
|
+
const zeto = new ZetoInstance(paladin, this.address);
|
|
78
|
+
zeto.erc20 = this.erc20;
|
|
79
|
+
return zeto;
|
|
80
|
+
}
|
|
81
|
+
mint(from, data) {
|
|
82
|
+
const params = {
|
|
83
|
+
mints: data.mints.map((t) => ({ ...t, to: t.to.lookup })),
|
|
84
|
+
};
|
|
85
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
86
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
87
|
+
abi: zetoAbi,
|
|
88
|
+
function: "mint",
|
|
89
|
+
to: this.address,
|
|
90
|
+
from: from.lookup,
|
|
91
|
+
data: params,
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
transfer(from, data) {
|
|
95
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
96
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
97
|
+
abi: zetoAbi,
|
|
98
|
+
function: "transfer",
|
|
99
|
+
to: this.address,
|
|
100
|
+
from: from.lookup,
|
|
101
|
+
data: {
|
|
102
|
+
transfers: data.transfers.map((t) => ({ ...t, to: t.to.lookup })),
|
|
103
|
+
},
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
transferLocked(from, data) {
|
|
107
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
108
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
109
|
+
abi: zetoAbi,
|
|
110
|
+
function: "transferLocked",
|
|
111
|
+
to: this.address,
|
|
112
|
+
from: from.lookup,
|
|
113
|
+
data: {
|
|
114
|
+
lockedInputs: data.lockedInputs,
|
|
115
|
+
delegate: data.delegate,
|
|
116
|
+
transfers: data.transfers.map((t) => ({ ...t, to: t.to.lookup })),
|
|
117
|
+
},
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
prepareTransferLocked(from, data) {
|
|
121
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.prepareTransaction({
|
|
122
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
123
|
+
abi: zetoAbi,
|
|
124
|
+
function: "transferLocked",
|
|
125
|
+
to: this.address,
|
|
126
|
+
from: from.lookup,
|
|
127
|
+
data: {
|
|
128
|
+
lockedInputs: data.lockedInputs,
|
|
129
|
+
delegate: data.delegate,
|
|
130
|
+
transfers: data.transfers.map((t) => ({ ...t, to: t.to.lookup })),
|
|
131
|
+
},
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
lock(from, data) {
|
|
135
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
136
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
137
|
+
abi: zetoAbi,
|
|
138
|
+
function: "lock",
|
|
139
|
+
to: this.address,
|
|
140
|
+
from: from.lookup,
|
|
141
|
+
data,
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
delegateLock(from, data) {
|
|
145
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
146
|
+
type: interfaces_1.TransactionType.Public,
|
|
147
|
+
abi: zetoPublicAbi,
|
|
148
|
+
function: "delegateLock",
|
|
149
|
+
to: this.address,
|
|
150
|
+
from: from.lookup,
|
|
151
|
+
data: {
|
|
152
|
+
data: "0x",
|
|
153
|
+
utxos: data.utxos,
|
|
154
|
+
delegate: data.delegate,
|
|
155
|
+
},
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
setERC20(from, data) {
|
|
159
|
+
this.erc20 = data.erc20;
|
|
160
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
161
|
+
type: interfaces_1.TransactionType.PUBLIC,
|
|
162
|
+
abi: zetoAbi,
|
|
163
|
+
function: "setERC20",
|
|
164
|
+
to: this.address,
|
|
165
|
+
from: from.lookup,
|
|
166
|
+
data,
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
deposit(from, data) {
|
|
170
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
171
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
172
|
+
abi: zetoAbi,
|
|
173
|
+
function: "deposit",
|
|
174
|
+
to: this.address,
|
|
175
|
+
from: from.lookup,
|
|
176
|
+
data,
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
withdraw(from, data) {
|
|
180
|
+
return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
|
|
181
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
182
|
+
abi: zetoAbi,
|
|
183
|
+
function: "withdraw",
|
|
184
|
+
to: this.address,
|
|
185
|
+
from: from.lookup,
|
|
186
|
+
data,
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
async balanceOf(from, data) {
|
|
190
|
+
return await this.paladin.call({
|
|
191
|
+
type: interfaces_1.TransactionType.PRIVATE,
|
|
192
|
+
domain: "zeto",
|
|
193
|
+
abi: zetoPrivateJSON.abi,
|
|
194
|
+
function: "balanceOf",
|
|
195
|
+
to: this.address,
|
|
196
|
+
from: from.lookup,
|
|
197
|
+
data,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.ZetoInstance = ZetoInstance;
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import PaladinClient from "./paladin";
|
|
2
|
+
export default PaladinClient;
|
|
3
|
+
export * from "./interfaces/index";
|
|
4
|
+
export * from "./utils";
|
|
5
|
+
export * from "./verifier";
|
|
6
|
+
export * from "./websocket";
|
|
7
|
+
export * from "./domains/noto";
|
|
8
|
+
export * from "./domains/pente";
|
|
9
|
+
export * from "./domains/zeto";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const paladin_1 = __importDefault(require("./paladin"));
|
|
21
|
+
exports.default = paladin_1.default;
|
|
22
|
+
__exportStar(require("./interfaces/index"), exports);
|
|
23
|
+
__exportStar(require("./utils"), exports);
|
|
24
|
+
__exportStar(require("./verifier"), exports);
|
|
25
|
+
__exportStar(require("./websocket"), exports);
|
|
26
|
+
__exportStar(require("./domains/noto"), exports);
|
|
27
|
+
__exportStar(require("./domains/pente"), exports);
|
|
28
|
+
__exportStar(require("./domains/zeto"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Algorithms = void 0;
|
|
4
|
+
const Prefix_ECDSA = "ecdsa";
|
|
5
|
+
const Curve_SECP256K1 = "secp256k1";
|
|
6
|
+
var Algorithms;
|
|
7
|
+
(function (Algorithms) {
|
|
8
|
+
Algorithms["ECDSA_SECP256K1"] = "ecdsa:secp256k1";
|
|
9
|
+
})(Algorithms || (exports.Algorithms = Algorithms = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
export interface IBlockchainEventListener {
|
|
3
|
+
name: string;
|
|
4
|
+
sources: IBlockchainEventListenerSource[];
|
|
5
|
+
options?: IBlockchainEventListenerOptions;
|
|
6
|
+
}
|
|
7
|
+
export interface IBlockchainEventListenerOptions {
|
|
8
|
+
batchSize?: number;
|
|
9
|
+
batchTimeout?: string;
|
|
10
|
+
fromBlock?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IBlockchainEventListenerSource {
|
|
13
|
+
abi: ethers.JsonFragment[];
|
|
14
|
+
address?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface IIndexedBlock {
|
|
2
|
+
number: number;
|
|
3
|
+
hash: string;
|
|
4
|
+
timestamp: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IIndexedTransaction {
|
|
7
|
+
hash: string;
|
|
8
|
+
blockNumber: number;
|
|
9
|
+
transactionIndex: number;
|
|
10
|
+
from?: string;
|
|
11
|
+
to?: string;
|
|
12
|
+
nonce: number;
|
|
13
|
+
contractAddress?: string;
|
|
14
|
+
result?: "failure" | "success";
|
|
15
|
+
block?: IIndexedBlock;
|
|
16
|
+
}
|
|
17
|
+
export interface IIndexedEvent {
|
|
18
|
+
blockNumber: number;
|
|
19
|
+
transactionIndex: number;
|
|
20
|
+
logIndex: number;
|
|
21
|
+
transactionHash: string;
|
|
22
|
+
signature: string;
|
|
23
|
+
transaction?: IIndexedTransaction;
|
|
24
|
+
block?: IIndexedBlock;
|
|
25
|
+
}
|
|
26
|
+
export interface IEventWithData extends IIndexedEvent {
|
|
27
|
+
soliditySignature: string;
|
|
28
|
+
address: string;
|
|
29
|
+
data: any;
|
|
30
|
+
}
|
|
@@ -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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./algorithms"), exports);
|
|
18
|
+
__exportStar(require("./blockindex"), exports);
|
|
19
|
+
__exportStar(require("./blockchainevent"), exports);
|
|
20
|
+
__exportStar(require("./domains"), exports);
|
|
21
|
+
__exportStar(require("./keymanager"), exports);
|
|
22
|
+
__exportStar(require("./logger"), exports);
|
|
23
|
+
__exportStar(require("./paladin"), exports);
|
|
24
|
+
__exportStar(require("./privacygroups"), exports);
|
|
25
|
+
__exportStar(require("./query"), exports);
|
|
26
|
+
__exportStar(require("./registry"), exports);
|
|
27
|
+
__exportStar(require("./states"), exports);
|
|
28
|
+
__exportStar(require("./transaction"), exports);
|
|
29
|
+
__exportStar(require("./transport"), exports);
|
|
30
|
+
__exportStar(require("./verifiers"), exports);
|
|
31
|
+
__exportStar(require("./websocket"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface IWalletInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IKeyMappingAndVerifier {
|
|
7
|
+
identifier: string;
|
|
8
|
+
keyHandle: string;
|
|
9
|
+
path: {
|
|
10
|
+
index: number;
|
|
11
|
+
name: string;
|
|
12
|
+
}[];
|
|
13
|
+
verifier: {
|
|
14
|
+
verifier: string;
|
|
15
|
+
type: string;
|
|
16
|
+
algorithm: string;
|
|
17
|
+
};
|
|
18
|
+
wallet: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IEthAddress {
|
|
21
|
+
address: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IKeyQueryEntry {
|
|
24
|
+
identifier: string;
|
|
25
|
+
keyHandle: string;
|
|
26
|
+
wallet: string;
|
|
27
|
+
verifiers: {
|
|
28
|
+
verifier: string;
|
|
29
|
+
type: string;
|
|
30
|
+
algorithm: string;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
@@ -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,14 @@
|
|
|
1
|
+
import { AxiosError, AxiosRequestConfig } from "axios";
|
|
2
|
+
import { Logger } from "./logger";
|
|
3
|
+
export interface PaladinConfig {
|
|
4
|
+
url: string;
|
|
5
|
+
requestConfig?: AxiosRequestConfig;
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
onError?: PaladinErrorHandler;
|
|
8
|
+
}
|
|
9
|
+
export interface PaladinErrorHandler {
|
|
10
|
+
(method: string, err: AxiosError): void | Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface JsonRpcResult<T> {
|
|
13
|
+
result: T;
|
|
14
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BigNumberish, ethers } from "ethers";
|
|
2
|
+
import { HexString } from "ethers/lib.commonjs/utils/data";
|
|
3
|
+
import { PublicTxOptions } from ".";
|
|
4
|
+
export interface IPrivacyGroupInput {
|
|
5
|
+
domain: string;
|
|
6
|
+
members: string[];
|
|
7
|
+
name?: string;
|
|
8
|
+
configuration?: Record<string, string | undefined>;
|
|
9
|
+
properties?: Record<string, string | undefined>;
|
|
10
|
+
transactionOptions?: IPrivacyGroupTXOptions;
|
|
11
|
+
}
|
|
12
|
+
export interface IPrivacyGroupResume {
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IPrivacyGroupTXOptions extends PublicTxOptions {
|
|
16
|
+
idempotencyKey?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IPrivacyGroup {
|
|
19
|
+
id: string;
|
|
20
|
+
domain: string;
|
|
21
|
+
created: string;
|
|
22
|
+
name: string;
|
|
23
|
+
members: string[];
|
|
24
|
+
properties: Record<string, string>;
|
|
25
|
+
configuration: Record<string, string>;
|
|
26
|
+
contractAddress?: string;
|
|
27
|
+
genesisTransaction?: string;
|
|
28
|
+
genesisSchema?: string;
|
|
29
|
+
genesisSalt?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface IPrivacyGroupEVMTX {
|
|
32
|
+
from: string;
|
|
33
|
+
to?: string;
|
|
34
|
+
gas?: BigNumberish;
|
|
35
|
+
value?: BigNumberish;
|
|
36
|
+
input?: unknown;
|
|
37
|
+
function?: ethers.JsonFragment;
|
|
38
|
+
bytecode?: HexString;
|
|
39
|
+
}
|
|
40
|
+
export interface IPrivacyGroupEVMTXInput extends IPrivacyGroupEVMTX {
|
|
41
|
+
idempotencyKey?: string;
|
|
42
|
+
domain: string;
|
|
43
|
+
group: string;
|
|
44
|
+
publicTxOptions?: PublicTxOptions;
|
|
45
|
+
}
|
|
46
|
+
export interface IPrivacyGroupEVMCall extends IPrivacyGroupEVMTX {
|
|
47
|
+
domain: string;
|
|
48
|
+
group: string;
|
|
49
|
+
dataFormat?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface IPrivacyGroupMessageListener {
|
|
52
|
+
name: string;
|
|
53
|
+
filters?: {
|
|
54
|
+
sequenceAbove?: number;
|
|
55
|
+
domain?: string;
|
|
56
|
+
group?: string;
|
|
57
|
+
topic?: string;
|
|
58
|
+
};
|
|
59
|
+
options?: {
|
|
60
|
+
excludeLocal?: boolean;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface IPrivacyGroupMessageInput {
|
|
64
|
+
correlationId?: string;
|
|
65
|
+
domain: string;
|
|
66
|
+
group: string;
|
|
67
|
+
topic: string;
|
|
68
|
+
data: any;
|
|
69
|
+
}
|
|
70
|
+
export interface IPrivacyGroupMessage extends IPrivacyGroupMessageInput {
|
|
71
|
+
id: string;
|
|
72
|
+
localSequence: number;
|
|
73
|
+
sent: string;
|
|
74
|
+
received: string;
|
|
75
|
+
node: string;
|
|
76
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface IQueryOp {
|
|
2
|
+
not?: boolean;
|
|
3
|
+
caseInsensitive?: boolean;
|
|
4
|
+
field: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IQueryOpSingleVal extends IQueryOp {
|
|
7
|
+
value: any;
|
|
8
|
+
}
|
|
9
|
+
export interface IQueryOpMultiVal extends IQueryOp {
|
|
10
|
+
values: any[];
|
|
11
|
+
}
|
|
12
|
+
export interface IQueryStatements {
|
|
13
|
+
or?: IQueryStatements[];
|
|
14
|
+
equal?: IQueryOpSingleVal[];
|
|
15
|
+
eq?: IQueryOpSingleVal[];
|
|
16
|
+
neq?: IQueryOpSingleVal[];
|
|
17
|
+
like?: IQueryOpSingleVal[];
|
|
18
|
+
lessThan?: IQueryOpSingleVal[];
|
|
19
|
+
lt?: IQueryOpSingleVal[];
|
|
20
|
+
lessThanOrEqual?: IQueryOpSingleVal[];
|
|
21
|
+
lte?: IQueryOpSingleVal[];
|
|
22
|
+
greaterThan?: IQueryOpSingleVal[];
|
|
23
|
+
gt?: IQueryOpSingleVal[];
|
|
24
|
+
greaterThanOrEqual?: IQueryOpSingleVal[];
|
|
25
|
+
gte?: IQueryOpSingleVal[];
|
|
26
|
+
in?: IQueryOpMultiVal[];
|
|
27
|
+
nin?: IQueryOpMultiVal[];
|
|
28
|
+
null?: IQueryOp;
|
|
29
|
+
}
|
|
30
|
+
export interface IQuery extends IQueryStatements {
|
|
31
|
+
limit?: number;
|
|
32
|
+
sort?: string[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
export interface IRegistryProperty {
|
|
12
|
+
registry: string;
|
|
13
|
+
entryId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
blockNumber?: number;
|
|
17
|
+
transactionIndex?: number;
|
|
18
|
+
logIndex?: number;
|
|
19
|
+
active?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface IRegistryEntryWithProperties extends IRegistryEntry {
|
|
22
|
+
properties: {
|
|
23
|
+
[key: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type ActiveFilter = "active" | "inactive" | "any";
|