diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md
index b2160eae..26d98056 100644
--- a/packages/sdk/CHANGELOG.md
+++ b/packages/sdk/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to casper-client-sdk.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.0.18]
+
+### Added
+
+- Partial support for the Contract object under StoredValue.
+
+### Fixed
+
+- Deploy's body hash derivation.
+
## [1.0.17]
### Added
@@ -13,7 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed
- Default `gasPrice` changed from `10` to `1`.
-- Casper balances checks return `BigNumber` now.
+- Casper balances checks return `BigNumber` now.
+
## [1.0.15]
### Added
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index d25e5ea5..ef34dca6 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "casper-client-sdk",
- "version": "1.0.17",
+ "version": "1.0.18",
"license": "Apache 2.0",
"description": "SDK to interact with the Casper blockchain",
"main": "dist/index.js",
diff --git a/packages/sdk/src/lib/DeployUtil.ts b/packages/sdk/src/lib/DeployUtil.ts
index 56011db5..d7834e22 100644
--- a/packages/sdk/src/lib/DeployUtil.ts
+++ b/packages/sdk/src/lib/DeployUtil.ts
@@ -284,7 +284,7 @@ export class StoredContractByHash extends ExecutableDeployItemInternal {
Uint8Array.from([this.tag]),
toBytesBytesArray(this.hash),
toBytesString(this.entryPoint),
- toBytesArrayU8(this.args.toBytes())
+ toBytesBytesArray(this.args.toBytes())
]);
}
}
@@ -321,7 +321,7 @@ export class StoredContractByName extends ExecutableDeployItemInternal {
Uint8Array.from([this.tag]),
toBytesString(this.name),
toBytesString(this.entryPoint),
- toBytesArrayU8(this.args.toBytes())
+ toBytesBytesArray(this.args.toBytes())
]);
}
}
@@ -370,7 +370,7 @@ export class StoredVersionedContractByName extends ExecutableDeployItemInternal
toBytesString(this.name),
serializedVersion.toBytes(),
toBytesString(this.entryPoint),
- toBytesArrayU8(this.args.toBytes())
+ toBytesBytesArray(this.args.toBytes())
]);
}
}
@@ -429,7 +429,7 @@ export class StoredVersionedContractByHash extends ExecutableDeployItemInternal
toBytesBytesArray(this.hash),
serializedVersion.toBytes(),
toBytesString(this.entryPoint),
- toBytesArrayU8(this.args.toBytes())
+ toBytesBytesArray(this.args.toBytes())
]);
}
}
diff --git a/packages/sdk/src/lib/StoredValue.ts b/packages/sdk/src/lib/StoredValue.ts
index fcac11d2..1cce0b00 100644
--- a/packages/sdk/src/lib/StoredValue.ts
+++ b/packages/sdk/src/lib/StoredValue.ts
@@ -145,7 +145,7 @@ export class SeigniorageAllocation {
}
/**
- * Auction metdata. Intended to be recorded at each era.
+ * Auction metadata. Intended to be recorded at each era.
*/
@jsonObject
export class EraInfoJson {
@@ -153,6 +153,21 @@ export class EraInfoJson {
public seigniorageAllocations: SeigniorageAllocation[];
}
+/**
+ * Contract metadata.
+ */
+@jsonObject
+export class ContractMetadataJson {
+ @jsonMember({ name: 'contract_package_hash', constructor: String })
+ public contractPackageHash: string;
+
+ @jsonMember({ name: 'contract_wasm_hash', constructor: String })
+ public contractWasmHash: string;
+
+ @jsonMember({ name: 'protocol_version', constructor: String })
+ public protocolVersion: string;
+}
+
@jsonObject
export class StoredValue {
// StoredVale
@@ -167,8 +182,8 @@ export class StoredValue {
public ContractWASM?: string;
// Methods and type signatures supported by a contract
- @jsonMember({ constructor: String })
- public Contract?: string;
+ @jsonMember({ constructor: ContractMetadataJson })
+ public Contract?: ContractMetadataJson;
// A contract definition, metadata, and security container
@jsonMember({ constructor: String })
diff --git a/packages/sdk/test/lib/StoredValue.test.ts b/packages/sdk/test/lib/StoredValue.test.ts
index d3b4f453..db6b7cba 100644
--- a/packages/sdk/test/lib/StoredValue.test.ts
+++ b/packages/sdk/test/lib/StoredValue.test.ts
@@ -85,14 +85,25 @@ describe('StoredValue', () => {
it('should parse Contract stored value correctly', function () {
const mockJson = {
- Contract:
- 'ea058d32053f59e9f66dd3d4de4594a8a3de36c65c87417efe79cdc7c1b926b4b1575b26a474dc52c03c2a7207db951fa4f82214ee4257c4b99bbab603908d5900000000010000000b00000063616c6c5f6661756365740b00000063616c6c5f66617563657402000000060000007461726765740f2000000006000000616d6f756e7408090100010000000000000000000000'
+ Contract: {
+ contract_package_hash: 'package-uref',
+ contract_wasm_hash: 'wasm-hash-uref',
+ protocol_version: '1.0.0'
+ }
};
const serializer = new TypedJSON(StoredValue);
const storedValue = serializer.parse(mockJson);
expect(storedValue?.Contract).to.not.eq(undefined);
- expect(storedValue?.Contract).to.eq(mockJson.Contract);
+ expect(storedValue?.Contract?.contractPackageHash).to.eq(
+ mockJson.Contract.contract_package_hash
+ );
+ expect(storedValue?.Contract?.contractWasmHash).to.eq(
+ mockJson.Contract.contract_wasm_hash
+ );
+ expect(storedValue?.Contract?.protocolVersion).to.eq(
+ mockJson.Contract.protocol_version
+ );
});
it('should parse ContractPackage stored value correctly', function () {
diff --git a/packages/ui/src/@types/models.d.ts b/packages/ui/src/@types/models.d.ts
index 4bb1dd8a..98a5e2b6 100644
--- a/packages/ui/src/@types/models.d.ts
+++ b/packages/ui/src/@types/models.d.ts
@@ -38,5 +38,5 @@ interface AccountBalance {
checkedAt: Date;
blockHashBase16: string;
// undefine means the account didn't exist.
- balance: number | undefined;
+ balance: BigNumber | undefined;
}
diff --git a/packages/ui/src/components/App.test.tsx b/packages/ui/src/components/App.test.tsx
deleted file mode 100644
index 1d117335..00000000
--- a/packages/ui/src/components/App.test.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import App from './App';
-import CasperContainer from '../containers/CasperContainer';
-
-it('renders without crashing', () => {
- const div = document.createElement('div');
- ReactDOM.render(