Skip to content

Commit

Permalink
Merge pull request #290 from Conflux-Chain/db-refactor
Browse files Browse the repository at this point in the history
feat: refactor db
  • Loading branch information
yqrashawn authored Dec 9, 2021
2 parents 2459a87 + 4171ff6 commit 4892345
Show file tree
Hide file tree
Showing 62 changed files with 1,357 additions and 876 deletions.
3 changes: 2 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# shared production environment variable
# the build tool will load this file when NODE_ENV is production
# the build tool will load this file when NODE_ENV is production
SNOWPACK_PUBLIC_FLUENT_VERSION="1.0.0"
14 changes: 7 additions & 7 deletions .github/scripts/assert-fullnode-error-message-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ const asserts = [
'"./conflux-rust/client/src/rpc/impls/cfx.rs"',
'"./conflux-rust/client/src/rpc/impls/cfx.rs"',
'null',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/core/src/verification.rs"',
'"./conflux-rust/core/src/verification.rs"',
'"./conflux-rust/core/src/verification.rs"',
'"./conflux-rust/core/src/executive/executed.rs"',
'"./conflux-rust/core/src/executive/executed.rs"',
'"./conflux-rust/core/src/executive/executed.rs"',
'"./conflux-rust/core/src/executive/executive.rs"',
'"./conflux-rust/core/src/executive/executive.rs"',
'"./conflux-rust/core/src/executive/executive.rs"',
'"./conflux-rust/core/src/verification.rs"',
'"./conflux-rust/core/src/verification.rs"',
'"./conflux-rust/core/src/verification.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'"./conflux-rust/primitives/src/transaction.rs"',
'null',
'"./conflux-rust/core/src/transaction_pool/mod.rs"',
'"./conflux-rust/core/src/transaction_pool/mod.rs"',
Expand Down
39 changes: 39 additions & 0 deletions .yarn/versions/52c5a07b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
releases:
"@fluent-wallet/cfx_accounts": patch
"@fluent-wallet/cfx_request-accounts": patch
"@fluent-wallet/cfx_send-transaction": patch
"@fluent-wallet/cfx_sign-transaction": patch
"@fluent-wallet/cfx_sign-typed-data_v4": patch
"@fluent-wallet/conflux-tx-error": patch
"@fluent-wallet/db": major
"@fluent-wallet/eth_accounts": major
"@fluent-wallet/eth_request-accounts": major
"@fluent-wallet/eth_sign-typed-data_v4": patch
"@fluent-wallet/personal_sign": patch
"@fluent-wallet/rpc-engine": major
"@fluent-wallet/wallet_add-vault": major
"@fluent-wallet/wallet_create-account": major
"@fluent-wallet/wallet_create-address": major
"@fluent-wallet/wallet_delete-account-group": patch
"@fluent-wallet/wallet_delete-app": patch
"@fluent-wallet/wallet_delete-network": patch
"@fluent-wallet/wallet_detect-network-type": patch
"@fluent-wallet/wallet_discover-accounts": patch
"@fluent-wallet/wallet_enrich-conflux-tx": patch
"@fluent-wallet/wallet_export-account": patch
"@fluent-wallet/wallet_export-account-group": patch
"@fluent-wallet/wallet_get-account-group-vault-value": patch
"@fluent-wallet/wallet_get-address-private-key": patch
"@fluent-wallet/wallet_get-blockchain-explorer-url": patch
"@fluent-wallet/wallet_get-fluent-metadata": patch
"@fluent-wallet/wallet_handle-unfinished-cfx-tx": patch
"@fluent-wallet/wallet_set-app-current-account": patch
"@fluent-wallet/wallet_set-current-account": patch
"@fluent-wallet/wallet_update-account": patch
"@fluent-wallet/wallet_update-account-group": patch
"@fluent-wallet/wallet_update-token-list": major
"@fluent-wallet/wallet_watch-asset": patch

declined:
- helios-background
- helios-popup
3 changes: 2 additions & 1 deletion packages/background/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@
"@fluent-wallet/wallet_get-account-group-vault-value": "workspace:packages/rpcs/wallet_getAccountGroupVaultValue",
"@fluent-wallet/wallet_get-address-private-key": "workspace:packages/rpcs/wallet_getAddressPrivateKey",
"@fluent-wallet/wallet_get-balance": "workspace:packages/rpcs/wallet_getBalance",
"@fluent-wallet/wallet_get-blockchain-explorer-url": "workspace:*",
"@fluent-wallet/wallet_get-current-account": "workspace:packages/rpcs/wallet_getCurrentAccount",
"@fluent-wallet/wallet_get-current-network": "workspace:packages/rpcs/wallet_getCurrentNetwork",
"@fluent-wallet/wallet_get-current-viewing-app": "workspace:packages/rpcs/wallet_getCurrentViewingApp",
"@fluent-wallet/wallet_get-explorer-url": "workspace:*",
"@fluent-wallet/wallet_get-fluent-metadata": "workspace:*",
"@fluent-wallet/wallet_get-network": "workspace:packages/rpcs/wallet_getNetwork",
"@fluent-wallet/wallet_get-next-nonce": "workspace:packages/rpcs/wallet_getNextNonce",
"@fluent-wallet/wallet_get-pending-auth-request": "workspace:packages/rpcs/wallet_getPendingAuthRequest",
Expand Down
33 changes: 16 additions & 17 deletions packages/background/src/db-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const schema = {
ticker: {
doc: 'A object with info of the currency, eg. {name: "Ethereum", symbol: "CFX", decimals: 18, iconUrls: [...svg]}',
},
address: {ref: true, many: true, component: true},
builtin: {doc: "Indicating builtin network, shouldn't be deleted"},
scanUrl: {doc: 'Url of block chain explorer'},
selected: {doc: 'network selected by wallet'},
Expand All @@ -63,12 +62,6 @@ const schema = {
component: true,
},
balanceChecker: {doc: 'balance checker contract address'},
token: {
doc: 'tokens from token list, dapp, and user of this network',
ref: true,
many: true,
component: true,
},
isMainnet: {doc: 'is mainnet network'},
isTestnet: {doc: 'is testnet network'},
isCustom: {doc: 'is custom network'},
Expand All @@ -86,8 +79,13 @@ const schema = {
},
accountGroup: {
nickname: {doc: 'account group nickname'},
vault: {ref: true, doc: 'Entity ID of vault', identity: true},
// customHdPath: {
vault: {
ref: true,
doc: 'Entity ID of vault',
identity: true,
component: true,
},
// hdPath: {
// ref: 'hdPath',
// doc: 'Entity ID of hd path, when set, will use this custom hd path for whatever network',
// },
Expand All @@ -99,12 +97,11 @@ const schema = {
account: {ref: true, many: true, component: true},
},
address: {
vault: {ref: true},
nativeBalance: {doc: 'balance of this address'},
index: {doc: 'Address index in hd path, starts from 0'},
id: {tuples: ['address/network', 'address/value'], identity: true},
network: {ref: true},
value: {doc: 'address string, hex or base32 based on network'},
hex: {doc: 'The value of the address, not cfx hex address'},
cfxHex: {doc: 'The value of cfx hex address'},
base32: {doc: 'base32 addr of the right network'},
nativeBalance: {doc: 'balance of this address'},
pk: {doc: 'the private key of the address', persist: false},
balance: {
doc: 'token balances of this address',
Expand Down Expand Up @@ -135,9 +132,9 @@ const schema = {

// ## tx
tx: {
payload: {
txPayload: {
doc: 'tx payload as an object',
ref: 'txPayload',
ref: true,
component: true,
},
raw: {doc: 'raw tx hash'},
Expand All @@ -153,7 +150,7 @@ const schema = {
chainSwitched: {doc: 'chain switched'},
created: {doc: 'created timestamp get with new Date().getTime()'},
err: {doc: 'basic error type/info'},
extra: {doc: 'enriched tx info', ref: 'txExtra', component: true},
txExtra: {doc: 'enriched tx info', ref: true, component: true},
fromFluent: {doc: 'tx sumitted from fluent'},
},
txPayload: {
Expand Down Expand Up @@ -224,6 +221,8 @@ const schema = {

// ## tokens
token: {
id: {tuples: ['token/network', 'token/address'], identity: true},
network: {ref: true},
name: {doc: 'token name'},
address: {doc: 'address, hex or base32'},
symbol: {doc: 'token symbol'},
Expand Down
Loading

0 comments on commit 4892345

Please sign in to comment.