@tari-project/tarijs-builders 0.5.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TariUniverseSigner } from "@tari-project/tari-universe-signer";
|
|
2
|
-
import { TariSigner
|
|
3
|
-
import { Transaction, TransactionResult, DownSubstates, UpSubstates, SubmitTxResult } from "@tari-project/tarijs-types";
|
|
4
|
-
export declare function buildTransactionRequest(transaction: Transaction, accountId: number, requiredSubstates:
|
|
2
|
+
import { TariSigner } from "@tari-project/tari-signer";
|
|
3
|
+
import { Transaction, TransactionResult, DownSubstates, UpSubstates, SubmitTxResult, ReqSubstate, SubmitTransactionRequest } from "@tari-project/tarijs-types";
|
|
4
|
+
export declare function buildTransactionRequest(transaction: Transaction, accountId: number, requiredSubstates: ReqSubstate[], inputRefs?: never[], isDryRun?: boolean, network?: number, isSealSignerAuthorized?: boolean, detectInputsUseUnversioned?: boolean): SubmitTransactionRequest;
|
|
5
5
|
export declare function submitAndWaitForTransaction(signer: TariSigner, req: SubmitTransactionRequest): Promise<SubmitTxResult>;
|
|
6
6
|
export declare function waitForTransactionResult(signer: TariSigner | TariUniverseSigner, transactionId: string): Promise<TransactionResult>;
|
|
7
7
|
export declare function getAcceptResultSubstates(txResult: TransactionResult): {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { TransactionStatus, } from "@tari-project/tarijs-types";
|
|
2
2
|
export function buildTransactionRequest(transaction, accountId, requiredSubstates, inputRefs = [], isDryRun = false, network = 0, isSealSignerAuthorized = true, detectInputsUseUnversioned = true) {
|
|
3
3
|
return {
|
|
4
|
-
//TODO refactor SubTxReq type to not use 'object[]' and types match
|
|
5
|
-
// https://github.com/tari-project/tari.js/issues/25
|
|
6
4
|
network,
|
|
7
5
|
account_id: accountId,
|
|
8
6
|
instructions: transaction.instructions,
|
|
@@ -45,7 +43,7 @@ export async function waitForTransactionResult(signer, transactionId) {
|
|
|
45
43
|
throw new Error(`Transaction rejected: ${JSON.stringify(resp.result)}`);
|
|
46
44
|
}
|
|
47
45
|
if (FINALIZED_STATUSES.includes(resp.status)) {
|
|
48
|
-
return resp;
|
|
46
|
+
return resp;
|
|
49
47
|
}
|
|
50
48
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
51
49
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ComponentAddress, ConfidentialClaim, ConfidentialWithdrawProof, Instruction, ResourceAddress, SubstateRequirement, Transaction, TransactionSignature, UnsignedTransaction,
|
|
1
|
+
import { ComponentAddress, ConfidentialClaim, ConfidentialWithdrawProof, Instruction, ResourceAddress, SubstateRequirement, Transaction, TransactionSignature, UnsignedTransaction, PublishedTemplateAddress, TransactionArg } from "@tari-project/tarijs-types";
|
|
2
2
|
export interface TransactionConstructor {
|
|
3
3
|
new (unsignedTransaction: UnsignedTransaction, signatures: TransactionSignature[]): Transaction;
|
|
4
4
|
}
|
|
5
5
|
export interface TariFunctionDefinition {
|
|
6
6
|
functionName: string;
|
|
7
|
-
args?:
|
|
8
|
-
templateAddress:
|
|
7
|
+
args?: TransactionArg[];
|
|
8
|
+
templateAddress: PublishedTemplateAddress;
|
|
9
9
|
}
|
|
10
10
|
export interface TariMethodDefinition {
|
|
11
11
|
methodName: string;
|
|
12
|
-
args?:
|
|
12
|
+
args?: TransactionArg[];
|
|
13
13
|
componentAddress: ComponentAddress;
|
|
14
14
|
}
|
|
15
15
|
export interface TariCreateAccountDefinition {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Epoch, Instruction, SubstateRequirement, Transaction,
|
|
1
|
+
import { Epoch, Instruction, SubstateRequirement, Transaction, TransactionSignature, UnsignedTransaction, VersionedSubstateId } from "@tari-project/tarijs-types";
|
|
2
2
|
export declare class TransactionRequest implements Transaction {
|
|
3
|
-
id:
|
|
3
|
+
id: string;
|
|
4
4
|
feeInstructions: Array<Instruction>;
|
|
5
5
|
instructions: Array<Instruction>;
|
|
6
6
|
inputs: Array<SubstateRequirement>;
|
|
@@ -10,18 +10,16 @@ export declare class TransactionRequest implements Transaction {
|
|
|
10
10
|
maxEpoch?: Epoch;
|
|
11
11
|
filledInputs: VersionedSubstateId[];
|
|
12
12
|
constructor(unsignedTransaction: UnsignedTransaction, signatures: TransactionSignature[]);
|
|
13
|
-
private calculateHash;
|
|
14
13
|
withFilledInputs(filled_inputs: Array<VersionedSubstateId>): this;
|
|
15
|
-
getId(): TransactionId;
|
|
16
|
-
checkId(): boolean;
|
|
17
14
|
getUnsignedTransaction(): UnsignedTransaction;
|
|
18
15
|
getFeeInstructions(): Instruction[];
|
|
19
16
|
getInstructions(): Instruction[];
|
|
20
17
|
getSignatures(): TransactionSignature[];
|
|
21
|
-
getHash(): string;
|
|
22
18
|
getInputs(): SubstateRequirement[];
|
|
23
19
|
getFilledInputs(): VersionedSubstateId[];
|
|
24
20
|
getFilledInputsMut(): VersionedSubstateId[];
|
|
25
21
|
getMinEpoch(): Epoch | undefined;
|
|
26
22
|
getMaxEpoch(): Epoch | undefined;
|
|
23
|
+
setId(id: string): void;
|
|
24
|
+
getId(): string;
|
|
27
25
|
}
|
|
@@ -11,7 +11,7 @@ export class TransactionRequest {
|
|
|
11
11
|
maxEpoch;
|
|
12
12
|
filledInputs;
|
|
13
13
|
constructor(unsignedTransaction, signatures) {
|
|
14
|
-
this.id =
|
|
14
|
+
this.id = "";
|
|
15
15
|
this.feeInstructions = unsignedTransaction.feeInstructions;
|
|
16
16
|
this.instructions = unsignedTransaction.instructions;
|
|
17
17
|
this.inputs = unsignedTransaction.inputs;
|
|
@@ -21,19 +21,9 @@ export class TransactionRequest {
|
|
|
21
21
|
// Inputs filled by some authority. These are not part of the transaction hash nor the signature
|
|
22
22
|
this.filledInputs = [];
|
|
23
23
|
}
|
|
24
|
-
calculateHash() {
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
24
|
withFilledInputs(filled_inputs) {
|
|
28
25
|
return { ...this, filled_inputs };
|
|
29
26
|
}
|
|
30
|
-
getId() {
|
|
31
|
-
return this.id;
|
|
32
|
-
}
|
|
33
|
-
checkId() {
|
|
34
|
-
const id = this.calculateHash();
|
|
35
|
-
return id === this.id;
|
|
36
|
-
}
|
|
37
27
|
getUnsignedTransaction() {
|
|
38
28
|
return this.unsignedTransaction;
|
|
39
29
|
}
|
|
@@ -46,9 +36,6 @@ export class TransactionRequest {
|
|
|
46
36
|
getSignatures() {
|
|
47
37
|
return this.signatures;
|
|
48
38
|
}
|
|
49
|
-
getHash() {
|
|
50
|
-
return this.id;
|
|
51
|
-
}
|
|
52
39
|
getInputs() {
|
|
53
40
|
return this.inputs;
|
|
54
41
|
}
|
|
@@ -64,4 +51,10 @@ export class TransactionRequest {
|
|
|
64
51
|
getMaxEpoch() {
|
|
65
52
|
return this.maxEpoch;
|
|
66
53
|
}
|
|
54
|
+
setId(id) {
|
|
55
|
+
this.id = id;
|
|
56
|
+
}
|
|
57
|
+
getId() {
|
|
58
|
+
return this.id;
|
|
59
|
+
}
|
|
67
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tarijs-builders",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tari-project/
|
|
14
|
-
"@tari-project/tari-signer": "^0.5.
|
|
15
|
-
"@tari-project/tarijs-types": "^0.5.
|
|
16
|
-
"@tari-project/tari-universe-signer": "^0.5.0"
|
|
13
|
+
"@tari-project/tari-signer": "^0.5.1",
|
|
14
|
+
"@tari-project/tari-universe-signer": "^0.5.1",
|
|
15
|
+
"@tari-project/tarijs-types": "^0.5.1"
|
|
17
16
|
},
|
|
18
17
|
"devDependencies": {
|
|
19
18
|
"@types/node": "^22.13.1",
|