@meshsdk/core 1.5.11-beta.1 → 1.5.11-beta.3
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,9 +1,10 @@
|
|
|
1
|
-
import { Action, Asset,
|
|
1
|
+
import { Action, Asset, Data, LanguageVersion, Protocol } from '@mesh/common/types';
|
|
2
2
|
import { csl } from '@mesh/core';
|
|
3
|
-
import { MintItem, TxIn, PubKeyTxIn, MeshTxBuilderBody, RefTxIn } from './type';
|
|
3
|
+
import { MintItem, TxIn, PubKeyTxIn, MeshTxBuilderBody, RefTxIn, BuilderData } from './type';
|
|
4
4
|
export declare class MeshTxBuilderCore {
|
|
5
5
|
txHex: string;
|
|
6
6
|
txBuilder: csl.TransactionBuilder;
|
|
7
|
+
txEvaluationMultiplier: number;
|
|
7
8
|
private _protocolParams;
|
|
8
9
|
private txOutput?;
|
|
9
10
|
private addingScriptInput;
|
|
@@ -14,6 +15,17 @@ export declare class MeshTxBuilderCore {
|
|
|
14
15
|
protected txInQueueItem?: TxIn;
|
|
15
16
|
protected collateralQueueItem?: PubKeyTxIn;
|
|
16
17
|
protected refScriptTxInQueueItem?: RefTxIn;
|
|
18
|
+
/**
|
|
19
|
+
* Reset everything in the MeshTxBuilder instance
|
|
20
|
+
* @returns The MeshTxBuilder instance
|
|
21
|
+
*/
|
|
22
|
+
reset: () => this;
|
|
23
|
+
/**
|
|
24
|
+
* Make an empty transaction body for building transaction in object
|
|
25
|
+
* @returns An empty transaction body
|
|
26
|
+
*/
|
|
27
|
+
emptyTxBuilderBody: () => MeshTxBuilderBody;
|
|
28
|
+
constructor();
|
|
17
29
|
/**
|
|
18
30
|
* Synchronous functions here
|
|
19
31
|
*/
|
|
@@ -28,7 +40,7 @@ export declare class MeshTxBuilderCore {
|
|
|
28
40
|
* @returns The signed transaction in hex
|
|
29
41
|
*/
|
|
30
42
|
completeSigning: () => string;
|
|
31
|
-
serializeTxBody
|
|
43
|
+
private serializeTxBody;
|
|
32
44
|
/**
|
|
33
45
|
* Set the input for transaction
|
|
34
46
|
* @param txHash The transaction hash of the input UTxO
|
|
@@ -41,15 +53,17 @@ export declare class MeshTxBuilderCore {
|
|
|
41
53
|
/**
|
|
42
54
|
* Set the script for transaction input
|
|
43
55
|
* @param {string} scriptCbor The CborHex of the script
|
|
56
|
+
* @param version Optional - The Plutus script version
|
|
44
57
|
* @returns The MeshTxBuilder instance
|
|
45
58
|
*/
|
|
46
|
-
txInScript: (scriptCbor: string) => this;
|
|
59
|
+
txInScript: (scriptCbor: string, version?: LanguageVersion) => this;
|
|
47
60
|
/**
|
|
48
61
|
* Set the input datum for transaction input
|
|
49
|
-
* @param
|
|
62
|
+
* @param datum The datum in Mesh Data type or Raw constructor like format
|
|
63
|
+
* @param type The datum type, either Mesh Data type or Raw constructor like format
|
|
50
64
|
* @returns The MeshTxBuilder instance
|
|
51
65
|
*/
|
|
52
|
-
txInDatumValue: (datum: Data) => this;
|
|
66
|
+
txInDatumValue: (datum: Data | object | string, type?: 'Mesh' | 'Raw') => this;
|
|
53
67
|
/**
|
|
54
68
|
* Tell the transaction builder that the input UTxO has inlined datum
|
|
55
69
|
* @returns The MeshTxBuilder instance
|
|
@@ -57,11 +71,15 @@ export declare class MeshTxBuilderCore {
|
|
|
57
71
|
txInInlineDatumPresent: () => this;
|
|
58
72
|
/**
|
|
59
73
|
* Set the redeemer for the reference input to be spent in same transaction
|
|
60
|
-
* @param redeemer The redeemer in
|
|
74
|
+
* @param redeemer The redeemer in Mesh Data type or Raw constructor like format
|
|
61
75
|
* @param exUnits The execution units budget for the redeemer
|
|
76
|
+
* @param type The redeemer data type, either Mesh Data type or Raw constructor like format
|
|
62
77
|
* @returns The MeshTxBuilder instance
|
|
63
78
|
*/
|
|
64
|
-
txInRedeemerValue: (redeemer: Data, exUnits?:
|
|
79
|
+
txInRedeemerValue: (redeemer: Data | object | string, exUnits?: {
|
|
80
|
+
mem: number;
|
|
81
|
+
steps: number;
|
|
82
|
+
}, type?: 'Mesh' | 'Raw') => this;
|
|
65
83
|
/**
|
|
66
84
|
* Set the output for transaction
|
|
67
85
|
* @param {string} address The recipient of the output
|
|
@@ -71,22 +89,25 @@ export declare class MeshTxBuilderCore {
|
|
|
71
89
|
txOut: (address: string, amount: Asset[]) => this;
|
|
72
90
|
/**
|
|
73
91
|
* Set the output datum hash for transaction
|
|
74
|
-
* @param
|
|
92
|
+
* @param datum The datum in Mesh Data type or Raw constructor like format
|
|
93
|
+
* @param type The datum type, either Mesh Data type or Raw constructor like format
|
|
75
94
|
* @returns The MeshTxBuilder instance
|
|
76
95
|
*/
|
|
77
|
-
txOutDatumHashValue: (datum: Data) => this;
|
|
96
|
+
txOutDatumHashValue: (datum: Data | object | string, type?: 'Mesh' | 'Raw') => this;
|
|
78
97
|
/**
|
|
79
98
|
* Set the output inline datum for transaction
|
|
80
|
-
* @param
|
|
99
|
+
* @param datum The datum in Mesh Data type or Raw constructor like format
|
|
100
|
+
* @param type The datum type, either Mesh Data type or Raw constructor like format
|
|
81
101
|
* @returns The MeshTxBuilder instance
|
|
82
102
|
*/
|
|
83
|
-
txOutInlineDatumValue: (datum: Data) => this;
|
|
103
|
+
txOutInlineDatumValue: (datum: Data | object | string, type?: 'Mesh' | 'Raw') => this;
|
|
84
104
|
/**
|
|
85
105
|
* Set the reference script to be attached with the output
|
|
86
106
|
* @param scriptCbor The CBOR hex of the script to be attached to UTxO as reference script
|
|
107
|
+
* @param version Optional - The Plutus script version
|
|
87
108
|
* @returns The MeshTxBuilder instance
|
|
88
109
|
*/
|
|
89
|
-
txOutReferenceScript: (scriptCbor: string) => this;
|
|
110
|
+
txOutReferenceScript: (scriptCbor: string, version?: LanguageVersion) => this;
|
|
90
111
|
/**
|
|
91
112
|
* Set the instruction that it is currently using V2 Plutus spending scripts
|
|
92
113
|
* @returns The MeshTxBuilder instance
|
|
@@ -99,7 +120,7 @@ export declare class MeshTxBuilderCore {
|
|
|
99
120
|
* @param spendingScriptHash The script hash of the spending script
|
|
100
121
|
* @returns The MeshTxBuilder instance
|
|
101
122
|
*/
|
|
102
|
-
spendingTxInReference: (txHash: string, txIndex: number, spendingScriptHash?: string) => this;
|
|
123
|
+
spendingTxInReference: (txHash: string, txIndex: number, spendingScriptHash?: string, version?: LanguageVersion) => this;
|
|
103
124
|
/**
|
|
104
125
|
* [Alias of txInInlineDatumPresent] Set the instruction that the reference input has inline datum
|
|
105
126
|
* @returns The MeshTxBuilder instance
|
|
@@ -111,7 +132,10 @@ export declare class MeshTxBuilderCore {
|
|
|
111
132
|
* @param exUnits The execution units budget for the redeemer
|
|
112
133
|
* @returns The MeshTxBuilder instance
|
|
113
134
|
*/
|
|
114
|
-
spendingReferenceTxInRedeemerValue: (redeemer: Data, exUnits?:
|
|
135
|
+
spendingReferenceTxInRedeemerValue: (redeemer: Data, exUnits?: {
|
|
136
|
+
mem: number;
|
|
137
|
+
steps: number;
|
|
138
|
+
}) => this;
|
|
115
139
|
/**
|
|
116
140
|
* Specify a read only reference input. This reference input is not witnessing anything it is simply provided in the plutus script context.
|
|
117
141
|
* @param txHash The transaction hash of the reference UTxO
|
|
@@ -135,30 +159,38 @@ export declare class MeshTxBuilderCore {
|
|
|
135
159
|
/**
|
|
136
160
|
* Set the minting script of current mint
|
|
137
161
|
* @param scriptCBOR The CBOR hex of the minting policy script
|
|
162
|
+
* @param version Optional - The Plutus script version
|
|
138
163
|
* @returns The MeshTxBuilder instance
|
|
139
164
|
*/
|
|
140
|
-
mintingScript: (scriptCBOR: string) => this;
|
|
165
|
+
mintingScript: (scriptCBOR: string, version?: LanguageVersion) => this;
|
|
141
166
|
/**
|
|
142
167
|
* Use reference script for minting
|
|
143
168
|
* @param txHash The transaction hash of the UTxO
|
|
144
169
|
* @param txIndex The transaction index of the UTxO
|
|
145
170
|
* @returns The MeshTxBuilder instance
|
|
146
171
|
*/
|
|
147
|
-
mintTxInReference: (txHash: string, txIndex: number) => this;
|
|
172
|
+
mintTxInReference: (txHash: string, txIndex: number, version?: LanguageVersion) => this;
|
|
148
173
|
/**
|
|
149
174
|
* Set the redeemer for minting
|
|
150
|
-
* @param redeemer The redeemer in
|
|
175
|
+
* @param redeemer The redeemer in Mesh Data type or Raw constructor like format
|
|
151
176
|
* @param exUnits The execution units budget for the redeemer
|
|
177
|
+
* @param type The redeemer data type, either Mesh Data type or Raw constructor like format
|
|
152
178
|
* @returns The MeshTxBuilder instance
|
|
153
179
|
*/
|
|
154
|
-
mintReferenceTxInRedeemerValue: (redeemer: Data, exUnits?:
|
|
180
|
+
mintReferenceTxInRedeemerValue: (redeemer: Data | object | string, exUnits?: {
|
|
181
|
+
mem: number;
|
|
182
|
+
steps: number;
|
|
183
|
+
}, type?: 'Mesh' | 'Raw') => this;
|
|
155
184
|
/**
|
|
156
185
|
* Set the redeemer for the reference input to be spent in same transaction
|
|
157
186
|
* @param redeemer The redeemer in object format
|
|
158
187
|
* @param exUnits The execution units budget for the redeemer
|
|
159
188
|
* @returns The MeshTxBuilder instance
|
|
160
189
|
*/
|
|
161
|
-
mintRedeemerValue: (redeemer: Data, exUnits?:
|
|
190
|
+
mintRedeemerValue: (redeemer: Data | object | string, exUnits?: {
|
|
191
|
+
mem: number;
|
|
192
|
+
steps: number;
|
|
193
|
+
}, type?: 'Mesh' | 'Raw') => this;
|
|
162
194
|
/**
|
|
163
195
|
* Set the required signer of the transaction
|
|
164
196
|
* @param pubKeyHash The PubKeyHash of the required signer
|
|
@@ -236,4 +268,6 @@ export declare class MeshTxBuilderCore {
|
|
|
236
268
|
private addAllRequiredSignatures;
|
|
237
269
|
private addAllMetadata;
|
|
238
270
|
protected updateRedeemer: (meshTxBuilderBody: MeshTxBuilderBody, txEvaluation: Omit<Action, 'data'>[]) => void;
|
|
271
|
+
protected castRawDataToJsonString: (rawData: object | string) => string;
|
|
272
|
+
protected castDataToPlutusData: ({ type, content }: BuilderData) => csl.PlutusData;
|
|
239
273
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Asset, Budget, Data } from '@mesh/common/types';
|
|
1
|
+
import { Asset, Budget, Data, LanguageVersion, PlutusScript } from '@mesh/common/types';
|
|
2
2
|
export declare type MeshTxBuilderBody = {
|
|
3
3
|
inputs: TxIn[];
|
|
4
4
|
outputs: Output[];
|
|
@@ -11,53 +11,33 @@ export declare type MeshTxBuilderBody = {
|
|
|
11
11
|
validityRange: ValidityRange;
|
|
12
12
|
signingKey: string[];
|
|
13
13
|
};
|
|
14
|
-
export declare type Output = {
|
|
15
|
-
address: string;
|
|
16
|
-
amount: Asset[];
|
|
17
|
-
datum?: {
|
|
18
|
-
type: 'Hash' | 'Inline';
|
|
19
|
-
data: Data;
|
|
20
|
-
};
|
|
21
|
-
referenceScript?: string;
|
|
22
|
-
};
|
|
23
|
-
export declare type ValidityRange = {
|
|
24
|
-
invalidBefore?: number;
|
|
25
|
-
invalidHereafter?: number;
|
|
26
|
-
};
|
|
27
|
-
export declare type RequiredWith<T, K extends keyof T> = Required<T> & {
|
|
28
|
-
[P in K]: Required<T[P]>;
|
|
29
|
-
};
|
|
30
|
-
export declare type RefTxIn = {
|
|
31
|
-
txHash: string;
|
|
32
|
-
txIndex: number;
|
|
33
|
-
};
|
|
34
14
|
export declare type TxIn = PubKeyTxIn | ScriptTxIn;
|
|
35
15
|
export declare type PubKeyTxIn = {
|
|
36
16
|
type: 'PubKey';
|
|
37
17
|
txIn: TxInParameter;
|
|
38
18
|
};
|
|
39
|
-
export declare type ScriptTxIn = {
|
|
40
|
-
type: 'Script';
|
|
41
|
-
txIn: TxInParameter;
|
|
42
|
-
scriptTxIn: ScriptTxInParameter;
|
|
43
|
-
};
|
|
44
19
|
export declare type TxInParameter = {
|
|
45
20
|
txHash: string;
|
|
46
21
|
txIndex: number;
|
|
47
22
|
amount?: Asset[];
|
|
48
23
|
address?: string;
|
|
49
24
|
};
|
|
25
|
+
export declare type ScriptTxIn = {
|
|
26
|
+
type: 'Script';
|
|
27
|
+
txIn: TxInParameter;
|
|
28
|
+
scriptTxIn: ScriptTxInParameter;
|
|
29
|
+
};
|
|
50
30
|
export declare type ScriptTxInParameter = {
|
|
51
31
|
scriptSource?: {
|
|
52
32
|
type: 'Provided';
|
|
53
|
-
|
|
33
|
+
script: PlutusScript;
|
|
54
34
|
} | {
|
|
55
35
|
type: 'Inline';
|
|
56
36
|
txInInfo: ScriptSourceInfo;
|
|
57
37
|
};
|
|
58
38
|
datumSource?: {
|
|
59
39
|
type: 'Provided';
|
|
60
|
-
data:
|
|
40
|
+
data: BuilderData;
|
|
61
41
|
} | {
|
|
62
42
|
type: 'Inline';
|
|
63
43
|
txHash: string;
|
|
@@ -69,6 +49,20 @@ export declare type ScriptSourceInfo = {
|
|
|
69
49
|
txHash: string;
|
|
70
50
|
txIndex: number;
|
|
71
51
|
spendingScriptHash?: string;
|
|
52
|
+
version: LanguageVersion;
|
|
53
|
+
};
|
|
54
|
+
export declare type RefTxIn = {
|
|
55
|
+
txHash: string;
|
|
56
|
+
txIndex: number;
|
|
57
|
+
};
|
|
58
|
+
export declare type Output = {
|
|
59
|
+
address: string;
|
|
60
|
+
amount: Asset[];
|
|
61
|
+
datum?: {
|
|
62
|
+
type: 'Hash' | 'Inline';
|
|
63
|
+
data: BuilderData;
|
|
64
|
+
};
|
|
65
|
+
referenceScript?: PlutusScript;
|
|
72
66
|
};
|
|
73
67
|
export declare type MintItem = {
|
|
74
68
|
type: 'Plutus' | 'Native';
|
|
@@ -78,18 +72,33 @@ export declare type MintItem = {
|
|
|
78
72
|
redeemer?: Redeemer;
|
|
79
73
|
scriptSource?: {
|
|
80
74
|
type: 'Provided';
|
|
81
|
-
|
|
75
|
+
script: PlutusScript;
|
|
82
76
|
} | {
|
|
83
77
|
type: 'Reference Script';
|
|
84
78
|
txHash: string;
|
|
85
79
|
txIndex: number;
|
|
80
|
+
version: LanguageVersion;
|
|
86
81
|
};
|
|
87
82
|
};
|
|
83
|
+
export declare type ValidityRange = {
|
|
84
|
+
invalidBefore?: number;
|
|
85
|
+
invalidHereafter?: number;
|
|
86
|
+
};
|
|
87
|
+
export declare type BuilderData = {
|
|
88
|
+
type: 'Mesh';
|
|
89
|
+
content: Data;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'Raw';
|
|
92
|
+
content: string | object;
|
|
93
|
+
};
|
|
88
94
|
export declare type Redeemer = {
|
|
89
|
-
data:
|
|
95
|
+
data: BuilderData;
|
|
90
96
|
exUnits: Budget;
|
|
91
97
|
};
|
|
92
98
|
export declare type Metadata = {
|
|
93
99
|
tag: string;
|
|
94
100
|
metadata: object;
|
|
95
101
|
};
|
|
102
|
+
export declare type RequiredWith<T, K extends keyof T> = Required<T> & {
|
|
103
|
+
[P in K]: Required<T[P]>;
|
|
104
|
+
};
|
package/package.json
CHANGED