@tari-project/tarijs-types 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SubstateDiff.d.ts +0 -4
- package/dist/TransactionResult.d.ts +1 -7
- package/dist/TransactionStatus.d.ts +8 -7
- package/dist/TransactionStatus.js +27 -7
- package/dist/helpers/txResult.d.ts +4 -11
- package/dist/helpers/txResult.js +3 -3
- package/dist/index.d.ts +3 -9
- package/dist/index.js +1 -1
- package/dist/signer.d.ts +2 -11
- package/package.json +2 -2
- package/dist/FinalizeResult.d.ts +0 -20
- package/dist/FinalizeResult.js +0 -1
- package/dist/Instruction.d.ts +0 -68
- package/dist/Instruction.js +0 -1
- package/dist/SubstateRequirement.d.ts +0 -5
- package/dist/SubstateRequirement.js +0 -1
- package/dist/Transaction.d.ts +0 -15
- package/dist/Transaction.js +0 -1
- package/dist/UnsignedTransaction.d.ts +0 -12
- package/dist/UnsignedTransaction.js +0 -1
- package/dist/VersionedSubstateId.d.ts +0 -5
- package/dist/VersionedSubstateId.js +0 -1
package/dist/SubstateDiff.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { Substate, SubstateId } from "@tari-project/typescript-bindings";
|
|
2
2
|
export type UpSubstates = Array<[SubstateId, Substate]>;
|
|
3
3
|
export type DownSubstates = Array<[SubstateId, number]>;
|
|
4
|
-
export interface SubstateDiff {
|
|
5
|
-
up_substates: UpSubstates;
|
|
6
|
-
down_substates: DownSubstates;
|
|
7
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TransactionStatus } from "./TransactionStatus";
|
|
2
|
-
import { FinalizeResult } from "./FinalizeResult";
|
|
3
2
|
import { DownSubstates, UpSubstates } from "./SubstateDiff";
|
|
4
|
-
import { ComponentAddress } from "@tari-project/typescript-bindings";
|
|
3
|
+
import { ComponentAddress, FinalizeResult, TransactionResult } from "@tari-project/typescript-bindings";
|
|
5
4
|
export type SubmitTransactionResponse = {
|
|
6
5
|
transaction_id: string;
|
|
7
6
|
};
|
|
@@ -13,11 +12,6 @@ export interface SubmitTxResult {
|
|
|
13
12
|
newComponents: UpSubstates;
|
|
14
13
|
getComponentForTemplate(templateAddress: string): ComponentAddress | null;
|
|
15
14
|
}
|
|
16
|
-
export type TransactionResult = {
|
|
17
|
-
transaction_id: string;
|
|
18
|
-
status: TransactionStatus;
|
|
19
|
-
result: FinalizeResult | null;
|
|
20
|
-
};
|
|
21
15
|
export type TransactionResultResponse = {
|
|
22
16
|
transaction_id: string;
|
|
23
17
|
status: TransactionStatus;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export declare enum TransactionStatus {
|
|
2
|
-
New =
|
|
3
|
-
DryRun =
|
|
4
|
-
Pending =
|
|
5
|
-
Accepted =
|
|
6
|
-
Rejected =
|
|
7
|
-
InvalidTransaction =
|
|
8
|
-
OnlyFeeAccepted =
|
|
2
|
+
New = "New",
|
|
3
|
+
DryRun = "DryRun",
|
|
4
|
+
Pending = "Pending",
|
|
5
|
+
Accepted = "Accepted",
|
|
6
|
+
Rejected = "Rejected",
|
|
7
|
+
InvalidTransaction = "InvalidTransaction",
|
|
8
|
+
OnlyFeeAccepted = "OnlyFeeAccepted"
|
|
9
9
|
}
|
|
10
|
+
export declare function transactionStatusFromStr(s: string): TransactionStatus;
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
export var TransactionStatus;
|
|
2
2
|
(function (TransactionStatus) {
|
|
3
|
-
TransactionStatus[
|
|
4
|
-
TransactionStatus[
|
|
5
|
-
TransactionStatus[
|
|
6
|
-
TransactionStatus[
|
|
7
|
-
TransactionStatus[
|
|
8
|
-
TransactionStatus[
|
|
9
|
-
TransactionStatus[
|
|
3
|
+
TransactionStatus["New"] = "New";
|
|
4
|
+
TransactionStatus["DryRun"] = "DryRun";
|
|
5
|
+
TransactionStatus["Pending"] = "Pending";
|
|
6
|
+
TransactionStatus["Accepted"] = "Accepted";
|
|
7
|
+
TransactionStatus["Rejected"] = "Rejected";
|
|
8
|
+
TransactionStatus["InvalidTransaction"] = "InvalidTransaction";
|
|
9
|
+
TransactionStatus["OnlyFeeAccepted"] = "OnlyFeeAccepted";
|
|
10
10
|
})(TransactionStatus || (TransactionStatus = {}));
|
|
11
|
+
export function transactionStatusFromStr(s) {
|
|
12
|
+
switch (s) {
|
|
13
|
+
case "New":
|
|
14
|
+
return TransactionStatus.New;
|
|
15
|
+
case "DryRun":
|
|
16
|
+
return TransactionStatus.DryRun;
|
|
17
|
+
case "Pending":
|
|
18
|
+
return TransactionStatus.Pending;
|
|
19
|
+
case "Accepted":
|
|
20
|
+
return TransactionStatus.Accepted;
|
|
21
|
+
case "Rejected":
|
|
22
|
+
return TransactionStatus.Rejected;
|
|
23
|
+
case "InvalidTransaction":
|
|
24
|
+
return TransactionStatus.InvalidTransaction;
|
|
25
|
+
case "OnlyFeeAccepted":
|
|
26
|
+
return TransactionStatus.OnlyFeeAccepted;
|
|
27
|
+
default:
|
|
28
|
+
throw new Error(`Unknown transaction status: ${s}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FinalizeResultStatus } from "../FinalizeResult";
|
|
1
|
+
import { VaultId, Vault, SubstateId, SubstateValue, ResourceContainer, ResourceAddress, Amount, ComponentAddress, FinalizeResult } from "@tari-project/typescript-bindings";
|
|
3
2
|
import { UpSubstates } from "../SubstateDiff";
|
|
4
3
|
export declare const txResultCheck: {
|
|
5
|
-
isAccept: (result:
|
|
6
|
-
Accept: SubstateDiff;
|
|
7
|
-
};
|
|
4
|
+
isAccept: (result: FinalizeResult) => boolean;
|
|
8
5
|
isVaultId: (substateId: SubstateId) => substateId is {
|
|
9
6
|
Vault: VaultId;
|
|
10
7
|
};
|
|
@@ -18,12 +15,8 @@ export declare const txResultCheck: {
|
|
|
18
15
|
locked_amount: Amount;
|
|
19
16
|
};
|
|
20
17
|
};
|
|
21
|
-
isReject: (result:
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
isAcceptFeeRejectRest: (result: FinalizeResultStatus) => result is {
|
|
25
|
-
AcceptFeeRejectRest: [SubstateDiff, RejectReason];
|
|
26
|
-
};
|
|
18
|
+
isReject: (result: FinalizeResult) => boolean;
|
|
19
|
+
isAcceptFeeRejectRest: (result: FinalizeResult) => boolean;
|
|
27
20
|
};
|
|
28
21
|
export declare function getSubstateValueFromUpSubstates(substateType: keyof SubstateValue | string, upSubstates: UpSubstates): UpSubstates;
|
|
29
22
|
export declare function getComponentsForTemplate(templateAddress: string, upSubstates: UpSubstates): ComponentAddress[] | null;
|
package/dist/helpers/txResult.js
CHANGED
|
@@ -4,7 +4,7 @@ function isOfType(obj, key) {
|
|
|
4
4
|
}
|
|
5
5
|
export const txResultCheck = {
|
|
6
6
|
isAccept: (result) => {
|
|
7
|
-
return "Accept" in result;
|
|
7
|
+
return "Accept" in result.result;
|
|
8
8
|
},
|
|
9
9
|
isVaultId: (substateId) => {
|
|
10
10
|
return isOfType(substateId, "Vault");
|
|
@@ -16,10 +16,10 @@ export const txResultCheck = {
|
|
|
16
16
|
return "Fungible" in resourceContainer;
|
|
17
17
|
},
|
|
18
18
|
isReject: (result) => {
|
|
19
|
-
return "Reject" in result;
|
|
19
|
+
return "Reject" in result.result;
|
|
20
20
|
},
|
|
21
21
|
isAcceptFeeRejectRest: (result) => {
|
|
22
|
-
return "AcceptFeeRejectRest" in result;
|
|
22
|
+
return "AcceptFeeRejectRest" in result.result;
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
export function getSubstateValueFromUpSubstates(substateType, upSubstates) {
|
package/dist/index.d.ts
CHANGED
|
@@ -4,18 +4,12 @@ export { TransactionArg } from "./TransactionArg";
|
|
|
4
4
|
export { ConfidentialClaim } from "./ConfidentialClaim";
|
|
5
5
|
export { ConfidentialOutput } from "./ConfidentialOutput";
|
|
6
6
|
export { ConfidentialWithdrawProof } from "./ConfidentialWithdrawProof";
|
|
7
|
-
export { FinalizeResult, FinalizeResultStatus, TxResultAccept, TxResultAcceptFeeRejectRest, TxResultReject, } from "./FinalizeResult";
|
|
8
7
|
export { GetTransactionResultResponse } from "./GetTransactionResultResponse";
|
|
9
|
-
export {
|
|
10
|
-
export { Transaction } from "./Transaction";
|
|
11
|
-
export { SubstateDiff, DownSubstates, UpSubstates } from "./SubstateDiff";
|
|
12
|
-
export { SubstateRequirement } from "./SubstateRequirement";
|
|
8
|
+
export { DownSubstates, UpSubstates } from "./SubstateDiff";
|
|
13
9
|
export { SubstateType } from "./SubstateType";
|
|
14
|
-
export {
|
|
10
|
+
export { SubmitTransactionResponse, } from "./TransactionResult";
|
|
15
11
|
export { TransactionSignature } from "./TransactionSignature";
|
|
16
|
-
export { TransactionStatus } from "./TransactionStatus";
|
|
17
|
-
export { UnsignedTransaction } from "./UnsignedTransaction";
|
|
18
|
-
export { VersionedSubstateId } from "./VersionedSubstateId";
|
|
12
|
+
export { TransactionStatus, transactionStatusFromStr } from "./TransactionStatus";
|
|
19
13
|
export { WorkspaceArg } from "./Workspace";
|
|
20
14
|
export { ListAccountNftFromBalancesRequest } from "./ListAccountNftFromBalancesRequest";
|
|
21
15
|
export { Network } from "./network";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Amount } from "./Amount";
|
|
2
|
-
export { TransactionStatus } from "./TransactionStatus";
|
|
2
|
+
export { TransactionStatus, transactionStatusFromStr } from "./TransactionStatus";
|
|
3
3
|
export { Network } from "./network";
|
|
4
4
|
export { convertHexStringToU256Array, convertStringToTransactionStatus, convertU256ToHexString, createNftAddressFromResource, createNftAddressFromToken, getRejectReasonFromTransactionResult, getSubstateDiffFromTransactionResult, jrpcPermissionToString, rejectReasonToString, shortenString, shortenSubstateId, stringToSubstateId, substateIdToString, fromHexString, toHexString, convertTaggedValue, getCborValueByPath, parseCbor, getSubstateValueFromUpSubstates, getComponentsForTemplate, txResultCheck, BinaryTag, } from "./helpers";
|
package/dist/signer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SubstateType, TemplateDef } from "@tari-project/typescript-bindings";
|
|
1
|
+
import { SubstateType, TemplateDef, UnsignedTransactionV1 } from "@tari-project/typescript-bindings";
|
|
2
2
|
export type SubstateMetadata = {
|
|
3
3
|
substate_id: string;
|
|
4
4
|
module_name: string | null;
|
|
@@ -10,17 +10,8 @@ export type ReqSubstate = {
|
|
|
10
10
|
version?: number | null;
|
|
11
11
|
};
|
|
12
12
|
export type SubmitTransactionRequest = {
|
|
13
|
-
|
|
13
|
+
transaction: UnsignedTransactionV1;
|
|
14
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
15
|
detect_inputs_use_unversioned: boolean;
|
|
25
16
|
};
|
|
26
17
|
export interface AccountData {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tarijs-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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.9.
|
|
13
|
+
"@tari-project/typescript-bindings": ">=1.9.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^22.13.1",
|
package/dist/FinalizeResult.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FeeReceipt, InstructionResult, LogEntry, RejectReason } from "@tari-project/typescript-bindings";
|
|
2
|
-
import { SubstateDiff } from "./SubstateDiff";
|
|
3
|
-
export type TxResultAccept = {
|
|
4
|
-
Accept: SubstateDiff;
|
|
5
|
-
};
|
|
6
|
-
export type TxResultAcceptFeeRejectRest = {
|
|
7
|
-
AcceptFeeRejectRest: [SubstateDiff, RejectReason];
|
|
8
|
-
};
|
|
9
|
-
export type TxResultReject = {
|
|
10
|
-
Reject: RejectReason;
|
|
11
|
-
};
|
|
12
|
-
export type FinalizeResultStatus = TxResultAccept | TxResultAcceptFeeRejectRest | TxResultReject;
|
|
13
|
-
export interface FinalizeResult {
|
|
14
|
-
transaction_hash: Uint8Array;
|
|
15
|
-
events: Array<Event>;
|
|
16
|
-
logs: Array<LogEntry>;
|
|
17
|
-
execution_results: Array<InstructionResult>;
|
|
18
|
-
result: FinalizeResultStatus;
|
|
19
|
-
fee_receipt: FeeReceipt;
|
|
20
|
-
}
|
package/dist/FinalizeResult.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Instruction.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ComponentAddress, ResourceAddress, LogLevel, PublishedTemplateAddress, SubstateType, WorkspaceOffsetId } from "@tari-project/typescript-bindings";
|
|
2
|
-
import { TransactionArg } from "./TransactionArg";
|
|
3
|
-
import { ConfidentialClaim } from "./ConfidentialClaim";
|
|
4
|
-
import { Amount } from "./Amount";
|
|
5
|
-
import { ConfidentialOutput } from "./ConfidentialOutput";
|
|
6
|
-
export type Instruction = CreateAccount | CallFunction | CallMethod | PutLastInstructionOutputOnWorkspace | EmitLog | ClaimBurn | ClaimValidatorFees | DropAllProofsInWorkspace | CreateFreeTestCoins | AllocateAddress | AssertBucketContains;
|
|
7
|
-
export type CreateAccount = {
|
|
8
|
-
CreateAccount: {
|
|
9
|
-
owner_public_key: string;
|
|
10
|
-
workspace_bucket: string | null;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type CallFunction = {
|
|
14
|
-
CallFunction: {
|
|
15
|
-
template_address: PublishedTemplateAddress;
|
|
16
|
-
function: string;
|
|
17
|
-
args: Array<TransactionArg>;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export type CallMethod = {
|
|
21
|
-
CallMethod: {
|
|
22
|
-
component_address: ComponentAddress;
|
|
23
|
-
method: string;
|
|
24
|
-
args: Array<TransactionArg>;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export type PutLastInstructionOutputOnWorkspace = {
|
|
28
|
-
PutLastInstructionOutputOnWorkspace: {
|
|
29
|
-
key: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export type EmitLog = {
|
|
33
|
-
EmitLog: {
|
|
34
|
-
level: LogLevel;
|
|
35
|
-
message: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export type ClaimBurn = {
|
|
39
|
-
ClaimBurn: {
|
|
40
|
-
claim: ConfidentialClaim;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type ClaimValidatorFees = {
|
|
44
|
-
ClaimValidatorFees: {
|
|
45
|
-
epoch: number;
|
|
46
|
-
validator_public_key: string;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export type DropAllProofsInWorkspace = "DropAllProofsInWorkspace";
|
|
50
|
-
export type CreateFreeTestCoins = {
|
|
51
|
-
CreateFreeTestCoins: {
|
|
52
|
-
revealed_amount: Amount;
|
|
53
|
-
output: ConfidentialOutput | null;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export type AllocateAddress = {
|
|
57
|
-
AllocateAddress: {
|
|
58
|
-
substate_type: SubstateType;
|
|
59
|
-
workspace_id: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export type AssertBucketContains = {
|
|
63
|
-
AssertBucketContains: {
|
|
64
|
-
key: WorkspaceOffsetId;
|
|
65
|
-
resource_address: ResourceAddress;
|
|
66
|
-
min_amount: Amount;
|
|
67
|
-
};
|
|
68
|
-
};
|
package/dist/Instruction.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Transaction.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Instruction } from "./Instruction";
|
|
2
|
-
import { SubstateRequirement } from "./SubstateRequirement";
|
|
3
|
-
import { VersionedSubstateId } from "./VersionedSubstateId";
|
|
4
|
-
import { TransactionSignature } from "./TransactionSignature";
|
|
5
|
-
import { Epoch } from "@tari-project/typescript-bindings";
|
|
6
|
-
export interface Transaction {
|
|
7
|
-
id: string;
|
|
8
|
-
feeInstructions: Array<Instruction>;
|
|
9
|
-
instructions: Array<Instruction>;
|
|
10
|
-
inputs: Array<SubstateRequirement>;
|
|
11
|
-
minEpoch?: Epoch;
|
|
12
|
-
maxEpoch?: Epoch;
|
|
13
|
-
signatures: Array<TransactionSignature>;
|
|
14
|
-
filledInputs: Array<VersionedSubstateId>;
|
|
15
|
-
}
|
package/dist/Transaction.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Epoch } from "@tari-project/typescript-bindings";
|
|
2
|
-
import { Instruction } from "./Instruction";
|
|
3
|
-
import { SubstateRequirement } from "./SubstateRequirement";
|
|
4
|
-
import { VersionedSubstateId } from "./VersionedSubstateId";
|
|
5
|
-
export interface UnsignedTransaction {
|
|
6
|
-
feeInstructions: Instruction[];
|
|
7
|
-
instructions: Instruction[];
|
|
8
|
-
inputs: SubstateRequirement[];
|
|
9
|
-
filledInputs: VersionedSubstateId[];
|
|
10
|
-
minEpoch?: Epoch;
|
|
11
|
-
maxEpoch?: Epoch;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|