本文整理汇总了TypeScript中bech32.toWords函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toWords函数的具体用法?TypeScript toWords怎么用?TypeScript toWords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toWords函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
lazy.prop(o, 'address', () => {
if (!o.hash) return;
const words = bech32.toWords(o.hash);
words.unshift(0x00);
return bech32.encode(network.bech32, words);
});
开发者ID:bitcoinjs,项目名称:bitcoinjs-lib,代码行数:7,代码来源:p2wpkh.ts
示例2: toBech32
export function toBech32(
data: Buffer,
version: number,
prefix: string,
): string {
const words = bech32.toWords(data);
words.unshift(version);
return bech32.encode(prefix, words);
}
开发者ID:sbwdlihao,项目名称:bitcoinjs-lib,代码行数:10,代码来源:address.ts
示例3:
import * as bech32 from 'bech32';
// Test decode
const testString = 'abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw';
const decoded = bech32.decode(testString);
// Test decode with limit
bech32.decode(testString, testString.length);
decoded.prefix;
decoded.words;
// Test convert from/to words
const words: Buffer = bech32.toWords(Buffer.from('foobar', 'utf8'));
bech32.fromWords(words);
// Test encode
const testPrefix = 'foo';
bech32.encode(testPrefix, words);
// Test encode with limit
bech32.encode(testPrefix, words, testPrefix.length + 7 + words.length);
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:19,代码来源:bech32-tests.ts
示例4:
import * as bech32 from 'bech32';
// Test decode
const testString = 'abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw';
const decoded = bech32.decode(testString);
// Test decode with limit
bech32.decode(testString, testString.length);
decoded.prefix;
decoded.words;
// Test convert from/to words
const words: number[] = bech32.toWords(Buffer.from('foobar', 'utf8'));
bech32.fromWords(words);
// Test encode
const testPrefix = 'foo';
bech32.encode(testPrefix, words);
// Test encode with limit
bech32.encode(testPrefix, words, testPrefix.length + 7 + words.length);
开发者ID:misak113,项目名称:DefinitelyTyped,代码行数:19,代码来源:bech32-tests.ts
注:本文中的bech32.toWords函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论