Skip to content

Commit b82cd04

Browse files
committed
refactor: use AddressFormat enum in sender() method signature
replace magic number parameter with strongly-typed AddressFormat enum. improves type safety and makes the API self-documenting. BTC-3064
1 parent d34cee0 commit b82cd04

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/wasm-dot/js/transaction.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import { WasmTransaction, MaterialJs, ValidityJs } from "./wasm/wasm_dot";
66
import type { Material, Validity, Era } from "./types";
7+
import { AddressFormat } from "./types";
78

89
/**
910
* DOT Transaction wrapper
@@ -37,10 +38,10 @@ export class DotTransaction {
3738
/**
3839
* Get sender address (SS58 encoded)
3940
*
40-
* @param prefix - SS58 address prefix (0 for Polkadot, 2 for Kusama, 42 for generic)
41+
* @param format - Address format (Polkadot, Kusama, or Substrate)
4142
*/
42-
sender(prefix: number = 0): string | undefined {
43-
return this._wasm.sender(prefix) ?? undefined;
43+
sender(format: AddressFormat = AddressFormat.Polkadot): string | undefined {
44+
return this._wasm.sender(format) ?? undefined;
4445
}
4546

4647
/**

0 commit comments

Comments
 (0)