generated from wharfkit/wallet-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from wharfkit/allowing-snap-origin-arg
Allowing snap origin arg on plugin initialization
- Loading branch information
Showing
12 changed files
with
144 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"request": { | ||
"path": "https://jungle4.greymass.com/v1/chain/get_info", | ||
"params": { | ||
"method": "GET", | ||
"headers": {} | ||
} | ||
}, | ||
"status": 200, | ||
"json": { | ||
"server_version": "17b89a28", | ||
"chain_id": "73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d", | ||
"head_block_num": 156088678, | ||
"last_irreversible_block_num": 156088343, | ||
"last_irreversible_block_id": "094db817b49cfc17bf85a65bc86c3fe70b2bb18030a0ca863c4b2abb09c0fb8c", | ||
"head_block_id": "094db96623b26ac406bd612b3160e80cda4963332a39e4d23005deeb094e34e1", | ||
"head_block_time": "2024-08-16T19:26:05.000", | ||
"head_block_producer": "eosriobrazil", | ||
"virtual_block_cpu_limit": 200000000, | ||
"virtual_block_net_limit": 1048576000, | ||
"block_cpu_limit": 200000, | ||
"block_net_limit": 1048576, | ||
"server_version_string": "v1.0.0-beta2.1", | ||
"fork_db_head_block_num": 156088678, | ||
"fork_db_head_block_id": "094db96623b26ac406bd612b3160e80cda4963332a39e4d23005deeb094e34e1", | ||
"server_full_version_string": "v1.0.0-beta2.1-17b89a28b525826db2986bc20106a6e8202b22a9", | ||
"total_cpu_weight": "120573498838233", | ||
"total_net_weight": "117542107821577", | ||
"earliest_available_block_num": 155899613, | ||
"last_irreversible_block_time": "2024-08-16T19:23:17.500" | ||
}, | ||
"text": "{\"server_version\":\"17b89a28\",\"chain_id\":\"73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d\",\"head_block_num\":156088678,\"last_irreversible_block_num\":156088343,\"last_irreversible_block_id\":\"094db817b49cfc17bf85a65bc86c3fe70b2bb18030a0ca863c4b2abb09c0fb8c\",\"head_block_id\":\"094db96623b26ac406bd612b3160e80cda4963332a39e4d23005deeb094e34e1\",\"head_block_time\":\"2024-08-16T19:26:05.000\",\"head_block_producer\":\"eosriobrazil\",\"virtual_block_cpu_limit\":200000000,\"virtual_block_net_limit\":1048576000,\"block_cpu_limit\":200000,\"block_net_limit\":1048576,\"server_version_string\":\"v1.0.0-beta2.1\",\"fork_db_head_block_num\":156088678,\"fork_db_head_block_id\":\"094db96623b26ac406bd612b3160e80cda4963332a39e4d23005deeb094e34e1\",\"server_full_version_string\":\"v1.0.0-beta2.1-17b89a28b525826db2986bc20106a6e8202b22a9\",\"total_cpu_weight\":\"120573498838233\",\"total_net_weight\":\"117542107821577\",\"earliest_available_block_num\":155899613,\"last_irreversible_block_time\":\"2024-08-16T19:23:17.500\"}" | ||
} |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference path="../../../global.d.ts" /> | ||
|
||
import {MetaMaskInpageProvider} from '@metamask/providers' | ||
|
||
class MockMetaMaskInpageProvider implements Partial<MetaMaskInpageProvider> { | ||
request(args: {method: string; params?: any}) { | ||
switch (args.method) { | ||
case 'wallet_getSnaps': | ||
return Promise.resolve({}) | ||
case 'wallet_requestSnaps': | ||
return Promise.resolve({ | ||
'local:http://localhost:8080': { | ||
id: 'local:http://localhost:8080', | ||
version: '1.0.0', | ||
}, | ||
}) | ||
case 'wallet_invokeSnap': | ||
if (args.params.request.method === 'antelope_getPublicKey') { | ||
return Promise.resolve( | ||
'PUB_K1_6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5BoDq63' | ||
) | ||
} | ||
if (args.params.request.method === 'antelope_signTransaction') { | ||
return Promise.resolve( | ||
'SIG_K1_KfCdjsrTnx5cBpbA5cUdHZAsRYsnC9uKzuS1shFeqfMCfdZwX4PBm9pfHwGRT6ffz3eavhtkyNci5GoFozQAx8P8PBnDmj' | ||
) | ||
} | ||
return Promise.resolve(null) | ||
case 'web3_clientVersion': | ||
return Promise.resolve(['MetaMask/v10.8.1']) | ||
default: | ||
return Promise.resolve(null) | ||
} | ||
} | ||
} | ||
|
||
const mockProvider = new MockMetaMaskInpageProvider() | ||
|
||
export function setupEthereumMock() { | ||
global.window = global.window || {} | ||
global.window.ethereum = mockProvider as any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,5 @@ | |
"strict": true, | ||
"target": "es2020" | ||
}, | ||
"include": ["src/**/*"] | ||
"include": ["src/**/*", "global.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters