@tari-project/tarijs 0.4.1 → 0.5.0

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 (108) hide show
  1. package/.github/workflows/ci.yml +2 -1
  2. package/.github/workflows/documentation-deploy.yml +44 -0
  3. package/.github/workflows/documentation-test-deploy.yml +20 -0
  4. package/.moon/workspace.yml +1 -0
  5. package/README.md +19 -0
  6. package/TODO.md +2 -6
  7. package/docusaurus/tari-docs/README.md +41 -0
  8. package/docusaurus/tari-docs/docs/index.md +21 -0
  9. package/docusaurus/tari-docs/docs/installation.md +27 -0
  10. package/docusaurus/tari-docs/docs/providers/_category_.json +8 -0
  11. package/docusaurus/tari-docs/docs/providers/indexer-provider.md +32 -0
  12. package/docusaurus/tari-docs/docs/signers/_category_.json +8 -0
  13. package/docusaurus/tari-docs/docs/signers/tari-universe.md +27 -0
  14. package/docusaurus/tari-docs/docs/signers/wallet-connect.md +51 -0
  15. package/docusaurus/tari-docs/docs/signers/wallet-daemon.md +37 -0
  16. package/docusaurus/tari-docs/docs/wallet/_category_.json +8 -0
  17. package/docusaurus/tari-docs/docs/wallet/default-account.md +51 -0
  18. package/docusaurus/tari-docs/docs/wallet/get-substate.md +110 -0
  19. package/docusaurus/tari-docs/docs/wallet/list-substates.md +68 -0
  20. package/docusaurus/tari-docs/docs/wallet/submit-transaction/_category_.json +8 -0
  21. package/docusaurus/tari-docs/docs/wallet/submit-transaction/build-execute-request.md +38 -0
  22. package/docusaurus/tari-docs/docs/wallet/submit-transaction/index.md +14 -0
  23. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/_category_.json +8 -0
  24. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/call-function.md +17 -0
  25. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/call-method.md +17 -0
  26. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/fee.md +28 -0
  27. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/index.md +426 -0
  28. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/inputs.md +24 -0
  29. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/instruction.md +108 -0
  30. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/min-max-epoch.md +19 -0
  31. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/raw-instructions.md +16 -0
  32. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/save-var.md +63 -0
  33. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/transaction-internals.md +20 -0
  34. package/docusaurus/tari-docs/docs/wallet/template-definition.md +101 -0
  35. package/docusaurus/tari-docs/docusaurus.config.ts +108 -0
  36. package/docusaurus/tari-docs/moon.yml +41 -0
  37. package/docusaurus/tari-docs/package.json +49 -0
  38. package/docusaurus/tari-docs/sidebars.ts +7 -0
  39. package/docusaurus/tari-docs/src/components/HomepageFeatures/index.tsx +69 -0
  40. package/docusaurus/tari-docs/src/components/HomepageFeatures/styles.module.css +11 -0
  41. package/docusaurus/tari-docs/src/css/custom.css +30 -0
  42. package/docusaurus/tari-docs/src/pages/index.module.css +23 -0
  43. package/docusaurus/tari-docs/src/pages/index.tsx +44 -0
  44. package/docusaurus/tari-docs/static/.nojekyll +0 -0
  45. package/docusaurus/tari-docs/static/img/favicon.png +0 -0
  46. package/docusaurus/tari-docs/static/img/meta-image.png +0 -0
  47. package/docusaurus/tari-docs/static/img/tari/wallet-connect-1.png +0 -0
  48. package/docusaurus/tari-docs/static/img/tari/wallet-connect-2.png +0 -0
  49. package/docusaurus/tari-docs/static/img/tari/wallet-connect-3.png +0 -0
  50. package/docusaurus/tari-docs/static/img/tari-logo.svg +30 -0
  51. package/docusaurus/tari-docs/tsconfig.json +10 -0
  52. package/package.json +1 -1
  53. package/packages/builders/package.json +3 -3
  54. package/packages/builders/src/helpers/submitTransaction.ts +8 -8
  55. package/packages/builders/tsconfig.json +2 -4
  56. package/packages/indexer_provider/package.json +31 -0
  57. package/packages/indexer_provider/src/index.ts +2 -0
  58. package/packages/indexer_provider/src/provider.ts +105 -0
  59. package/packages/indexer_provider/src/transports/IndexerProviderClient.ts +144 -0
  60. package/packages/indexer_provider/src/transports/fetch.ts +46 -0
  61. package/packages/indexer_provider/src/transports/index.ts +3 -0
  62. package/packages/indexer_provider/src/transports/rpc.ts +19 -0
  63. package/packages/indexer_provider/tsconfig.json +22 -0
  64. package/packages/metamask_signer/moon.yml +55 -0
  65. package/packages/{metamask_provider → metamask_signer}/package.json +3 -3
  66. package/packages/{metamask_provider → metamask_signer}/src/index.ts +11 -6
  67. package/packages/metamask_signer/tsconfig.json +19 -0
  68. package/packages/tari_permissions/package.json +2 -3
  69. package/packages/tari_permissions/src/helpers.ts +33 -0
  70. package/packages/tari_permissions/src/index.ts +2 -1
  71. package/packages/tari_permissions/src/tari_permissions.ts +59 -42
  72. package/packages/tari_provider/package.json +1 -1
  73. package/packages/tari_provider/src/TariProvider.ts +7 -23
  74. package/packages/tari_provider/src/index.ts +1 -2
  75. package/packages/tari_provider/src/types.ts +38 -24
  76. package/packages/tari_signer/moon.yml +55 -0
  77. package/packages/tari_signer/package.json +28 -0
  78. package/packages/tari_signer/src/TariSigner.ts +35 -0
  79. package/packages/tari_signer/src/index.ts +2 -0
  80. package/packages/tari_signer/src/types.ts +84 -0
  81. package/packages/{metamask_provider → tari_signer}/tsconfig.json +0 -3
  82. package/packages/tari_universe/package.json +3 -3
  83. package/packages/tari_universe/src/index.ts +1 -1
  84. package/packages/tari_universe/src/{provider.ts → signer.ts} +32 -33
  85. package/packages/tari_universe/src/types.ts +15 -10
  86. package/packages/tari_universe/src/utils.ts +8 -8
  87. package/packages/tari_universe/tsconfig.json +2 -4
  88. package/packages/tarijs/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +44 -44
  89. package/packages/tarijs/moon.yml +8 -0
  90. package/packages/tarijs/package.json +9 -6
  91. package/packages/tarijs/src/cbor.spec.ts +259 -0
  92. package/packages/tarijs/src/cbor.ts +114 -0
  93. package/packages/tarijs/src/index.ts +31 -15
  94. package/packages/tarijs/tsconfig.json +7 -1
  95. package/packages/tarijs_types/package.json +1 -1
  96. package/packages/tarijs_types/src/helpers/index.ts +62 -0
  97. package/packages/tarijs_types/src/index.ts +12 -1
  98. package/packages/wallet_daemon/package.json +4 -3
  99. package/packages/wallet_daemon/src/index.ts +1 -1
  100. package/packages/wallet_daemon/src/{provider.ts → signer.ts} +45 -47
  101. package/packages/wallet_daemon/tsconfig.json +4 -1
  102. package/packages/walletconnect/package.json +4 -3
  103. package/packages/walletconnect/src/index.ts +42 -43
  104. package/packages/walletconnect/tsconfig.json +4 -1
  105. package/pnpm-workspace.yaml +4 -3
  106. package/tsconfig.json +11 -2
  107. /package/packages/{metamask_provider → indexer_provider}/moon.yml +0 -0
  108. /package/packages/{metamask_provider → metamask_signer}/src/utils.ts +0 -0
