Skip to content

Commit

Permalink
Merge pull request #146 from OneKeyHQ/feat/supportEip6963
Browse files Browse the repository at this point in the history
feat: support eip 6963
  • Loading branch information
ByteZhang1024 authored Jan 8, 2024
2 parents 2724214 + 08a4521 commit dc579c5
Show file tree
Hide file tree
Showing 34 changed files with 242 additions and 138 deletions.
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-core",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -29,9 +29,9 @@
"build-version-info": "node ./scripts/buildVersionInfo.js"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-errors": "1.1.50",
"@onekeyfe/cross-inpage-provider-events": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/cross-inpage-provider-errors": "1.1.51",
"@onekeyfe/cross-inpage-provider-events": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"events": "^3.3.0",
"lodash": "^4.17.21",
"ms": "^2.1.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/versionInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

const version = '1.1.48';
const version = '1.1.51';
const versionBuild = '2020-0101-1';

export default {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/walletProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function defineWindowProperty(property: string, provider: unknown) {
((window as any)[property] ?? {})[key] = (proxyProvider as any)[key];
});
Object.defineProperty(window, property, {
enumerable: true, // Object.keys loop check inject
configurable: false, // prevent redefined
get() {
return proxyProvider;
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop/desktop-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/desktop-bridge-injected",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -34,7 +34,7 @@
"electron": "^17.2.0"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50"
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51"
}
}
2 changes: 1 addition & 1 deletion packages/empty/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-empty",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-errors",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/events/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-events",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down
24 changes: 12 additions & 12 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-example",
"version": "1.1.50",
"version": "1.1.51",
"private": true,
"scripts": {
"postinstall": "patch-package",
Expand All @@ -16,17 +16,17 @@
"@ethersproject/bytes": "^5.0.6",
"@metamask/onboarding": "^1.0.1",
"@mysten/wallet-kit": "^0.7.2",
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/onekey-aptos-provider": "1.1.50",
"@onekeyfe/onekey-cardano-provider": "1.1.50",
"@onekeyfe/onekey-conflux-provider": "1.1.50",
"@onekeyfe/onekey-cosmos-provider": "1.1.50",
"@onekeyfe/onekey-near-provider": "1.1.50",
"@onekeyfe/onekey-solana-provider": "1.1.50",
"@onekeyfe/onekey-sui-provider": "1.1.50",
"@onekeyfe/onekey-tron-provider": "1.1.50",
"@onekeyfe/onekey-webln-provider": "1.1.50",
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/onekey-aptos-provider": "1.1.51",
"@onekeyfe/onekey-cardano-provider": "1.1.51",
"@onekeyfe/onekey-conflux-provider": "1.1.51",
"@onekeyfe/onekey-cosmos-provider": "1.1.51",
"@onekeyfe/onekey-near-provider": "1.1.51",
"@onekeyfe/onekey-solana-provider": "1.1.51",
"@onekeyfe/onekey-sui-provider": "1.1.51",
"@onekeyfe/onekey-tron-provider": "1.1.51",
"@onekeyfe/onekey-webln-provider": "1.1.51",
"@polkadot/api": "^9.11.3",
"@polkadot/extension-dapp": "^0.44.8",
"@solana/web3.js": "^1.41.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-hosted/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-hosted",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,8 +28,8 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/extension/extension-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/extension-bridge-injected",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50"
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51"
}
}
14 changes: 7 additions & 7 deletions packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cross-inpage-provider-injected",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -42,12 +42,12 @@
"electron": "*"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/desktop-bridge-injected": "1.1.50",
"@onekeyfe/extension-bridge-injected": "1.1.50",
"@onekeyfe/inpage-providers-hub": "1.1.50",
"@onekeyfe/native-bridge-injected": "1.1.50",
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/desktop-bridge-injected": "1.1.51",
"@onekeyfe/extension-bridge-injected": "1.1.51",
"@onekeyfe/inpage-providers-hub": "1.1.51",
"@onekeyfe/native-bridge-injected": "1.1.51",
"buffer": "^6.0.3"
}
}
6 changes: 3 additions & 3 deletions packages/native/native-bridge-injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/native-bridge-injected",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,7 +28,7 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50"
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51"
}
}
34 changes: 17 additions & 17 deletions packages/providers/inpage-providers-hub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/inpage-providers-hub",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,22 +28,22 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/onekey-aptos-provider": "1.1.50",
"@onekeyfe/onekey-btc-provider": "1.1.50",
"@onekeyfe/onekey-cardano-provider": "1.1.50",
"@onekeyfe/onekey-conflux-provider": "1.1.50",
"@onekeyfe/onekey-cosmos-provider": "1.1.50",
"@onekeyfe/onekey-eth-provider": "1.1.50",
"@onekeyfe/onekey-nostr-provider": "1.1.50",
"@onekeyfe/onekey-polkadot-provider": "1.1.50",
"@onekeyfe/onekey-private-provider": "1.1.50",
"@onekeyfe/onekey-solana-provider": "1.1.50",
"@onekeyfe/onekey-starcoin-provider": "1.1.50",
"@onekeyfe/onekey-sui-provider": "1.1.50",
"@onekeyfe/onekey-tron-provider": "1.1.50",
"@onekeyfe/onekey-webln-provider": "1.1.50",
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/onekey-aptos-provider": "1.1.51",
"@onekeyfe/onekey-btc-provider": "1.1.51",
"@onekeyfe/onekey-cardano-provider": "1.1.51",
"@onekeyfe/onekey-conflux-provider": "1.1.51",
"@onekeyfe/onekey-cosmos-provider": "1.1.51",
"@onekeyfe/onekey-eth-provider": "1.1.51",
"@onekeyfe/onekey-nostr-provider": "1.1.51",
"@onekeyfe/onekey-polkadot-provider": "1.1.51",
"@onekeyfe/onekey-private-provider": "1.1.51",
"@onekeyfe/onekey-solana-provider": "1.1.51",
"@onekeyfe/onekey-starcoin-provider": "1.1.51",
"@onekeyfe/onekey-sui-provider": "1.1.51",
"@onekeyfe/onekey-tron-provider": "1.1.51",
"@onekeyfe/onekey-webln-provider": "1.1.51",
"web3": "^1.7.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { JsBridgeBase } from '@onekeyfe/cross-inpage-provider-core';
import { ProviderEthereum, shimWeb3 } from '@onekeyfe/onekey-eth-provider';
import { ProviderEthereum, shimWeb3, registerEIP6963Provider } from '@onekeyfe/onekey-eth-provider';
import { ProviderPrivate } from '@onekeyfe/onekey-private-provider';
import { ProviderSolana, registerSolanaWallet, WalletIcon } from '@onekeyfe/onekey-solana-provider';
import { ProviderStarcoin } from '@onekeyfe/onekey-starcoin-provider';
Expand Down Expand Up @@ -31,6 +31,7 @@ export type IWindowOneKeyHub = {
phantom?: { solana?: ProviderSolana };
starcoin?: any;
aptos?: ProviderAptos;
petra?: ProviderAptos;
martian?: ProviderAptosMartian;
suiWallet?: ProviderSui;
cardano?: ProviderCardano;
Expand Down Expand Up @@ -146,10 +147,16 @@ function injectWeb3Provider(): unknown {
});

