mirror of
https://github.com/wharfkit/wallet-plugin-mock.git
synced 2026-07-21 10:02:10 +00:00
Updating for SessionKit 1.1.0
This commit is contained in:
@@ -10,11 +10,11 @@ lib: ${SRC_FILES} package.json tsconfig.json node_modules rollup.config.js
|
||||
|
||||
.PHONY: test
|
||||
test: node_modules
|
||||
@TS_NODE_PROJECT='./test/tsconfig.json' \
|
||||
@TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR=./test/data \
|
||||
${BIN}/mocha ${MOCHA_OPTS} ${TEST_FILES} --grep '$(grep)'
|
||||
|
||||
build/coverage: ${SRC_FILES} ${TEST_FILES} node_modules
|
||||
@TS_NODE_PROJECT='./test/tsconfig.json' \
|
||||
@TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR=./test/data \
|
||||
${BIN}/nyc ${NYC_OPTS} --reporter=html \
|
||||
${BIN}/mocha ${MOCHA_OPTS} -R nyan ${TEST_FILES}
|
||||
|
||||
@@ -24,7 +24,7 @@ coverage: build/coverage
|
||||
|
||||
.PHONY: ci-test
|
||||
ci-test: node_modules
|
||||
@TS_NODE_PROJECT='./test/tsconfig.json' \
|
||||
@TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR=./test/data \
|
||||
${BIN}/nyc ${NYC_OPTS} --reporter=text \
|
||||
${BIN}/mocha ${MOCHA_OPTS} -R list ${TEST_FILES}
|
||||
|
||||
|
||||
+3
-2
@@ -19,7 +19,7 @@
|
||||
"tslib": "^2.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@wharfkit/session": "^1.0.0"
|
||||
"@wharfkit/session": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-alias": "^3.1.4",
|
||||
@@ -34,7 +34,8 @@
|
||||
"@types/node": "^18.7.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
||||
"@typescript-eslint/parser": "^5.20.0",
|
||||
"@wharfkit/session": "^1.0.0",
|
||||
"@wharfkit/mock-data": "^1.2.0",
|
||||
"@wharfkit/session": "^1.1.0-rcfinal",
|
||||
"chai": "^4.3.4",
|
||||
"eslint": "^8.13.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"request": {
|
||||
"path": "https://jungle4.greymass.com/v1/chain/get_info",
|
||||
"params": {
|
||||
"method": "GET"
|
||||
}
|
||||
},
|
||||
"status": 200,
|
||||
"json": {
|
||||
"server_version": "905c5cc9",
|
||||
"chain_id": "73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d",
|
||||
"head_block_num": 107764556,
|
||||
"last_irreversible_block_num": 107764221,
|
||||
"last_irreversible_block_id": "066c59fd122658f9c7b0a2d86a92c2899fffd33994c33dee9725e1245588eb3b",
|
||||
"head_block_id": "066c5b4cd7e827bac4551b8ebb2f37839ee6ecbc4e18317a5133fb15725d7ee8",
|
||||
"head_block_time": "2023-11-10T18:06:05.000",
|
||||
"head_block_producer": "eosnationftw",
|
||||
"virtual_block_cpu_limit": 200000000,
|
||||
"virtual_block_net_limit": 1048576000,
|
||||
"block_cpu_limit": 200000,
|
||||
"block_net_limit": 1048576,
|
||||
"server_version_string": "v3.1.3",
|
||||
"fork_db_head_block_num": 107764556,
|
||||
"fork_db_head_block_id": "066c5b4cd7e827bac4551b8ebb2f37839ee6ecbc4e18317a5133fb15725d7ee8",
|
||||
"server_full_version_string": "v3.1.3-905c5cc900b4e88aed4ab6912009127bf9f4f140",
|
||||
"total_cpu_weight": "120613298869319",
|
||||
"total_net_weight": "117529300091371",
|
||||
"earliest_available_block_num": 107585477,
|
||||
"last_irreversible_block_time": "2023-11-10T18:03:17.500"
|
||||
},
|
||||
"text": "{\"server_version\":\"905c5cc9\",\"chain_id\":\"73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d\",\"head_block_num\":107764556,\"last_irreversible_block_num\":107764221,\"last_irreversible_block_id\":\"066c59fd122658f9c7b0a2d86a92c2899fffd33994c33dee9725e1245588eb3b\",\"head_block_id\":\"066c5b4cd7e827bac4551b8ebb2f37839ee6ecbc4e18317a5133fb15725d7ee8\",\"head_block_time\":\"2023-11-10T18:06:05.000\",\"head_block_producer\":\"eosnationftw\",\"virtual_block_cpu_limit\":200000000,\"virtual_block_net_limit\":1048576000,\"block_cpu_limit\":200000,\"block_net_limit\":1048576,\"server_version_string\":\"v3.1.3\",\"fork_db_head_block_num\":107764556,\"fork_db_head_block_id\":\"066c5b4cd7e827bac4551b8ebb2f37839ee6ecbc4e18317a5133fb15725d7ee8\",\"server_full_version_string\":\"v3.1.3-905c5cc900b4e88aed4ab6912009127bf9f4f140\",\"total_cpu_weight\":\"120613298869319\",\"total_net_weight\":\"117529300091371\",\"earliest_available_block_num\":107585477,\"last_irreversible_block_time\":\"2023-11-10T18:03:17.500\"}"
|
||||
}
|
||||
+2
-14
@@ -1,10 +1,7 @@
|
||||
import {assert} from 'chai'
|
||||
import {PermissionLevel, SessionKit} from '@wharfkit/session'
|
||||
|
||||
import {WalletPluginMock} from '$lib'
|
||||
import {mockFetch} from '$test/utils/mock-fetch'
|
||||
import {MockStorage} from '$test/utils/mock-storage'
|
||||
import {MockUserInterface} from '$test/utils/mock-ui'
|
||||
import {mockSessionKitArgs, mockSessionKitOptions} from '@wharfkit/mock-data'
|
||||
|
||||
const mockChainDefinition = {
|
||||
id: '73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d',
|
||||
@@ -13,18 +10,9 @@ const mockChainDefinition = {
|
||||
|
||||
const mockPermissionLevel = PermissionLevel.from('wharfkit1115@test')
|
||||
|
||||
const mockSessionKitOptions = {
|
||||
appName: 'unittests',
|
||||
chains: [mockChainDefinition],
|
||||
fetch: mockFetch, // Required for unit tests
|
||||
storage: new MockStorage(),
|
||||
ui: new MockUserInterface(),
|
||||
walletPlugins: [new WalletPluginMock()],
|
||||
}
|
||||
|
||||
suite('wallet plugin', function () {
|
||||
test('login and sign', async function () {
|
||||
const kit = new SessionKit(mockSessionKitOptions)
|
||||
const kit = new SessionKit(mockSessionKitArgs, mockSessionKitOptions)
|
||||
const {session} = await kit.login({
|
||||
chain: mockChainDefinition.id,
|
||||
permissionLevel: mockPermissionLevel,
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
PromptArgs,
|
||||
PromptResponse,
|
||||
UserInterface,
|
||||
UserInterfaceAccountCreationResponse,
|
||||
UserInterfaceLoginResponse,
|
||||
} from '@wharfkit/session'
|
||||
|
||||
@@ -77,4 +78,12 @@ export class MockUserInterface extends AbstractUserInterface implements UserInte
|
||||
addTranslations(): void {
|
||||
this.log('addTranslations')
|
||||
}
|
||||
async onAccountCreate(): Promise<UserInterfaceAccountCreationResponse> {
|
||||
this.log('onAccountCreate')
|
||||
return Promise.resolve({})
|
||||
}
|
||||
|
||||
async onAccountCreateComplete(): Promise<void> {
|
||||
this.log('onAccountCreateComplete')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,54 +540,73 @@
|
||||
"@typescript-eslint/types" "5.50.0"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
"@wharfkit/abicache@^1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/abicache/-/abicache-1.1.1.tgz#03624d03d9466e7def278786aaf074d274fc5650"
|
||||
integrity sha512-CfpHzCLxFATcfReqdJDUxEDSHIeBF3jFx0cP8RcTDyhC2jX4cd+Q/wqjw/kCni3xrBM7cIGUp9c9NZdvdTK9Cg==
|
||||
"@wharfkit/abicache@^1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/abicache/-/abicache-1.2.0.tgz#f67f7bbd854adc443c3e363d5fbe3d27ac4f8383"
|
||||
integrity sha512-1+564ODM1KhUs7chE8KpYhnxShuPLC1MvqYcXVuLosxXXwcYC4IiJ1V3VuikLG+xfBDp1GZivGjHQwv1awE2Zw==
|
||||
dependencies:
|
||||
"@wharfkit/antelope" "^0.7.3"
|
||||
"@wharfkit/signing-request" "^3.0.0"
|
||||
"@wharfkit/antelope" "^1.0.0"
|
||||
"@wharfkit/signing-request" "^3.1.0"
|
||||
pako "^2.0.4"
|
||||
tslib "^2.1.0"
|
||||
|
||||
"@wharfkit/antelope@^0.7.3":
|
||||
version "0.7.3"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-0.7.3.tgz#408f6c587f4f5990d4b55596c10be2e976798641"
|
||||
integrity sha512-pyUmuXUpLQh1RVpJVIcbVUHTwV/DQ+MI0nlfWDBHIICdYf6XidZtQmaHB7JEXiFzlS8T7S9Xc5VOTOQU8dnl3Q==
|
||||
"@wharfkit/antelope@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/antelope/-/antelope-1.0.0.tgz#c3057b70575991be5de3aea19e0c474614783c80"
|
||||
integrity sha512-gwc6L3AzceN/menx9HCV22Ekd3it1wRruY6dIkyfCaV2UBGmfvIVJ3wPaDi4Ppj2k50b86ShSSHdd52jOFd+dg==
|
||||
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.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/common/-/common-1.1.0.tgz#1ee9dd1ba9e202002fadd20593f5f42a3e67c827"
|
||||
integrity sha512-A1Ta8zrEXkuEQcEiEexG0BVrYOxqm75qbLYU9tGNhyw4z/vQiF6rzmCOqhmWGg6nE2J2GYPvrPZPZzDmRGtG+w==
|
||||
"@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.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/session/-/session-1.0.0.tgz#09c60d01a6185ab2e451d34462d84de2d7013220"
|
||||
integrity sha512-wXmvOVBZ1Rp/9HPUzGPaD/vpGXv2FCNgl8JRLopKgKPHkkEX/u4untshHR8AwSc0ZitjOlv6ubR2h9/UW8h6ug==
|
||||
"@wharfkit/mock-data@^1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/mock-data/-/mock-data-1.2.0.tgz#fa5749f1332e413ecd4126dedf1d17724840df41"
|
||||
integrity sha512-R779GKbzVeJFvO/VMLnjSua4YteQiuJ1WX/MjEeo2ftP0aPgaLNEoFKGa7veAvYEv/6mgEcS4Sm5gyFi1Enxhg==
|
||||
dependencies:
|
||||
"@wharfkit/abicache" "^1.1.1"
|
||||
"@wharfkit/antelope" "^0.7.3"
|
||||
"@wharfkit/common" "^1.1.0"
|
||||
"@wharfkit/signing-request" "^3.0.0"
|
||||
"@wharfkit/antelope" "^1.0.0"
|
||||
"@wharfkit/session" "^1.1.0-rcfinal"
|
||||
"@wharfkit/wallet-plugin-privatekey" "^1.0.0"
|
||||
node-fetch "^2.6.1"
|
||||
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==
|
||||
dependencies:
|
||||
"@wharfkit/abicache" "^1.2.0"
|
||||
"@wharfkit/antelope" "^1.0.0"
|
||||
"@wharfkit/common" "^1.2.0"
|
||||
"@wharfkit/signing-request" "^3.1.0"
|
||||
pako "^2.0.4"
|
||||
tslib "^2.1.0"
|
||||
|
||||
"@wharfkit/signing-request@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/signing-request/-/signing-request-3.0.0.tgz#3464cdc76c0690ab241d805116101e3ed63ba846"
|
||||
integrity sha512-+9UaznhYlZSgdZGG/LF5GkH7P9dCVh+b32cR1PYHKG6KuOsPlLqfv1DuWkqsxQyi3kGT1fXG1i8sl39ItgwLzg==
|
||||
"@wharfkit/signing-request@^3.1.0":
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/signing-request/-/signing-request-3.1.0.tgz#7883f0b2350c6fe3446d2b8733dd7d0004f01911"
|
||||
integrity sha512-aVWV9Z3o77uDrFSR3wC78c1e/QNkfi3IxZbGzMizvoYTYPKHgHs1F6Go/1oe0Dlo/kEB9tgckFviccUqrK987w==
|
||||
dependencies:
|
||||
"@wharfkit/antelope" "^0.7.3"
|
||||
"@wharfkit/antelope" "^1.0.0"
|
||||
tslib "^2.0.3"
|
||||
|
||||
"@wharfkit/wallet-plugin-privatekey@^1.0.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@wharfkit/wallet-plugin-privatekey/-/wallet-plugin-privatekey-1.1.0.tgz#5985bff61895c54d2afbef359cd42da4f3871c7d"
|
||||
integrity sha512-45LPj7AOVDm4RugDEhy0fnQX/BcMffeJPjGUCUrLazJ2S0Sti8nNk4nqiJqyme84c/0gq7d65vvwlmVfGtPVEg==
|
||||
dependencies:
|
||||
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"
|
||||
@@ -2105,7 +2124,7 @@ package-hash@^4.0.0:
|
||||
lodash.flattendeep "^4.4.0"
|
||||
release-zalgo "^1.0.0"
|
||||
|
||||
pako@^2.0.4:
|
||||
pako@^2.0.4, pako@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
|
||||
integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==
|
||||
|
||||
Reference in New Issue
Block a user