Skip to content

Commit d2bc3e5

Browse files
authored
Support logout (#16)
* Update session and protocol-scatter version * Implement logout
1 parent e77b573 commit d2bc3e5

File tree

3 files changed

+93
-13
lines changed

3 files changed

+93
-13
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"prepare": "make"
1717
},
1818
"dependencies": {
19-
"@wharfkit/protocol-scatter": "^1.2.0",
19+
"@wharfkit/protocol-scatter": "^1.3.1",
2020
"tslib": "^2.1.0"
2121
},
2222
"peerDependencies": {
@@ -34,7 +34,7 @@
3434
"@types/node": "^18.7.18",
3535
"@typescript-eslint/eslint-plugin": "^5.20.0",
3636
"@typescript-eslint/parser": "^5.20.0",
37-
"@wharfkit/session": "^1.2.2",
37+
"@wharfkit/session": "^1.3.1",
3838
"chai": "^4.3.4",
3939
"crypto-js": "^4.1.1",
4040
"eslint": "^8.13.0",

src/index.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AbstractWalletPlugin,
33
LoginContext,
4+
LogoutContext,
45
ResolvedSigningRequest,
56
TransactContext,
67
WalletPlugin,
@@ -9,9 +10,9 @@ import {
910
WalletPluginMetadata,
1011
WalletPluginSignResponse,
1112
} from '@wharfkit/session'
12-
import {handleLogin, handleSignatureRequest} from '@wharfkit/protocol-scatter'
13+
import {handleLogin, handleLogout, handleSignatureRequest} from '@wharfkit/protocol-scatter'
1314

14-
export class WalletPluginWombat extends AbstractWalletPlugin {
15+
export class WalletPluginWombat extends AbstractWalletPlugin implements WalletPlugin {
1516
id = 'wombat'
1617

1718
translations = {}
@@ -44,7 +45,7 @@ export class WalletPluginWombat extends AbstractWalletPlugin {
4445
/**
4546
* Performs the wallet logic required to login and return the chain and permission level to use.
4647
*
47-
* @param options WalletPluginLoginOptions
48+
* @param context LoginContext
4849
* @returns Promise<WalletPluginLoginResponse>
4950
*/
5051
login(context: LoginContext): Promise<WalletPluginLoginResponse> {
@@ -59,6 +60,25 @@ export class WalletPluginWombat extends AbstractWalletPlugin {
5960
})
6061
}
6162

63+
/**
64+
* Performs the wallet logic required to logout.
65+
*
66+
* @param context: LogoutContext
67+
* @returns Promise<void>
68+
*/
69+
70+
logout(context: LogoutContext): Promise<void> {
71+
return new Promise((resolve, reject) => {
72+
handleLogout(context)
73+
.then(() => {
74+
resolve()
75+
})
76+
.catch((error) => {
77+
reject(error)
78+
})
79+
})
80+
}
81+
6282
/**
6383
* Performs the wallet logic required to sign a transaction and return the signature.
6484
*

yarn.lock

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@
540540
"@typescript-eslint/types" "5.62.0"
541541
eslint-visitor-keys "^3.3.0"
542542

543-
"@wharfkit/abicache@^1.2.1":
543+
"@wharfkit/abicache@^1.2.0", "@wharfkit/abicache@^1.2.1":
544544
version "1.2.2"
545545
resolved "https://registry.yarnpkg.com/@wharfkit/abicache/-/abicache-1.2.2.tgz#c3d83485e3e3782ac94ced460915bad1ceee0be9"
546546
integrity sha512-yOsYz2qQpQy7Nb8XZj62pZqp8YnmWDqFlrenYksBb9jl+1aWIpFhWd+14VEez4tUAezRH4UWW+w1SX5vhmUY9A==
@@ -550,6 +550,18 @@
550550
pako "^2.0.4"
551551
tslib "^2.1.0"
552552

553+
"@wharfkit/account@^1.0.0":
554+
version "1.0.1"
555+
resolved "https://registry.yarnpkg.com/@wharfkit/account/-/account-1.0.1.tgz#84934dfbee7e9f5dfe9972b5f2a2165c43afcfe8"
556+
integrity sha512-BtyoXgELprV/cqIdEi/Kl4iFLATDW6t2PWoQTYzeVXlyWekPsAkbaQ00lSLrt+7+8QEb65gUi5Z+/SWR34RqIA==
557+
dependencies:
558+
"@wharfkit/antelope" "^1.0.0"
559+
"@wharfkit/common" "^1.2.0"
560+
"@wharfkit/contract" "^1.0.0"
561+
"@wharfkit/resources" "^1.1.0"
562+
"@wharfkit/token" "^1.1.2"
563+
tslib "^2.1.0"
564+
553565
"@wharfkit/antelope@^1.0.0", "@wharfkit/antelope@^1.0.2":
554566
version "1.0.3"
555567
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.3.tgz#e9863451fb7dac51f40d48dead097e29bdcd0c13"
@@ -562,28 +574,61 @@
562574
pako "^2.1.0"
563575
tslib "^2.0.3"
564576

577+
"@wharfkit/antelope@^1.0.4":
578+
version "1.0.7"
579+
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.7.tgz#5ca010db963e061b2e8c47c14e55f86817718c2e"
580+
integrity sha512-C4DRC4U+qC2XQKUgwznKX6i8xdKo+ZqxkZURrPTtY3v53IvKwj+3amTQQSpuECechS5x6ItcT+/fOFBNlQ2Juw==
581+
dependencies:
582+
bn.js "^4.11.9"
583+
brorand "^1.1.0"
584+
elliptic "^6.5.4"
585+
hash.js "^1.0.0"
586+
pako "^2.1.0"
587+
tslib "^2.0.3"
588+
565589
"@wharfkit/common@^1.2.0":
566590
version "1.2.0"
567591
resolved "https://registry.yarnpkg.com/@wharfkit/common/-/common-1.2.0.tgz#147f783f2ba5cc6fa7dd75863ba98dd05880a9aa"
568592
integrity sha512-me/BN8D/4UPkY7yt+4v+E/z62PVj4VKY5+iRb7zoWv0epbW4o4nC6Oer8kBVL7xWC6Guucaol3hkxkTMgrnwlQ==
569593
dependencies:
570594
tslib "^2.1.0"
571595

572-
"@wharfkit/protocol-scatter@^1.2.0":
573-
version "1.2.0"
574-
resolved "https://registry.yarnpkg.com/@wharfkit/protocol-scatter/-/protocol-scatter-1.2.0.tgz#7f74642e9b81c59e7b9034042e00f166e244bc6c"
575-
integrity sha512-U9cLSGG5GHxuGTKQObWi1/PAGwlNc4ywOJAVdn9FoQqnU1cyD4ISAMKuiKC4LaKPrHcrArZZ/KsZnYHMuPs96Q==
596+
"@wharfkit/contract@^1.0.0", "@wharfkit/contract@^1.1.4":
597+
version "1.1.5"
598+
resolved "https://registry.yarnpkg.com/@wharfkit/contract/-/contract-1.1.5.tgz#2ca10090330cbb458049890076089237b644eb0e"
599+
integrity sha512-I4w2QFvD/zb4uj5z0U4uQJLRCiZEbrT+AJ9/5goGm6SU42fsRud/k55qSBzW8Ij00OAv2h1+e8rR7xzUruXC9g==
600+
dependencies:
601+
"@wharfkit/abicache" "^1.2.0"
602+
"@wharfkit/antelope" "^1.0.4"
603+
"@wharfkit/signing-request" "^3.1.0"
604+
tslib "^2.1.0"
605+
606+
"@wharfkit/protocol-scatter@^1.3.1":
607+
version "1.3.1"
608+
resolved "https://registry.yarnpkg.com/@wharfkit/protocol-scatter/-/protocol-scatter-1.3.1.tgz#92017892acb8923a23bf4d9a20a81681cc148d67"
609+
integrity sha512-rsjPmY4rHw3fOFj7Yg6WSDLjF4afpS12vGVuEG/jGNu8zMfjYoezQbwViUwkVd+bbNPOKwYWpex2EQVLoywhNA==
576610
dependencies:
577611
eosjs "20.0.0"
578612
scatter-ts "^0.1.9"
579613
tslib "^2.1.0"
580614

581-
"@wharfkit/session@^1.2.2":
615+
"@wharfkit/resources@^1.1.0":
582616
version "1.2.2"
583-
resolved "https://registry.yarnpkg.com/@wharfkit/session/-/session-1.2.2.tgz#660cb72cfaa598c4733776dc7709b5cb9396e014"
584-
integrity sha512-tkeuTq8AltJmVj7uos04vKhgNL7gFuq0VnrE7E+mAVFqpatr6XVT5/ShWrQxCDubHXraKK6nnZ6inUlETQkc9w==
617+
resolved "https://registry.yarnpkg.com/@wharfkit/resources/-/resources-1.2.2.tgz#5c58140745d013533739b1ee285cbd1031c3f063"
618+
integrity sha512-WOsI5pIklx3rkz1OmUNISyYbG6cwaAOcHShRCeUrpEwWykjW91iEjslFtoW1+ZyQ0aJOUc9v6721jvS7gP3OPg==
619+
dependencies:
620+
"@wharfkit/antelope" "^1.0.0"
621+
bn.js "^4.11.9"
622+
js-big-decimal "^2.0.7"
623+
tslib "^2.1.0"
624+
625+
"@wharfkit/session@^1.3.1":
626+
version "1.3.1"
627+
resolved "https://registry.yarnpkg.com/@wharfkit/session/-/session-1.3.1.tgz#2cbfa14aafc21abba060e97dab24e9263c78ad6e"
628+
integrity sha512-x+SV14arfhvuiDGyWAH2WIKW7v2WKQ1njc3EzU5ZzE6xVWRfKZ23mqtz83YemQ2h0562+QR712CzX5ZhAcdcpg==
585629
dependencies:
586630
"@wharfkit/abicache" "^1.2.1"
631+
"@wharfkit/account" "^1.0.0"
587632
"@wharfkit/antelope" "^1.0.2"
588633
"@wharfkit/common" "^1.2.0"
589634
"@wharfkit/signing-request" "^3.1.0"
@@ -598,6 +643,16 @@
598643
"@wharfkit/antelope" "^1.0.0"
599644
tslib "^2.0.3"
600645

646+
"@wharfkit/token@^1.1.2":
647+
version "1.1.2"
648+
resolved "https://registry.yarnpkg.com/@wharfkit/token/-/token-1.1.2.tgz#de01dc211c10e6d3ccf9948357e8373bf6067259"
649+
integrity sha512-LYAGB7LnE3hxwjNsYYwpxbJ8APi0Y8pmh7i1SeKv13HaPVjuHisTnuPxJm3ndwU7pX9GT3hPyo/By0l3CEuLfw==
650+
dependencies:
651+
"@wharfkit/antelope" "^1.0.4"
652+
"@wharfkit/contract" "^1.1.4"
653+
bn.js "^4.11.9"
654+
tslib "^2.1.0"
655+
601656
"@yarnpkg/lockfile@^1.1.0":
602657
version "1.1.0"
603658
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
@@ -1896,6 +1951,11 @@ istanbul-reports@^3.0.2:
18961951
html-escaper "^2.0.0"
18971952
istanbul-lib-report "^3.0.0"
18981953

1954+
js-big-decimal@^2.0.7:
1955+
version "2.0.7"
1956+
resolved "https://registry.yarnpkg.com/js-big-decimal/-/js-big-decimal-2.0.7.tgz#fb9b44b4c1eae08903cb191c0cf37b82f3a8d7c4"
1957+
integrity sha512-XGc79t2Iv3b7LFlYaTT8WoQBuWL4K81aST+dq2YGHV6giedbnoG0s33ju24Uw/BGqLYfPPgn4HGRrPS2mfKk3Q==
1958+
18991959
js-tokens@^4.0.0:
19001960
version "4.0.0"
19011961
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"

0 commit comments

Comments
 (0)