Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align Address with sdk-specs, as much as possible (without breaking changes) #448

Merged
merged 11 commits into from
May 27, 2024
60 changes: 42 additions & 18 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-core",
"version": "13.1.0",
"version": "13.2.0-beta.2",
"description": "MultiversX SDK for JavaScript and TypeScript",
"main": "out/index.js",
"types": "out/index.d.js",
Expand Down Expand Up @@ -34,8 +34,8 @@
"keccak": "3.0.2"
},
"devDependencies": {
"@multiversx/sdk-network-providers": "2.4.1",
"@multiversx/sdk-wallet": "4.4.0",
"@multiversx/sdk-network-providers": "2.4.3",
"@multiversx/sdk-wallet": "4.5.0-beta.0",
"@types/assert": "1.4.6",
"@types/chai": "4.2.11",
"@types/mocha": "9.1.0",
Expand Down
12 changes: 12 additions & 0 deletions src/address.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ describe("test address", () => {
assert.equal(new Address(new Uint8Array(Buffer.from(bobHex, "hex"))).toHex(), bobHex);
});

it("should create address (custom hrp)", async () => {
let address = Address.fromHex(aliceHex, "test");
assert.deepEqual(address.getPublicKey(), Buffer.from(aliceHex, "hex"));
assert.equal(address.getHrp(), "test");
assert.equal(address.toBech32(), "test1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ss5hqhtr");

address = Address.fromHex(bobHex, "xerd");
assert.deepEqual(address.getPublicKey(), Buffer.from(bobHex, "hex"));
assert.equal(address.getHrp(), "xerd");
assert.equal(address.toBech32(), "xerd1spyavw0956vq68xj8y4tenjpq2wd5a9p2c6j8gsz7ztyrnpxrruq9thc9j");
});

it("should create empty address", async () => {
const nobody = Address.empty();

Expand Down
Loading
Loading