@meshsdk/core 1.9.0-beta.21 → 1.9.0-beta.22
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/index.cjs +138 -0
- package/dist/index.d.cts +113 -2
- package/dist/index.d.ts +113 -2
- package/dist/index.js +135 -0
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
+
MintingBlueprint: () => MintingBlueprint,
|
|
35
|
+
SpendingBlueprint: () => SpendingBlueprint,
|
|
36
|
+
WithdrawalBlueprint: () => WithdrawalBlueprint,
|
|
34
37
|
applyCborEncoding: () => applyCborEncoding,
|
|
35
38
|
applyParamsToScript: () => applyParamsToScript2,
|
|
36
39
|
checkSignature: () => import_core_cst.checkSignature,
|
|
@@ -145,6 +148,138 @@ var serializeData = (rawData, type) => {
|
|
|
145
148
|
return serializer.serializeData(builderData);
|
|
146
149
|
};
|
|
147
150
|
|
|
151
|
+
// src/utils/blueprint/minting.ts
|
|
152
|
+
var MintingBlueprint = class {
|
|
153
|
+
version;
|
|
154
|
+
cbor;
|
|
155
|
+
hash;
|
|
156
|
+
constructor(version) {
|
|
157
|
+
this.version = version;
|
|
158
|
+
this.cbor = "";
|
|
159
|
+
this.hash = "";
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
163
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
164
|
+
* @param params The parameters to apply, in an array.
|
|
165
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
166
|
+
* @returns The minting blueprint object
|
|
167
|
+
*/
|
|
168
|
+
paramScript(compiledCode, params, paramsType = "Mesh") {
|
|
169
|
+
const cbor = applyParamsToScript2(compiledCode, params, paramsType);
|
|
170
|
+
const hash = resolveScriptHash(cbor, this.version);
|
|
171
|
+
this.hash = hash;
|
|
172
|
+
this.cbor = cbor;
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Initialize the minting blueprint, with no parameters
|
|
177
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
178
|
+
* @returns The minting blueprint object
|
|
179
|
+
*/
|
|
180
|
+
noParamScript(compiledCode) {
|
|
181
|
+
return this.paramScript(compiledCode, []);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/utils/blueprint/spending.ts
|
|
186
|
+
var SpendingBlueprint = class {
|
|
187
|
+
version;
|
|
188
|
+
networkId;
|
|
189
|
+
cbor;
|
|
190
|
+
hash;
|
|
191
|
+
address;
|
|
192
|
+
stakeHash;
|
|
193
|
+
isStakeScriptCredential;
|
|
194
|
+
constructor(version, networkId, stakeHash, isStakeScriptCredential = false) {
|
|
195
|
+
this.version = version;
|
|
196
|
+
this.networkId = networkId;
|
|
197
|
+
this.stakeHash = stakeHash;
|
|
198
|
+
this.cbor = "";
|
|
199
|
+
this.hash = "";
|
|
200
|
+
this.address = "";
|
|
201
|
+
this.isStakeScriptCredential = isStakeScriptCredential;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
205
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
206
|
+
* @param params The parameters to apply, in an array.
|
|
207
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
208
|
+
* @returns
|
|
209
|
+
*/
|
|
210
|
+
paramScript(compiledCode, params, paramsType = "Mesh") {
|
|
211
|
+
const cbor = applyParamsToScript2(compiledCode, params, paramsType);
|
|
212
|
+
const hash = resolveScriptHash(cbor, this.version);
|
|
213
|
+
const plutusScript = {
|
|
214
|
+
code: cbor,
|
|
215
|
+
version: this.version
|
|
216
|
+
};
|
|
217
|
+
const address = serializePlutusScript(
|
|
218
|
+
plutusScript,
|
|
219
|
+
this.stakeHash,
|
|
220
|
+
this.networkId,
|
|
221
|
+
this.isStakeScriptCredential
|
|
222
|
+
).address;
|
|
223
|
+
this.hash = hash;
|
|
224
|
+
this.cbor = cbor;
|
|
225
|
+
this.address = address;
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Initialize the minting blueprint, with no parameters
|
|
230
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
231
|
+
* @returns The minting blueprint object
|
|
232
|
+
*/
|
|
233
|
+
noParamScript(compiledCode) {
|
|
234
|
+
return this.paramScript(compiledCode, []);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// src/utils/blueprint/withdrawal.ts
|
|
239
|
+
var WithdrawalBlueprint = class {
|
|
240
|
+
version;
|
|
241
|
+
networkId;
|
|
242
|
+
cbor;
|
|
243
|
+
hash;
|
|
244
|
+
address;
|
|
245
|
+
isStakeScriptCredential;
|
|
246
|
+
constructor(version, networkId, isStakeScriptCredential = false) {
|
|
247
|
+
this.version = version;
|
|
248
|
+
this.networkId = networkId;
|
|
249
|
+
this.cbor = "";
|
|
250
|
+
this.hash = "";
|
|
251
|
+
this.address = "";
|
|
252
|
+
this.isStakeScriptCredential = isStakeScriptCredential;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Initialize the withdrawal blueprint, with the same parameters to `applyParamsToScript`
|
|
256
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
257
|
+
* @param params The parameters to apply, in an array.
|
|
258
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
259
|
+
* @returns The withdrawal blueprint object
|
|
260
|
+
*/
|
|
261
|
+
paramScript(compiledCode, params, paramsType = "Mesh") {
|
|
262
|
+
const cbor = applyParamsToScript2(compiledCode, params, paramsType);
|
|
263
|
+
const hash = resolveScriptHash(cbor, this.version);
|
|
264
|
+
this.address = serializeRewardAddress(
|
|
265
|
+
hash,
|
|
266
|
+
this.isStakeScriptCredential,
|
|
267
|
+
this.networkId
|
|
268
|
+
);
|
|
269
|
+
this.hash = hash;
|
|
270
|
+
this.cbor = cbor;
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Initialize the withdrawal blueprint, with no parameters
|
|
275
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
276
|
+
* @returns The withdrawal blueprint object
|
|
277
|
+
*/
|
|
278
|
+
noParamScript(compiledCode) {
|
|
279
|
+
return this.paramScript(compiledCode, []);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
148
283
|
// src/index.ts
|
|
149
284
|
__reExport(index_exports, require("@meshsdk/common"), module.exports);
|
|
150
285
|
var cst = __toESM(require("@meshsdk/core-cst"), 1);
|
|
@@ -154,6 +289,9 @@ __reExport(index_exports, require("@meshsdk/wallet"), module.exports);
|
|
|
154
289
|
var import_core_cst = require("@meshsdk/core-cst");
|
|
155
290
|
// Annotate the CommonJS export names for ESM import in node:
|
|
156
291
|
0 && (module.exports = {
|
|
292
|
+
MintingBlueprint,
|
|
293
|
+
SpendingBlueprint,
|
|
294
|
+
WithdrawalBlueprint,
|
|
157
295
|
applyCborEncoding,
|
|
158
296
|
applyParamsToScript,
|
|
159
297
|
checkSignature,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _meshsdk_common from '@meshsdk/common';
|
|
2
|
-
import { Data, NativeScript, LanguageVersion, PlutusScript, DeserializedAddress, PubKeyAddress, ScriptAddress, BuilderData, PlutusDataType } from '@meshsdk/common';
|
|
2
|
+
import { Data, NativeScript, LanguageVersion, PlutusScript, DeserializedAddress, PubKeyAddress, ScriptAddress, BuilderData, PlutusDataType, IMintingBlueprint, ISpendingBlueprint, IWithdrawalBlueprint } from '@meshsdk/common';
|
|
3
3
|
export * from '@meshsdk/common';
|
|
4
4
|
import * as coreCst from '@meshsdk/core-cst';
|
|
5
5
|
export { coreCst as core };
|
|
@@ -170,4 +170,115 @@ declare const serializeRewardAddress: (hash: string, isScriptHash?: boolean, net
|
|
|
170
170
|
*/
|
|
171
171
|
declare const serializeData: (rawData: BuilderData["content"], type: Omit<PlutusDataType, "CBOR">) => string;
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Minting blueprint
|
|
175
|
+
* @category Blueprint
|
|
176
|
+
* @implements IMintingBlueprint
|
|
177
|
+
* @class
|
|
178
|
+
* @example
|
|
179
|
+
*
|
|
180
|
+
* const blueprint = new MintingBlueprint("V3");
|
|
181
|
+
* blueprint.paramScript("84xxxxxx", ["params"], "Mesh");
|
|
182
|
+
*
|
|
183
|
+
* const policyId = blueprint.hash;
|
|
184
|
+
* const scriptCbor = blueprint.cbor;
|
|
185
|
+
*/
|
|
186
|
+
declare class MintingBlueprint implements IMintingBlueprint {
|
|
187
|
+
version: LanguageVersion;
|
|
188
|
+
cbor: string;
|
|
189
|
+
hash: string;
|
|
190
|
+
constructor(version: LanguageVersion);
|
|
191
|
+
/**
|
|
192
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
193
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
194
|
+
* @param params The parameters to apply, in an array.
|
|
195
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
196
|
+
* @returns The minting blueprint object
|
|
197
|
+
*/
|
|
198
|
+
paramScript(compiledCode: string, params: string[], paramsType?: PlutusDataType): this;
|
|
199
|
+
/**
|
|
200
|
+
* Initialize the minting blueprint, with no parameters
|
|
201
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
202
|
+
* @returns The minting blueprint object
|
|
203
|
+
*/
|
|
204
|
+
noParamScript(compiledCode: string): this;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Spending blueprint
|
|
209
|
+
* @category Blueprint
|
|
210
|
+
* @implements ISpendingBlueprint
|
|
211
|
+
* @class
|
|
212
|
+
* @example
|
|
213
|
+
*
|
|
214
|
+
* const blueprint = new SpendingBlueprint("V3", 0, stakeHash);
|
|
215
|
+
* blueprint.paramScript("84xxxxxx", ["params"], "Mesh");
|
|
216
|
+
*
|
|
217
|
+
* const scriptHash = blueprint.hash;
|
|
218
|
+
* const scriptCbor = blueprint.cbor;
|
|
219
|
+
* const scriptAddress = blueprint.address;
|
|
220
|
+
*/
|
|
221
|
+
declare class SpendingBlueprint implements ISpendingBlueprint {
|
|
222
|
+
version: LanguageVersion;
|
|
223
|
+
networkId: number;
|
|
224
|
+
cbor: string;
|
|
225
|
+
hash: string;
|
|
226
|
+
address: string;
|
|
227
|
+
stakeHash?: string;
|
|
228
|
+
isStakeScriptCredential: boolean;
|
|
229
|
+
constructor(version: LanguageVersion, networkId: number, stakeHash: string, isStakeScriptCredential?: boolean);
|
|
230
|
+
/**
|
|
231
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
232
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
233
|
+
* @param params The parameters to apply, in an array.
|
|
234
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
235
|
+
* @returns
|
|
236
|
+
*/
|
|
237
|
+
paramScript(compiledCode: string, params: string[], paramsType?: PlutusDataType): this;
|
|
238
|
+
/**
|
|
239
|
+
* Initialize the minting blueprint, with no parameters
|
|
240
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
241
|
+
* @returns The minting blueprint object
|
|
242
|
+
*/
|
|
243
|
+
noParamScript(compiledCode: string): this;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Withdrawal blueprint
|
|
248
|
+
* @category Blueprint
|
|
249
|
+
* @implements IWithdrawalBlueprint
|
|
250
|
+
* @class
|
|
251
|
+
* @example
|
|
252
|
+
*
|
|
253
|
+
* const blueprint = new WithdrawalBlueprint("V3", 0);
|
|
254
|
+
* blueprint.paramScript("84xxxxxx", ["params"], "Mesh");
|
|
255
|
+
*
|
|
256
|
+
* const scriptHash = blueprint.hash;
|
|
257
|
+
* const scriptCbor = blueprint.cbor;
|
|
258
|
+
* const rewardAddress = blueprint.address;
|
|
259
|
+
*/
|
|
260
|
+
declare class WithdrawalBlueprint implements IWithdrawalBlueprint {
|
|
261
|
+
version: LanguageVersion;
|
|
262
|
+
networkId: number;
|
|
263
|
+
cbor: string;
|
|
264
|
+
hash: string;
|
|
265
|
+
address: string;
|
|
266
|
+
isStakeScriptCredential: boolean;
|
|
267
|
+
constructor(version: LanguageVersion, networkId: number, isStakeScriptCredential?: boolean);
|
|
268
|
+
/**
|
|
269
|
+
* Initialize the withdrawal blueprint, with the same parameters to `applyParamsToScript`
|
|
270
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
271
|
+
* @param params The parameters to apply, in an array.
|
|
272
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
273
|
+
* @returns The withdrawal blueprint object
|
|
274
|
+
*/
|
|
275
|
+
paramScript(compiledCode: string, params: string[], paramsType?: PlutusDataType): this;
|
|
276
|
+
/**
|
|
277
|
+
* Initialize the withdrawal blueprint, with no parameters
|
|
278
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
279
|
+
* @returns The withdrawal blueprint object
|
|
280
|
+
*/
|
|
281
|
+
noParamScript(compiledCode: string): this;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export { MintingBlueprint, SpendingBlueprint, WithdrawalBlueprint, applyCborEncoding, applyParamsToScript, deserializeAddress, deserializeDatum, deserializePoolId, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptHash, resolveScriptHashDRepId, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, serializeAddressObj, serializeData, serializeNativeScript, serializePlutusScript, serializePoolId, serializeRewardAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _meshsdk_common from '@meshsdk/common';
|
|
2
|
-
import { Data, NativeScript, LanguageVersion, PlutusScript, DeserializedAddress, PubKeyAddress, ScriptAddress, BuilderData, PlutusDataType } from '@meshsdk/common';
|
|
2
|
+
import { Data, NativeScript, LanguageVersion, PlutusScript, DeserializedAddress, PubKeyAddress, ScriptAddress, BuilderData, PlutusDataType, IMintingBlueprint, ISpendingBlueprint, IWithdrawalBlueprint } from '@meshsdk/common';
|
|
3
3
|
export * from '@meshsdk/common';
|
|
4
4
|
import * as coreCst from '@meshsdk/core-cst';
|
|
5
5
|
export { coreCst as core };
|
|
@@ -170,4 +170,115 @@ declare const serializeRewardAddress: (hash: string, isScriptHash?: boolean, net
|
|
|
170
170
|
*/
|
|
171
171
|
declare const serializeData: (rawData: BuilderData["content"], type: Omit<PlutusDataType, "CBOR">) => string;
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Minting blueprint
|
|
175
|
+
* @category Blueprint
|
|
176
|
+
* @implements IMintingBlueprint
|
|
177
|
+
* @class
|
|
178
|
+
* @example
|
|
179
|
+
*
|
|
180
|
+
* const blueprint = new MintingBlueprint("V3");
|
|
181
|
+
* blueprint.paramScript("84xxxxxx", ["params"], "Mesh");
|
|
182
|
+
*
|
|
183
|
+
* const policyId = blueprint.hash;
|
|
184
|
+
* const scriptCbor = blueprint.cbor;
|
|
185
|
+
*/
|
|
186
|
+
declare class MintingBlueprint implements IMintingBlueprint {
|
|
187
|
+
version: LanguageVersion;
|
|
188
|
+
cbor: string;
|
|
189
|
+
hash: string;
|
|
190
|
+
constructor(version: LanguageVersion);
|
|
191
|
+
/**
|
|
192
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
193
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
194
|
+
* @param params The parameters to apply, in an array.
|
|
195
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
196
|
+
* @returns The minting blueprint object
|
|
197
|
+
*/
|
|
198
|
+
paramScript(compiledCode: string, params: string[], paramsType?: PlutusDataType): this;
|
|
199
|
+
/**
|
|
200
|
+
* Initialize the minting blueprint, with no parameters
|
|
201
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
202
|
+
* @returns The minting blueprint object
|
|
203
|
+
*/
|
|
204
|
+
noParamScript(compiledCode: string): this;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Spending blueprint
|
|
209
|
+
* @category Blueprint
|
|
210
|
+
* @implements ISpendingBlueprint
|
|
211
|
+
* @class
|
|
212
|
+
* @example
|
|
213
|
+
*
|
|
214
|
+
* const blueprint = new SpendingBlueprint("V3", 0, stakeHash);
|
|
215
|
+
* blueprint.paramScript("84xxxxxx", ["params"], "Mesh");
|
|
216
|
+
*
|
|
217
|
+
* const scriptHash = blueprint.hash;
|
|
218
|
+
* const scriptCbor = blueprint.cbor;
|
|
219
|
+
* const scriptAddress = blueprint.address;
|
|
220
|
+
*/
|
|
221
|
+
declare class SpendingBlueprint implements ISpendingBlueprint {
|
|
222
|
+
version: LanguageVersion;
|
|
223
|
+
networkId: number;
|
|
224
|
+
cbor: string;
|
|
225
|
+
hash: string;
|
|
226
|
+
address: string;
|
|
227
|
+
stakeHash?: string;
|
|
228
|
+
isStakeScriptCredential: boolean;
|
|
229
|
+
constructor(version: LanguageVersion, networkId: number, stakeHash: string, isStakeScriptCredential?: boolean);
|
|
230
|
+
/**
|
|
231
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
232
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
233
|
+
* @param params The parameters to apply, in an array.
|
|
234
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
235
|
+
* @returns
|
|
236
|
+
*/
|
|
237
|
+
paramScript(compiledCode: string, params: string[], paramsType?: PlutusDataType): this;
|
|
238
|
+
/**
|
|
239
|
+
* Initialize the minting blueprint, with no parameters
|
|
240
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
241
|
+
* @returns The minting blueprint object
|
|
242
|
+
*/
|
|
243
|
+
noParamScript(compiledCode: string): this;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Withdrawal blueprint
|
|
248
|
+
* @category Blueprint
|
|
249
|
+
* @implements IWithdrawalBlueprint
|
|
250
|
+
* @class
|
|
251
|
+
* @example
|
|
252
|
+
*
|
|
253
|
+
* const blueprint = new WithdrawalBlueprint("V3", 0);
|
|
254
|
+
* blueprint.paramScript("84xxxxxx", ["params"], "Mesh");
|
|
255
|
+
*
|
|
256
|
+
* const scriptHash = blueprint.hash;
|
|
257
|
+
* const scriptCbor = blueprint.cbor;
|
|
258
|
+
* const rewardAddress = blueprint.address;
|
|
259
|
+
*/
|
|
260
|
+
declare class WithdrawalBlueprint implements IWithdrawalBlueprint {
|
|
261
|
+
version: LanguageVersion;
|
|
262
|
+
networkId: number;
|
|
263
|
+
cbor: string;
|
|
264
|
+
hash: string;
|
|
265
|
+
address: string;
|
|
266
|
+
isStakeScriptCredential: boolean;
|
|
267
|
+
constructor(version: LanguageVersion, networkId: number, isStakeScriptCredential?: boolean);
|
|
268
|
+
/**
|
|
269
|
+
* Initialize the withdrawal blueprint, with the same parameters to `applyParamsToScript`
|
|
270
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
271
|
+
* @param params The parameters to apply, in an array.
|
|
272
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
273
|
+
* @returns The withdrawal blueprint object
|
|
274
|
+
*/
|
|
275
|
+
paramScript(compiledCode: string, params: string[], paramsType?: PlutusDataType): this;
|
|
276
|
+
/**
|
|
277
|
+
* Initialize the withdrawal blueprint, with no parameters
|
|
278
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
279
|
+
* @returns The withdrawal blueprint object
|
|
280
|
+
*/
|
|
281
|
+
noParamScript(compiledCode: string): this;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export { MintingBlueprint, SpendingBlueprint, WithdrawalBlueprint, applyCborEncoding, applyParamsToScript, deserializeAddress, deserializeDatum, deserializePoolId, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptHash, resolveScriptHashDRepId, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, serializeAddressObj, serializeData, serializeNativeScript, serializePlutusScript, serializePoolId, serializeRewardAddress };
|
package/dist/index.js
CHANGED
|
@@ -78,6 +78,138 @@ var serializeData = (rawData, type) => {
|
|
|
78
78
|
return serializer.serializeData(builderData);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
// src/utils/blueprint/minting.ts
|
|
82
|
+
var MintingBlueprint = class {
|
|
83
|
+
version;
|
|
84
|
+
cbor;
|
|
85
|
+
hash;
|
|
86
|
+
constructor(version) {
|
|
87
|
+
this.version = version;
|
|
88
|
+
this.cbor = "";
|
|
89
|
+
this.hash = "";
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
93
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
94
|
+
* @param params The parameters to apply, in an array.
|
|
95
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
96
|
+
* @returns The minting blueprint object
|
|
97
|
+
*/
|
|
98
|
+
paramScript(compiledCode, params, paramsType = "Mesh") {
|
|
99
|
+
const cbor = applyParamsToScript2(compiledCode, params, paramsType);
|
|
100
|
+
const hash = resolveScriptHash(cbor, this.version);
|
|
101
|
+
this.hash = hash;
|
|
102
|
+
this.cbor = cbor;
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Initialize the minting blueprint, with no parameters
|
|
107
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
108
|
+
* @returns The minting blueprint object
|
|
109
|
+
*/
|
|
110
|
+
noParamScript(compiledCode) {
|
|
111
|
+
return this.paramScript(compiledCode, []);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// src/utils/blueprint/spending.ts
|
|
116
|
+
var SpendingBlueprint = class {
|
|
117
|
+
version;
|
|
118
|
+
networkId;
|
|
119
|
+
cbor;
|
|
120
|
+
hash;
|
|
121
|
+
address;
|
|
122
|
+
stakeHash;
|
|
123
|
+
isStakeScriptCredential;
|
|
124
|
+
constructor(version, networkId, stakeHash, isStakeScriptCredential = false) {
|
|
125
|
+
this.version = version;
|
|
126
|
+
this.networkId = networkId;
|
|
127
|
+
this.stakeHash = stakeHash;
|
|
128
|
+
this.cbor = "";
|
|
129
|
+
this.hash = "";
|
|
130
|
+
this.address = "";
|
|
131
|
+
this.isStakeScriptCredential = isStakeScriptCredential;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Initialize the minting blueprint, with the same parameters to `applyParamsToScript`
|
|
135
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
136
|
+
* @param params The parameters to apply, in an array.
|
|
137
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
138
|
+
* @returns
|
|
139
|
+
*/
|
|
140
|
+
paramScript(compiledCode, params, paramsType = "Mesh") {
|
|
141
|
+
const cbor = applyParamsToScript2(compiledCode, params, paramsType);
|
|
142
|
+
const hash = resolveScriptHash(cbor, this.version);
|
|
143
|
+
const plutusScript = {
|
|
144
|
+
code: cbor,
|
|
145
|
+
version: this.version
|
|
146
|
+
};
|
|
147
|
+
const address = serializePlutusScript(
|
|
148
|
+
plutusScript,
|
|
149
|
+
this.stakeHash,
|
|
150
|
+
this.networkId,
|
|
151
|
+
this.isStakeScriptCredential
|
|
152
|
+
).address;
|
|
153
|
+
this.hash = hash;
|
|
154
|
+
this.cbor = cbor;
|
|
155
|
+
this.address = address;
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Initialize the minting blueprint, with no parameters
|
|
160
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
161
|
+
* @returns The minting blueprint object
|
|
162
|
+
*/
|
|
163
|
+
noParamScript(compiledCode) {
|
|
164
|
+
return this.paramScript(compiledCode, []);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/utils/blueprint/withdrawal.ts
|
|
169
|
+
var WithdrawalBlueprint = class {
|
|
170
|
+
version;
|
|
171
|
+
networkId;
|
|
172
|
+
cbor;
|
|
173
|
+
hash;
|
|
174
|
+
address;
|
|
175
|
+
isStakeScriptCredential;
|
|
176
|
+
constructor(version, networkId, isStakeScriptCredential = false) {
|
|
177
|
+
this.version = version;
|
|
178
|
+
this.networkId = networkId;
|
|
179
|
+
this.cbor = "";
|
|
180
|
+
this.hash = "";
|
|
181
|
+
this.address = "";
|
|
182
|
+
this.isStakeScriptCredential = isStakeScriptCredential;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Initialize the withdrawal blueprint, with the same parameters to `applyParamsToScript`
|
|
186
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
187
|
+
* @param params The parameters to apply, in an array.
|
|
188
|
+
* @param paramsType The type of the parameters, default to be Mesh's Data type. It could also be in JSON and raw CBOR.
|
|
189
|
+
* @returns The withdrawal blueprint object
|
|
190
|
+
*/
|
|
191
|
+
paramScript(compiledCode, params, paramsType = "Mesh") {
|
|
192
|
+
const cbor = applyParamsToScript2(compiledCode, params, paramsType);
|
|
193
|
+
const hash = resolveScriptHash(cbor, this.version);
|
|
194
|
+
this.address = serializeRewardAddress(
|
|
195
|
+
hash,
|
|
196
|
+
this.isStakeScriptCredential,
|
|
197
|
+
this.networkId
|
|
198
|
+
);
|
|
199
|
+
this.hash = hash;
|
|
200
|
+
this.cbor = cbor;
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Initialize the withdrawal blueprint, with no parameters
|
|
205
|
+
* @param compiledCode The raw script CborHex from blueprint.
|
|
206
|
+
* @returns The withdrawal blueprint object
|
|
207
|
+
*/
|
|
208
|
+
noParamScript(compiledCode) {
|
|
209
|
+
return this.paramScript(compiledCode, []);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
81
213
|
// src/index.ts
|
|
82
214
|
export * from "@meshsdk/common";
|
|
83
215
|
import * as cst from "@meshsdk/core-cst";
|
|
@@ -86,6 +218,9 @@ export * from "@meshsdk/transaction";
|
|
|
86
218
|
export * from "@meshsdk/wallet";
|
|
87
219
|
import { checkSignature, signData, generateNonce } from "@meshsdk/core-cst";
|
|
88
220
|
export {
|
|
221
|
+
MintingBlueprint,
|
|
222
|
+
SpendingBlueprint,
|
|
223
|
+
WithdrawalBlueprint,
|
|
89
224
|
applyCborEncoding,
|
|
90
225
|
applyParamsToScript2 as applyParamsToScript,
|
|
91
226
|
checkSignature,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/core",
|
|
3
|
-
"version": "1.9.0-beta.
|
|
3
|
+
"version": "1.9.0-beta.22",
|
|
4
4
|
"description": "Mesh SDK Core - https://meshjs.dev/",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"browser": "./dist/index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"typescript": "^5.3.3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@meshsdk/common": "1.9.0-beta.
|
|
37
|
-
"@meshsdk/core-cst": "1.9.0-beta.
|
|
38
|
-
"@meshsdk/provider": "1.9.0-beta.
|
|
39
|
-
"@meshsdk/react": "1.9.0-beta.
|
|
40
|
-
"@meshsdk/transaction": "1.9.0-beta.
|
|
41
|
-
"@meshsdk/wallet": "1.9.0-beta.
|
|
36
|
+
"@meshsdk/common": "1.9.0-beta.22",
|
|
37
|
+
"@meshsdk/core-cst": "1.9.0-beta.22",
|
|
38
|
+
"@meshsdk/provider": "1.9.0-beta.22",
|
|
39
|
+
"@meshsdk/react": "1.9.0-beta.22",
|
|
40
|
+
"@meshsdk/transaction": "1.9.0-beta.22",
|
|
41
|
+
"@meshsdk/wallet": "1.9.0-beta.22"
|
|
42
42
|
},
|
|
43
43
|
"prettier": "@meshsdk/configs/prettier",
|
|
44
44
|
"publishConfig": {
|