@tari-project/tarijs 0.4.0 → 0.4.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/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +27 -0
- package/.github/dependabot.yml +8 -0
- package/.github/workflows/ci.yml +25 -0
- package/.github/workflows/npm_publish.yml +26 -0
- package/.github/workflows/pr_signed_commits_check.yml +19 -0
- package/.github/workflows/pr_title.yml +30 -0
- package/.moon/toolchain.yml +6 -0
- package/.moon/workspace.yml +32 -0
- package/.prettierrc +12 -0
- package/.prototools +9 -0
- package/CODEOWNERS +3 -0
- package/README.md +47 -0
- package/TODO.md +12 -0
- package/package.json +4 -28
- package/packages/builders/moon.yml +55 -0
- package/packages/builders/package.json +30 -0
- package/packages/builders/src/helpers/index.ts +2 -0
- package/packages/builders/src/helpers/submitTransaction.ts +97 -0
- package/packages/builders/src/helpers/workspace.ts +32 -0
- package/packages/builders/src/index.ts +9 -0
- package/packages/builders/src/transaction/TransactionBuilder.ts +276 -0
- package/packages/builders/src/transaction/TransactionRequest.ts +93 -0
- package/packages/builders/src/transaction/index.ts +2 -0
- package/packages/builders/tsconfig.json +24 -0
- package/packages/metamask_provider/moon.yml +55 -0
- package/packages/metamask_provider/package.json +30 -0
- package/packages/metamask_provider/src/index.ts +232 -0
- package/packages/metamask_provider/src/utils.ts +86 -0
- package/packages/metamask_provider/tsconfig.json +21 -0
- package/packages/tari_permissions/moon.yml +55 -0
- package/packages/tari_permissions/package.json +26 -0
- package/packages/tari_permissions/src/index.ts +1 -0
- package/packages/tari_permissions/src/tari_permissions.ts +312 -0
- package/packages/tari_permissions/tsconfig.json +15 -0
- package/packages/tari_provider/moon.yml +55 -0
- package/packages/tari_provider/package.json +27 -0
- package/packages/tari_provider/src/TariProvider.ts +35 -0
- package/packages/tari_provider/src/index.ts +3 -0
- package/packages/tari_provider/src/types.ts +82 -0
- package/packages/tari_provider/tsconfig.json +11 -0
- package/packages/tari_universe/moon.yml +55 -0
- package/packages/tari_universe/package.json +31 -0
- package/packages/tari_universe/src/index.ts +3 -0
- package/packages/tari_universe/src/provider.ts +135 -0
- package/packages/tari_universe/src/types.ts +33 -0
- package/packages/tari_universe/src/utils.ts +23 -0
- package/packages/tari_universe/tsconfig.json +24 -0
- package/packages/tarijs/integration-tests/.env +1 -0
- package/packages/tarijs/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +191 -0
- package/packages/tarijs/moon.yml +63 -0
- package/packages/tarijs/package.json +39 -0
- package/packages/tarijs/src/index.ts +69 -0
- package/packages/tarijs/src/network.ts +8 -0
- package/packages/tarijs/src/templates/Account.ts +98 -0
- package/packages/tarijs/src/templates/Pool.ts +42 -0
- package/packages/tarijs/src/templates/Tariswap.ts +101 -0
- package/packages/tarijs/src/templates/TemplateFactory.ts +22 -0
- package/packages/tarijs/src/templates/TestFaucet.ts +72 -0
- package/{dist/utils.js → packages/tarijs/src/utils.ts} +4 -3
- package/packages/tarijs/tsconfig.json +39 -0
- package/packages/tarijs/vitest.config.ts +9 -0
- package/packages/tarijs_types/moon.yml +55 -0
- package/packages/tarijs_types/package.json +27 -0
- package/packages/tarijs_types/src/Amount.ts +113 -0
- package/packages/tarijs_types/src/Arg.ts +3 -0
- package/packages/tarijs_types/src/ComponentAddress.ts +3 -0
- package/packages/tarijs_types/src/ConfidentialClaim.ts +9 -0
- package/packages/tarijs_types/src/ConfidentialOutput.ts +9 -0
- package/packages/tarijs_types/src/ConfidentialOutputStatement.ts +10 -0
- package/packages/tarijs_types/src/ConfidentialStatement.ts +9 -0
- package/packages/tarijs_types/src/ConfidentialWithdrawProof.ts +8 -0
- package/packages/tarijs_types/src/ElgamalVerifiableBalance.ts +4 -0
- package/packages/tarijs_types/src/Epoch.ts +3 -0
- package/packages/tarijs_types/src/FinalizeResult.ts +17 -0
- package/packages/tarijs_types/src/Instruction.ts +29 -0
- package/packages/tarijs_types/src/ResourceAddress.ts +3 -0
- package/packages/tarijs_types/src/SubstateDiff.ts +9 -0
- package/packages/tarijs_types/src/SubstateRequirement.ts +6 -0
- package/packages/tarijs_types/src/TemplateAddress.ts +3 -0
- package/packages/tarijs_types/src/Transaction.ts +16 -0
- package/packages/tarijs_types/src/TransactionId.ts +4 -0
- package/packages/tarijs_types/src/TransactionResult.ts +26 -0
- package/packages/tarijs_types/src/TransactionSignature.ts +4 -0
- package/packages/tarijs_types/src/UnsignedTransaction.ts +15 -0
- package/packages/tarijs_types/src/VersionedSubstateId.ts +6 -0
- package/packages/tarijs_types/src/ViewableBalanceProof.ts +12 -0
- package/packages/tarijs_types/src/Workspace.ts +3 -0
- package/packages/tarijs_types/src/index.ts +25 -0
- package/packages/tarijs_types/tsconfig.json +15 -0
- package/packages/wallet_daemon/moon.yml +55 -0
- package/packages/wallet_daemon/package.json +29 -0
- package/packages/wallet_daemon/src/index.ts +5 -0
- package/packages/wallet_daemon/src/provider.ts +263 -0
- package/packages/wallet_daemon/src/webrtc.ts +229 -0
- package/packages/wallet_daemon/src/webrtc_transport.ts +27 -0
- package/packages/wallet_daemon/tsconfig.json +21 -0
- package/packages/walletconnect/moon.yml +55 -0
- package/packages/walletconnect/package.json +32 -0
- package/packages/walletconnect/src/index.ts +274 -0
- package/packages/walletconnect/tsconfig.json +21 -0
- package/pnpm-workspace.yaml +14 -0
- package/tsconfig.json +42 -0
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -13
- package/dist/network.d.ts +0 -8
- package/dist/network.js +0 -9
- package/dist/templates/Account.d.ts +0 -65
- package/dist/templates/Account.js +0 -31
- package/dist/templates/Pool.d.ts +0 -29
- package/dist/templates/Pool.js +0 -20
- package/dist/templates/Tariswap.d.ts +0 -64
- package/dist/templates/Tariswap.js +0 -36
- package/dist/templates/TemplateFactory.d.ts +0 -9
- package/dist/templates/TemplateFactory.js +0 -18
- package/dist/templates/TestFaucet.d.ts +0 -49
- package/dist/templates/TestFaucet.js +0 -31
- package/dist/templates/index.js +0 -5
- package/dist/utils.d.ts +0 -2
- /package/{dist/templates/index.d.ts → packages/tarijs/src/templates/index.ts} +0 -0
package/tsconfig.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
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": "packages/builders"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "packages/metamask_provider"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "packages/tari_permissions"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "packages/tari_provider"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "packages/tari_universe"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "packages/tarijs"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "packages/tarijs_types"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "packages/types"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "packages/wallet_daemon"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "packages/walletconnect"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
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
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
|
-
}
|
package/dist/templates/Pool.d.ts
DELETED
|
@@ -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 {};
|
package/dist/templates/Pool.js
DELETED
|
@@ -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 {};
|
|
@@ -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
|
-
}
|
package/dist/templates/index.js
DELETED
package/dist/utils.d.ts
DELETED
|
File without changes
|