@tari-project/tarijs 0.4.0 → 0.4.2

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 (167) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +27 -0
  3. package/.github/dependabot.yml +8 -0
  4. package/.github/workflows/ci.yml +26 -0
  5. package/.github/workflows/documentation-deploy.yml +44 -0
  6. package/.github/workflows/documentation-test-deploy.yml +20 -0
  7. package/.github/workflows/npm_publish.yml +26 -0
  8. package/.github/workflows/pr_signed_commits_check.yml +19 -0
  9. package/.github/workflows/pr_title.yml +30 -0
  10. package/.moon/toolchain.yml +6 -0
  11. package/.moon/workspace.yml +33 -0
  12. package/.prettierrc +12 -0
  13. package/.prototools +9 -0
  14. package/CODEOWNERS +3 -0
  15. package/README.md +66 -0
  16. package/TODO.md +12 -0
  17. package/docusaurus/tari-docs/README.md +41 -0
  18. package/docusaurus/tari-docs/docs/index.md +16 -0
  19. package/docusaurus/tari-docs/docs/installation.md +27 -0
  20. package/docusaurus/tari-docs/docs/providers/_category_.json +8 -0
  21. package/docusaurus/tari-docs/docs/providers/tari-universe.md +27 -0
  22. package/docusaurus/tari-docs/docs/providers/wallet-connect.md +52 -0
  23. package/docusaurus/tari-docs/docs/providers/wallet-daemon.md +37 -0
  24. package/docusaurus/tari-docs/docs/wallet/_category_.json +8 -0
  25. package/docusaurus/tari-docs/docs/wallet/default-account.md +51 -0
  26. package/docusaurus/tari-docs/docs/wallet/get-substate.md +110 -0
  27. package/docusaurus/tari-docs/docs/wallet/list-substates.md +69 -0
  28. package/docusaurus/tari-docs/docs/wallet/submit-transaction/_category_.json +8 -0
  29. package/docusaurus/tari-docs/docs/wallet/submit-transaction/build-execute-request.md +38 -0
  30. package/docusaurus/tari-docs/docs/wallet/submit-transaction/index.md +14 -0
  31. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/_category_.json +8 -0
  32. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/call-function.md +17 -0
  33. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/call-method.md +17 -0
  34. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/fee.md +28 -0
  35. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/index.md +426 -0
  36. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/inputs.md +24 -0
  37. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/instruction.md +108 -0
  38. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/min-max-epoch.md +19 -0
  39. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/raw-instructions.md +16 -0
  40. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/save-var.md +63 -0
  41. package/docusaurus/tari-docs/docs/wallet/submit-transaction/transaction-builder/transaction-internals.md +20 -0
  42. package/docusaurus/tari-docs/docs/wallet/template-definition.md +101 -0
  43. package/docusaurus/tari-docs/docusaurus.config.ts +108 -0
  44. package/docusaurus/tari-docs/moon.yml +41 -0
  45. package/docusaurus/tari-docs/package.json +49 -0
  46. package/docusaurus/tari-docs/sidebars.ts +7 -0
  47. package/docusaurus/tari-docs/src/components/HomepageFeatures/index.tsx +69 -0
  48. package/docusaurus/tari-docs/src/components/HomepageFeatures/styles.module.css +11 -0
  49. package/docusaurus/tari-docs/src/css/custom.css +30 -0
  50. package/docusaurus/tari-docs/src/pages/index.module.css +23 -0
  51. package/docusaurus/tari-docs/src/pages/index.tsx +44 -0
  52. package/docusaurus/tari-docs/static/.nojekyll +0 -0
  53. package/docusaurus/tari-docs/static/img/favicon.png +0 -0
  54. package/docusaurus/tari-docs/static/img/meta-image.png +0 -0
  55. package/docusaurus/tari-docs/static/img/tari/wallet-connect-1.png +0 -0
  56. package/docusaurus/tari-docs/static/img/tari/wallet-connect-2.png +0 -0
  57. package/docusaurus/tari-docs/static/img/tari/wallet-connect-3.png +0 -0
  58. package/docusaurus/tari-docs/static/img/tari-logo.svg +30 -0
  59. package/docusaurus/tari-docs/tsconfig.json +8 -0
  60. package/package.json +4 -28
  61. package/packages/builders/moon.yml +55 -0
  62. package/packages/builders/package.json +30 -0
  63. package/packages/builders/src/helpers/index.ts +2 -0
  64. package/packages/builders/src/helpers/submitTransaction.ts +97 -0
  65. package/packages/builders/src/helpers/workspace.ts +32 -0
  66. package/packages/builders/src/index.ts +9 -0
  67. package/packages/builders/src/transaction/TransactionBuilder.ts +276 -0
  68. package/packages/builders/src/transaction/TransactionRequest.ts +93 -0
  69. package/packages/builders/src/transaction/index.ts +2 -0
  70. package/packages/builders/tsconfig.json +24 -0
  71. package/packages/metamask_provider/moon.yml +55 -0
  72. package/packages/metamask_provider/package.json +30 -0
  73. package/packages/metamask_provider/src/index.ts +232 -0
  74. package/packages/metamask_provider/src/utils.ts +86 -0
  75. package/packages/metamask_provider/tsconfig.json +21 -0
  76. package/packages/tari_permissions/moon.yml +55 -0
  77. package/packages/tari_permissions/package.json +26 -0
  78. package/packages/tari_permissions/src/index.ts +1 -0
  79. package/packages/tari_permissions/src/tari_permissions.ts +312 -0
  80. package/packages/tari_permissions/tsconfig.json +15 -0
  81. package/packages/tari_provider/moon.yml +55 -0
  82. package/packages/tari_provider/package.json +27 -0
  83. package/packages/tari_provider/src/TariProvider.ts +34 -0
  84. package/packages/tari_provider/src/index.ts +3 -0
  85. package/packages/tari_provider/src/types.ts +84 -0
  86. package/packages/tari_provider/tsconfig.json +11 -0
  87. package/packages/tari_universe/moon.yml +55 -0
  88. package/packages/tari_universe/package.json +31 -0
  89. package/packages/tari_universe/src/index.ts +3 -0
  90. package/packages/tari_universe/src/provider.ts +120 -0
  91. package/packages/tari_universe/src/types.ts +33 -0
  92. package/packages/tari_universe/src/utils.ts +23 -0
  93. package/packages/tari_universe/tsconfig.json +24 -0
  94. package/packages/tarijs/integration-tests/.env +1 -0
  95. package/packages/tarijs/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +191 -0
  96. package/packages/tarijs/moon.yml +71 -0
  97. package/packages/tarijs/package.json +40 -0
  98. package/packages/tarijs/src/cbor.spec.ts +259 -0
  99. package/packages/tarijs/src/cbor.ts +114 -0
  100. package/packages/tarijs/src/index.ts +72 -0
  101. package/packages/tarijs/src/network.ts +8 -0
  102. package/packages/tarijs/src/templates/Account.ts +98 -0
  103. package/packages/tarijs/src/templates/Pool.ts +42 -0
  104. package/packages/tarijs/src/templates/Tariswap.ts +101 -0
  105. package/packages/tarijs/src/templates/TemplateFactory.ts +22 -0
  106. package/packages/tarijs/src/templates/TestFaucet.ts +72 -0
  107. package/{dist/utils.js → packages/tarijs/src/utils.ts} +4 -3
  108. package/packages/tarijs/tsconfig.json +39 -0
  109. package/packages/tarijs/vitest.config.ts +9 -0
  110. package/packages/tarijs_types/moon.yml +55 -0
  111. package/packages/tarijs_types/package.json +27 -0
  112. package/packages/tarijs_types/src/Amount.ts +113 -0
  113. package/packages/tarijs_types/src/Arg.ts +3 -0
  114. package/packages/tarijs_types/src/ComponentAddress.ts +3 -0
  115. package/packages/tarijs_types/src/ConfidentialClaim.ts +9 -0
  116. package/packages/tarijs_types/src/ConfidentialOutput.ts +9 -0
  117. package/packages/tarijs_types/src/ConfidentialOutputStatement.ts +10 -0
  118. package/packages/tarijs_types/src/ConfidentialStatement.ts +9 -0
  119. package/packages/tarijs_types/src/ConfidentialWithdrawProof.ts +8 -0
  120. package/packages/tarijs_types/src/ElgamalVerifiableBalance.ts +4 -0
  121. package/packages/tarijs_types/src/Epoch.ts +3 -0
  122. package/packages/tarijs_types/src/FinalizeResult.ts +17 -0
  123. package/packages/tarijs_types/src/Instruction.ts +29 -0
  124. package/packages/tarijs_types/src/ResourceAddress.ts +3 -0
  125. package/packages/tarijs_types/src/SubstateDiff.ts +9 -0
  126. package/packages/tarijs_types/src/SubstateRequirement.ts +6 -0
  127. package/packages/tarijs_types/src/TemplateAddress.ts +3 -0
  128. package/packages/tarijs_types/src/Transaction.ts +16 -0
  129. package/packages/tarijs_types/src/TransactionId.ts +4 -0
  130. package/packages/tarijs_types/src/TransactionResult.ts +26 -0
  131. package/packages/tarijs_types/src/TransactionSignature.ts +4 -0
  132. package/packages/tarijs_types/src/UnsignedTransaction.ts +15 -0
  133. package/packages/tarijs_types/src/VersionedSubstateId.ts +6 -0
  134. package/packages/tarijs_types/src/ViewableBalanceProof.ts +12 -0
  135. package/packages/tarijs_types/src/Workspace.ts +3 -0
  136. package/packages/tarijs_types/src/index.ts +25 -0
  137. package/packages/tarijs_types/tsconfig.json +15 -0
  138. package/packages/wallet_daemon/moon.yml +55 -0
  139. package/packages/wallet_daemon/package.json +29 -0
  140. package/packages/wallet_daemon/src/index.ts +5 -0
  141. package/packages/wallet_daemon/src/provider.ts +263 -0
  142. package/packages/wallet_daemon/src/webrtc.ts +229 -0
  143. package/packages/wallet_daemon/src/webrtc_transport.ts +27 -0
  144. package/packages/wallet_daemon/tsconfig.json +21 -0
  145. package/packages/walletconnect/moon.yml +55 -0
  146. package/packages/walletconnect/package.json +32 -0
  147. package/packages/walletconnect/src/index.ts +274 -0
  148. package/packages/walletconnect/tsconfig.json +21 -0
  149. package/pnpm-workspace.yaml +15 -0
  150. package/tsconfig.json +45 -0
  151. package/dist/index.d.ts +0 -14
  152. package/dist/index.js +0 -13
  153. package/dist/network.d.ts +0 -8
  154. package/dist/network.js +0 -9
  155. package/dist/templates/Account.d.ts +0 -65
  156. package/dist/templates/Account.js +0 -31
  157. package/dist/templates/Pool.d.ts +0 -29
  158. package/dist/templates/Pool.js +0 -20
  159. package/dist/templates/Tariswap.d.ts +0 -64
  160. package/dist/templates/Tariswap.js +0 -36
  161. package/dist/templates/TemplateFactory.d.ts +0 -9
  162. package/dist/templates/TemplateFactory.js +0 -18
  163. package/dist/templates/TestFaucet.d.ts +0 -49
  164. package/dist/templates/TestFaucet.js +0 -31
  165. package/dist/templates/index.js +0 -5
  166. package/dist/utils.d.ts +0 -2
  167. /package/{dist/templates/index.d.ts → packages/tarijs/src/templates/index.ts} +0 -0
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@tari-project/wallet-connect-provider",
3
+ "version": "0.4.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/tari-provider": "workspace:^",
17
+ "@tari-project/tarijs-builders": "workspace:^",
18
+ "@tari-project/typescript-bindings": "catalog:",
19
+ "@tari-project/wallet_jrpc_client": "catalog:",
20
+ "@walletconnect/modal": "catalog:",
21
+ "@walletconnect/universal-provider": "catalog:"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "catalog:",
25
+ "typescript": "catalog:"
26
+ },
27
+ "files": [
28
+ "/dist"
29
+ ],
30
+ "main": "dist/index.js",
31
+ "types": "dist/index.d.ts"
32
+ }
@@ -0,0 +1,274 @@
1
+ import {
2
+ TariProvider, SubmitTransactionRequest,
3
+ TransactionResult,
4
+ SubmitTransactionResponse,
5
+ VaultBalances, TemplateDefinition, Substate,
6
+ Account,
7
+ ListSubstatesResponse,
8
+ } from "@tari-project/tari-provider";
9
+ import {
10
+ TransactionStatus,
11
+ } from "@tari-project/tarijs-builders";
12
+ import UniversalProvider from "@walletconnect/universal-provider";
13
+ import { WalletConnectModal } from "@walletconnect/modal";
14
+ import {
15
+ Instruction,
16
+ KeyBranch,
17
+ stringToSubstateId,
18
+ substateIdToString,
19
+ SubstateType,
20
+ TransactionSubmitRequest,
21
+ } from "@tari-project/wallet_jrpc_client";
22
+
23
+ const walletConnectParams = {
24
+ requiredNamespaces: {
25
+ tari: {
26
+ methods: [
27
+ "tari_getSubstate",
28
+ "tari_getDefaultAccount",
29
+ "tari_getAccountBalances",
30
+ "tari_submitTransaction",
31
+ "tari_getTransactionResult",
32
+ "tari_getTemplate",
33
+ "tari_createKey",
34
+ "tari_viewConfidentialVaultBalance",
35
+ "tari_createFreeTestCoins",
36
+ "tari_listSubstates",
37
+ ],
38
+ chains: [
39
+ "tari:devnet",
40
+ ],
41
+ events: ["chainChanged\", \"accountsChanged"],
42
+ },
43
+ },
44
+ };
45
+
46
+ export class WalletConnectTariProvider implements TariProvider {
47
+ public providerName = "WalletConnect";
48
+ projectId: string;
49
+ wcProvider: UniversalProvider | null;
50
+ wcSession: any | null;
51
+
52
+ constructor(projectId: string) {
53
+ this.projectId = projectId;
54
+ this.wcProvider = null;
55
+ this.wcSession = null;
56
+ }
57
+
58
+ async connect(): Promise<void> {
59
+ if (this.wcProvider && this.wcSession)
60
+ return;
61
+
62
+ // initialize WalletConnect
63
+ const projectId = this.projectId;
64
+ this.wcProvider = await UniversalProvider.init({
65
+ projectId,
66
+ // TODO: parameterize the relay URL
67
+ relayUrl: "wss://relay.walletconnect.com",
68
+ });
69
+
70
+ // open UI modal with the connection URI
71
+ const { uri, approval } = await this.wcProvider.client.connect(walletConnectParams);
72
+ const walletConnectModal = new WalletConnectModal({
73
+ projectId,
74
+ });
75
+ if (uri) {
76
+ walletConnectModal.openModal({ uri });
77
+ }
78
+
79
+ // wait for the wallet to approve the connection
80
+ console.log("waiting for session approval from the wallet app");
81
+ const session = await approval();
82
+ walletConnectModal.closeModal();
83
+
84
+ // at this point session is open
85
+ console.log("session approved by the wallet");
86
+ this.wcSession = session;
87
+ }
88
+
89
+ private async sendRequest(method: string, params: object): Promise<any> {
90
+ if (!this.wcProvider) {
91
+ throw "WalletConnect provider not initialized";
92
+ }
93
+
94
+ if (!this.wcSession) {
95
+ throw "WalletConnect session not initialized";
96
+ }
97
+
98
+ const requestResult = await this.wcProvider.client.request({
99
+ topic: this.wcSession.topic,
100
+ chainId: "tari:devnet",
101
+ request: {
102
+ method,
103
+ params,
104
+ },
105
+ });
106
+
107
+ console.log({ requestResult });
108
+
109
+ return requestResult;
110
+ }
111
+
112
+
113
+ isConnected(): boolean {
114
+ // TODO: check status in the session
115
+ return this.wcSession !== null;
116
+ }
117
+
118
+ async getAccount(): Promise<Account> {
119
+ const { account, public_key } = await this.sendRequest("tari_getDefaultAccount", {});
120
+ const { balances } = await this.sendRequest(
121
+ "tari_getAccountBalances",
122
+ {
123
+ account: { ComponentAddress: account.address }, refresh: false,
124
+ });
125
+
126
+ return {
127
+ account_id: account.key_index,
128
+ address: account.address,
129
+ public_key,
130
+ // TODO: should be vaults not resources
131
+ resources: balances.map((b: any) => ({
132
+ type: b.resource_type,
133
+ resource_address: b.resource_address,
134
+ balance: b.balance + b.confidential_balance,
135
+ vault_id: (typeof (b.vault_address) === "object" && "Vault" in b.vault_address) ? b.vault_address.Vault : b.vault_address,
136
+ token_symbol: b.token_symbol,
137
+ })),
138
+ };
139
+ }
140
+
141
+ async getSubstate(substate_address: string): Promise<Substate> {
142
+ const method = "tari_getSubstate";
143
+ const params = { substate_id: substate_address };
144
+ const { value, record } = await this.sendRequest(method, params);
145
+ return {
146
+ value,
147
+ address: {
148
+ substate_id: record.substate_id,
149
+ version: record.version,
150
+ },
151
+ };
152
+ }
153
+
154
+ public async listSubstates(filter_by_template: string | null, filter_by_type: SubstateType | null, limit: number | null, offset: number | null): Promise<ListSubstatesResponse> {
155
+ const method = "tari_listSubstates";
156
+ const params = {
157
+ filter_by_template,
158
+ filter_by_type,
159
+ limit,
160
+ offset,
161
+ };
162
+ const res = await this.sendRequest(method, params);
163
+ const substates = res.substates.map((s: any) => ({
164
+ substate_id: substateIdToString(s.substate_id),
165
+ module_name: s.module_name,
166
+ version: s.version,
167
+ template_address: s.template_address,
168
+ }));
169
+
170
+ return { substates };
171
+ }
172
+
173
+ public async createFreeTestCoins(): Promise<Account> {
174
+ const method = "tari_createFreeTestCoins";
175
+ const params = {
176
+ account: { Name: "template_web" },
177
+ amount: 1000000,
178
+ max_fee: null,
179
+ key_id: 0,
180
+ };
181
+ const res = await this.sendRequest(method, params);
182
+ return {
183
+ account_id: res.account.key_index,
184
+ address: (res.account.address as { Component: string }).Component,
185
+ public_key: res.public_key,
186
+ resources: [],
187
+ };
188
+ }
189
+
190
+ async submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse> {
191
+ const method = "tari_submitTransaction";
192
+ const params: TransactionSubmitRequest = {
193
+ transaction: {
194
+ V1: {
195
+ network: req.network,
196
+ fee_instructions: req.fee_instructions as Instruction[],
197
+ instructions: req.instructions as Instruction[],
198
+ inputs: req.required_substates.map((s) => ({
199
+ // TODO: Hmm The bindings want a SubstateId object, but the wallet only wants a string. Any is used to skip type checking here
200
+ substate_id: s.substate_id as any,
201
+ version: s.version ?? null,
202
+ })),
203
+ min_epoch: null,
204
+ max_epoch: null,
205
+ is_seal_signer_authorized: req.is_seal_signer_authorized,
206
+ },
207
+ },
208
+ signing_key_index: req.account_id,
209
+ autofill_inputs: [],
210
+ detect_inputs: true,
211
+ proof_ids: [],
212
+ detect_inputs_use_unversioned: req.detect_inputs_use_unversioned,
213
+ };
214
+
215
+ const res = await this.sendRequest(method, params);
216
+
217
+ return { transaction_id: res.transaction_id };
218
+ }
219
+
220
+ async getTransactionResult(transactionId: string): Promise<TransactionResult> {
221
+ const res = await this.sendRequest("tari_getTransactionResult", { transaction_id: transactionId });
222
+
223
+ return {
224
+ transaction_id: transactionId,
225
+ status: convertStringToTransactionStatus(res.status),
226
+ result: res.result,
227
+ };
228
+ }
229
+
230
+ async getTemplateDefinition(template_address: string): Promise<TemplateDefinition> {
231
+ let resp = await this.sendRequest("tari_getTemplate", { template_address });
232
+ return resp.template_definition as TemplateDefinition;
233
+ }
234
+
235
+ async getPublicKey(branch: string, index: number): Promise<string> {
236
+ const res = await this.sendRequest("tari_createKey", { branch: branch as KeyBranch, specific_index: index });
237
+ return res.public_key;
238
+ }
239
+
240
+ async getConfidentialVaultBalances(viewKeyId: number, vaultId: string, min: number | null, max: number | null): Promise<VaultBalances> {
241
+ const method = "tari_viewConfidentialVaultBalance";
242
+ const params = {
243
+ view_key_id: viewKeyId,
244
+ vault_id: vaultId,
245
+ minimum_expected_value: min,
246
+ maximum_expected_value: max,
247
+ };
248
+
249
+ const res = await this.sendRequest(method, params);
250
+ return { balances: res.balances as unknown as Map<string, number | null> };
251
+ }
252
+
253
+ }
254
+
255
+ function convertStringToTransactionStatus(status: string): TransactionStatus {
256
+ switch (status) {
257
+ case "New":
258
+ return TransactionStatus.New;
259
+ case "DryRun":
260
+ return TransactionStatus.DryRun;
261
+ case "Pending":
262
+ return TransactionStatus.Pending;
263
+ case "Accepted":
264
+ return TransactionStatus.Accepted;
265
+ case "Rejected":
266
+ return TransactionStatus.Rejected;
267
+ case "InvalidTransaction":
268
+ return TransactionStatus.InvalidTransaction;
269
+ case "OnlyFeeAccepted":
270
+ return TransactionStatus.OnlyFeeAccepted;
271
+ default:
272
+ throw new Error(`Unknown status: ${status}`);
273
+ }
274
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "ES2020",
5
+ "target": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "outDir": "./dist",
8
+ "rootDir": "./src"
9
+ },
10
+ "include": [
11
+ "src/**/*"
12
+ ],
13
+ "references": [
14
+ {
15
+ "path": "../builders"
16
+ },
17
+ {
18
+ "path": "../tari_provider"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,15 @@
1
+ packages:
2
+ - packages/*
3
+ - apps/*
4
+ - docusaurus/*
5
+ - "!**/test/**"
6
+ catalog:
7
+ typescript: ^5.0.4
8
+ vitest: ^3.0.4
9
+ vite: ^6.1.0
10
+ "@types/node": ^22.13.1
11
+ "@tari-project/typescript-bindings": ^1.4.0
12
+ "@tari-project/wallet_jrpc_client": ^1.4.0
13
+ "@metamask/providers": ^18.2.0
14
+ "@walletconnect/universal-provider": ^2.13.3
15
+ "@walletconnect/modal": ^2.6.2
package/tsconfig.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "strictPropertyInitialization": false,
5
+ "allowSyntheticDefaultImports": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "composite": true
9
+ },
10
+ "references": [
11
+ {
12
+ "path": "docusaurus/tari-docs"
13
+ },
14
+ {
15
+ "path": "packages/builders"
16
+ },
17
+ {
18
+ "path": "packages/metamask_provider"
19
+ },
20
+ {
21
+ "path": "packages/tari_permissions"
22
+ },
23
+ {
24
+ "path": "packages/tari_provider"
25
+ },
26
+ {
27
+ "path": "packages/tari_universe"
28
+ },
29
+ {
30
+ "path": "packages/tarijs"
31
+ },
32
+ {
33
+ "path": "packages/tarijs_types"
34
+ },
35
+ {
36
+ "path": "packages/types"
37
+ },
38
+ {
39
+ "path": "packages/wallet_daemon"
40
+ },
41
+ {
42
+ "path": "packages/walletconnect"
43
+ }
44
+ ]
45
+ }
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { TariProvider } from "@tari-project/tari-provider";
2
- import * as utils from "./utils";
3
- import { Network } from "./network";
4
- import { Account, TransactionStatus, TransactionResult, SubmitTransactionResponse, SubmitTransactionRequest, VaultBalances, VaultData, TemplateDefinition, SubstateRequirement, Substate } from "@tari-project/tari-provider";
5
- import { MetamaskTariProvider } from "@tari-project/metamask-provider";
6
- import { MetaMaskInpageProvider } from "@metamask/providers";
7
- import { WalletDaemonTariProvider, WalletDaemonParameters, TariPermissions } from "@tari-project/wallet-daemon-provider";
8
- import { TariUniverseProvider, TariUniverseProviderParameters } from "@tari-project/tari-universe-provider";
9
- import * as permissions from "@tari-project/tari-permissions";
10
- import { WalletConnectTariProvider } from "@tari-project/wallet-connect-provider";
11
- import { TransactionBuilder, TransactionRequest, buildTransactionRequest, submitAndWaitForTransaction, waitForTransactionResult, fromWorkspace, toWorkspace } from "@tari-project/tarijs-builders";
12
- import * as templates from "./templates";
13
- export * from "@tari-project/tarijs-types";
14
- export { utils, Network, TariProvider, Account, TransactionStatus, TransactionResult, SubmitTransactionResponse, SubmitTransactionRequest, VaultBalances, VaultData, TemplateDefinition, SubstateRequirement, MetamaskTariProvider, WalletDaemonTariProvider, WalletDaemonParameters, TariUniverseProvider, TariUniverseProviderParameters, TariPermissions, MetaMaskInpageProvider, Substate, permissions, WalletConnectTariProvider, TransactionBuilder, TransactionRequest, buildTransactionRequest, submitAndWaitForTransaction, waitForTransactionResult, fromWorkspace, toWorkspace, templates, };
package/dist/index.js DELETED
@@ -1,13 +0,0 @@
1
- import * as utils from "./utils";
2
- import { Network } from "./network";
3
- import { TransactionStatus, } from "@tari-project/tari-provider";
4
- import { MetamaskTariProvider } from "@tari-project/metamask-provider";
5
- import { MetaMaskInpageProvider } from "@metamask/providers";
6
- import { WalletDaemonTariProvider, TariPermissions, } from "@tari-project/wallet-daemon-provider";
7
- import { TariUniverseProvider } from "@tari-project/tari-universe-provider";
8
- import * as permissions from "@tari-project/tari-permissions";
9
- import { WalletConnectTariProvider } from "@tari-project/wallet-connect-provider";
10
- import { TransactionBuilder, TransactionRequest, buildTransactionRequest, submitAndWaitForTransaction, waitForTransactionResult, fromWorkspace, toWorkspace, } from "@tari-project/tarijs-builders";
11
- import * as templates from "./templates";
12
- export * from "@tari-project/tarijs-types";
13
- export { utils, Network, TransactionStatus, MetamaskTariProvider, WalletDaemonTariProvider, TariUniverseProvider, TariPermissions, MetaMaskInpageProvider, permissions, WalletConnectTariProvider, TransactionBuilder, TransactionRequest, buildTransactionRequest, submitAndWaitForTransaction, waitForTransactionResult, fromWorkspace, toWorkspace, templates, };
package/dist/network.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare enum Network {
2
- MainNet = 0,
3
- StageNet = 1,
4
- NextNet = 2,
5
- LocalNet = 16,
6
- Igor = 36,
7
- Esmeralda = 38
8
- }
package/dist/network.js DELETED
@@ -1,9 +0,0 @@
1
- export var Network;
2
- (function (Network) {
3
- Network[Network["MainNet"] = 0] = "MainNet";
4
- Network[Network["StageNet"] = 1] = "StageNet";
5
- Network[Network["NextNet"] = 2] = "NextNet";
6
- Network[Network["LocalNet"] = 16] = "LocalNet";
7
- Network[Network["Igor"] = 36] = "Igor";
8
- Network[Network["Esmeralda"] = 38] = "Esmeralda";
9
- })(Network || (Network = {}));
@@ -1,65 +0,0 @@
1
- import { ConfidentialWithdrawProof, NonFungibleId, ResourceAddress } from "@tari-project/typescript-bindings";
2
- import { Amount } from "@tari-project/tarijs-types";
3
- import { TariMethodDefinition, WorkspaceArg } from "@tari-project/tarijs-builders";
4
- import { TemplateFactory } from "./TemplateFactory";
5
- /**
6
- * Adds a fee instruction that calls the "take_fee" method on a component.
7
- * This method must exist and return a Bucket with containing revealed confidential XTR resource.
8
- * This allows the fee to originate from sources other than the transaction sender's account.
9
- * The fee instruction will lock up the "max_fee" amount for the duration of the transaction.
10
- * @param componentAddress
11
- * @param maxFee
12
- * @returns
13
- */
14
- interface PayFeeMethod extends TariMethodDefinition {
15
- methodName: "pay_fee";
16
- args?: [Amount];
17
- }
18
- interface PayFeeConfidentialMethod extends TariMethodDefinition {
19
- methodName: "pay_fee_confidential";
20
- args?: [ConfidentialWithdrawProof];
21
- }
22
- interface WithdrawMethod extends TariMethodDefinition {
23
- methodName: "withdraw";
24
- args?: [string, Amount];
25
- }
26
- interface DepositMethod extends TariMethodDefinition {
27
- methodName: "deposit";
28
- args?: WorkspaceArg[];
29
- }
30
- interface CreateProofForResourceMethod extends TariMethodDefinition {
31
- methodName: "create_proof_for_resource";
32
- args?: [ResourceAddress];
33
- }
34
- interface CreateProofByAmountMethod extends TariMethodDefinition {
35
- methodName: "create_proof_by_amount";
36
- args?: [ResourceAddress, Amount];
37
- }
38
- interface CreateProofByNonFungibleIdsMethod extends TariMethodDefinition {
39
- methodName: "create_proof_by_non_fungible_ids";
40
- args?: [ResourceAddress, NonFungibleId[]];
41
- }
42
- interface BalanceMethod extends TariMethodDefinition {
43
- methodName: "balance";
44
- args?: [ResourceAddress];
45
- }
46
- interface GetBalancesMethod extends TariMethodDefinition {
47
- methodName: "get_balances";
48
- args?: [];
49
- }
50
- export declare class AccountTemplate extends TemplateFactory {
51
- templateAddress: string;
52
- deposit: DepositMethod;
53
- withdraw: WithdrawMethod;
54
- createProofByAmount: CreateProofByAmountMethod;
55
- createProofByNonFungibleIds: CreateProofByNonFungibleIdsMethod;
56
- createProofForResource: CreateProofForResourceMethod;
57
- balance: BalanceMethod;
58
- getBalances: GetBalancesMethod;
59
- payFee: PayFeeMethod;
60
- payFeeConfidential: PayFeeConfidentialMethod;
61
- constructor(templateAddress: string);
62
- protected _initFunctions(): void;
63
- protected _initMethods(): void;
64
- }
65
- export {};
@@ -1,31 +0,0 @@
1
- import { TemplateFactory } from "./TemplateFactory";
2
- export class AccountTemplate extends TemplateFactory {
3
- templateAddress;
4
- deposit;
5
- withdraw;
6
- createProofByAmount;
7
- createProofByNonFungibleIds;
8
- createProofForResource;
9
- balance;
10
- getBalances;
11
- payFee;
12
- payFeeConfidential;
13
- constructor(templateAddress) {
14
- super(templateAddress);
15
- this.templateAddress = templateAddress;
16
- this._initFunctions();
17
- this._initMethods();
18
- }
19
- _initFunctions() { }
20
- _initMethods() {
21
- this.deposit = this._defineMethod("deposit");
22
- this.withdraw = this._defineMethod("withdraw");
23
- this.createProofByAmount = this._defineMethod("create_proof_by_amount");
24
- this.createProofByNonFungibleIds = this._defineMethod("create_proof_by_non_fungible_ids");
25
- this.createProofForResource = this._defineMethod("create_proof_for_resource");
26
- this.balance = this._defineMethod("balance");
27
- this.getBalances = this._defineMethod("get_balances");
28
- this.payFee = this._defineMethod("pay_fee");
29
- this.payFeeConfidential = this._defineMethod("pay_fee_confidential");
30
- }
31
- }
@@ -1,29 +0,0 @@
1
- import { TariMethodDefinition, WorkspaceArg } from "@tari-project/tarijs-builders";
2
- import { TemplateFactory } from "./TemplateFactory";
3
- interface CreatePool extends TariMethodDefinition {
4
- methodName: "create_pool";
5
- args?: [string, string];
6
- }
7
- interface AddLiquidityMethod extends TariMethodDefinition {
8
- methodName: "add_liquidity";
9
- args?: WorkspaceArg[];
10
- }
11
- interface RemoveLiquidityMethod extends TariMethodDefinition {
12
- methodName: "remove_liquidity";
13
- args?: WorkspaceArg[];
14
- }
15
- interface SwapMethod extends TariMethodDefinition {
16
- methodName: "swap";
17
- args?: (WorkspaceArg | string)[];
18
- }
19
- export declare class PoolTemplate extends TemplateFactory {
20
- templateAddress: string;
21
- createPool: CreatePool;
22
- addLiquidity: AddLiquidityMethod;
23
- removeLiquidity: RemoveLiquidityMethod;
24
- swap: SwapMethod;
25
- constructor(templateAddress: string);
26
- protected _initFunctions(): void;
27
- protected _initMethods(): void;
28
- }
29
- export {};
@@ -1,20 +0,0 @@
1
- import { TemplateFactory } from "./TemplateFactory";
2
- export class PoolTemplate extends TemplateFactory {
3
- templateAddress;
4
- createPool;
5
- addLiquidity;
6
- removeLiquidity;
7
- swap;
8
- constructor(templateAddress) {
9
- super(templateAddress);
10
- this.templateAddress = templateAddress;
11
- this._initFunctions();
12
- this._initMethods();
13
- }
14
- _initFunctions() { }
15
- _initMethods() {
16
- this.addLiquidity = this._defineMethod("add_liquidity");
17
- this.removeLiquidity = this._defineMethod("remove_liquidity");
18
- this.swap = this._defineMethod("swap");
19
- }
20
- }
@@ -1,64 +0,0 @@
1
- import { Amount, ConfidentialWithdrawProof, ResourceAddress, TariFunctionDefinition, TariMethodDefinition, WorkspaceArg } from "@tari-project/tarijs-builders";
2
- import { TemplateFactory } from "./TemplateFactory";
3
- interface NewPoolFunction extends TariFunctionDefinition {
4
- functionName: "new";
5
- args?: [ResourceAddress, ResourceAddress, Amount];
6
- }
7
- interface MintFunction extends TariFunctionDefinition {
8
- functionName: "mint";
9
- args?: [Amount];
10
- }
11
- interface MintWithSymbolFunction extends TariFunctionDefinition {
12
- functionName: "mint_with_symbol";
13
- args?: [Amount, string];
14
- }
15
- interface PayFeeMethod extends TariMethodDefinition {
16
- methodName: "pay_fee";
17
- args?: [string];
18
- }
19
- interface PayFeeConfidentialMethod extends TariMethodDefinition {
20
- methodName: "pay_fee_confidential";
21
- args?: [ConfidentialWithdrawProof];
22
- }
23
- interface TotalSupplyMethod extends TariMethodDefinition {
24
- methodName: "total_supply";
25
- args?: [];
26
- }
27
- interface WithdrawMethod extends TariMethodDefinition {
28
- methodName: "withdraw";
29
- args?: [string, string];
30
- }
31
- interface AddLiquidityMethod extends TariMethodDefinition {
32
- methodName: "add_liquidity";
33
- args?: WorkspaceArg[];
34
- }
35
- interface RemoveLiquidityMethod extends TariMethodDefinition {
36
- methodName: "remove_liquidity";
37
- args?: WorkspaceArg[];
38
- }
39
- interface DepositMethod extends TariMethodDefinition {
40
- methodName: "deposit";
41
- args?: WorkspaceArg[];
42
- }
43
- interface SwapMethod extends TariMethodDefinition {
44
- methodName: "swap";
45
- args?: (WorkspaceArg | string)[];
46
- }
47
- export declare class TariswapTemplate extends TemplateFactory {
48
- templateAddress: string;
49
- newPool: NewPoolFunction;
50
- mint: MintFunction;
51
- mintWithSymbol: MintWithSymbolFunction;
52
- totalSupply: TotalSupplyMethod;
53
- payFee: PayFeeMethod;
54
- payFeeConfidential: PayFeeConfidentialMethod;
55
- withdraw: WithdrawMethod;
56
- addLiquidity: AddLiquidityMethod;
57
- removeLiquidity: RemoveLiquidityMethod;
58
- deposit: DepositMethod;
59
- swap: SwapMethod;
60
- constructor(templateAddress: string);
61
- protected _initFunctions(): void;
62
- protected _initMethods(): void;
63
- }
64
- export {};