@@ -26,11 +26,10 @@ export class Tagged {
26
26
  this.value = value;
27
27
  }
28
28
  toJSON() {
29
- return { "@@TAGGED@@": [this.tag, this.value] }
29
+ return { "@@TAGGED@@": [this.tag, this.value] };
30
30
  }
31
31
  }
32
32
 
33
-
34
33
  export class ResourceAddress {
35
34
  private tagged: Tagged;
36
35
  constructor(hash: Hash) {
@@ -72,12 +71,12 @@ export class NonFungibleId {
72
71
  }
73
72
  toJSON() {
74
73
  switch (typeof this.value) {
75
- case 'string':
76
- return { 'string': this.value };
77
- case 'number':
78
- return { 'Uint64': this.value };
74
+ case "string":
75
+ return { string: this.value };
76
+ case "number":
77
+ return { Uint64: this.value };
79
78
  }
80
- return { 'U256': this.value };
79
+ return { U256: this.value };
81
80
  }
82
81
  }
83
82
 
@@ -89,14 +88,14 @@ export class NonFungibleAddressContents {
89
88
  this.id = id;
90
89
  }
91
90
  toJSON() {
92
- return { "resource_address": this.resource_address, "id": this.id }
91
+ return { resource_address: this.resource_address, id: this.id };
93
92
  }
94
93
  }
