Skip to content

Commit

Permalink
less interesting examples for bech32m (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
turbocrime authored May 3, 2024
1 parent b63927b commit 88cd189
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/bech32m/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,25 @@ const partialPositionId: PartialMessage<PositionId> = plpidFromBech32(
'plpid1fkf3tlv500vgzwc6dkc7g9wnuv6rzezhefefdywq5tt4lyl97rgsd6j689',
);

// if you want to use the functionality available on the full Message class object, you
// must construct it explicitly
// you must explicitly construct the object if you want to use functions
// available on the @bufbuild/protobuf Message class

const realSpendKey: SpendKey = new SpendKey(
spendKeyFromBech32m(
'penumbraspendkey1qul0huewkcmemljd5m3vz3awqt7442tjg2dudahvzu6eyj9qf0eszrnguh',
),
);

void fetch('https://example.com/iamveryclever', {
method: 'POST',
body: realSpendKey.toJsonString(),
// marshal to protojson
realSpendKey.toJson();
// { "inner": "Bz778y62N53+TabiwUeuAv1aqXJCm8b27Bc1kkigS/M=" }

// true
realSpendKey.equals({
inner: new Uint8Array([
0x07, 0x3e, 0xfb, 0xf3, 0x2e, 0xb6, 0x37, 0x9d, 0xfe, 0x4d, 0xa6, 0xe2, 0xc1, 0x47, 0xae, 0x02,
0xfd, 0x5a, 0xa9, 0x72, 0x42, 0x9b, 0xc6, 0xf6, 0xec, 0x17, 0x35, 0x92, 0x48, 0xa0, 0x4b, 0xf3,
]),
});
```

Expand Down

0 comments on commit 88cd189

Please sign in to comment.