From 3b8c8c13991ffec79791ed3334cb5405d66077d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20=C5=BDivanovi=C4=87?= <125874670+LukaStreamflow@users.noreply.github.com> Date: Thu, 4 Jan 2024 01:13:31 +0100 Subject: [PATCH] Aptos address normalization (#121) --- packages/stream/aptos/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/stream/aptos/utils.ts b/packages/stream/aptos/utils.ts index 0eea4bf1..c00f6b5b 100644 --- a/packages/stream/aptos/utils.ts +++ b/packages/stream/aptos/utils.ts @@ -17,7 +17,11 @@ function isAddressSpecial(address: string): boolean { return false; } -// Per this: https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/core/accountAddress.ts#L115 +/** + * Aptos has inconsistencies in how it returns addresses. + * This method normalizes them to be 64 characters long, or leaves it as SPECIAL ADDRESS (0x0 - 0xf inclusive) + * Per this: https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/core/accountAddress.ts#L115 + * */ export function normalizeAptosAddress(address: string): string { if (isAddressSpecial(address)) { return address;