Skip to content

Commit

Permalink
Merge pull request #3 from wharfkit/apporc_logout
Browse files Browse the repository at this point in the history
Add handleLogout
  • Loading branch information
aaroncox committed May 10, 2024
2 parents 87e7af0 + 3062c9d commit 017a5e1
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"tslib": "^2.1.0"
},
"peerDependencies": {
"@wharfkit/session": "^1.1.0"
"@wharfkit/session": "^1.3.1"
},
"devDependencies": {
"@babel/runtime": "^7.22.6",
Expand All @@ -35,7 +35,7 @@
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@wharfkit/session": "^1.1.0-rcfinal",
"@wharfkit/session": "^1.3.1",
"chai": "^4.3.4",
"crypto-js": "^4.1.1",
"eslint": "^8.13.0",
Expand Down
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Chains,
Checksum256,
LoginContext,
LogoutContext,
PermissionLevel,
ResolvedSigningRequest,
Serializer,
Expand Down Expand Up @@ -83,6 +84,14 @@ export async function handleLogin(context: LoginContext): Promise<WalletPluginLo
}
}

export async function handleLogout(context: LogoutContext): Promise<void> {
if (context.session === undefined) {
throw new Error('Unknown session')
}
const {scatter} = await getScatter({appName: context.appName, chain: context.session.chain})
await scatter.logout()
}

export async function handleSignatureRequest(
resolved: ResolvedSigningRequest,
context: TransactContext
Expand Down
78 changes: 74 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,28 @@
pako "^2.0.4"
tslib "^2.1.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==
dependencies:
"@wharfkit/antelope" "^1.0.2"
"@wharfkit/signing-request" "^3.1.0"
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":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.0.tgz#c3057b70575991be5de3aea19e0c474614783c80"
Expand All @@ -562,20 +584,53 @@
pako "^2.1.0"
tslib "^2.0.3"

"@wharfkit/antelope@^1.0.2", "@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/session@^1.1.0-rcfinal":
version "1.1.0-rcfinal"
resolved "https://registry.yarnpkg.com/@wharfkit/session/-/session-1.1.0-rcfinal.tgz#29a9f40dca8557e96d5e44c1498b09eb641f47e1"
integrity sha512-UijDlP2yE8WoprAXz8EpAyz1GyxWv9OloRGApTUKM/lMuSk1U2d7vefQzyXTn14f1npd7bfBzeTQ5piTerBHww==
"@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/resources@^1.1.0":
version "1.2.2"
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"
pako "^2.0.4"
Expand All @@ -589,6 +644,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 @@ -1887,6 +1952,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

0 comments on commit 017a5e1

Please sign in to comment.