-
Notifications
You must be signed in to change notification settings - Fork 3
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: Miroslav Bajtoš <[email protected]>
- Loading branch information
Showing
3 changed files
with
3,656 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { rpc } from './lib/miner-info.js' | ||
import { decodeBase64 } from './vendor/deno-deps.js' | ||
import { multiaddr } from './vendor/multiaddr.js' | ||
|
||
const minerId = 'f03156722' | ||
|
||
const info = await rpc('Filecoin.StateMinerInfo', minerId, null) | ||
console.log(info) | ||
|
||
const binary = info.Multiaddrs[0] | ||
console.log(binary) | ||
const addr = multiaddr(decodeBase64(binary)) | ||
console.log(addr.toString()) | ||
|
||
const res = await Zinnia.requestProtocol( | ||
addr.toString() + '/p2p/' + info.PeerId, | ||
'/ipfs/id/1.0.0', | ||
new Uint8Array(0) | ||
) | ||
|
||
const chunks = [] | ||
for await (const chunk of res) { | ||
chunks.push(chunk); | ||
} | ||
const bytes =chunks.map(c => c.values()).flat() | ||
console.log('BYTES', bytes) | ||
|
||
const data = new Uint8Array(bytes) | ||
console.log('DATA: %o', data) | ||
|
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
Oops, something went wrong.