Skip to content

Commit c2bc44d

Browse files
authored
fix: uses Address object directly (#84)
Refactors code to use the `Address` object directly instead of encoding/decoding addresses, enhancing efficiency and code clarity.
1 parent d4e94d6 commit c2bc44d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/clients/SubtopiaRegistryClient.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import algosdk, {
77
algosToMicroalgos,
8-
decodeAddress,
98
decodeUint64,
109
encodeAddress,
1110
AtomicTransactionComposer,
@@ -438,7 +437,7 @@ export class SubtopiaRegistryClient {
438437
registryID,
439438
new Uint8Array([
440439
...getLockerBoxPrefix(lockerType),
441-
...decodeAddress(String(ownerAddress)).publicKey,
440+
...ownerAddress.publicKey,
442441
]),
443442
)
444443
.do()
@@ -486,7 +485,7 @@ export class SubtopiaRegistryClient {
486485
appIndex: this.appID,
487486
name: new Uint8Array([
488487
...getLockerBoxPrefix(LockerType.CREATOR),
489-
...decodeAddress(String(newOwnerAddress)).publicKey,
488+
...newOwnerAddress.publicKey,
490489
]),
491490
},
492491
];

src/utils/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import algosdk, {
1212
ABIType,
1313
ABIArrayDynamicType,
1414
ABIUintType,
15-
encodeAddress,
1615
Address,
1716
} from "algosdk";
1817

@@ -431,7 +430,7 @@ export function parseTokenProductGlobalState(input: AppState) {
431430
for (const key in input) {
432431
if (keyMap[key]) {
433432
if (keyMap[key] === "manager") {
434-
output[keyMap[key]] = encodeAddress(
433+
output[keyMap[key]] = new Address(
435434
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
436435
// @ts-ignore
437436
input[key].valueRaw,

0 commit comments

Comments
 (0)