Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bitcoin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/bitcoin",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Mesh Bitcoin package",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/mesh-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/common",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Contains constants, types and interfaces used across the SDK and different serialization libraries",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/mesh-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/contract",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down Expand Up @@ -34,8 +34,8 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@meshsdk/common": "1.9.0-beta.87",
"@meshsdk/core": "1.9.0-beta.87"
"@meshsdk/common": "1.9.0-beta.88",
"@meshsdk/core": "1.9.0-beta.88"
},
"prettier": "@meshsdk/configs/prettier",
"publishConfig": {
Expand Down
6 changes: 3 additions & 3 deletions packages/mesh-core-csl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core-csl",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Types and utilities functions between Mesh and cardano-serialization-lib",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand Down Expand Up @@ -31,15 +31,15 @@
},
"devDependencies": {
"@meshsdk/configs": "*",
"@meshsdk/provider": "1.9.0-beta.87",
"@meshsdk/provider": "1.9.0-beta.88",
"@types/json-bigint": "^1.0.4",
"eslint": "^8.57.0",
"ts-jest": "^29.1.4",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
},
"dependencies": {
"@meshsdk/common": "1.9.0-beta.87",
"@meshsdk/common": "1.9.0-beta.88",
"@sidan-lab/whisky-js-browser": "^1.0.11",
"@sidan-lab/whisky-js-nodejs": "^1.0.11",
"@types/base32-encoding": "^1.0.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/mesh-core-cst/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core-cst",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Types and utilities functions between Mesh and cardano-js-sdk",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down Expand Up @@ -40,11 +40,11 @@
"@cardano-sdk/crypto": "^0.2.2",
"@cardano-sdk/util": "^0.15.5",
"@cardano-sdk/input-selection": "^0.13.33",
"@harmoniclabs/cbor": "1.3.0",
"@harmoniclabs/cbor": "1.6.0",
"@harmoniclabs/plutus-data": "1.2.4",
"@harmoniclabs/uplc": "1.2.4",
"@harmoniclabs/pair": "^1.0.0",
"@meshsdk/common": "1.9.0-beta.87",
"@meshsdk/common": "1.9.0-beta.88",
"@types/base32-encoding": "^1.0.2",
"base32-encoding": "^1.0.0",
"bech32": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const checkSignature = async (
await ready();
const builder = CoseSign1.fromCbor(signature);
const publicKeyBuffer = getPublicKeyFromCoseKey(key);

if (address) {
let network = NetworkId.Mainnet;
const paymentAddress = BaseAddress.fromAddress(Address.fromBech32(address));
Expand Down
24 changes: 16 additions & 8 deletions packages/mesh-core-cst/src/message-signing/cose-sign1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ class CoseSign1 {
if (
!this.unProtectedMap.map.find((value) => {
return (
JSONBig.stringify(value.k) ===
JSONBig.stringify(new CborText("hashed"))
JSONBig.stringify(value.k.toRawObj()) ===
JSONBig.stringify({
text: "hashed",
})
);
})
) {
Expand Down Expand Up @@ -190,8 +192,10 @@ class CoseSign1 {
getAddress(): Buffer {
const address = this.protectedMap.map.find((value) => {
return (
JSONBig.stringify(value.k) ===
JSONBig.stringify(new CborText("address"))
JSONBig.stringify(value.k.toRawObj()) ===
JSONBig.stringify({
text: "address",
})
);
});
if (!address) throw Error("Address not found");
Expand All @@ -200,7 +204,12 @@ class CoseSign1 {

getPublicKey(): Buffer {
const publicKey = this.protectedMap.map.find((value) => {
return JSONBig.stringify(value.k) === JSONBig.stringify(new CborUInt(4));
return (
JSONBig.stringify(value.k.toRawObj()) ===
JSONBig.stringify({
uint: BigInt(4),
})
);
});
if (!publicKey) throw Error("Public key not found");
return Buffer.from((publicKey.v as CborBytes).bytes);
Expand All @@ -216,11 +225,10 @@ class CoseSign1 {
}

const getPublicKeyFromCoseKey = (cbor: string): Buffer => {
const decodedCoseKey = Cbor.parse(cbor) as CborMap;
const decodedCoseKey = Cbor.parse(cbor).toRawObj() as RawCborMap;
const publicKeyEntry = decodedCoseKey.map.find((value) => {
return (
JSONBig.stringify(value.k) ===
JSONBig.stringify(new CborNegInt(BigInt(-2)))
JSONBig.stringify(value.k) === JSONBig.stringify({ neg: BigInt(-2) })
);
});

Expand Down
3 changes: 3 additions & 0 deletions packages/mesh-core-cst/test/message-signing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,8 @@ describe("MessageSigning", () => {
expect(coseSign1.createSigStructure().toString("hex")).toBe(
"846a5369676e617475726531582aa201276761646472657373581de075531fbe1e68b11e9a10dbbc5df889edea92325a85b758bbbf8735d94058805369676e20746f2076657269667920746865206164647265737320666f723a207374616b655f74657374317570363478386137726535747a3835367a72646d6368306333386b373479336a74327a6d776b396d6837726e746b6773367a786a70315a424e474e79506d3975565677514a53385837724663476551424843657433",
);
expect(coseSign1.getAddress().toString("hex")).toBe(
"e075531fbe1e68b11e9a10dbbc5df889edea92325a85b758bbbf8735d9",
);
});
});
14 changes: 7 additions & 7 deletions packages/mesh-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Mesh SDK Core - https://meshjs.dev/",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down Expand Up @@ -33,12 +33,12 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@meshsdk/common": "1.9.0-beta.87",
"@meshsdk/core-cst": "1.9.0-beta.87",
"@meshsdk/provider": "1.9.0-beta.87",
"@meshsdk/react": "1.9.0-beta.87",
"@meshsdk/transaction": "1.9.0-beta.87",
"@meshsdk/wallet": "1.9.0-beta.87"
"@meshsdk/common": "1.9.0-beta.88",
"@meshsdk/core-cst": "1.9.0-beta.88",
"@meshsdk/provider": "1.9.0-beta.88",
"@meshsdk/react": "1.9.0-beta.88",
"@meshsdk/transaction": "1.9.0-beta.88",
"@meshsdk/wallet": "1.9.0-beta.88"
},
"prettier": "@meshsdk/configs/prettier",
"publishConfig": {
Expand Down
8 changes: 4 additions & 4 deletions packages/mesh-hydra/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/hydra",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Mesh Hydra package",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand All @@ -27,9 +27,9 @@
"test": "jest"
},
"dependencies": {
"@meshsdk/common": "1.9.0-beta.87",
"@meshsdk/core": "1.9.0-beta.87",
"@meshsdk/core-cst": "1.9.0-beta.87",
"@meshsdk/common": "1.9.0-beta.88",
"@meshsdk/core": "1.9.0-beta.88",
"@meshsdk/core-cst": "1.9.0-beta.88",
"axios": "^1.7.2"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/mesh-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/provider",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.88",
"description": "Blockchain data providers - https://meshjs.dev/providers",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down Expand Up @@ -35,9 +35,9 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@meshsdk/bitcoin": "1.9.0-beta.87",
"@meshsdk/common": "1.9.0-beta.87",
"@meshsdk/core-cst": "1.9.0-beta.87",
"@meshsdk/bitcoin": "1.9.0-beta.88",
"@meshsdk/common": "1.9.0-beta.88",
"@meshsdk/core-cst": "1.9.0-beta.88",
"@utxorpc/sdk": "^0.6.7",
"@utxorpc/spec": "^0.16.0",
"axios": "^1.7.2",
Expand Down
5 changes: 4 additions & 1 deletion packages/mesh-provider/src/koios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,10 @@ export class KoiosProvider
}
return <Omit<Action, "data">>{
index: val.validator.index,
tag: val.validator.purpose.toUpperCase(),
tag:
val.validator.purpose.toUpperCase() === "PUBLISH"
? "CERT"
: val.validator.purpose.toUpperCase(),
budget: {
mem: val.budget.memory,
steps: val.budget.cpu,
Expand Down
5 changes: 4 additions & 1 deletion packages/mesh-provider/src/ogmios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export class OgmiosProvider implements IEvaluator, ISubmitter {
Object.values(result).map((val: any) => {
return <Omit<Action, "data">>{
index: val.validator.index,
tag: val.validator.purpose.toUpperCase(),
tag:
val.validator.purpose.toUpperCase() === "PUBLISH"
? "CERT"
: val.validator.purpose.toUpperCase(),
budget: {
mem: val.budget.memory,
steps: val.budget.cpu,
Expand Down
82 changes: 82 additions & 0 deletions packages/mesh-provider/test/blockfrost/evaluator.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import dotenv from "dotenv";

import {
applyCborEncoding,
DRep,
MeshTxBuilder,
resolveScriptHash,
serializeRewardAddress,
} from "@meshsdk/core";
import { blake2b } from "@meshsdk/core-cst";
import { BlockfrostProvider } from "@meshsdk/provider";

dotenv.config();
Expand Down Expand Up @@ -49,4 +57,78 @@ describe("Blockfrost Evaluator", () => {
.catch(() => "error");
expect(res).toBe("error");
});

it("should succeed with with registering certificates", async () => {
const txHash = (tx: string) => {
return blake2b(32).update(Buffer.from(tx, "utf-8")).digest("hex");
};

const alwaysSucceedCbor = applyCborEncoding(
"58340101002332259800a518a4d153300249011856616c696461746f722072657475726e65642066616c736500136564004ae715cd01",
);

const alwaysSucceedHash = resolveScriptHash(alwaysSucceedCbor, "V3");

const txBuilder = new MeshTxBuilder({});
const drep: DRep = {
alwaysAbstain: null,
};

const txHex = await txBuilder
.voteDelegationCertificate(
drep,
serializeRewardAddress(alwaysSucceedHash, true),
)
.certificateScript(alwaysSucceedCbor, "V3")
.certificateRedeemerValue("")
.txIn(
txHash("tx1"),
0,
[
{
unit: "lovelace",
quantity: "100000000",
},
],
"addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9",
0,
)
.txInCollateral(
txHash("tx1"),
0,
[
{
unit: "lovelace",
quantity: "100000000",
},
],
"addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9",
)
.changeAddress(
"addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9",
)
.complete();

const res = await provider.evaluateTx(txHex, [
{
input: {
txHash: txHash("tx1"),
outputIndex: 0,
},
output: {
address:
"addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9",
amount: [
{
unit: "lovelace",
quantity: "100000000",
},
],
},
},
]);
expect(res).toEqual([
{ tag: "CERT", index: 0, budget: { mem: 2001, steps: 380149 } },
]);
});
});
Loading
Loading