本文整理汇总了TypeScript中dpos-offline.LiskWallet.signTransaction方法的典型用法代码示例。如果您正苦于以下问题:TypeScript LiskWallet.signTransaction方法的具体用法?TypeScript LiskWallet.signTransaction怎么用?TypeScript LiskWallet.signTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dpos-offline.LiskWallet
的用法示例。
在下文中一共展示了LiskWallet.signTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
tx = anotherMultisig.signTransaction(new SendTx()
.set('senderPublicKey', anotherMultisig.publicKey)
.set('recipientId', '1R')
.set('fee', systemModule.getFees().fees.send)
.set('amount', 100)
.set('timestamp', 1));
tx.signatures = [];
});
示例2: it
it('should not allow creating multisig account without main account second signature', async () => {
const secondWallet = createRandomWallet();
const secondSign = wallet
.signTransaction(
new CreateSignatureTx({
signature: { publicKey: secondWallet.publicKey },
})
.set('fee', systemModule.getFees().fees.secondsignature)
.set('timestamp', 1)
);
await initializer.rawMineBlockWithTxs([toBufferedTransaction(secondSign)]);
const keys = await createRandomAccountsWithFunds(3, 1e10);
const multisigTx = wallet.signTransaction(new MultiSignatureTx({
multisignature: {
keysgroup: keys.map((k) => `+${k.account.publicKey}`),
lifetime : 48,
min : 2,
},
})
.set('fee', systemModule.getFees().fees.multisignature)
.set('timestamp', 1)
);
// from main account - no secondsignature - all multisig signatures
multisigTx.signatures = keys.map((k) => k.account.getSignatureOfTransaction(multisigTx));
await expect(initializer.rawMineBlockWithTxs([toBufferedTransaction(multisigTx)]))
.rejectedWith('Failed to verify second signature');
// With second signature but old signatures that do not account the secondSignature
multisigTx.signSignature = secondWallet.getSignatureOfTransaction(multisigTx);
await expect(initializer.rawMineBlockWithTxs([toBufferedTransaction(multisigTx)]))
.rejectedWith('Failed to verify multisignature');
// updating the signatures should work
multisigTx.signatures = keys.map((k) => k.account.getSignatureOfTransaction(multisigTx));
await expect(initializer.rawMineBlockWithTxs([toBufferedTransaction(multisigTx)]))
.not.rejected;
});