@altiuslabs/tx-sdk 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altiuslabs/tx-sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "SDK for signing and sending Altius USD multi-token transactions",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/constants.js CHANGED
@@ -32,15 +32,10 @@ export const FEE_TOKEN_FACTORY_ADDRESS = '0xa17000000000000000000000000000000000
32
32
 
33
33
  /**
34
34
  * Fee Manager (Independent prefix)
35
- * Address: 0xFE0000000000000000000000000000000000000001
35
+ * Address: 0xFE00000000000000000000000000000000000001
36
36
  */
37
37
  export const FEE_MANAGER_ADDRESS = '0xFE00000000000000000000000000000000000001';
38
38
 
39
- /**
40
- * Fee token prefix (10 bytes) for validation
41
- */
42
- export const FEE_TOKEN_PREFIX = '0xa1700000';
43
-
44
39
  /**
45
40
  * Zero address
46
41
  */
@@ -87,6 +82,16 @@ export const FAUCET_AMOUNT_MICRO = BigInt(100_000_000);
87
82
  */
88
83
  export const FAUCET_AMOUNT_WEI = BigInt(100_000_000_000_000_000_000);
89
84
 
85
+ /**
86
+ * Default faucet amount in token units (100 USDA with 18 decimals)
87
+ */
88
+ export const DEFAULT_FAUCET_AMOUNT = BigInt(100_000_000_000_000_000_000);
89
+
90
+ /**
91
+ * Default faucet amount in microdollars
92
+ */
93
+ export const DEFAULT_FAUCET_AMOUNT_MICRO = 100_000_000;
94
+
90
95
  /**
91
96
  * Default transfer amount in microdollars (10 USDA)
92
97
  */
package/src/index.js CHANGED
@@ -26,7 +26,7 @@ export { NonceManager, create_nonce_manager } from './nonce.js';
26
26
  export { TxClient, TxClientBuilder, create_tx_client } from './client.js';
27
27
 
28
28
  // Utilities
29
- export { keccak256, pad_hex, num_to_hex, rlp_encode, transaction_hash, computeFeeTokenAddress, isReservedAddress } from './utils.js';
29
+ export { keccak256, pad_hex, num_to_hex, rlp_encode, transaction_hash, computeFeeTokenAddress, isReservedAddress, is_fee_token_prefix, is_valid_fee_token_address, is_index_reserved } from './utils.js';
30
30
 
31
31
  // Constants
32
32
  export * from './constants.js';
package/src/utils.js CHANGED
@@ -117,3 +117,31 @@ export function isReservedAddress(address, creator, salt) {
117
117
  const { index } = computeFeeTokenAddress(creator, salt);
118
118
  return index < 256n;
119
119
  }
120
+
121
+ /**
122
+ * Check if address has fee token prefix (0xa170...)
123
+ * @param {string} address - Address to check
124
+ * @returns {boolean} True if has fee token prefix
125
+ */
126
+ export function is_fee_token_prefix(address) {
127
+ const clean = address.startsWith('0x') ? address.slice(2) : address;
128
+ return clean.startsWith('a170');
129
+ }
130
+
131
+ /**
132
+ * Check if address is valid fee token (has prefix and not zero)
133
+ * @param {string} address - Address to check
134
+ * @returns {boolean} True if valid fee token address
135
+ */
136
+ export function is_valid_fee_token_address(address) {
137
+ return is_fee_token_prefix(address) && address !== '0x0000000000000000000000000000000000000000';
138
+ }
139
+
140
+ /**
141
+ * Check if index is reserved (index < 256)
142
+ * @param {bigint|number} index - Index to check
143
+ * @returns {boolean} True if reserved
144
+ */
145
+ export function is_index_reserved(index) {
146
+ return BigInt(index) < 256n;
147
+ }