-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: homura <[email protected]>
- Loading branch information
Showing
12 changed files
with
124 additions
and
14 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
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 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,6 @@ | ||
import { addMethod } from './server'; | ||
|
||
addMethod('ckb_getBlockchainInfo', async (_, { resolveService }) => { | ||
const backend = await resolveService('backendProvider').resolve(); | ||
return backend.getBlockchainInfo(); | ||
}); |
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,33 @@ | ||
import type { ChainInfo } from '@ckb-lumos/base'; | ||
|
||
export interface CkbMethods { | ||
/** | ||
* get the current chain info, useful when the app needs to determine what network Nexus is connected to. | ||
* @example | ||
* await window.ckb.request({ method: "ckb_getBlockchainInfo" }) | ||
* @returns {@link https://github.com/nervosnetwork/ckb/blob/develop/rpc/README.md#method-get_blockchain_info ChainInfo} | ||
* <details> | ||
* <summary>show return data example</summary> | ||
* | ||
* ```json | ||
* { | ||
* "alerts": [ | ||
* { | ||
* "id": "0x2a", | ||
* "message": "An example alert message!", | ||
* "notice_until": "0x24bcca57c00", | ||
* "priority": "0x1" | ||
* } | ||
* ], | ||
* "chain": "ckb", | ||
* "difficulty": "0x1f4003", | ||
* "epoch": "0x7080018000001", | ||
* "isInitialBlockDownload": true, | ||
* "medianime": "0x5cd2b105" | ||
* } | ||
* ``` | ||
* | ||
* </details> | ||
*/ | ||
ckb_getBlockchainInfo(): Promise<ChainInfo>; | ||
} |
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 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 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