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

Support logout #16

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"prepare": "make"
},
"dependencies": {
"@wharfkit/protocol-scatter": "^1.2.0",
"@wharfkit/protocol-scatter": "^1.3.1",
"tslib": "^2.1.0"
},
"peerDependencies": {
Expand All @@ -34,7 +34,7 @@
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@wharfkit/session": "^1.2.2",
"@wharfkit/session": "^1.3.1",
"chai": "^4.3.4",
"crypto-js": "^4.1.1",
"eslint": "^8.13.0",
Expand Down
26 changes: 23 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
AbstractWalletPlugin,
LoginContext,
LogoutContext,
ResolvedSigningRequest,
TransactContext,
WalletPlugin,
Expand All @@ -9,9 +10,9 @@ import {
WalletPluginMetadata,
WalletPluginSignResponse,
} from '@wharfkit/session'
import {handleLogin, handleSignatureRequest} from '@wharfkit/protocol-scatter'
import {handleLogin, handleLogout, handleSignatureRequest} from '@wharfkit/protocol-scatter'

export class WalletPluginWombat extends AbstractWalletPlugin {
export class WalletPluginWombat extends AbstractWalletPlugin implements WalletPlugin {
id = 'wombat'

translations = {}
Expand Down Expand Up @@ -44,7 +45,7 @@ export class WalletPluginWombat extends AbstractWalletPlugin {
/**
* Performs the wallet logic required to login and return the chain and permission level to use.
*
* @param options WalletPluginLoginOptions
* @param context LoginContext
* @returns Promise<WalletPluginLoginResponse>
*/
login(context: LoginContext): Promise<WalletPluginLoginResponse> {
Expand All @@ -59,6 +60,25 @@ export class WalletPluginWombat extends AbstractWalletPlugin {
})
}

/**
* Performs the wallet logic required to logout.
*
* @param context: LogoutContext
* @returns Promise<void>
*/

logout(context: LogoutContext): Promise<void> {
return new Promise((resolve, reject) => {
handleLogout(context)
.then(() => {
resolve()
})
.catch((error) => {
reject(error)
})
})
}

/**
* Performs the wallet logic required to sign a transaction and return the signature.
*
Expand Down
76 changes: 68 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
"@typescript-eslint/types" "5.62.0"
eslint-visitor-keys "^3.3.0"

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

"@wharfkit/account@^1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@wharfkit/account/-/account-1.0.1.tgz#84934dfbee7e9f5dfe9972b5f2a2165c43afcfe8"
integrity sha512-BtyoXgELprV/cqIdEi/Kl4iFLATDW6t2PWoQTYzeVXlyWekPsAkbaQ00lSLrt+7+8QEb65gUi5Z+/SWR34RqIA==
dependencies:
"@wharfkit/antelope" "^1.0.0"
"@wharfkit/common" "^1.2.0"
"@wharfkit/contract" "^1.0.0"
"@wharfkit/resources" "^1.1.0"
"@wharfkit/token" "^1.1.2"
tslib "^2.1.0"

"@wharfkit/antelope@^1.0.0", "@wharfkit/antelope@^1.0.2":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.3.tgz#e9863451fb7dac51f40d48dead097e29bdcd0c13"
Expand All @@ -562,28 +574,61 @@
pako "^2.1.0"
tslib "^2.0.3"

"@wharfkit/antelope@^1.0.4":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.7.tgz#5ca010db963e061b2e8c47c14e55f86817718c2e"
integrity sha512-C4DRC4U+qC2XQKUgwznKX6i8xdKo+ZqxkZURrPTtY3v53IvKwj+3amTQQSpuECechS5x6ItcT+/fOFBNlQ2Juw==
dependencies:
bn.js "^4.11.9"
brorand "^1.1.0"
elliptic "^6.5.4"
hash.js "^1.0.0"
pako "^2.1.0"
tslib "^2.0.3"

"@wharfkit/common@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@wharfkit/common/-/common-1.2.0.tgz#147f783f2ba5cc6fa7dd75863ba98dd05880a9aa"
integrity sha512-me/BN8D/4UPkY7yt+4v+E/z62PVj4VKY5+iRb7zoWv0epbW4o4nC6Oer8kBVL7xWC6Guucaol3hkxkTMgrnwlQ==
dependencies:
tslib "^2.1.0"

"@wharfkit/protocol-scatter@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@wharfkit/protocol-scatter/-/protocol-scatter-1.2.0.tgz#7f74642e9b81c59e7b9034042e00f166e244bc6c"
integrity sha512-U9cLSGG5GHxuGTKQObWi1/PAGwlNc4ywOJAVdn9FoQqnU1cyD4ISAMKuiKC4LaKPrHcrArZZ/KsZnYHMuPs96Q==
"@wharfkit/contract@^1.0.0", "@wharfkit/contract@^1.1.4":
version "1.1.5"
resolved "https://registry.yarnpkg.com/@wharfkit/contract/-/contract-1.1.5.tgz#2ca10090330cbb458049890076089237b644eb0e"
integrity sha512-I4w2QFvD/zb4uj5z0U4uQJLRCiZEbrT+AJ9/5goGm6SU42fsRud/k55qSBzW8Ij00OAv2h1+e8rR7xzUruXC9g==
dependencies:
"@wharfkit/abicache" "^1.2.0"
"@wharfkit/antelope" "^1.0.4"
"@wharfkit/signing-request" "^3.1.0"
tslib "^2.1.0"

"@wharfkit/protocol-scatter@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@wharfkit/protocol-scatter/-/protocol-scatter-1.3.1.tgz#92017892acb8923a23bf4d9a20a81681cc148d67"
integrity sha512-rsjPmY4rHw3fOFj7Yg6WSDLjF4afpS12vGVuEG/jGNu8zMfjYoezQbwViUwkVd+bbNPOKwYWpex2EQVLoywhNA==
dependencies:
eosjs "20.0.0"
scatter-ts "^0.1.9"
tslib "^2.1.0"

"@wharfkit/session@^1.2.2":
"@wharfkit/resources@^1.1.0":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@wharfkit/session/-/session-1.2.2.tgz#660cb72cfaa598c4733776dc7709b5cb9396e014"
integrity sha512-tkeuTq8AltJmVj7uos04vKhgNL7gFuq0VnrE7E+mAVFqpatr6XVT5/ShWrQxCDubHXraKK6nnZ6inUlETQkc9w==
resolved "https://registry.yarnpkg.com/@wharfkit/resources/-/resources-1.2.2.tgz#5c58140745d013533739b1ee285cbd1031c3f063"
integrity sha512-WOsI5pIklx3rkz1OmUNISyYbG6cwaAOcHShRCeUrpEwWykjW91iEjslFtoW1+ZyQ0aJOUc9v6721jvS7gP3OPg==
dependencies:
"@wharfkit/antelope" "^1.0.0"
bn.js "^4.11.9"
js-big-decimal "^2.0.7"
tslib "^2.1.0"

"@wharfkit/session@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@wharfkit/session/-/session-1.3.1.tgz#2cbfa14aafc21abba060e97dab24e9263c78ad6e"
integrity sha512-x+SV14arfhvuiDGyWAH2WIKW7v2WKQ1njc3EzU5ZzE6xVWRfKZ23mqtz83YemQ2h0562+QR712CzX5ZhAcdcpg==
dependencies:
"@wharfkit/abicache" "^1.2.1"
"@wharfkit/account" "^1.0.0"
"@wharfkit/antelope" "^1.0.2"
"@wharfkit/common" "^1.2.0"
"@wharfkit/signing-request" "^3.1.0"
Expand All @@ -598,6 +643,16 @@
"@wharfkit/antelope" "^1.0.0"
tslib "^2.0.3"

"@wharfkit/token@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@wharfkit/token/-/token-1.1.2.tgz#de01dc211c10e6d3ccf9948357e8373bf6067259"
integrity sha512-LYAGB7LnE3hxwjNsYYwpxbJ8APi0Y8pmh7i1SeKv13HaPVjuHisTnuPxJm3ndwU7pX9GT3hPyo/By0l3CEuLfw==
dependencies:
"@wharfkit/antelope" "^1.0.4"
"@wharfkit/contract" "^1.1.4"
bn.js "^4.11.9"
tslib "^2.1.0"

"@yarnpkg/lockfile@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
Expand Down Expand Up @@ -1896,6 +1951,11 @@ istanbul-reports@^3.0.2:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"

js-big-decimal@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/js-big-decimal/-/js-big-decimal-2.0.7.tgz#fb9b44b4c1eae08903cb191c0cf37b82f3a8d7c4"
integrity sha512-XGc79t2Iv3b7LFlYaTT8WoQBuWL4K81aST+dq2YGHV6giedbnoG0s33ju24Uw/BGqLYfPPgn4HGRrPS2mfKk3Q==

js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
Expand Down