95
94
 
96
95
  export class NonFungibleAddress {
97
96
  private tagged: Tagged;
98
97
  constructor(value: NonFungibleAddressContents) {
99
- this.tagged = new Tagged(TAG.NonFungibleAddress, value)
98
+ this.tagged = new Tagged(TAG.NonFungibleAddress, value);
100
99
  }
101
100
  toJSON() {
102
101
  return this.tagged.toJSON();
@@ -111,7 +110,7 @@ export class NonFungibleIndexAddress {
111
110
  this.index = index;
112
111
  }
113
112
  toJSON() {
114
- return { "resource_address": this.resource_address, "index": this.index }
113
+ return { resource_address: this.resource_address, index: this.index };
115
114
  }
116
115
  }
117
116
 
@@ -121,7 +120,7 @@ export class ComponentAddress {
121
120
  this.tagged = new Tagged(TAG.ComponentAddress, hash);
122
121
  }
123
122
  toJSON() {
124
- return this.tagged.toJSON()
123
+ return this.tagged.toJSON();
125
124
  }
126
125
  }
127
126
 
@@ -131,12 +130,17 @@ export class VaultId {
131
130
  this.tagged = new Tagged(TAG.VaultId, hash);
132
131
  }
133
132
  toJSON() {
134
- return this.tagged.toJSON()
133
+ return this.tagged.toJSON();
135
134
  }
136
135
  }
137
136
 
138
- export type SubstateAddressType = ResourceAddress | ComponentAddress | VaultId | UnclaimedConfidentialOutputAddress | NonFungibleAddress | NonFungibleIndexAddress;
139
-
137
+ export type SubstateAddressType =
138
+ | ResourceAddress
139
+ | ComponentAddress
140
+ | VaultId
141
+ | UnclaimedConfidentialOutputAddress
142
+ | NonFungibleAddress
143
+ | NonFungibleIndexAddress;
140
144
 
141
145
  export class SubstateAddress {
142
146
  private value: SubstateAddressType;
@@ -145,19 +149,19 @@ export class SubstateAddress {
145
149
  }
146
150
  toJSON() {
147
151
  if (this.value instanceof ComponentAddress) {
148
- return { "Component": this.value }
152
+ return { Component: this.value };
149
153
  } else if (this.value instanceof ResourceAddress) {
150
- return { "Resource": this.value }
154
+ return { Resource: this.value };
151
155
  } else if (this.value instanceof VaultId) {
152
- return { "Vault": this.value }
156
+ return { Vault: this.value };
153
157
  } else if (this.value instanceof UnclaimedConfidentialOutputAddress) {
154
- return { "UnclaimedConfidentialOutput": this.value }
158
+ return { UnclaimedConfidentialOutput: this.value };
155
159
  } else if (this.value instanceof NonFungibleAddress) {
156
- return { "NonFungible": this.value }
160
+ return { NonFungible: this.value };
157
161
  } else if (this.value instanceof NonFungibleIndexAddress) {
158
- return { "NonFungibleIndex": this.value }
162
+ return { NonFungibleIndex: this.value };
159
163
  }
160
- throw "Unknown type"
164
+ throw "Unknown type";
161
165
  }
162
166
  }
163
167
 
@@ -167,15 +171,15 @@ export class TariPermissionAccountBalance {
167
171
  this.value = value;
168
172
  }
169
173
  toJSON() {
170
- console.log("stringify", this.value)
171
- return { "AccountBalance": this.value }
174
+ console.log("stringify", this.value);
175
+ return { AccountBalance: this.value };
172
176
  }
173
177
  }
174
178
 
