Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit daf38f1

Browse files
author
Jimmy Chu
authored
Updated with latest polkadot-JS API (#206)
1 parent 4e845e8 commit daf38f1

3 files changed

Lines changed: 59 additions & 59 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"deploy": "gh-pages -d build -m '[ci skip] Updates'"
1616
},
1717
"dependencies": {
18-
"@polkadot/api": "^6.1.2",
18+
"@polkadot/api": "^6.3.1",
1919
"@polkadot/extension-dapp": "^0.40.3",
2020
"@polkadot/keyring": "^7.4.1",
2121
"@polkadot/networks": "^7.4.1",
22-
"@polkadot/types": "^6.1.2",
22+
"@polkadot/types": "^6.3.1",
2323
"@polkadot/ui-keyring": "^0.85.4",
2424
"@polkadot/ui-settings": "^0.85.4",
2525
"@polkadot/util": "^7.4.1",

src/Events.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@ import { useSubstrate } from './substrate-lib';
55

66
// Events to be filtered from feed
77
const FILTERED_EVENTS = [
8-
'system:extrinsicSuccess::(phase={"applyExtrinsic":0})'
8+
'system:ExtrinsicSuccess::(phase={"applyExtrinsic":0})'
99
];
1010

11-
const eventName = ev => {
12-
const level1key = Object.keys(ev)[0];
13-
const level2key = Object.keys(ev[level1key])[0];
14-
return `${level1key}:${level2key}`;
15-
};
16-
17-
const eventParams = ev => {
18-
const level1key = Object.keys(ev)[0];
19-
const level2key = Object.keys(ev[level1key])[0];
20-
return JSON.stringify(ev[level1key][level2key]);
21-
};
11+
const eventName = ev => `${ev.section}:${ev.method}`;
12+
const eventParams = ev => JSON.stringify(ev.data);
2213

2314
function Main (props) {
2415
const { api } = useSubstrate();
@@ -35,9 +26,9 @@ function Main (props) {
3526
const { event, phase } = record;
3627

3728
// show what we are busy with
38-
const evjson = event.toJSON();
39-
const evName = eventName(evjson);
40-
const evParams = eventParams(evjson);
29+
const evHuman = event.toHuman();
30+
const evName = eventName(evHuman);
31+
const evParams = eventParams(evHuman);
4132
const evNamePhase = `${evName}::(phase=${phase.toString()})`;
4233

4334
if (FILTERED_EVENTS.includes(evNamePhase)) return;

yarn.lock

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,37 +2177,37 @@ __metadata:
21772177
languageName: node
21782178
linkType: hard
21792179

2180-
"@polkadot/api-derive@npm:6.1.2":
2181-
version: 6.1.2
2182-
resolution: "@polkadot/api-derive@npm:6.1.2"
2180+
"@polkadot/api-derive@npm:6.3.1":
2181+
version: 6.3.1
2182+
resolution: "@polkadot/api-derive@npm:6.3.1"
21832183
dependencies:
21842184
"@babel/runtime": ^7.15.4
2185-
"@polkadot/api": 6.1.2
2186-
"@polkadot/rpc-core": 6.1.2
2187-
"@polkadot/types": 6.1.2
2185+
"@polkadot/api": 6.3.1
2186+
"@polkadot/rpc-core": 6.3.1
2187+
"@polkadot/types": 6.3.1
21882188
"@polkadot/util": ^7.4.1
21892189
"@polkadot/util-crypto": ^7.4.1
2190-
rxjs: ^7.3.0
2191-
checksum: bdf9735c71761fad8090b2e3a3bf773ec38420d832a5955d5b545d7ed7c8bbefa5b2ab0825daa61581ad1af5d5da6bf50f0fbda9a1d56df278d0c69f23f2e220
2190+
rxjs: ^7.4.0
2191+
checksum: 0905111169c8dededd2ae063255c748bc75b8d420a4e0a7690948fa81b70bd9dea92fe30b1464f90d994ad799abcc2a77e1d6f317d2b398a4903509d2e1d0261
21922192
languageName: node
21932193
linkType: hard
21942194

2195-
"@polkadot/api@npm:6.1.2, @polkadot/api@npm:^6.1.2":
2196-
version: 6.1.2
2197-
resolution: "@polkadot/api@npm:6.1.2"
2195+
"@polkadot/api@npm:6.3.1, @polkadot/api@npm:^6.3.1":
2196+
version: 6.3.1
2197+
resolution: "@polkadot/api@npm:6.3.1"
21982198
dependencies:
21992199
"@babel/runtime": ^7.15.4
2200-
"@polkadot/api-derive": 6.1.2
2200+
"@polkadot/api-derive": 6.3.1
22012201
"@polkadot/keyring": ^7.4.1
2202-
"@polkadot/rpc-core": 6.1.2
2203-
"@polkadot/rpc-provider": 6.1.2
2204-
"@polkadot/types": 6.1.2
2205-
"@polkadot/types-known": 6.1.2
2202+
"@polkadot/rpc-core": 6.3.1
2203+
"@polkadot/rpc-provider": 6.3.1
2204+
"@polkadot/types": 6.3.1
2205+
"@polkadot/types-known": 6.3.1
22062206
"@polkadot/util": ^7.4.1
22072207
"@polkadot/util-crypto": ^7.4.1
22082208
eventemitter3: ^4.0.7
2209-
rxjs: ^7.3.0
2210-
checksum: a81c5ba93f547d983f8d99c8daee48f9104ea878e6bb8d46a1b2782ecb8ee1c3448983a98cce716fe9408921f25f2276887fa44976341c8a5260621fe8a33c12
2209+
rxjs: ^7.4.0
2210+
checksum: 765b2ddbc0ee370f956156654be29bc4425d179b5d18d905d73381da0a2a958366b0cab69e81b1a3f6ee542384320cb14600446e8d0e925eb88d709af7fd58cf
22112211
languageName: node
22122212
linkType: hard
22132213

@@ -2289,56 +2289,56 @@ __metadata:
22892289
languageName: node
22902290
linkType: hard
22912291

2292-
"@polkadot/rpc-core@npm:6.1.2":
2293-
version: 6.1.2
2294-
resolution: "@polkadot/rpc-core@npm:6.1.2"
2292+
"@polkadot/rpc-core@npm:6.3.1":
2293+
version: 6.3.1
2294+
resolution: "@polkadot/rpc-core@npm:6.3.1"
22952295
dependencies:
22962296
"@babel/runtime": ^7.15.4
2297-
"@polkadot/rpc-provider": 6.1.2
2298-
"@polkadot/types": 6.1.2
2297+
"@polkadot/rpc-provider": 6.3.1
2298+
"@polkadot/types": 6.3.1
22992299
"@polkadot/util": ^7.4.1
2300-
rxjs: ^7.3.0
2301-
checksum: 66d67f1a216c8cbd828bc24a8dc82f8881c97d91b5542c80493d1ff79b1a00f220e5f7502428d82fc4577b22635eee1b23bc50c342f7b61f8cbaae43f078d93d
2300+
rxjs: ^7.4.0
2301+
checksum: 77bfda852f0a6b86a32262d2fbd888f6e2bdfc80bcf65730cf4602b30b1a10f475592f5e33941d4aab9dd45dea3dd627f43879ee476b645365b9f26ddee6090d
23022302
languageName: node
23032303
linkType: hard
23042304

2305-
"@polkadot/rpc-provider@npm:6.1.2":
2306-
version: 6.1.2
2307-
resolution: "@polkadot/rpc-provider@npm:6.1.2"
2305+
"@polkadot/rpc-provider@npm:6.3.1":
2306+
version: 6.3.1
2307+
resolution: "@polkadot/rpc-provider@npm:6.3.1"
23082308
dependencies:
23092309
"@babel/runtime": ^7.15.4
2310-
"@polkadot/types": 6.1.2
2310+
"@polkadot/types": 6.3.1
23112311
"@polkadot/util": ^7.4.1
23122312
"@polkadot/util-crypto": ^7.4.1
23132313
"@polkadot/x-fetch": ^7.4.1
23142314
"@polkadot/x-global": ^7.4.1
23152315
"@polkadot/x-ws": ^7.4.1
23162316
eventemitter3: ^4.0.7
2317-
checksum: 9a08226a2c12edda78970a7bb5c2f111bae8374de65e9df4269a2b2f4baf1bb9cc739fa9152797ab1323c1f70217cab61351abc2f0c3ebe3235b06f3ba81935b
2317+
checksum: 65f19354a442e3761190922298acfcc6b480e11dcfa57f38f0deff298f284378020afaa168140c6db9e7f24e419aeec30b3eb8c35b36169643a82d4052289d34
23182318
languageName: node
23192319
linkType: hard
23202320

2321-
"@polkadot/types-known@npm:6.1.2":
2322-
version: 6.1.2
2323-
resolution: "@polkadot/types-known@npm:6.1.2"
2321+
"@polkadot/types-known@npm:6.3.1":
2322+
version: 6.3.1
2323+
resolution: "@polkadot/types-known@npm:6.3.1"
23242324
dependencies:
23252325
"@babel/runtime": ^7.15.4
23262326
"@polkadot/networks": ^7.4.1
2327-
"@polkadot/types": 6.1.2
2327+
"@polkadot/types": 6.3.1
23282328
"@polkadot/util": ^7.4.1
2329-
checksum: d5ccf31431ce4a278b5a07d7f9352c836b80046109ae66417fe208c1e6d0a53944ae8708abceb1e8ab98c7d7d7cd2a8adc67905b46cd055ea760e402e682a4ba
2329+
checksum: 69ea00f86e0a0b96cf1e9389748a83ac1214b034e49731d3f3537cd24e9ca1ed142530cf0dcbe393d460cca9358f545b7448658f4364f1f7bb4cba707e82255c
23302330
languageName: node
23312331
linkType: hard
23322332

2333-
"@polkadot/types@npm:6.1.2, @polkadot/types@npm:^6.1.2":
2334-
version: 6.1.2
2335-
resolution: "@polkadot/types@npm:6.1.2"
2333+
"@polkadot/types@npm:6.3.1, @polkadot/types@npm:^6.3.1":
2334+
version: 6.3.1
2335+
resolution: "@polkadot/types@npm:6.3.1"
23362336
dependencies:
23372337
"@babel/runtime": ^7.15.4
23382338
"@polkadot/util": ^7.4.1
23392339
"@polkadot/util-crypto": ^7.4.1
2340-
rxjs: ^7.3.0
2341-
checksum: 347578185768ba239d3c3890ee51d28a9a0fdc483b2f992ae1b30271a0f029bb3ae3257e867c8c81307241a7d670b99d909ad72ac2e057fa6a71b9f097a87c13
2340+
rxjs: ^7.4.0
2341+
checksum: 9f086954752e662b11306cb08a9306f9f8c08d029070a6b3d097d3db66244df8366a4fbbc8a9f77a3641f02a3de1d67da4c82b215caf60d957362c189cb8115f
23422342
languageName: node
23432343
linkType: hard
23442344

@@ -14468,6 +14468,15 @@ resolve@^2.0.0-next.3:
1446814468
languageName: node
1446914469
linkType: hard
1447014470

14471+
"rxjs@npm:^7.4.0":
14472+
version: 7.4.0
14473+
resolution: "rxjs@npm:7.4.0"
14474+
dependencies:
14475+
tslib: ~2.1.0
14476+
checksum: 6b33172a760dcad6882fdc836ee8cf1ebe160dd7eaad95c45a12338ffdaa96eb41e48e6c25bbd3d1fdf45075949ff447954bc17a9d01c688558a67967d09c114
14477+
languageName: node
14478+
linkType: hard
14479+
1447114480
"safe-buffer@npm:5.1.2, safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
1447214481
version: 5.1.2
1447314482
resolution: "safe-buffer@npm:5.1.2"
@@ -15615,11 +15624,11 @@ resolve@^2.0.0-next.3:
1561515624
resolution: "substrate-front-end-template@workspace:."
1561615625
dependencies:
1561715626
"@babel/core": ^7.14.3
15618-
"@polkadot/api": ^6.1.2
15627+
"@polkadot/api": ^6.3.1
1561915628
"@polkadot/extension-dapp": ^0.40.3
1562015629
"@polkadot/keyring": ^7.4.1
1562115630
"@polkadot/networks": ^7.4.1
15622-
"@polkadot/types": ^6.1.2
15631+
"@polkadot/types": ^6.3.1
1562315632
"@polkadot/ui-keyring": ^0.85.4
1562415633
"@polkadot/ui-settings": ^0.85.4
1562515634
"@polkadot/util": ^7.4.1

0 commit comments

Comments
 (0)