Last active
May 23, 2023 07:34
-
-
Save serefyarar/97757bcf6a79d5e0c5df03a0b1da6c99 to your computer and use it in GitHub Desktop.
Main Action
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
/** | |
* NAME: main | |
*/ | |
import * as dagCBOR from '@ipld/dag-cbor'; | |
import { sha256 } from 'multiformats/hashes/sha2'; | |
import * as Block from 'multiformats/block'; | |
const go = async () => { | |
const payload = {"data":{"link_id":"kjzl6kcym7w8y6mlt4jg7so9lvuqixkl7c7uh9y7ndvxcnmf65d30hua8eku9wu","index_id":"kjzl6kcym7w8y87yu5qkjfo27l3wvvkfq2b99t0p624b32tqc0wu0eoeiqb02s2","created_at":"2023-04-20T12:53:48.407Z","updated_at":"2023-04-20T12:53:48.407Z","indexer_did":"did:key:z6MkfQcGtC6diZtiT379LLugPsYFeeFjX9m6UUrrzdwHNmH1"},"header":{"model":{"0":206,"1":1,"2":2,"3":1,"4":133,"5":1,"6":18,"7":32,"8":6,"9":44,"10":48,"11":93,"12":42,"13":123,"14":115,"15":227,"16":175,"17":161,"18":221,"19":33,"20":16,"21":132,"22":9,"23":76,"24":7,"25":213,"26":1,"27":0,"28":27,"29":11,"30":202,"31":111,"32":141,"33":152,"34":144,"35":43,"36":40,"37":109,"38":155,"39":96},"unique":{"0":248,"1":194,"2":130,"3":214,"4":112,"5":125,"6":98,"7":43,"8":88,"9":171,"10":207,"11":9},"controllers":["did:key:zQ3shmbBM4xA6h4gfgLhvYSpkm2vXDnFeWcBoBEPcoghwBQEn"]}}; | |
const linkedBlockEncoded = await Block.encode({ | |
value: payload, | |
codec: dagCBOR, | |
hasher: sha256 | |
}); | |
console.log(linkedBlockEncoded) | |
} | |
go() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment