@meshsdk/contract 1.7.1 → 1.7.2
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 +15 -6
- package/dist/index.js +17 -8
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -456,6 +456,7 @@ var MeshEscrowContract = class extends MeshTxInitiator {
|
|
|
456
456
|
scriptCbor = (0, import_core_csl2.applyParamsToScript)(plutus_default.validators[0].compiledCode, []);
|
|
457
457
|
constructor(inputs) {
|
|
458
458
|
super(inputs);
|
|
459
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
459
460
|
}
|
|
460
461
|
initiateEscrow = async (escrowAmount) => {
|
|
461
462
|
const { utxos, walletAddress } = await this.getWalletInfoForTx();
|
|
@@ -490,7 +491,9 @@ var MeshEscrowContract = class extends MeshTxInitiator {
|
|
|
490
491
|
const initiatorAddress = (0, import_core.serializeAddressObj)(initiatorAddressObj);
|
|
491
492
|
const recipientAddress = (0, import_core.serializeAddressObj)(recipientAddressObj);
|
|
492
493
|
const initiatorToReceive = import_common.MeshValue.fromValue(initiatorAmount).toAssets();
|
|
493
|
-
const recipientToReceive = import_common.MeshValue.fromValue(
|
|
494
|
+
const recipientToReceive = import_common.MeshValue.fromValue(
|
|
495
|
+
recipientAmount
|
|
496
|
+
).toAssets();
|
|
494
497
|
this.mesh.txOut(initiatorAddress, initiatorToReceive).txOut(recipientAddress, recipientToReceive);
|
|
495
498
|
}
|
|
496
499
|
await this.mesh.spendingPlutusScriptV2().txIn(
|
|
@@ -750,6 +753,7 @@ var MeshGiftCardContract = class extends MeshTxInitiator {
|
|
|
750
753
|
if (paramUtxo) {
|
|
751
754
|
this.paramUtxo = paramUtxo;
|
|
752
755
|
}
|
|
756
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
753
757
|
}
|
|
754
758
|
createGiftCard = async (tokenName2, giftValue) => {
|
|
755
759
|
const { utxos, walletAddress, collateral } = await this.getWalletInfoForTx();
|
|
@@ -908,6 +912,7 @@ var MeshHelloWorldContract = class extends MeshTxInitiator {
|
|
|
908
912
|
scriptCbor = (0, import_core_csl4.applyParamsToScript)(plutus_default3.validators[0].compiledCode, []);
|
|
909
913
|
constructor(inputs) {
|
|
910
914
|
super(inputs);
|
|
915
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
911
916
|
}
|
|
912
917
|
getScript = () => {
|
|
913
918
|
const { address } = (0, import_core3.serializePlutusScript)(
|
|
@@ -1187,6 +1192,7 @@ var MeshMarketplaceContract = class extends MeshTxInitiator {
|
|
|
1187
1192
|
],
|
|
1188
1193
|
"JSON"
|
|
1189
1194
|
);
|
|
1195
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1190
1196
|
}
|
|
1191
1197
|
listAsset = async (asset, price) => {
|
|
1192
1198
|
const { utxos, walletAddress } = await this.getWalletInfoForTx();
|
|
@@ -1415,6 +1421,7 @@ var MeshPaymentSplitterContract = class extends MeshTxInitiator {
|
|
|
1415
1421
|
"Wallet not provided. Therefore the payment address will not be added to the payees list which makes it impossible to trigger the payout."
|
|
1416
1422
|
);
|
|
1417
1423
|
}
|
|
1424
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1418
1425
|
}
|
|
1419
1426
|
sendLovelaceToSplitter = async (lovelaceAmount) => {
|
|
1420
1427
|
if (this.wallet === null || this.wallet === void 0) {
|
|
@@ -1428,7 +1435,7 @@ var MeshPaymentSplitterContract = class extends MeshTxInitiator {
|
|
|
1428
1435
|
const { address: scriptAddress } = (0, import_core5.serializePlutusScript)(
|
|
1429
1436
|
script,
|
|
1430
1437
|
void 0,
|
|
1431
|
-
|
|
1438
|
+
this.networkId
|
|
1432
1439
|
);
|
|
1433
1440
|
const { pubKeyHash } = (0, import_core5.deserializeAddress)(walletAddress);
|
|
1434
1441
|
const datum = {
|
|
@@ -1457,7 +1464,7 @@ var MeshPaymentSplitterContract = class extends MeshTxInitiator {
|
|
|
1457
1464
|
const { address: scriptAddress } = (0, import_core5.serializePlutusScript)(
|
|
1458
1465
|
script,
|
|
1459
1466
|
void 0,
|
|
1460
|
-
|
|
1467
|
+
this.networkId
|
|
1461
1468
|
);
|
|
1462
1469
|
const utxos = await this.fetcher?.fetchAddressUTxOs(scriptAddress) || [];
|
|
1463
1470
|
const { pubKeyHash } = (0, import_core5.deserializeAddress)(walletAddress);
|
|
@@ -1715,8 +1722,9 @@ var MeshSwapContract = class extends MeshTxInitiator {
|
|
|
1715
1722
|
this.scriptAddress = (0, import_core6.serializePlutusScript)(
|
|
1716
1723
|
{ code: this.scriptCbor, version: "V2" },
|
|
1717
1724
|
void 0,
|
|
1718
|
-
|
|
1725
|
+
inputs.networkId
|
|
1719
1726
|
).address;
|
|
1727
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1720
1728
|
}
|
|
1721
1729
|
initiateSwap = async (toProvide, toReceive) => {
|
|
1722
1730
|
const { utxos, walletAddress, collateral } = await this.getWalletInfoForTx();
|
|
@@ -1865,13 +1873,14 @@ var MeshVestingContract = class extends MeshTxInitiator {
|
|
|
1865
1873
|
scriptCbor = (0, import_core_csl8.applyParamsToScript)(plutus_default7.validators[0].compiledCode, []);
|
|
1866
1874
|
constructor(inputs) {
|
|
1867
1875
|
super(inputs);
|
|
1876
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1868
1877
|
}
|
|
1869
1878
|
depositFund = async (amount, lockUntilTimeStampMs, beneficiary) => {
|
|
1870
1879
|
const { utxos, walletAddress } = await this.getWalletInfoForTx();
|
|
1871
1880
|
const scriptAddr = (0, import_core7.serializePlutusScript)(
|
|
1872
1881
|
{ code: this.scriptCbor, version: "V2" },
|
|
1873
1882
|
void 0,
|
|
1874
|
-
|
|
1883
|
+
this.networkId
|
|
1875
1884
|
).address;
|
|
1876
1885
|
const { pubKeyHash: ownerPubKeyHash } = (0, import_core7.deserializeAddress)(walletAddress);
|
|
1877
1886
|
const { pubKeyHash: beneficiaryPubKeyHash } = (0, import_core7.deserializeAddress)(beneficiary);
|
|
@@ -1890,7 +1899,7 @@ var MeshVestingContract = class extends MeshTxInitiator {
|
|
|
1890
1899
|
const scriptAddr = (0, import_core7.serializePlutusScript)(
|
|
1891
1900
|
{ code: this.scriptCbor, version: "V2" },
|
|
1892
1901
|
void 0,
|
|
1893
|
-
|
|
1902
|
+
this.networkId
|
|
1894
1903
|
).address;
|
|
1895
1904
|
const { pubKeyHash } = (0, import_core7.deserializeAddress)(walletAddress);
|
|
1896
1905
|
const datum = (0, import_core7.deserializeDatum)(
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
conStr1,
|
|
5
5
|
mConStr1,
|
|
6
6
|
mConStr2,
|
|
7
|
+
MeshValue,
|
|
7
8
|
pubKeyAddress,
|
|
8
|
-
value
|
|
9
|
-
MeshValue
|
|
9
|
+
value
|
|
10
10
|
} from "@meshsdk/common";
|
|
11
11
|
import {
|
|
12
12
|
deserializeAddress,
|
|
@@ -427,6 +427,7 @@ var MeshEscrowContract = class extends MeshTxInitiator {
|
|
|
427
427
|
scriptCbor = applyParamsToScript(plutus_default.validators[0].compiledCode, []);
|
|
428
428
|
constructor(inputs) {
|
|
429
429
|
super(inputs);
|
|
430
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
430
431
|
}
|
|
431
432
|
initiateEscrow = async (escrowAmount) => {
|
|
432
433
|
const { utxos, walletAddress } = await this.getWalletInfoForTx();
|
|
@@ -461,7 +462,9 @@ var MeshEscrowContract = class extends MeshTxInitiator {
|
|
|
461
462
|
const initiatorAddress = serializeAddressObj(initiatorAddressObj);
|
|
462
463
|
const recipientAddress = serializeAddressObj(recipientAddressObj);
|
|
463
464
|
const initiatorToReceive = MeshValue.fromValue(initiatorAmount).toAssets();
|
|
464
|
-
const recipientToReceive = MeshValue.fromValue(
|
|
465
|
+
const recipientToReceive = MeshValue.fromValue(
|
|
466
|
+
recipientAmount
|
|
467
|
+
).toAssets();
|
|
465
468
|
this.mesh.txOut(initiatorAddress, initiatorToReceive).txOut(recipientAddress, recipientToReceive);
|
|
466
469
|
}
|
|
467
470
|
await this.mesh.spendingPlutusScriptV2().txIn(
|
|
@@ -731,6 +734,7 @@ var MeshGiftCardContract = class extends MeshTxInitiator {
|
|
|
731
734
|
if (paramUtxo) {
|
|
732
735
|
this.paramUtxo = paramUtxo;
|
|
733
736
|
}
|
|
737
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
734
738
|
}
|
|
735
739
|
createGiftCard = async (tokenName2, giftValue) => {
|
|
736
740
|
const { utxos, walletAddress, collateral } = await this.getWalletInfoForTx();
|
|
@@ -894,6 +898,7 @@ var MeshHelloWorldContract = class extends MeshTxInitiator {
|
|
|
894
898
|
scriptCbor = applyParamsToScript3(plutus_default3.validators[0].compiledCode, []);
|
|
895
899
|
constructor(inputs) {
|
|
896
900
|
super(inputs);
|
|
901
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
897
902
|
}
|
|
898
903
|
getScript = () => {
|
|
899
904
|
const { address } = serializePlutusScript3(
|
|
@@ -1187,6 +1192,7 @@ var MeshMarketplaceContract = class extends MeshTxInitiator {
|
|
|
1187
1192
|
],
|
|
1188
1193
|
"JSON"
|
|
1189
1194
|
);
|
|
1195
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1190
1196
|
}
|
|
1191
1197
|
listAsset = async (asset, price) => {
|
|
1192
1198
|
const { utxos, walletAddress } = await this.getWalletInfoForTx();
|
|
@@ -1421,6 +1427,7 @@ var MeshPaymentSplitterContract = class extends MeshTxInitiator {
|
|
|
1421
1427
|
"Wallet not provided. Therefore the payment address will not be added to the payees list which makes it impossible to trigger the payout."
|
|
1422
1428
|
);
|
|
1423
1429
|
}
|
|
1430
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1424
1431
|
}
|
|
1425
1432
|
sendLovelaceToSplitter = async (lovelaceAmount) => {
|
|
1426
1433
|
if (this.wallet === null || this.wallet === void 0) {
|
|
@@ -1434,7 +1441,7 @@ var MeshPaymentSplitterContract = class extends MeshTxInitiator {
|
|
|
1434
1441
|
const { address: scriptAddress } = serializePlutusScript5(
|
|
1435
1442
|
script,
|
|
1436
1443
|
void 0,
|
|
1437
|
-
|
|
1444
|
+
this.networkId
|
|
1438
1445
|
);
|
|
1439
1446
|
const { pubKeyHash } = deserializeAddress4(walletAddress);
|
|
1440
1447
|
const datum = {
|
|
@@ -1463,7 +1470,7 @@ var MeshPaymentSplitterContract = class extends MeshTxInitiator {
|
|
|
1463
1470
|
const { address: scriptAddress } = serializePlutusScript5(
|
|
1464
1471
|
script,
|
|
1465
1472
|
void 0,
|
|
1466
|
-
|
|
1473
|
+
this.networkId
|
|
1467
1474
|
);
|
|
1468
1475
|
const utxos = await this.fetcher?.fetchAddressUTxOs(scriptAddress) || [];
|
|
1469
1476
|
const { pubKeyHash } = deserializeAddress4(walletAddress);
|
|
@@ -1733,8 +1740,9 @@ var MeshSwapContract = class extends MeshTxInitiator {
|
|
|
1733
1740
|
this.scriptAddress = serializePlutusScript6(
|
|
1734
1741
|
{ code: this.scriptCbor, version: "V2" },
|
|
1735
1742
|
void 0,
|
|
1736
|
-
|
|
1743
|
+
inputs.networkId
|
|
1737
1744
|
).address;
|
|
1745
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1738
1746
|
}
|
|
1739
1747
|
initiateSwap = async (toProvide, toReceive) => {
|
|
1740
1748
|
const { utxos, walletAddress, collateral } = await this.getWalletInfoForTx();
|
|
@@ -1891,13 +1899,14 @@ var MeshVestingContract = class extends MeshTxInitiator {
|
|
|
1891
1899
|
scriptCbor = applyParamsToScript7(plutus_default7.validators[0].compiledCode, []);
|
|
1892
1900
|
constructor(inputs) {
|
|
1893
1901
|
super(inputs);
|
|
1902
|
+
this.mesh.setNetwork(inputs.networkId === 1 ? "mainnet" : "preprod");
|
|
1894
1903
|
}
|
|
1895
1904
|
depositFund = async (amount, lockUntilTimeStampMs, beneficiary) => {
|
|
1896
1905
|
const { utxos, walletAddress } = await this.getWalletInfoForTx();
|
|
1897
1906
|
const scriptAddr = serializePlutusScript7(
|
|
1898
1907
|
{ code: this.scriptCbor, version: "V2" },
|
|
1899
1908
|
void 0,
|
|
1900
|
-
|
|
1909
|
+
this.networkId
|
|
1901
1910
|
).address;
|
|
1902
1911
|
const { pubKeyHash: ownerPubKeyHash } = deserializeAddress6(walletAddress);
|
|
1903
1912
|
const { pubKeyHash: beneficiaryPubKeyHash } = deserializeAddress6(beneficiary);
|
|
@@ -1916,7 +1925,7 @@ var MeshVestingContract = class extends MeshTxInitiator {
|
|
|
1916
1925
|
const scriptAddr = serializePlutusScript7(
|
|
1917
1926
|
{ code: this.scriptCbor, version: "V2" },
|
|
1918
1927
|
void 0,
|
|
1919
|
-
|
|
1928
|
+
this.networkId
|
|
1920
1929
|
).address;
|
|
1921
1930
|
const { pubKeyHash } = deserializeAddress6(walletAddress);
|
|
1922
1931
|
const datum = deserializeDatum5(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/contract",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"typescript": "^5.3.3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@meshsdk/common": "1.7.
|
|
37
|
-
"@meshsdk/core": "1.7.
|
|
38
|
-
"@meshsdk/core-csl": "1.7.
|
|
39
|
-
"@meshsdk/core-cst": "1.7.
|
|
40
|
-
"@meshsdk/transaction": "1.7.
|
|
36
|
+
"@meshsdk/common": "1.7.2",
|
|
37
|
+
"@meshsdk/core": "1.7.2",
|
|
38
|
+
"@meshsdk/core-csl": "1.7.2",
|
|
39
|
+
"@meshsdk/core-cst": "1.7.2",
|
|
40
|
+
"@meshsdk/transaction": "1.7.2"
|
|
41
41
|
},
|
|
42
42
|
"prettier": "@meshsdk/configs/prettier",
|
|
43
43
|
"publishConfig": {
|