@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
@@ -1,36 +0,0 @@
1
- import { TemplateFactory } from "./TemplateFactory";
2
- export class TariswapTemplate extends TemplateFactory {
3
- templateAddress;
4
- newPool;
5
- mint;
6
- mintWithSymbol;
7
- totalSupply;
8
- payFee;
9
- payFeeConfidential;
10
- withdraw;
11
- addLiquidity;
12
- removeLiquidity;
13
- deposit;
14
- swap;
15
- constructor(templateAddress) {
16
- super(templateAddress);
17
- this.templateAddress = templateAddress;
18
- this._initFunctions();
19
- this._initMethods();
20
- }
21
- _initFunctions() {
22
- this.newPool = this._defineFunction("new");
23
- this.mint = this._defineFunction("mint");
24
- this.mintWithSymbol = this._defineFunction("mint_with_symbol");
25
- }
26
- _initMethods() {
27
- this.totalSupply = this._defineMethod("total_supply");
28
- this.payFee = this._defineMethod("pay_fee");
29
- this.payFeeConfidential = this._defineMethod("pay_fee_confidential");
30
- this.withdraw = this._defineMethod("withdraw");
31
- this.addLiquidity = this._defineMethod("add_liquidity");
32
- this.removeLiquidity = this._defineMethod("remove_liquidity");
33
- this.deposit = this._defineMethod("deposit");
34
- this.swap = this._defineMethod("swap");
35
- }
36
- }
@@ -1,9 +0,0 @@
1
- import { TariFunctionDefinition, TariMethodDefinition } from "@tari-project/tarijs-builders";
2
- export declare abstract class TemplateFactory {
3
- templateAddress: string;
4
- constructor(templateAddress: string);
5
- _defineFunction<T extends TariFunctionDefinition>(name: T["functionName"]): T;
6
- _defineMethod<T extends TariMethodDefinition>(name: T["methodName"]): T;
7
- protected abstract _initFunctions(): void;
8
- protected abstract _initMethods(): void;
9
- }
@@ -1,18 +0,0 @@
1
- export class TemplateFactory {
2
- templateAddress;
3
- constructor(templateAddress) {
4
- this.templateAddress = templateAddress;
5
- }
6
- _defineFunction(name) {
7
- return {
8
- templateAddress: this.templateAddress,
9
- functionName: name,
10
- };
11
- }
12
- _defineMethod(name) {
13
- return {
14
- componentAddress: this.templateAddress,
15
- methodName: name,
16
- };
17
- }
18
- }
@@ -1,49 +0,0 @@
1
- import { Amount, ConfidentialWithdrawProof, TariFunctionDefinition, TariMethodDefinition } from "@tari-project/tarijs-builders";
2
- import { TemplateFactory } from "./TemplateFactory";
3
- interface MintFunction extends TariFunctionDefinition {
4
- functionName: "mint";
5
- args?: [string];
6
- }
7
- interface MintWithSymbolFunction extends TariFunctionDefinition {
8
- functionName: "mint_with_symbol";
9
- args?: [amount: string, symbol: string];
10
- }
11
- interface PayFeeMethod extends TariMethodDefinition {
12
- methodName: "pay_fee";
13
- args?: [Amount];
14
- }
15
- interface PayFeeConfidentialMethod extends TariMethodDefinition {
16
- methodName: "pay_fee_confidential";
17
- args?: [ConfidentialWithdrawProof];
18
- }
19
- interface TakeFreeCoinsMethod extends TariMethodDefinition {
20
- methodName: "take_free_coins";
21
- args?: [];
22
- }
23
- interface TakeFreeCoinsConfidentialMethod extends TariMethodDefinition {
24
- methodName: "take_free_coins_confidential";
25
- args?: [ConfidentialWithdrawProof];
26
- }
27
- interface BurnCoinsMethod extends TariMethodDefinition {
28
- methodName: "burn_coins";
29
- args?: [BigInt];
30
- }
31
- interface TotalSupplyMethod extends TariMethodDefinition {
32
- methodName: "total_supply";
33
- args?: [];
34
- }
35
- export declare class TestFaucet extends TemplateFactory {
36
- templateAddress: string;
37
- mint: MintFunction;
38
- mintWithSymbol: MintWithSymbolFunction;
39
- takeFreeCoins: TakeFreeCoinsMethod;
40
- takeFreeCoinsConfidential: TakeFreeCoinsConfidentialMethod;
41
- burnCoins: BurnCoinsMethod;
42
- totalSupply: TotalSupplyMethod;
43
- payFee: PayFeeMethod;
44
- payFeeConfidential: PayFeeConfidentialMethod;
45
- constructor(templateAddress: string);
46
- protected _initFunctions(): void;
47
- protected _initMethods(): void;
48
- }
49
- export {};
@@ -1,31 +0,0 @@
1
- import { TemplateFactory } from "./TemplateFactory";
2
- export class TestFaucet extends TemplateFactory {
3
- templateAddress;
4
- mint;
5
- mintWithSymbol;
6
- takeFreeCoins;
7
- takeFreeCoinsConfidential;
8
- burnCoins;
9
- totalSupply;
10
- payFee;
11
- payFeeConfidential;
12
- constructor(templateAddress) {
13
- super(templateAddress);
14
- this.templateAddress = templateAddress;
15
- this._initFunctions();
16
- this._initMethods();
17
- }
18
- _initFunctions() {
19
- this.mint = this._defineFunction("mint");
20
- this.mintWithSymbol = this._defineFunction("mint_with_symbol");
21
- }
22
- _initMethods() {
23
- this.takeFreeCoins = this._defineMethod("take_free_coins");
24
- this.takeFreeCoinsConfidential =
25
- this._defineMethod("take_free_coins_confidential");
26
- this.burnCoins = this._defineMethod("burn_coins");
27
- this.totalSupply = this._defineMethod("total_supply");
28
- this.payFee = this._defineMethod("pay_fee");
29
- this.payFeeConfidential = this._defineMethod("pay_fee_confidential");
30
- }
31
- }
@@ -1,5 +0,0 @@
1
- export { TemplateFactory } from "./TemplateFactory";
2
- export { AccountTemplate } from "./Account";
3
- export { TariswapTemplate } from "./Tariswap";
4
- export { PoolTemplate } from "./Pool";
5
- export { TestFaucet } from "./TestFaucet";
package/dist/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function toHexString(byteArray: any): string;
2
- export declare function fromHexString(hexString: string): number[];