import * as HCSdk from 'hc-base'; const sourceKey = HCSdk.Keypair.random(); // $ExpectType Keypair const destKey = HCSdk.Keypair.random(); const account = new HCSdk.Account(sourceKey.publicKey(), '1'); const transaction = new HCSdk.TransactionBuilder(account) .addOperation( HCSdk.Operation.accountMerge({ destination: destKey.publicKey() }) ) .addMemo(new HCSdk.Memo(HCSdk.MemoText, 'memo')) .setTimeout(5) .build(); // $ExpectType () => Transaction, Operation[]> const sig = HCSdk.xdr.DecoratedSignature.fromXDR(Buffer.of(1, 2)); // $ExpectType DecoratedSignature sig.hint(); // $ExpectType Buffer sig.signature(); // $ExpectType Buffer HCSdk.Memo.none(); // $ExpectType Memo<"none"> HCSdk.Memo.text('asdf'); // $ExpectType Memo<"text"> HCSdk.Memo.id('asdf'); // $ExpectType Memo<"id"> HCSdk.Memo.return('asdf'); // $ExpectType Memo<"return"> HCSdk.Memo.hash('asdf'); // $ExpectType Memo<"hash"> HCSdk.Memo.none().value; // $ExpectType null HCSdk.Memo.id('asdf').value; // $ExpectType string HCSdk.Memo.text('asdf').value; // $ExpectType string | Buffer HCSdk.Memo.return('asdf').value; // $ExpectType Buffer HCSdk.Memo.hash('asdf').value; // $ExpectType Buffer // P.S. don't use Memo constructor new HCSdk.Memo(HCSdk.MemoHash, 'asdf').value; // $ExpectType MemoValue // (new HCSdk.Memo(HCSdk.MemoHash, 'asdf')).type; // $ExpectType MemoType // TODO: Inspect what's wrong with linter. const noSignerXDR = HCSdk.Operation.setOptions({ lowThreshold: 1 }); HCSdk.Operation.fromXDRObject(noSignerXDR).signer; // $ExpectType never const newSignerXDR1 = HCSdk.Operation.setOptions({ signer: { ed25519PublicKey: sourceKey.publicKey(), weight: '1' } }); HCSdk.Operation.fromXDRObject(newSignerXDR1).signer; // $ExpectType Ed25519PublicKey const newSignerXDR2 = HCSdk.Operation.setOptions({ signer: { sha256Hash: Buffer.from(''), weight: '1' } }); HCSdk.Operation.fromXDRObject(newSignerXDR2).signer; // $ExpectType Sha256Hash const newSignerXDR3 = HCSdk.Operation.setOptions({ signer: { preAuthTx: '', weight: 1 } }); HCSdk.Operation.fromXDRObject(newSignerXDR3).signer; // $ExpectType PreAuthTx HCSdk.TimeoutInfinite; // $ExpectType 0