Merge pull request #26938 from pselden/stellar-sdk-memo

Fix stellar-sdk memo type strings
This commit is contained in:
Paul van Brenk
2018-06-29 10:33:07 -07:00
committed by GitHub
2 changed files with 12 additions and 4 deletions
+11 -4
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/stellar/js-stellar-sdk
// Definitions by: Carl Foster <https://github.com/carl-foster>
// Triston Jones <https://github.com/tristonj>
// Paul Selden <https://github.com/pselden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -505,16 +506,22 @@ export class Memo {
static return(hash: string): Memo;
static text(text: string): Memo;
constructor(type: 'MemoNone')
constructor(type: 'MemoID' | 'MemoText', value: string)
constructor(type: 'MemoHash' | 'MemoReturn', value: Buffer)
constructor(type: 'none');
constructor(type: 'id' | 'text' | 'hash' | 'return', value: string)
constructor(type: 'hash' | 'return', value: Buffer)
type: 'MemoNone' | 'MemoID' | 'MemoText' | 'MemoHash' | 'MemoReturn';
type: string;
value: null | string | Buffer;
toXDRObject(): xdr.Memo;
}
export const MemoNone = 'none';
export const MemoID = 'id';
export const MemoText = 'text';
export const MemoHash = 'hash';
export const MemoReturn = 'return';
export enum Networks {
PUBLIC = 'Public Global Stellar Network ; September 2015',
TESTNET = 'Test SDF Network ; September 2015',
+1
View File
@@ -5,5 +5,6 @@ const destKey = StellarSdk.Keypair.random();
const account = new StellarSdk.Account(sourceKey.publicKey(), 1);
const transaction = new StellarSdk.TransactionBuilder(account)
.addOperation(StellarSdk.Operation.accountMerge({destination: destKey.publicKey()}))
.addMemo(new StellarSdk.Memo(StellarSdk.MemoText, "memo"))
.build(); // $ExpectType () => Transaction
transaction; // $ExpectType Transaction