defineWindowProperty('ethereum', ethereum);
registerEIP6963Provider({
image: WALLET_CONNECT_INFO.onekey.icon,
provider: ethereum,
});

defineWindowProperty('solana', solana);
defineWindowProperty('phantom', { solana });
defineWindowProperty('starcoin', starcoin);
defineWindowProperty('aptos', martian);
defineWindowProperty('petra', martian);
defineWindowProperty('martian', martianProxy);
defineWindowProperty('conflux', conflux);
defineWindowProperty('tronLink', tron);
Expand Down
10 changes: 5 additions & 5 deletions packages/providers/onekey-aptos-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-aptos-provider",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,10 +28,10 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-errors": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/extension-bridge-injected": "1.1.50",
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-errors": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/extension-bridge-injected": "1.1.51",
"aptos": "^1.3.17",
"eth-rpc-errors": "^4.0.3"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/providers/onekey-btc-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-btc-provider",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,9 +28,9 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-errors": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/extension-bridge-injected": "1.1.50"
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-errors": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/extension-bridge-injected": "1.1.51"
}
}
10 changes: 5 additions & 5 deletions packages/providers/onekey-cardano-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-cardano-provider",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider",
"cardano"
Expand Down Expand Up @@ -29,9 +29,9 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-errors": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/extension-bridge-injected": "1.1.50"
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-errors": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/extension-bridge-injected": "1.1.51"
}
}
10 changes: 5 additions & 5 deletions packages/providers/onekey-conflux-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-conflux-provider",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -28,9 +28,9 @@
"start": "tsc --watch"
},
"dependencies": {
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-errors": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/extension-bridge-injected": "1.1.50"
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-errors": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/extension-bridge-injected": "1.1.51"
}
}
10 changes: 5 additions & 5 deletions packages/providers/onekey-cosmos-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/onekey-cosmos-provider",
"version": "1.1.50",
"version": "1.1.51",
"keywords": [
"cross-inpage-provider"
],
Expand Down Expand Up @@ -29,10 +29,10 @@
},
"dependencies": {
"@noble/hashes": "^1.3.0",
"@onekeyfe/cross-inpage-provider-core": "1.1.50",
"@onekeyfe/cross-inpage-provider-errors": "1.1.50",
"@onekeyfe/cross-inpage-provider-types": "1.1.50",
"@onekeyfe/extension-bridge-injected": "1.1.50",
"@onekeyfe/cross-inpage-provider-core": "1.1.51",
"@onekeyfe/cross-inpage-provider-errors": "1.1.51",
"@onekeyfe/cross-inpage-provider-types": "1.1.51",
"@onekeyfe/extension-bridge-injected": "1.1.51",
"eth-rpc-errors": "^4.0.3",
"long": "^5.2.1",
"mitt": "^3.0.0"
Expand Down
Loading

0 comments on commit dc579c5

Please sign in to comment.