175
179
  export class TariPermissionAccountInfo {
176
180
  constructor() {}
177
181
  toJSON() {
178
- return "AccountInfo"
182
+ return "AccountInfo";
179
183
  }
180
184
  }
181
185
 
@@ -189,11 +193,11 @@ export class TariPermissionAccountList {
189
193
  }
190
194
  }
191
195
  toJSON() {
192
- console.log('JSON TariPermissionAccountList', this.value)
196
+ console.log("JSON TariPermissionAccountList", this.value);
193
197
  if (this.value === undefined) {
194
- return { "AccountList": null }
198
+ return { AccountList: null };
195
199
  } else {
196
- return { "AccountList": this.value }
200
+ return { AccountList: this.value };
197
201
  }
198
202
  }
199
203
  }
@@ -201,14 +205,14 @@ export class TariPermissionAccountList {
201
205
  export class TariPermissionKeyList {
202
206
  constructor() {}
203
207
  toJSON() {
204
- return "KeyList"
208
+ return "KeyList";
205
209
  }
206
210
  }
207
211
 
208
212
  export class TariPermissionTransactionGet {
209
213
  constructor() {}
210
214
  toJSON() {
211
- return "TransactionGet"
215
+ return "TransactionGet";
212
216
  }
213
217
  }
214
218
  export class TariPermissionTransactionSend {
@@ -217,11 +221,11 @@ export class TariPermissionTransactionSend {
217
221
  this.value = value;
218
222
  }
219
223
  toJSON() {
220
- console.log('JSON TariPermissionTransactionSend', this.value)
224
+ console.log("JSON TariPermissionTransactionSend", this.value);
221
225
  if (this.value === undefined) {
222
- return { "TransactionSend": null }
226
+ return { TransactionSend: null };
223
227
  } else {
224
- return { "TransactionSend": this.value }
228
+ return { TransactionSend: this.value };
225
229
  }
226
230
  }
227
231
  }
@@ -234,7 +238,7 @@ export class TariPermissionGetNft {
234
238
  this.value1 = value1;
235
239
  }
236
240
  toJSON() {
237
- return { "GetNft": [this.value0, this.value1] }
241
+ return { GetNft: [this.value0, this.value1] };
238
242
  }
239
243
  }
240
244
 
@@ -244,32 +248,44 @@ export class TariPermissionNftGetOwnershipProof {
244
248
  this.value = value;
245
249
  }
246
250
  toJSON() {
247
- return { "NftGetOwnershipProof": this.value }
251
+ return { NftGetOwnershipProof: this.value };
248
252
  }
249
253
  }
250
254
 
251
255
  export class TariPermissionTransactionsGet {
252
256
  constructor() {}
253
257
  toJSON() {
254
- return "TransactionGet"
258
+ return "TransactionGet";
255
259
  }
256
260
  }
257
261
 
258
262
  export class TariPermissionSubstatesRead {
259
263
  constructor() {}
260
264
  toJSON() {
261
- return "SubstatesRead"
265
+ return "SubstatesRead";
262
266
  }
263
267
  }
264
268
 
265
269
  export class TariPermissionTemplatesRead {
266
270
  constructor() {}
267
271
  toJSON() {
268
- return "TemplatesRead"
272
+ return "TemplatesRead";
269
273
  }
270
274
  }
271
275
 
272
- export type TariPermission = TariPermissionNftGetOwnershipProof | TariPermissionAccountBalance | TariPermissionAccountInfo | TariPermissionAccountList | TariPermissionKeyList | TariPermissionTransactionGet | TariPermissionTransactionSend | TariPermissionGetNft | TariPermissionTransactionsGet | TariPermissionSubstatesRead | TariPermissionTemplatesRead | string;
276
+ export type TariPermission =
277
+ | TariPermissionNftGetOwnershipProof
278
+ | TariPermissionAccountBalance
279
+ | TariPermissionAccountInfo
280
+ | TariPermissionAccountList
281
+ | TariPermissionKeyList
282
+ | TariPermissionTransactionGet
283
+ | TariPermissionTransactionSend
284
+ | TariPermissionGetNft
285
+ | TariPermissionTransactionsGet
286
+ | TariPermissionSubstatesRead
287
+ | TariPermissionTemplatesRead
288
+ | string;
273
289
 
274
290
  // export enum TariPermission {
275
291
  // AccountBalance = "AccountBalance",
