Skip to content

Commit 06c74dd

Browse files
committed
Update typescript to match API changes
1 parent 4d81f1d commit 06c74dd

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

types/index.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class Account {
1212
incrementSequenceNumber(): void;
1313
}
1414

15-
export class Address {
15+
export class Address {@
1616
constructor(address: string);
1717
static fromString(address: string): Address;
1818
static account(buffer: Buffer): Address;
@@ -1135,7 +1135,9 @@ export function encodeMuxedAccount(gAddress: string, id: string): xdr.MuxedAccou
11351135
export function extractBaseAddress(address: string): string;
11361136

11371137
export type IntLike = string | number | bigint;
1138-
export type ScIntType =
1138+
export type IntType =
1139+
| 'i32'
1140+
| 'u32'
11391141
| 'i64'
11401142
| 'u64'
11411143
| 'i128'
@@ -1145,7 +1147,7 @@ export type ScIntType =
11451147

11461148
export class Int {
11471149
constructor(
1148-
type: ScIntType,
1150+
type: IntType,
11491151
values: IntLike | IntLike[]
11501152
);
11511153

@@ -1166,11 +1168,11 @@ export class Int {
11661168
toString(): string;
11671169
toJSON(): {
11681170
value: string;
1169-
type: ScIntType;
1171+
type: IntType;
11701172
};
11711173

1172-
static isType(t: string): t is ScIntType;
1173-
static getType(scvType: string): ScIntType;
1174+
static isType(t: string): t is IntType;
1175+
static getType(scvType: string): IntType;
11741176

11751177
static fromValue(x: IntLike): Int;
11761178
static fromScVal(x: xdr.ScVal): Int;

types/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@ const sk = StellarSdk.xdr.SignerKey.signerKeyTypeEd25519SignedPayload(
351351
StellarSdk.SignerKey.encodeSignerKey(sk); // $ExpectType string
352352
StellarSdk.SignerKey.decodeAddress(sourceKey.publicKey()); // $ExpectType SignerKey
353353

354-
new StellarSdk.ScInt(1234); // $ExpectType ScInt
355-
new StellarSdk.ScInt('1234'); // $ExpectType ScInt
356-
new StellarSdk.ScInt(BigInt(1234)); // $ExpectType ScInt
357-
(['i64', 'u64', 'i128', 'u128', 'i256', 'u256'] as StellarSdk.ScIntType[]).forEach((type) => {
358-
new StellarSdk.ScInt(1234, { type }); // $ExpectType ScInt
354+
StellarSdk.Int.fromValue(1234); // $ExpectType Int
355+
StellarSdk.Int.fromValue('1234'); // $ExpectType Int
356+
StellarSdk.Int.fromValue(BigInt(1234)); // $ExpectType Int
357+
(['i32', 'u32', 'i64', 'u64', 'i128', 'u128', 'i256', 'u256'] as StellarSdk.IntType[]).forEach((type) => {
358+
new StellarSdk.Int(type, 1234); // $ExpectType Int
359359
});
360360

361361
const root = new StellarSdk.xdr.SorobanAuthorizedInvocation({

0 commit comments

Comments
 (0)