Skip to content

Commit b2f04dd

Browse files
committed
refactor: update type handling for integer values in examples and bridge types
1 parent e3a7697 commit b2f04dd

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

example/app/examples/MetadataExamples.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export default class MetadataExamples {
144144
const textValue = textMetadatum.as_text();
145145
results.push(`✓ Text metadatum value: ${textValue}`);
146146

147-
const intValue = intMetadatum.as_int();
147+
const intValue = intMetadatum.as_int().as_i32();
148148
results.push(`✓ Integer metadatum value: ${intValue}`);
149149

150150
const bytesValue = bytesMetadatum.as_bytes();

example/app/examples/ValueExamples.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export default class ValueExamples {
254254
const mintAssetsLen = mintAssets2.len();
255255
results.push(`✓ MintAssets length: ${mintAssetsLen}`);
256256

257-
const retrievedMintAmount = mintAssets2.get(mintAssetName2);
257+
const retrievedMintAmount = mintAssets2.get(mintAssetName2).as_i32();
258258
results.push(`✓ Retrieved mint amount: ${retrievedMintAmount}`);
259259

260260
const mintAssetsKeys = mintAssets2.keys();

src/BridgeTypes.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export declare class BigInt {
318318
static from_json(json: string): BigInt;
319319
is_zero(): boolean;
320320
as_u64(): BigNum;
321-
as_int(): number;
321+
as_int(): Int;
322322
static from_str(text: string): BigInt;
323323
to_str(): string;
324324
add(other: BigInt): BigInt;
@@ -606,8 +606,8 @@ export declare class CostModel {
606606
to_json(): string;
607607
static from_json(json: string): CostModel;
608608
static new(): CostModel;
609-
set(operation: number, cost: Int): number;
610-
get(operation: number): number;
609+
set(operation: number, cost: Int): Int;
610+
get(operation: number): Int;
611611
len(): number;
612612
}
613613

@@ -1177,8 +1177,8 @@ export declare class MIRToStakeCredentials {
11771177
static from_json(json: string): MIRToStakeCredentials;
11781178
static new(): MIRToStakeCredentials;
11791179
len(): number;
1180-
insert(cred: Credential, delta: Int): number;
1181-
get(cred: Credential): number;
1180+
insert(cred: Credential, delta: Int): Int;
1181+
get(cred: Credential): Int;
11821182
keys(): Credentials;
11831183
}
11841184

@@ -1237,8 +1237,8 @@ export declare class MintAssets {
12371237
static new(): MintAssets;
12381238
static new_from_entry(key: AssetName, value: Int): MintAssets;
12391239
len(): number;
1240-
insert(key: AssetName, value: Int): number;
1241-
get(key: AssetName): number;
1240+
insert(key: AssetName, value: Int): Int;
1241+
get(key: AssetName): Int;
12421242
keys(): AssetNames;
12431243
}
12441244

@@ -2377,7 +2377,7 @@ export declare class TransactionMetadatum {
23772377
kind(): TransactionMetadatumKind;
23782378
as_map(): MetadataMap;
23792379
as_list(): MetadataList;
2380-
as_int(): number;
2380+
as_int(): Int;
23812381
as_bytes(): Uint8Array;
23822382
as_text(): string;
23832383
}

0 commit comments

Comments
 (0)