(chain: string, amount: number | string, opts?: ITokenObj)
| 327 | } |
| 328 | |
| 329 | static amountToSats(chain: string, amount: number | string, opts?: ITokenObj): bigint { |
| 330 | if (opts) { |
| 331 | return BigInt(amount as number * opts.toSatoshis); |
| 332 | } |
| 333 | chain = chain.toLowerCase(); |
| 334 | switch (chain) { |
| 335 | case 'btc': |
| 336 | case 'bch': |
| 337 | case 'doge': |
| 338 | case 'ltc': |
| 339 | return BigInt(amount as number * 1e8); |
| 340 | case 'xrp': |
| 341 | return BigInt(amount as number * 1e6); |
| 342 | case 'sol': |
| 343 | return BigInt(amount as number * 1e9); |
| 344 | default: |
| 345 | // Assume EVM chain |
| 346 | return BigInt(amount as number * 1e18); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | static maxLength(str: string, maxLength?: number) { |
| 351 | maxLength = maxLength || 50; |
no outgoing calls
no test coverage detected