@@ -289,7 +305,7 @@ export class TariPermissions {
289
305
  private permissions: TariPermission[];
290
306
 
291
307
  constructor() {
292
- this.permissions = []
308
+ this.permissions = [];
293
309
  }
294
310
 
295
311
  addPermission(permission: TariPermission): this {
@@ -307,6 +323,7 @@ export class TariPermissions {
307
323
  }
308
324
  }
309
325
 
310
- // TariPermissionType.prototype.toString = function () {
311
- // return "wtf"
312
- // }
326
+ export type TappletPermissions = {
327
+ requiredPermissions: TariPermission[];
328
+ optionalPermissions: TariPermission[];
329
+ };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-provider",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,35 +1,19 @@
1
- import type { SubstateType } from "@tari-project/typescript-bindings";
1
+ import type { ListTemplatesResponse } from "@tari-project/typescript-bindings";
2
2
  import {
3
- Account,
4
- SubmitTransactionRequest,
5
3
  TransactionResult,
6
- SubmitTransactionResponse,
7
- VaultBalances,
8
4
  TemplateDefinition,
9
5
  Substate,
10
6
  ListSubstatesResponse,
7
+ GetSubstateRequest,
8
+ ListSubstatesRequest,
11
9
  } from "./types";
12
10
 
13
-
14
11
  export interface TariProvider {
15
12
  providerName: string;
16
13
  isConnected(): boolean;
17
- getAccount(): Promise<Account>;
18
- getSubstate(substate_address: string): Promise<Substate>;
19
- submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse>;
14
+ getSubstate(req: GetSubstateRequest): Promise<Substate>;
20
15
  getTransactionResult(transactionId: string): Promise<TransactionResult>;
21
16
  getTemplateDefinition(template_address: string): Promise<TemplateDefinition>;
22
- getPublicKey(branch: string, index: number): Promise<string>;
23
- getConfidentialVaultBalances(
24
- viewKeyId: number,
25
- vaultId: string,
26
- min: number | null,
27
- max: number | null,
28
- ): Promise<VaultBalances>;
29
- listSubstates(
30
- filter_by_template: string | null,
31
- filter_by_type: SubstateType | null,
32
- limit: number | null,
33
- offset: number | null,
34
- ): Promise<ListSubstatesResponse>;
35
- }
17
+ listSubstates(req: ListSubstatesRequest): Promise<ListSubstatesResponse>;
18
+ listTemplates(limit?: number): Promise<ListTemplatesResponse>;
19
+ }
@@ -1,3 +1,2 @@
1
1
  export * from "./types";
2
-
3
- export { TariProvider } from "./TariProvider";
2
+ export { TariProvider } from "./TariProvider";
@@ -1,4 +1,4 @@
1
- import { FinalizeResult } from "@tari-project/typescript-bindings";
1
+ import { FinalizeResult, SubstateType } from "@tari-project/typescript-bindings";
2
2
 
