@tari-project/tarijs-types 0.4.0 → 0.5.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/dist/ConfidentialOutput.d.ts +1 -1
- package/dist/ConfidentialWithdrawProof.d.ts +1 -1
- package/dist/GetTransactionResultResponse.d.ts +7 -0
- package/dist/Instruction.d.ts +5 -6
- package/dist/ListAccountNftFromBalancesRequest.d.ts +4 -0
- package/dist/Transaction.d.ts +1 -1
- package/dist/TransactionArg.d.ts +1 -0
- package/dist/TransactionResult.d.ts +1 -9
- package/dist/TransactionResult.js +1 -10
- package/dist/TransactionStatus.d.ts +9 -0
- package/dist/TransactionStatus.js +10 -0
- package/dist/UnsignedTransaction.d.ts +1 -1
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.js +51 -0
- package/dist/index.d.ts +8 -10
- package/dist/index.js +2 -1
- package/dist/signer.d.ts +62 -0
- package/package.json +2 -2
- package/dist/Arg.d.ts +0 -1
- package/dist/ComponentAddress.d.ts +0 -1
- package/dist/ConfidentialOutputStatement.d.ts +0 -9
- package/dist/ConfidentialStatement.d.ts +0 -8
- package/dist/ElgamalVerifiableBalance.d.ts +0 -4
- package/dist/ElgamalVerifiableBalance.js +0 -1
- package/dist/Epoch.d.ts +0 -1
- package/dist/Epoch.js +0 -1
- package/dist/ResourceAddress.d.ts +0 -1
- package/dist/ResourceAddress.js +0 -2
- package/dist/TemplateAddress.d.ts +0 -1
- package/dist/TemplateAddress.js +0 -2
- package/dist/TransactionId.d.ts +0 -1
- package/dist/TransactionId.js +0 -1
- package/dist/ViewableBalanceProof.d.ts +0 -10
- package/dist/ViewableBalanceProof.js +0 -2
- /package/dist/{Arg.js → GetTransactionResultResponse.js} +0 -0
- /package/dist/{ComponentAddress.js → ListAccountNftFromBalancesRequest.js} +0 -0
- /package/dist/{ConfidentialOutputStatement.js → TransactionArg.js} +0 -0
- /package/dist/{ConfidentialStatement.js → signer.js} +0 -0
package/dist/Instruction.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ComponentAddress, LogLevel } from "@tari-project/typescript-bindings";
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentAddress, LogLevel, PublishedTemplateAddress } from "@tari-project/typescript-bindings";
|
|
2
|
+
import { TransactionArg } from "./TransactionArg";
|
|
3
3
|
import { ConfidentialClaim } from "./ConfidentialClaim";
|
|
4
4
|
import { Amount } from "./Amount";
|
|
5
5
|
import { ConfidentialOutput } from "./ConfidentialOutput";
|
|
6
|
-
import { TemplateAddress } from "./TemplateAddress";
|
|
7
6
|
export type Instruction = CreateAccount | CallFunction | CallMethod | PutLastInstructionOutputOnWorkspace | EmitLog | ClaimBurn | ClaimValidatorFees | DropAllProofsInWorkspace | CreateFreeTestCoins;
|
|
8
7
|
export type CreateAccount = {
|
|
9
8
|
CreateAccount: {
|
|
@@ -13,16 +12,16 @@ export type CreateAccount = {
|
|
|
13
12
|
};
|
|
14
13
|
export type CallFunction = {
|
|
15
14
|
CallFunction: {
|
|
16
|
-
template_address:
|
|
15
|
+
template_address: PublishedTemplateAddress;
|
|
17
16
|
function: string;
|
|
18
|
-
args: Array<
|
|
17
|
+
args: Array<TransactionArg>;
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
20
|
export type CallMethod = {
|
|
22
21
|
CallMethod: {
|
|
23
22
|
component_address: ComponentAddress;
|
|
24
23
|
method: string;
|
|
25
|
-
args: Array<
|
|
24
|
+
args: Array<TransactionArg>;
|
|
26
25
|
};
|
|
27
26
|
};
|
|
28
27
|
export type PutLastInstructionOutputOnWorkspace = {
|
package/dist/Transaction.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Instruction } from "./Instruction";
|
|
2
2
|
import { SubstateRequirement } from "./SubstateRequirement";
|
|
3
|
-
import { Epoch } from "./Epoch";
|
|
4
3
|
import { VersionedSubstateId } from "./VersionedSubstateId";
|
|
5
4
|
import { TransactionSignature } from "./TransactionSignature";
|
|
5
|
+
import { Epoch } from "@tari-project/typescript-bindings";
|
|
6
6
|
export interface Transaction {
|
|
7
7
|
id: string;
|
|
8
8
|
feeInstructions: Array<Instruction>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TransactionArg = any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TransactionStatus } from "./TransactionStatus";
|
|
1
2
|
import { FinalizeResult } from "./FinalizeResult";
|
|
2
3
|
export type SubmitTransactionResponse = {
|
|
3
4
|
transaction_id: string;
|
|
@@ -6,15 +7,6 @@ export interface SubmitTxResult {
|
|
|
6
7
|
response: SubmitTransactionResponse;
|
|
7
8
|
result: TransactionResult;
|
|
8
9
|
}
|
|
9
|
-
export declare enum TransactionStatus {
|
|
10
|
-
New = 0,
|
|
11
|
-
DryRun = 1,
|
|
12
|
-
Pending = 2,
|
|
13
|
-
Accepted = 3,
|
|
14
|
-
Rejected = 4,
|
|
15
|
-
InvalidTransaction = 5,
|
|
16
|
-
OnlyFeeAccepted = 6
|
|
17
|
-
}
|
|
18
10
|
export type TransactionResult = {
|
|
19
11
|
transaction_id: string;
|
|
20
12
|
status: TransactionStatus;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (TransactionStatus) {
|
|
3
|
-
TransactionStatus[TransactionStatus["New"] = 0] = "New";
|
|
4
|
-
TransactionStatus[TransactionStatus["DryRun"] = 1] = "DryRun";
|
|
5
|
-
TransactionStatus[TransactionStatus["Pending"] = 2] = "Pending";
|
|
6
|
-
TransactionStatus[TransactionStatus["Accepted"] = 3] = "Accepted";
|
|
7
|
-
TransactionStatus[TransactionStatus["Rejected"] = 4] = "Rejected";
|
|
8
|
-
TransactionStatus[TransactionStatus["InvalidTransaction"] = 5] = "InvalidTransaction";
|
|
9
|
-
TransactionStatus[TransactionStatus["OnlyFeeAccepted"] = 6] = "OnlyFeeAccepted";
|
|
10
|
-
})(TransactionStatus || (TransactionStatus = {}));
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var TransactionStatus;
|
|
2
|
+
(function (TransactionStatus) {
|
|
3
|
+
TransactionStatus[TransactionStatus["New"] = 0] = "New";
|
|
4
|
+
TransactionStatus[TransactionStatus["DryRun"] = 1] = "DryRun";
|
|
5
|
+
TransactionStatus[TransactionStatus["Pending"] = 2] = "Pending";
|
|
6
|
+
TransactionStatus[TransactionStatus["Accepted"] = 3] = "Accepted";
|
|
7
|
+
TransactionStatus[TransactionStatus["Rejected"] = 4] = "Rejected";
|
|
8
|
+
TransactionStatus[TransactionStatus["InvalidTransaction"] = 5] = "InvalidTransaction";
|
|
9
|
+
TransactionStatus[TransactionStatus["OnlyFeeAccepted"] = 6] = "OnlyFeeAccepted";
|
|
10
|
+
})(TransactionStatus || (TransactionStatus = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Epoch } from "@tari-project/typescript-bindings";
|
|
1
2
|
import { Instruction } from "./Instruction";
|
|
2
|
-
import { Epoch } from "./Epoch";
|
|
3
3
|
import { SubstateRequirement } from "./SubstateRequirement";
|
|
4
4
|
import { VersionedSubstateId } from "./VersionedSubstateId";
|
|
5
5
|
export interface UnsignedTransaction {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NonFungibleId, NonFungibleToken, ResourceAddress } from "@tari-project/typescript-bindings";
|
|
2
|
+
import { TransactionStatus } from "../TransactionStatus";
|
|
3
|
+
export { substateIdToString, stringToSubstateId, shortenSubstateId, shortenString, rejectReasonToString, getSubstateDiffFromTransactionResult, getRejectReasonFromTransactionResult, jrpcPermissionToString, } from "@tari-project/typescript-bindings";
|
|
4
|
+
export declare function convertStringToTransactionStatus(status: string): TransactionStatus;
|
|
5
|
+
export declare function createNftAddressFromToken(token: NonFungibleToken): string;
|
|
6
|
+
export declare function convertU256ToHexString(id: NonFungibleId): string;
|
|
7
|
+
export declare function convertHexStringToU256Array(hexString: string): number[];
|
|
8
|
+
export declare function createNftAddressFromResource(address: ResourceAddress, tokenId: NonFungibleId): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TransactionStatus } from "../TransactionStatus";
|
|
2
|
+
export { substateIdToString, stringToSubstateId, shortenSubstateId, shortenString, rejectReasonToString, getSubstateDiffFromTransactionResult, getRejectReasonFromTransactionResult, jrpcPermissionToString, } from "@tari-project/typescript-bindings";
|
|
3
|
+
export function convertStringToTransactionStatus(status) {
|
|
4
|
+
switch (status) {
|
|
5
|
+
case "New":
|
|
6
|
+
return TransactionStatus.New;
|
|
7
|
+
case "DryRun":
|
|
8
|
+
return TransactionStatus.DryRun;
|
|
9
|
+
case "Pending":
|
|
10
|
+
return TransactionStatus.Pending;
|
|
11
|
+
case "Accepted":
|
|
12
|
+
return TransactionStatus.Accepted;
|
|
13
|
+
case "Rejected":
|
|
14
|
+
return TransactionStatus.Rejected;
|
|
15
|
+
case "InvalidTransaction":
|
|
16
|
+
return TransactionStatus.InvalidTransaction;
|
|
17
|
+
case "OnlyFeeAccepted":
|
|
18
|
+
return TransactionStatus.OnlyFeeAccepted;
|
|
19
|
+
default:
|
|
20
|
+
throw new Error(`Unknown status: ${status}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Function to create the Nft address
|
|
24
|
+
// address format: nft_RESOURCEADDR_uuid_TOKENID
|
|
25
|
+
export function createNftAddressFromToken(token) {
|
|
26
|
+
return createNftAddressFromResource(token.resource_address, token.nft_id);
|
|
27
|
+
}
|
|
28
|
+
export function convertU256ToHexString(id) {
|
|
29
|
+
if ("U256" in id && Array.isArray(id.U256)) {
|
|
30
|
+
return id.U256.map((num) => num.toString(16).padStart(2, "0")).join("");
|
|
31
|
+
}
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
export function convertHexStringToU256Array(hexString) {
|
|
35
|
+
const cleanHexString = hexString.replace(/[^0-9a-fA-F]/g, "");
|
|
36
|
+
const u256Array = [];
|
|
37
|
+
for (let i = 0; i < cleanHexString.length; i += 2) {
|
|
38
|
+
const hexPair = cleanHexString.slice(i, i + 2);
|
|
39
|
+
u256Array.push(parseInt(hexPair, 16));
|
|
40
|
+
}
|
|
41
|
+
return u256Array;
|
|
42
|
+
}
|
|
43
|
+
export function createNftAddressFromResource(address, tokenId) {
|
|
44
|
+
let nftAddress = "nft_";
|
|
45
|
+
const resourceAddress = address.replace(/^resource_/, "");
|
|
46
|
+
nftAddress += resourceAddress;
|
|
47
|
+
nftAddress += "_uuid_";
|
|
48
|
+
const nftIdHexString = convertU256ToHexString(tokenId);
|
|
49
|
+
nftAddress += nftIdHexString;
|
|
50
|
+
return nftAddress;
|
|
51
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ComponentAddress, ResourceAddress, PublishedTemplateAddress, Epoch } from "@tari-project/typescript-bindings";
|
|
2
2
|
export { Amount } from "./Amount";
|
|
3
|
-
export {
|
|
4
|
-
export { ComponentAddress } from "./ComponentAddress";
|
|
3
|
+
export { TransactionArg } from "./TransactionArg";
|
|
5
4
|
export { ConfidentialClaim } from "./ConfidentialClaim";
|
|
6
5
|
export { ConfidentialOutput } from "./ConfidentialOutput";
|
|
7
|
-
export { ConfidentialOutputStatement } from "./ConfidentialOutputStatement";
|
|
8
|
-
export { ConfidentialStatement } from "./ConfidentialStatement";
|
|
9
6
|
export { ConfidentialWithdrawProof } from "./ConfidentialWithdrawProof";
|
|
10
|
-
export { Epoch } from "./Epoch";
|
|
11
7
|
export { FinalizeResult, FinalizeResultStatus, TxResultAccept, TxResultAcceptFeeRejectRest, TxResultReject, } from "./FinalizeResult";
|
|
12
|
-
export {
|
|
8
|
+
export { GetTransactionResultResponse } from "./GetTransactionResultResponse";
|
|
13
9
|
export { Instruction } from "./Instruction";
|
|
14
10
|
export { Transaction } from "./Transaction";
|
|
15
11
|
export { SubstateDiff, DownSubstates, UpSubstates } from "./SubstateDiff";
|
|
16
12
|
export { SubstateRequirement } from "./SubstateRequirement";
|
|
17
|
-
export {
|
|
18
|
-
export { TransactionResult, TransactionStatus, SubmitTxResult, SubmitTransactionResponse } from "./TransactionResult";
|
|
13
|
+
export { TransactionResult, SubmitTxResult, SubmitTransactionResponse } from "./TransactionResult";
|
|
19
14
|
export { TransactionSignature } from "./TransactionSignature";
|
|
15
|
+
export { TransactionStatus } from "./TransactionStatus";
|
|
20
16
|
export { UnsignedTransaction } from "./UnsignedTransaction";
|
|
21
17
|
export { VersionedSubstateId } from "./VersionedSubstateId";
|
|
22
|
-
export { ViewableBalanceProof } from "./ViewableBalanceProof";
|
|
23
18
|
export { WorkspaceArg } from "./Workspace";
|
|
19
|
+
export { ListAccountNftFromBalancesRequest } from "./ListAccountNftFromBalancesRequest";
|
|
20
|
+
export { AccountData, ListSubstatesRequest, ListSubstatesResponse, SubmitTransactionRequest, Substate, SubstateMetadata, ReqSubstate, TemplateDefinition, VaultBalances, VaultData, GetSubstateRequest, } from "./signer";
|
|
21
|
+
export { convertHexStringToU256Array, convertStringToTransactionStatus, convertU256ToHexString, createNftAddressFromResource, createNftAddressFromToken, getRejectReasonFromTransactionResult, getSubstateDiffFromTransactionResult, jrpcPermissionToString, rejectReasonToString, shortenString, shortenSubstateId, stringToSubstateId, substateIdToString, } from "./helpers";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { Amount } from "./Amount";
|
|
2
|
-
export { TransactionStatus } from "./
|
|
2
|
+
export { TransactionStatus } from "./TransactionStatus";
|
|
3
|
+
export { convertHexStringToU256Array, convertStringToTransactionStatus, convertU256ToHexString, createNftAddressFromResource, createNftAddressFromToken, getRejectReasonFromTransactionResult, getSubstateDiffFromTransactionResult, jrpcPermissionToString, rejectReasonToString, shortenString, shortenSubstateId, stringToSubstateId, substateIdToString, } from "./helpers";
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SubstateType, TemplateDef } from "@tari-project/typescript-bindings";
|
|
2
|
+
export type SubstateMetadata = {
|
|
3
|
+
substate_id: string;
|
|
4
|
+
module_name: string | null;
|
|
5
|
+
version: number;
|
|
6
|
+
template_address: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type ReqSubstate = {
|
|
9
|
+
substate_id: string;
|
|
10
|
+
version?: number | null;
|
|
11
|
+
};
|
|
12
|
+
export type SubmitTransactionRequest = {
|
|
13
|
+
network: number;
|
|
14
|
+
account_id: number;
|
|
15
|
+
instructions: object[];
|
|
16
|
+
fee_instructions: object[];
|
|
17
|
+
inputs: object[];
|
|
18
|
+
input_refs: object[];
|
|
19
|
+
required_substates: ReqSubstate[];
|
|
20
|
+
is_dry_run: boolean;
|
|
21
|
+
min_epoch: number | null;
|
|
22
|
+
max_epoch: number | null;
|
|
23
|
+
is_seal_signer_authorized: boolean;
|
|
24
|
+
detect_inputs_use_unversioned: boolean;
|
|
25
|
+
};
|
|
26
|
+
export interface AccountData {
|
|
27
|
+
account_id: number;
|
|
28
|
+
address: string;
|
|
29
|
+
public_key: string;
|
|
30
|
+
resources: VaultData[];
|
|
31
|
+
}
|
|
32
|
+
export interface VaultData {
|
|
33
|
+
type: string;
|
|
34
|
+
balance: number;
|
|
35
|
+
resource_address: string;
|
|
36
|
+
token_symbol: string;
|
|
37
|
+
vault_id: string;
|
|
38
|
+
}
|
|
39
|
+
export interface VaultBalances {
|
|
40
|
+
balances: Map<string, number | null>;
|
|
41
|
+
}
|
|
42
|
+
export type TemplateDefinition = TemplateDef;
|
|
43
|
+
export interface Substate {
|
|
44
|
+
value: any;
|
|
45
|
+
address: {
|
|
46
|
+
substate_id: string;
|
|
47
|
+
version: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export type ListSubstatesResponse = {
|
|
51
|
+
substates: Array<SubstateMetadata>;
|
|
52
|
+
};
|
|
53
|
+
export type ListSubstatesRequest = {
|
|
54
|
+
filter_by_template: string | null;
|
|
55
|
+
filter_by_type: SubstateType | null;
|
|
56
|
+
limit: number | null;
|
|
57
|
+
offset: number | null;
|
|
58
|
+
};
|
|
59
|
+
export type GetSubstateRequest = {
|
|
60
|
+
substate_address: string;
|
|
61
|
+
version: number | null;
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tarijs-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tari-project/typescript-bindings": "^1.
|
|
13
|
+
"@tari-project/typescript-bindings": "^1.5.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^22.13.1",
|
package/dist/Arg.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Arg = any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ComponentAddress = string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Amount } from "./Amount";
|
|
2
|
-
import type { ConfidentialStatement } from "./ConfidentialStatement";
|
|
3
|
-
export interface ConfidentialOutputStatement {
|
|
4
|
-
outputStatement?: ConfidentialStatement;
|
|
5
|
-
changeStatement?: ConfidentialStatement;
|
|
6
|
-
rangeProof: Array<number>;
|
|
7
|
-
outputRevealedAmount: Amount;
|
|
8
|
-
changeRevealedAmount: Amount;
|
|
9
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ViewableBalanceProof } from "./ViewableBalanceProof";
|
|
2
|
-
export interface ConfidentialStatement {
|
|
3
|
-
commitment: Array<number>;
|
|
4
|
-
senderPublicNonce: Array<number>;
|
|
5
|
-
encryptedData: Array<number>;
|
|
6
|
-
minimumValuePromise: number;
|
|
7
|
-
viewableBalanceProof?: ViewableBalanceProof;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Epoch.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Epoch = number;
|
package/dist/Epoch.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ResourceAddress = string;
|
package/dist/ResourceAddress.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type TemplateAddress = string;
|
package/dist/TemplateAddress.js
DELETED
package/dist/TransactionId.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type TransactionId = string;
|
package/dist/TransactionId.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|