mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-26 10:14:26 +08:00
[stellar-sdk]: Fix AccountRecord.data and add data_attr (#29632)
* [stellar-sdk]: Fix AccountRecord.data and data_attr
data is a function to call the /accounts/{id}/data/{key} endpoint, while data_attr is an object bag containing data for the account.
* [stellar-sdk] Add overload to toXDR() which accepts a string encoding
This commit is contained in:
10
types/stellar-sdk/index.d.ts
vendored
10
types/stellar-sdk/index.d.ts
vendored
@@ -10,7 +10,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
export class Account {
|
||||
constructor(accountId: string, sequence: string | number)
|
||||
constructor(accountId: string, sequence: string)
|
||||
accountId(): string;
|
||||
sequenceNumber(): string;
|
||||
incrementSequenceNumber(): void;
|
||||
@@ -98,10 +98,10 @@ export interface AccountRecord extends Record {
|
||||
weight: number
|
||||
}
|
||||
>;
|
||||
data: {
|
||||
data: (options: {value: string}) => Promise<{value: string}>;
|
||||
data_attr: {
|
||||
[key: string]: string
|
||||
};
|
||||
|
||||
effects: CallCollectionFunction<EffectRecord>;
|
||||
offers: CallCollectionFunction<OfferRecord>;
|
||||
operations: CallCollectionFunction<OperationRecord>;
|
||||
@@ -437,7 +437,8 @@ export class AccountResponse implements AccountRecord {
|
||||
weight: number
|
||||
}
|
||||
>;
|
||||
data: {
|
||||
data: (options: {value: string}) => Promise<{value: string}>;
|
||||
data_attr: {
|
||||
[key: string]: string
|
||||
};
|
||||
|
||||
@@ -894,6 +895,7 @@ export namespace xdr {
|
||||
static fromXDR(xdr: Buffer): XDRStruct;
|
||||
|
||||
toXDR(): Buffer;
|
||||
toXDR(encoding: string): string;
|
||||
}
|
||||
class Operation<T extends Operation.Operation> extends XDRStruct { }
|
||||
class Asset extends XDRStruct { }
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as StellarSdk from 'stellar-sdk';
|
||||
|
||||
const sourceKey = StellarSdk.Keypair.random(); // $ExpectType Keypair
|
||||
const destKey = StellarSdk.Keypair.random();
|
||||
const account = new StellarSdk.Account(sourceKey.publicKey(), 1);
|
||||
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"))
|
||||
|
||||
Reference in New Issue
Block a user