Skip to content

Commit

Permalink
Merge pull request #431 from multiversx/fix-events-parsing
Browse files Browse the repository at this point in the history
Fix events parsing (deciding on event identifier)
  • Loading branch information
andreibancioiu authored Apr 4, 2024
2 parents d9697c6 + 726542f commit 72e5ca5
Show file tree
Hide file tree
Showing 10 changed files with 923 additions and 252 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-core",
"version": "13.0.0-beta.16",
"version": "13.0.0-beta.17",
"description": "MultiversX SDK for JavaScript and TypeScript",
"main": "out/index.js",
"types": "out/index.d.js",
Expand All @@ -10,10 +10,10 @@
],
"scripts": {
"test": "npm run tests-unit",
"tests-unit": "mocha $(find . -name '*.spec.ts' ! -name '*.net.spec.*')",
"tests-unit": "mocha $(find . -name '*.spec.ts' ! -name '*.local.net.spec.*' ! -name '*.devnet.spec.*' ! -name '*.testnet.spec.*')",
"tests-localnet": "mocha $(find . -name '*.local.net.spec.ts')",
"tests-devnet": "mocha $(find . -name '*.dev.net.spec.ts')",
"tests-testnet": "mocha $(find . -name '*.test.net.spec.ts')",
"tests-devnet": "mocha $(find . -name '*.devnet.spec.ts')",
"tests-testnet": "mocha $(find . -name '*.testnet.spec.ts')",
"compile-browser": "tsc -p tsconfig.json && browserify out/index.js -o out-browser/sdk-core.js --standalone multiversxSdkCore -p esmify",
"compile": "tsc -p tsconfig.json",
"compile-proto": "npx pbjs -t static-module -w default -o src/proto/compiled.js src/proto/transaction.proto",
Expand Down
8 changes: 4 additions & 4 deletions src/smartcontracts/typesystem/abiRegistry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ describe("test abi registry", () => {
it("binary codec correctly decodes perform action result", async () => {
let bc = new BinaryCodec();
let buff = Buffer.from(
"0588c738a5d26c0e3a2b4f9e8110b540ee9c0b71a3be057569a5a7b0fcb482c8f70000000806f05b59d3b200000000000b68656c6c6f20776f726c6400000000",
"0500000000000000000500d006f73c4221216fa679bc559005584c4f1160e569e1000000012a0000000003616464000000010000000107",
"hex",
);

let registry = await loadAbiRegistry("src/testdata/multisig.abi.json");
let registry = await loadAbiRegistry("src/testdata/multisig-full.abi.json");
let performAction = registry.getEndpoint("getActionData");
assert.equal(performAction.output[0].type.getName(), "Action");

let result = bc.decodeTopLevel(buff, performAction.output[0].type);
assert.deepEqual(
JSON.stringify(result.valueOf()),
`{"name":"SendTransferExecute","fields":[{"to":{"bech32":"erd13rrn3fwjds8r5260n6q3pd2qa6wqkudrhczh26d957c0edyzermshds0k8","pubkey":"88c738a5d26c0e3a2b4f9e8110b540ee9c0b71a3be057569a5a7b0fcb482c8f7"},"egld_amount":"500000000000000000","endpoint_name":{"type":"Buffer","data":[104,101,108,108,111,32,119,111,114,108,100]},"arguments":[]}]}`,
`{"name":"SendTransferExecuteEgld","fields":[{"to":{"bech32":"erd1qqqqqqqqqqqqqpgq6qr0w0zzyysklfneh32eqp2cf383zc89d8sstnkl60","pubkey":"00000000000000000500d006f73c4221216fa679bc559005584c4f1160e569e1"},"egld_amount":"42","opt_gas_limit":null,"endpoint_name":{"type":"Buffer","data":[97,100,100]},"arguments":[{"type":"Buffer","data":[7]}]}]}`,
);
assert.equal(result.valueOf().name, "SendTransferExecute");
assert.equal(result.valueOf().name, "SendTransferExecuteEgld");
});

it("should load ABI containing arrayN and nested structs", async () => {
Expand Down
Loading

0 comments on commit 72e5ca5

Please sign in to comment.