@lfdecentralizedtrust/paladin-sdk 0.14.0 → 0.15.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.
@@ -143,7 +143,7 @@ class ZetoInstance {
143
143
  }
144
144
  delegateLock(from, data) {
145
145
  return new transaction_1.TransactionFuture(this.paladin, this.paladin.sendTransaction({
146
- type: interfaces_1.TransactionType.Public,
146
+ type: interfaces_1.TransactionType.PUBLIC,
147
147
  abi: zetoPublicAbi,
148
148
  function: "delegateLock",
149
149
  to: this.address,
@@ -1,9 +1,17 @@
1
+ export interface IDomainConfig {
2
+ signingAlgorithms?: Record<string, number>;
3
+ }
1
4
  export interface IDomain {
2
5
  name: string;
3
6
  registryAddress: string;
7
+ config?: IDomainConfig;
8
+ }
9
+ export interface IContractConfig {
10
+ contractConfig?: object;
4
11
  }
5
12
  export interface IDomainSmartContract {
6
13
  domainName: string;
7
14
  domainAddress: string;
8
15
  address: string;
16
+ config?: IContractConfig;
9
17
  }
@@ -46,6 +46,7 @@ export interface IPrivacyGroupEVMTXInput extends IPrivacyGroupEVMTX {
46
46
  export interface IPrivacyGroupEVMCall extends IPrivacyGroupEVMTX {
47
47
  domain: string;
48
48
  group: string;
49
+ block?: BigNumberish | string;
49
50
  dataFormat?: string;
50
51
  }
51
52
  export interface IPrivacyGroupMessageListener {
@@ -25,6 +25,7 @@ export interface IStateEncoded {
25
25
  }
26
26
  export interface IState extends IStateBase {
27
27
  confirmed?: IStateConfirm;
28
+ read?: IStateRead;
28
29
  spent?: IStateSpend;
29
30
  locks?: IStateLock[];
30
31
  nullifier?: IStateNullifier;
@@ -44,6 +45,9 @@ export interface IStateInt64Label {
44
45
  export interface IStateConfirm {
45
46
  transaction: string;
46
47
  }
48
+ export interface IStateRead {
49
+ transaction: string;
50
+ }
47
51
  export interface IStateSpend {
48
52
  transaction: string;
49
53
  }
@@ -16,7 +16,11 @@ export interface PublicTxOptions {
16
16
  maxPriorityFeePerGas?: BigNumberish;
17
17
  maxFeePerGas?: BigNumberish;
18
18
  }
19
+ export interface PublicCallOptions {
20
+ block?: BigNumberish | string;
21
+ }
19
22
  export interface ITransactionBase {
23
+ idempotencyKey?: string;
20
24
  type: TransactionType;
21
25
  domain?: string;
22
26
  function?: string;
@@ -26,10 +30,12 @@ export interface ITransactionBase {
26
30
  [key: string]: any;
27
31
  };
28
32
  }
33
+ export type SubmitMode = "auto" | "external" | "call" | "prepare";
29
34
  export interface ITransaction extends ITransactionBase {
30
35
  id: string;
31
36
  created: string;
32
37
  abiReference: string;
38
+ submitMode?: SubmitMode;
33
39
  }
34
40
  export interface IPreparedTransaction {
35
41
  id: string;
@@ -50,8 +56,10 @@ export interface ITransactionInput extends ITransactionBase {
50
56
  abiReference?: string;
51
57
  abi?: ethers.InterfaceAbi;
52
58
  bytecode?: string;
59
+ dependsOn?: string[];
53
60
  }
54
- export interface ITransactionCall extends ITransactionInput {
61
+ export interface ITransactionCall extends ITransactionInput, PublicCallOptions {
62
+ dataFormat?: string;
55
63
  }
56
64
  export interface ITransactionReceipt {
57
65
  blockNumber: number;
@@ -131,10 +139,6 @@ export interface ITransactionStates {
131
139
  info?: string[];
132
140
  };
133
141
  }
134
- export declare enum TransactionType {
135
- Private = "private",
136
- Public = "public"
137
- }
138
142
  export interface IABIDecodedData {
139
143
  signature: string;
140
144
  definition: ethers.JsonFragment;
@@ -6,7 +6,3 @@ var TransactionType;
6
6
  TransactionType["PUBLIC"] = "public";
7
7
  TransactionType["PRIVATE"] = "private";
8
8
  })(TransactionType || (exports.TransactionType = TransactionType = {}));
9
- (function (TransactionType) {
10
- TransactionType["Private"] = "private";
11
- TransactionType["Public"] = "public";
12
- })(TransactionType || (exports.TransactionType = TransactionType = {}));
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { ethers, InterfaceAbi } from "ethers";
3
- import { ActiveFilter, Algorithms, IABIDecodedData, IBlockchainEventListener, IEthAddress, IEventWithData, IKeyMappingAndVerifier, IKeyQueryEntry, INotoDomainReceipt, IPenteDomainReceipt, IPreparedTransaction, IPrivacyGroup, IPrivacyGroupEVMCall, IPrivacyGroupEVMTXInput, IPrivacyGroupInput, IPrivacyGroupMessageInput, IPrivacyGroupMessageListener, IQuery, IRegistryEntry, IRegistryEntryWithProperties, IRegistryProperty, ISchema, IState, IStoredABI, ITransaction, ITransactionCall, ITransactionInput, ITransactionReceipt, ITransactionReceiptListener, ITransactionStates, IWalletInfo, PaladinConfig, StateStatus, Verifiers } from "./interfaces";
3
+ import { ActiveFilter, Algorithms, IABIDecodedData, IBlockchainEventListener, IDomain, IDomainSmartContract, IEthAddress, IEventWithData, IKeyMappingAndVerifier, IKeyQueryEntry, INotoDomainReceipt, IPenteDomainReceipt, IPreparedTransaction, IPrivacyGroup, IPrivacyGroupEVMCall, IPrivacyGroupEVMTXInput, IPrivacyGroupInput, IPrivacyGroupMessageInput, IPrivacyGroupMessageListener, IQuery, IRegistryEntry, IRegistryEntryWithProperties, IRegistryProperty, ISchema, IState, IStoredABI, ITransaction, ITransactionCall, ITransactionInput, ITransactionReceipt, ITransactionReceiptListener, ITransactionStates, IWalletInfo, PaladinConfig, StateStatus, Verifiers } from "./interfaces";
4
4
  import { PaladinVerifier } from "./verifier";
5
5
  export default class PaladinClient {
6
6
  protected http: AxiosInstance;
@@ -236,10 +236,10 @@ export default class PaladinClient {
236
236
  };
237
237
  domain: {
238
238
  listDomains: () => Promise<string[]>;
239
- getDomain: (name: string) => Promise<any>;
240
- getDomainByAddress: (address: string) => Promise<any>;
241
- querySmartContracts: (query: IQuery) => Promise<any[]>;
242
- getSmartContractByAddress: (address: string) => Promise<any>;
239
+ getDomain: (name: string) => Promise<IDomain | undefined>;
240
+ getDomainByAddress: (address: string) => Promise<IDomain | undefined>;
241
+ querySmartContracts: (query: IQuery) => Promise<IDomainSmartContract[]>;
242
+ getSmartContractByAddress: (address: string) => Promise<IDomainSmartContract | undefined>;
243
243
  };
244
244
  bidx: {
245
245
  getBlockByNumber: (number: number) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lfdecentralizedtrust/paladin-sdk",
3
- "version": "0.14.0",
3
+ "version": "0.15.0-rc.1",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -208,7 +208,7 @@ export class ZetoInstance {
208
208
  return new TransactionFuture(
209
209
  this.paladin,
210
210
  this.paladin.sendTransaction({
211
- type: TransactionType.Public,
211
+ type: TransactionType.PUBLIC,
212
212
  abi: zetoPublicAbi,
213
213
  function: "delegateLock",
214
214
  to: this.address,
@@ -1,10 +1,20 @@
1
+ export interface IDomainConfig {
2
+ signingAlgorithms?: Record<string, number>;
3
+ }
4
+
1
5
  export interface IDomain {
2
6
  name: string;
3
7
  registryAddress: string;
8
+ config?: IDomainConfig;
9
+ }
10
+
11
+ export interface IContractConfig {
12
+ contractConfig?: object;
4
13
  }
5
14
 
6
15
  export interface IDomainSmartContract {
7
16
  domainName: string;
8
17
  domainAddress: string;
9
18
  address: string;
19
+ config?: IContractConfig;
10
20
  }
@@ -53,6 +53,7 @@ export interface IPrivacyGroupEVMTXInput extends IPrivacyGroupEVMTX {
53
53
  export interface IPrivacyGroupEVMCall extends IPrivacyGroupEVMTX {
54
54
  domain: string;
55
55
  group: string;
56
+ block?: BigNumberish | string;
56
57
  dataFormat?: string;
57
58
  }
58
59
 
@@ -29,6 +29,7 @@ export interface IStateEncoded {
29
29
 
30
30
  export interface IState extends IStateBase {
31
31
  confirmed?: IStateConfirm;
32
+ read?: IStateRead;
32
33
  spent?: IStateSpend;
33
34
  locks?: IStateLock[];
34
35
  nullifier?: IStateNullifier;
@@ -52,6 +53,10 @@ export interface IStateConfirm {
52
53
  transaction: string;
53
54
  }
54
55
 
56
+ export interface IStateRead {
57
+ transaction: string;
58
+ }
59
+
55
60
  export interface IStateSpend {
56
61
  transaction: string;
57
62
  }
@@ -20,7 +20,12 @@ export interface PublicTxOptions {
20
20
  maxFeePerGas?: BigNumberish;
21
21
  }
22
22
 
23
+ export interface PublicCallOptions {
24
+ block?: BigNumberish | string;
25
+ }
26
+
23
27
  export interface ITransactionBase {
28
+ idempotencyKey?: string;
24
29
  type: TransactionType;
25
30
  domain?: string;
26
31
  function?: string;
@@ -31,10 +36,13 @@ export interface ITransactionBase {
31
36
  };
32
37
  }
33
38
 
39
+ export type SubmitMode = "auto" | "external" | "call" | "prepare";
40
+
34
41
  export interface ITransaction extends ITransactionBase {
35
42
  id: string;
36
43
  created: string;
37
44
  abiReference: string;
45
+ submitMode?: SubmitMode;
38
46
  }
39
47
 
40
48
  export interface IPreparedTransaction {
@@ -57,9 +65,12 @@ export interface ITransactionInput extends ITransactionBase {
57
65
  abiReference?: string;
58
66
  abi?: ethers.InterfaceAbi;
59
67
  bytecode?: string;
68
+ dependsOn?: string[];
60
69
  }
61
70
 
62
- export interface ITransactionCall extends ITransactionInput {}
71
+ export interface ITransactionCall extends ITransactionInput, PublicCallOptions {
72
+ dataFormat?: string;
73
+ }
63
74
 
64
75
  export interface ITransactionReceipt {
65
76
  blockNumber: number;
@@ -148,11 +159,6 @@ export interface ITransactionStates {
148
159
  };
149
160
  }
150
161
 
151
- export enum TransactionType {
152
- Private = "private",
153
- Public = "public",
154
- }
155
-
156
162
  export interface IABIDecodedData {
157
163
  signature: string;
158
164
  definition: ethers.JsonFragment;
package/src/paladin.ts CHANGED
@@ -5,6 +5,8 @@ import {
5
5
  Algorithms,
6
6
  IABIDecodedData,
7
7
  IBlockchainEventListener,
8
+ IDomain,
9
+ IDomainSmartContract,
8
10
  IEthAddress,
9
11
  IEventWithData,
10
12
  IKeyMappingAndVerifier,
@@ -1104,7 +1106,7 @@ export default class PaladinClient {
1104
1106
  };
1105
1107
 
1106
1108
  domain = {
1107
- listDomains: async () => {
1109
+ listDomains: async (): Promise<string[]> => {
1108
1110
  const res = await this.post<JsonRpcResult<string[]>>(
1109
1111
  "domain_listDomains",
1110
1112
  []
@@ -1112,8 +1114,8 @@ export default class PaladinClient {
1112
1114
  return res.data.result;
1113
1115
  },
1114
1116
 
1115
- getDomain: async (name: string) => {
1116
- const res = await this.post<JsonRpcResult<any>>(
1117
+ getDomain: async (name: string): Promise<IDomain | undefined> => {
1118
+ const res = await this.post<JsonRpcResult<IDomain>>(
1117
1119
  "domain_getDomain",
1118
1120
  [name],
1119
1121
  { validateStatus: (status) => status < 300 || status === 404 }
@@ -1121,8 +1123,10 @@ export default class PaladinClient {
1121
1123
  return res.status === 404 ? undefined : res.data.result;
1122
1124
  },
1123
1125
 
1124
- getDomainByAddress: async (address: string) => {
1125
- const res = await this.post<JsonRpcResult<any>>(
1126
+ getDomainByAddress: async (
1127
+ address: string
1128
+ ): Promise<IDomain | undefined> => {
1129
+ const res = await this.post<JsonRpcResult<IDomain>>(
1126
1130
  "domain_getDomainByAddress",
1127
1131
  [address],
1128
1132
  { validateStatus: (status) => status < 300 || status === 404 }
@@ -1130,16 +1134,20 @@ export default class PaladinClient {
1130
1134
  return res.status === 404 ? undefined : res.data.result;
1131
1135
  },
1132
1136
 
1133
- querySmartContracts: async (query: IQuery) => {
1134
- const res = await this.post<JsonRpcResult<any[]>>(
1137
+ querySmartContracts: async (
1138
+ query: IQuery
1139
+ ): Promise<IDomainSmartContract[]> => {
1140
+ const res = await this.post<JsonRpcResult<IDomainSmartContract[]>>(
1135
1141
  "domain_querySmartContracts",
1136
1142
  [query]
1137
1143
  );
1138
1144
  return res.data.result;
1139
1145
  },
1140
1146
 
1141
- getSmartContractByAddress: async (address: string) => {
1142
- const res = await this.post<JsonRpcResult<any>>(
1147
+ getSmartContractByAddress: async (
1148
+ address: string
1149
+ ): Promise<IDomainSmartContract | undefined> => {
1150
+ const res = await this.post<JsonRpcResult<IDomainSmartContract>>(
1143
1151
  "domain_getSmartContractByAddress",
1144
1152
  [address],
1145
1153
  { validateStatus: (status) => status < 300 || status === 404 }