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

Adding failing tests that need to resolve #67

Draft
wants to merge 26 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
83c3ddd
The `ui` option is now required for the SessionKit
aaroncox May 29, 2023
44c784c
Split SessionKit initialization to both "args" and "options"
aaroncox May 29, 2023
03ff1fd
Move `onSignComplete` to after all signing ops finish
aaroncox Jun 9, 2023
cfbcda2
Allow restoring without serialized session
aaroncox Jun 9, 2023
ef7a000
Track and allow restoring a default account per-chain
aaroncox Jun 29, 2023
7bb6984
Reapplied 4faab919a3154dc875279e54c3baf9448de7eefa
aaroncox Jun 29, 2023
3dfec19
Version 1.0.0-beta1
aaroncox Jun 30, 2023
09e7d4c
Moved all mock data to its own repository
aaroncox Jun 30, 2023
bdb09d4
Updating @wharfkit/mock-data and MOCK_DIR
aaroncox Jun 30, 2023
6a7a24d
Fixing ci-test
aaroncox Jun 30, 2023
d271f9f
Updating @wharfkit/mock-data
aaroncox Jun 30, 2023
c254b65
Allow manually passing in ABIDef for use in Sessions
aaroncox Jul 3, 2023
d26324c
Version 1.0.0-beta2
aaroncox Jul 3, 2023
e581be6
Version 1.0.0-beta3
aaroncox Jul 5, 2023
63d670c
Renamed AbiProvider to ABICache since it's an extension of ESR
aaroncox Jul 5, 2023
f8ec7d0
Better defined ABICacheInterface
aaroncox Jul 5, 2023
f4ada69
Version 1.0.0-beta4
aaroncox Jul 6, 2023
d1946fe
Prevent uneeded get_info calls when resolving
aaroncox Jul 26, 2023
a0a087f
Linting of tests
aaroncox Jul 26, 2023
39946aa
Adding tests for placeholder resolution
aaroncox Jul 26, 2023
cc1f063
Adding test data for placeholder resolution
aaroncox Jul 26, 2023
0c33616
Unused test cleanup
aaroncox Jul 26, 2023
891b6b1
Linting
aaroncox Jul 26, 2023
c53fc44
Adding failing tests that need to resolve
aaroncox Jul 26, 2023
8ee946b
Removing unused import
aaroncox Jul 26, 2023
ab5d284
Merge branch 'dev' into placeholder-resolution
aaroncox Jul 26, 2023
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
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["lib/*", "node_modules/**"],
"ignorePatterns": ["lib/*", "tests/*", "node_modules/**"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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} --no-timeout --grep '$(grep)'

test/watch: node_modules
Expand All @@ -28,13 +28,13 @@ 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}

.PHONY: check
check: node_modules
@${BIN}/eslint src --ext .ts --max-warnings 0 --format unix && echo "Ok"
@${BIN}/eslint src test --ext .ts --max-warnings 0 --format unix && echo "Ok"

.PHONY: format
format: node_modules
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wharfkit/session",
"description": "DESCRIPTION",
"version": "0.5.1",
"version": "1.0.0-beta4",
"homepage": "https://github.com/wharfkit/session",
"license": "BSD-3-Clause",
"main": "lib/session.js",
Expand Down Expand Up @@ -40,7 +40,10 @@
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@wharfkit/wallet-plugin-privatekey": "^0.3.0-ui-13",
"@wharfkit/contract": "^0.2.1",
"@wharfkit/mock-data": "^1.0.0-beta10",
"@wharfkit/transact-plugin-resource-provider": "^1.0.0-beta1",
"@wharfkit/wallet-plugin-privatekey": "^0.5.0",
"chai": "^4.3.4",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.1.0",
Expand All @@ -59,6 +62,6 @@
"typedoc": "^0.23.14",
"typedoc-plugin-mermaid": "^1.10.0",
"typescript": "^4.1.2",
"yarn-deduplicate": "^6.0.1"
"yarn-deduplicate": "^6.0.2"
}
}
15 changes: 11 additions & 4 deletions src/abi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import {ABI, API, APIClient, NameType} from '@greymass/eosio'
import {ABI, ABIDef, API, APIClient, NameType} from '@greymass/eosio'
import {AbiProvider} from 'eosio-signing-request'

export interface ABICacheInterface extends AbiProvider {
readonly cache: Map<string, ABI>
readonly pending: Map<string, Promise<API.v1.GetAbiResponse>>
getAbi(account: NameType): Promise<ABI>
setAbi(account: NameType, abi: ABIDef): void
}

/**
* Given an APIClient instance, this class provides an AbiProvider interface for retrieving and caching ABIs.
*/
export class ABICache implements AbiProvider {
export class ABICache implements ABICacheInterface {
readonly cache: Map<string, ABI> = new Map()
readonly pending: Map<string, Promise<API.v1.GetAbiResponse>> = new Map()

Expand All @@ -31,8 +38,8 @@ export class ABICache implements AbiProvider {
return record
}

setAbi(account: NameType, abi: ABI) {
setAbi(account: NameType, abi: ABIDef) {
const key = String(account)
this.cache.set(key, abi)
this.cache.set(key, ABI.from(abi))
}
}
Loading