diff --git a/lerna.json b/lerna.json index 1de3fdc..370d7eb 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": [ "packages/*" ], - "version": "0.1.6" + "version": "0.1.6-asset" } diff --git a/packages/native-utils/bench/hash.js b/packages/native-utils/bench/hash.js index 425c75c..98d72dc 100644 --- a/packages/native-utils/bench/hash.js +++ b/packages/native-utils/bench/hash.js @@ -14,7 +14,7 @@ const DEFAULT_STATE = { challengeDuration: 1, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: diff --git a/packages/native-utils/bench/recover.js b/packages/native-utils/bench/recover.js index c46cb41..5d9b215 100644 --- a/packages/native-utils/bench/recover.js +++ b/packages/native-utils/bench/recover.js @@ -6,7 +6,7 @@ const PRIVATE_KEY = '0x111111111111111111111111111111111111111111111111111111111 const OUTCOME = [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: '0x0000000000000000000000000000000000000000000000000000000000000000', diff --git a/packages/native-utils/bench/sign.js b/packages/native-utils/bench/sign.js index 547f4e0..2e67707 100644 --- a/packages/native-utils/bench/sign.js +++ b/packages/native-utils/bench/sign.js @@ -6,7 +6,7 @@ const PRIVATE_KEY = '0x111111111111111111111111111111111111111111111111111111111 const OUTCOME = [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: '0x0000000000000000000000000000000000000000000000000000000000000000', diff --git a/packages/native-utils/common/src/state.rs b/packages/native-utils/common/src/state.rs index 3d4f324..229b7ee 100644 --- a/packages/native-utils/common/src/state.rs +++ b/packages/native-utils/common/src/state.rs @@ -42,7 +42,7 @@ impl Tokenize for AssetOutcomeType { #[derive(Deserialize,PartialEq)] #[serde(rename_all = "camelCase")] pub struct AllocationAssetOutcome { - pub asset_holder_address: Address, + pub asset: Address, pub allocation_items: Vec, } @@ -74,7 +74,7 @@ impl Tokenize for Guarantee { #[derive(Deserialize,PartialEq)] #[serde(rename_all = "camelCase")] pub struct GuaranteeAssetOutcome { - pub asset_holder_address: Address, + pub asset: Address, pub guarantee: Guarantee, } @@ -96,12 +96,12 @@ pub enum AssetOutcome { impl Tokenize for AssetOutcome { fn tokenize(&self) -> Token { - let (asset_holder_address, encoded) = match self { - Self::AllocationAssetOutcome(o) => (o.asset_holder_address, o.encode()), - Self::GuaranteeAssetOutcome(o) => (o.asset_holder_address, o.encode()), + let (asset, encoded) = match self { + Self::AllocationAssetOutcome(o) => (o.asset, o.encode()), + Self::GuaranteeAssetOutcome(o) => (o.asset, o.encode()), }; Token::Tuple(vec![ - asset_holder_address.tokenize(), + asset.tokenize(), Bytes(encoded).tokenize(), ]) } diff --git a/packages/native-utils/package.json b/packages/native-utils/package.json index 088604d..429b33e 100644 --- a/packages/native-utils/package.json +++ b/packages/native-utils/package.json @@ -2,11 +2,11 @@ "name": "@statechannels/native-utils", "main": "lib/index.js", "types": "lib/index.d.ts", - "version": "0.1.6", + "version": "0.1.6-asset", "author": "Jannis Pohlmann ", "license": "MIT", "dependencies": { - "@statechannels/wasm-utils": "^0.1.6", + "@statechannels/wasm-utils": "^0.1.6-asset", "lodash": "^4.17.20" }, "scripts": { @@ -15,7 +15,7 @@ "bench": "node bench/index.js" }, "devDependencies": { - "@statechannels/nitro-protocol": "^0.11.0", + "@statechannels/nitro-protocol": "0.17.1", "@types/jest": "^26.0.14", "benny": "^3.6.14", "ethers": "5.0.12", diff --git a/packages/native-utils/tests/hash.test.ts b/packages/native-utils/tests/hash.test.ts index bf18a3d..fb74863 100644 --- a/packages/native-utils/tests/hash.test.ts +++ b/packages/native-utils/tests/hash.test.ts @@ -129,7 +129,7 @@ describe('encodeOutcome', () => { ...DEFAULT_STATE, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: @@ -149,7 +149,7 @@ describe('encodeOutcome', () => { ...DEFAULT_STATE, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: @@ -174,7 +174,7 @@ describe('encodeOutcome', () => { ...DEFAULT_STATE, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', guarantee: { targetChannelId: '0x0000000000000000000000000000000000000000000000000000000000000000', @@ -203,7 +203,7 @@ describe('hashOutcome', () => { ...DEFAULT_STATE, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: @@ -223,7 +223,7 @@ describe('hashOutcome', () => { ...DEFAULT_STATE, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: diff --git a/packages/native-utils/tests/recover.test.ts b/packages/native-utils/tests/recover.test.ts index 89c645f..2e1e73a 100644 --- a/packages/native-utils/tests/recover.test.ts +++ b/packages/native-utils/tests/recover.test.ts @@ -15,7 +15,7 @@ const DEFAULT_STATE: State = { challengeDuration: 1, outcome: [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: diff --git a/packages/native-utils/tests/sign.test.ts b/packages/native-utils/tests/sign.test.ts index d0faede..45b745a 100644 --- a/packages/native-utils/tests/sign.test.ts +++ b/packages/native-utils/tests/sign.test.ts @@ -39,7 +39,7 @@ describe('Sign state', () => { test('State with asset allocation outcome', async () => { const outcome = [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', allocationItems: [ { destination: @@ -71,7 +71,7 @@ describe('Sign state', () => { test('State with guarantee outcome', async () => { const outcome = [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', guarantee: { targetChannelId: '0x0000000000000000000000000000000000000000000000000000000000000000', diff --git a/packages/native-utils/tests/transition.test.ts b/packages/native-utils/tests/transition.test.ts index c42731d..0ec5a48 100644 --- a/packages/native-utils/tests/transition.test.ts +++ b/packages/native-utils/tests/transition.test.ts @@ -4,7 +4,7 @@ import * as native from '..' const OUTCOME = [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', guarantee: { targetChannelId: '0x0000000000000000000000000000000000000000000000000000000000000000', @@ -137,7 +137,7 @@ describe('Validate state transitions', () => { test('Outcome mismatch mismatch fails', async () => { const otheroutcome = [ { - assetHolderAddress: '0x0000000000000000000000000000000000000000', + asset: '0x0000000000000000000000000000000000000000', guarantee: { targetChannelId: '0x0000000000000000000000000000000000000000000000000000000000000000', diff --git a/wasm-utils/Cargo.lock b/wasm-utils/Cargo.lock index b897580..30e8c73 100644 --- a/wasm-utils/Cargo.lock +++ b/wasm-utils/Cargo.lock @@ -602,7 +602,7 @@ checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "wasm-utils" -version = "0.1.6" +version = "0.1.6-asset" dependencies = [ "js-sys", "statechannels-native-utils-common", diff --git a/wasm-utils/Cargo.toml b/wasm-utils/Cargo.toml index fdf9b6f..48b9aef 100644 --- a/wasm-utils/Cargo.toml +++ b/wasm-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-utils" -version = "0.1.6" +version = "0.1.6-asset" edition = "2018" license = "MIT" authors = [ diff --git a/yarn.lock b/yarn.lock index 5b614ba..f0e07dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1735,13 +1735,16 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@statechannels/nitro-protocol@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@statechannels/nitro-protocol/-/nitro-protocol-0.11.0.tgz#deb3e09198dd4f4428723738465fc67732486c4f" - integrity sha512-qLYLpJ3dS3PL/daXKSwK7XJVCSHkbPLOtLiLk9yT0EWMJEJy9PlCXQzWwh6ES4uz1M9Ph0hDhpOx+Rw9vf8N1Q== +"@statechannels/nitro-protocol@0.17.1": + version "0.17.1" + resolved "https://registry.yarnpkg.com/@statechannels/nitro-protocol/-/nitro-protocol-0.17.1.tgz#8e6bd0cd826ed8b5216009e1f30fcbeeb1c9099d" + integrity sha512-Axyprx+iG5Dj6ujiWXjkHlAzhEiQ3Fpwjmdgw9Q2PGexCFcU6vfwtztqTdlkqYnjLDsw5kK/au/rJ6r7wfNpbA== dependencies: "@openzeppelin/contracts" "3.2.2-solc-0.7" ethers "5.0.12" + lodash.isequal "^4.5.0" + lodash.pick "4.4.0" + lodash.shuffle "^4.2.0" "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.9" @@ -5183,6 +5186,11 @@ lodash.get@^4.4.2: resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -5198,11 +5206,21 @@ lodash.padend@^4.6.1: resolved "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e" integrity sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= +lodash.pick@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" + integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= + lodash.set@^4.3.2: version "4.3.2" resolved "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= +lodash.shuffle@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.shuffle/-/lodash.shuffle-4.2.0.tgz#145b5053cf875f6f5c2a33f48b6e9948c6ec7b4b" + integrity sha1-FFtQU8+HX29cKjP0i26ZSMbse0s= + lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"