3
3
  export type SubstateMetadata = {
4
4
  substate_id: string;
@@ -12,25 +12,6 @@ export type SubstateRequirement = {
12
12
  version?: number | null;
13
13
  };
14
14
 
15
- export type SubmitTransactionRequest = {
16
- network: number;
17
- account_id: number;
18
- instructions: object[];
19
- fee_instructions: object[];
20
- inputs: object[];
21
- input_refs: object[];
22
- required_substates: SubstateRequirement[];
23
- is_dry_run: boolean;
24
- min_epoch: number | null;
25
- max_epoch: number | null;
26
- is_seal_signer_authorized: boolean;
27
- detect_inputs_use_unversioned: boolean;
28
- };
29
-
30
- export type SubmitTransactionResponse = {
31
- transaction_id: string;
32
- };
33
-
34
15
  export type TransactionResult = {
35
16
  transaction_id: string;
36
17
  status: TransactionStatus;
@@ -58,6 +39,8 @@ export interface VaultData {
58
39
  type: string;
59
40
  balance: number;
60
41
  resource_address: string;
42
+ token_symbol: string;
43
+ vault_id: string;
61
44
  }
62
45
 
63
46
  export interface VaultBalances {
@@ -69,6 +52,41 @@ export interface TemplateDefinition {
69
52
  [key: string]: any;
70
53
  }
71
54
 
55
+ export type SubmitTransactionRequest = {
56
+ network: number;
57
+ account_id: number;
58
+ instructions: object[];
59
+ fee_instructions: object[];
60
+ inputs: object[];
61
+ input_refs: object[];
62
+ required_substates: SubstateRequirement[];
63
+ is_dry_run: boolean;
64
+ min_epoch: number | null;
65
+ max_epoch: number | null;
66
+ is_seal_signer_authorized: boolean;
67
+ detect_inputs_use_unversioned: boolean;
68
+ };
69
+
70
+ export type SubmitTransactionResponse = {
71
+ transaction_id: string;
72
+ };
73
+
74
+ export type ListSubstatesRequest = {
75
+ filter_by_template: string | null;
76
+ filter_by_type: SubstateType | null;
77
+ limit: number | null;
78
+ offset: number | null;
79
+ };
80
+
81
+ export type ListSubstatesResponse = {
82
+ substates: Array<SubstateMetadata>;
83
+ };
84
+
85
+ export type GetSubstateRequest = {
86
+ substate_address: string;
87
+ version: number | null;
88
+ };
89
+
72
90
  export interface Substate {
73
91
  value: any;
74
92
  address: {
@@ -76,7 +94,3 @@ export interface Substate {
76
94
  version: number;
77
95
  };
78
96
  }
79
-
80
- export type ListSubstatesResponse = {
81
- substates: Array<SubstateMetadata>;
82
- };
@@ -0,0 +1,55 @@
1
+ language: "typescript"
2
+ platform: "node"
3
+ type: "library"
4
+
5
+ fileGroups:
6
+ configs:
7
+ - "tsconfig.json"
8
+ - "package.json"
9
+ - "eslint.config.ts"
10
+ sources:
11
+ - "src/**/*"
12
+ tests:
13
+ - "integration-tests/**/*"
14
+
15
+ tasks:
16
+ build:
17
+ command: "pnpm run build"
18
+ inputs:
19
+ - "@files(sources)"
20
+ - "@files(configs)"
21
+ outputs:
22
+ - "dist"
23
+ format:
24
+ command: "pnpm run format"
25
+ inputs:
26
+ - "@files(sources)"
27
+ - "@files(configs)"
28
+ - "@files(tests)"
29
+ options:
30
+ runInCI: false
31
+ lint:
32
+ command: "pnpm run lint:fix"
33
+ inputs:
34
+ - "@files(sources)"
35
+ - "@files(configs)"
36
+ - "@files(tests)"
37
+ options:
38
+ runInCI: false
39
+ deps:
40
+ - "build"
41
+
42
+ lintCheck:
43
+ command: "pnpm run lint"
44
+ inputs:
45
+ - "@files(sources)"
46
+ - "@files(configs)"
47
+ - "@files(tests)"
48
+ deps:
49
+ - "build"
50
+ formatCheck:
51
+ command: "pnpm run format:check"
52
+ inputs:
53
+ - "@files(sources)"
54
+ - "@files(configs)"
55
+ - "@files(tests)"
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@tari-project/tari-signer",
3
+ "version": "0.5.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc -b"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "@tari-project/tarijs-types": "workspace:^",
17
+ "@tari-project/typescript-bindings": "catalog:"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "catalog:",
21
+ "typescript": "catalog:"
22
+ },
23
+ "files": [
24
+ "/dist"
25
+ ],
26
+ "main": "dist/index.js",
27
+ "types": "dist/index.d.ts"
28
+ }
@@ -0,0 +1,35 @@
1
+ import type { ListAccountNftRequest, ListAccountNftResponse, SubstateType } from "@tari-project/typescript-bindings";
2
+ import {
3
+ Account,
4
+ SubmitTransactionRequest,
5
+ TransactionResult,
6
+ SubmitTransactionResponse,
7
+ VaultBalances,
8
+ TemplateDefinition,
9
+ Substate,
10
+ ListSubstatesResponse,
11
+ } from "./types";
12
+
13
+ export interface TariSigner {
14
+ signerName: string;
15
+ isConnected(): boolean;
16
+ getAccount(): Promise<Account>;
17
+ getSubstate(substate_address: string): Promise<Substate>;
18
+ submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse>;
19
+ getTransactionResult(transactionId: string): Promise<TransactionResult>;
20
+ getTemplateDefinition(template_address: string): Promise<TemplateDefinition>;
21
+ getPublicKey(branch: string, index: number): Promise<string>;
22
+ getConfidentialVaultBalances(
23
+ viewKeyId: number,
24
+ vaultId: string,
25
+ min: number | null,
26
+ max: number | null,
27
+ ): Promise<VaultBalances>;
28
+ listSubstates(
29
+ filter_by_template: string | null,
30
+ filter_by_type: SubstateType | null,
31
+ limit: number | null,
32
+ offset: number | null,
33
+ ): Promise<ListSubstatesResponse>;
34
+ getNftsList(req: ListAccountNftRequest): Promise<ListAccountNftResponse>;
35
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export { TariSigner } from "./TariSigner";
@@ -0,0 +1,84 @@
1
+ import { FinalizeResult } from "@tari-project/typescript-bindings";
2
+
3
+ export type SubstateMetadata = {
4
+ substate_id: string;
5
+ module_name: string | null;
6
+ version: number;
7
+ template_address: string | null;
8
+ };
9
+
10
+ export type SubstateRequirement = {
11
+ substate_id: string;
12
+ version?: number | null;
13
+ };
14
+
15
+ export type SubmitTransactionRequest = {
16
+ network: number;
17
+ account_id: number;
18
+ instructions: object[];
19
+ fee_instructions: object[];
20
+ inputs: object[];
21
+ input_refs: object[];
22
+ required_substates: SubstateRequirement[];
23
+ is_dry_run: boolean;
24
+ min_epoch: number | null;
25
+ max_epoch: number | null;
26
+ is_seal_signer_authorized: boolean;
27
+ detect_inputs_use_unversioned: boolean;
28
+ };
29
+
30
+ export type SubmitTransactionResponse = {
31
+ transaction_id: string;
32
+ };
33
+
34
+ export type TransactionResult = {
35
+ transaction_id: string;
36
+ status: TransactionStatus;
37
+ result: FinalizeResult | null;
38
+ };
39
+
40
+ export enum TransactionStatus {
41
+ New,
42
+ DryRun,
43
+ Pending,
44
+ Accepted,
45
+ Rejected,
46
+ InvalidTransaction,
47
+ OnlyFeeAccepted,
48
+ }
49
+
50
+ export interface Account {
51
+ account_id: number;
52
+ address: string;
53
+ public_key: string;
54
+ resources: VaultData[];
55
+ }
56
+
57
+ export interface VaultData {
58
+ type: string;
59
+ balance: number;
60
+ resource_address: string;
61
+ token_symbol: string;
62
+ vault_id: string;
63
+ }
64
+
65
+ export interface VaultBalances {
66
+ balances: Map<string, number | null>;
67
+ }
68
+
69
+ export interface TemplateDefinition {
70
+ // TODO: Define this type
71
+ [key: string]: any;
72
+ }
73
+
74
+ export interface Substate {
75
+ value: any;
76
+ address: {
77
+ substate_id: string;
78
+ version: number;
79
+ };
80
+ }
81
+
82
+ export type ListSubstatesResponse = {
83
+ substates: Array<SubstateMetadata>;
84
+ };
@@ -11,9 +11,6 @@
11
11
  "src/**/*"
12
12
  ],
13
13
  "references": [
14
- {
15
- "path": "../tari_provider"
16
- },
17
14
  {
18
15
  "path": "../tarijs_types"
19
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "@tari-project/tari-universe-provider",
3
- "version": "0.4.0",
2
+ "name": "@tari-project/tari-universe-signer",
3
+ "version": "0.5.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -14,7 +14,7 @@
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
16
  "@tari-project/tari-permissions": "workspace:^",
17
- "@tari-project/tari-provider": "workspace:^",
17
+ "@tari-project/tari-signer": "workspace:^",
18
18
  "@tari-project/tarijs-types": "workspace:^",
19
19
  "@tari-project/typescript-bindings": "catalog:",
20
20
  "@tari-project/wallet_jrpc_client": "catalog:"
@@ -1,3 +1,3 @@
1
1
  export * from "@tari-project/tari-permissions";
2
- export * from "./provider";
2
+ export * from "./signer";
3
3
  export * from "./types";