zkLink X Documentaion
HomeGitHubBlogExplorer
  • 🙂Welcome
    • Introduction
  • ⚖️Architecture
    • Overview
    • Settlement Layer
      • Working Principal of A Multi-Chain ZK-Rollup
      • Nexus: Settlement on ETH L2s
      • Origin: Settlement on ETH and Alt-L1s
      • Multi-Chain State Synchronization
        • In-Detail: Nexus Multi-Chain State Synchronization
      • Supported Networks of zkLink Nexus and Origin
      • Security Assumptions of zkLink Nexus and Origin
    • Execution Layer
      • TS-zkVM for App Rollup
    • Sequencing Layer
    • DA Layer
  • 🛠️Developer
    • Developer Overview
    • Get Started
    • Examples
      • Base Demo
    • JSON RPC & Websocket & Kafka
      • JSON-RPC API
      • JSON-RPC Errors
      • Websocket
      • Kafka
    • Transactions
      • Basic Types
      • State Update
      • Transaction
        • Deposit
        • FullExit
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • AutoDeleveraging
        • ContractMatching
        • Funding
        • Liquidation
        • UpdateGlobalVar
      • Private Key & Signature
        • Algorithm
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • ContractMatching
        • Funding
        • Liquidation
        • AutoDeleveraging
        • UpdateGlobalVar
    • SDK
      • Go
        • Types
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Js
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Dart
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
  • ⚙️Network Information
    • Connected Networks
      • Mainnet
      • Testnet
    • DApps & Deployment Addresses
      • Mainnet
      • Testnet
  • Wallet & User Fund Streamline
    • Withdraw
    • Wallet Integration & AA Wallet
    • Deposit
  • Integration Cases
    • Heavyweight Integration (Multi-Chain Derivatives & Spot Exchange)
    • Simple Integration (Multi-Chain Spot Exchange)
  • Appendix
    • Audits
    • FAQ
    • glossary
Powered by GitBook
On this page

Was this helpful?

  1. Developer
  2. SDK
  3. Dart

Utils

func isTokenAmountPackable

bool isTokenAmountPackable(String amount)

Checks whether the token amount can be packed (and thus used in the transaction)

func isFeeAmountPackable

bool isFeeAmountPackable(String fee)

Checks whether the fee amount can be packed (and thus used in the transaction)

func closestPackableTokenAmount

String closestPackableTokenAmount(String amount)

Returns the closest possible packable token amount. Returned amount is always less or equal to the provided amount.

func closestPackableFeeAmount

String closestPackableFeeAmount(String fee)

Returns the closest possible packable fee amount. Returned amount is always less or equal to the provided amount.

Example

var amount = "1234567899808787";
print("Original amount: " + amount);
expect(isTokenAmountPackable(amount: amount), false);
amount = closestPackableTokenAmount(amount: amount);
expect(isTokenAmountPackable(amount: amount), true);
print("Converted amount: " + amount);
var fee = "10000567777";
print("Original fee: " + fee);
expect(isFeeAmountPackable(fee: fee), false);
fee = closestPackableFeeAmount(fee: fee);
expect(isFeeAmountPackable(fee: fee), true);
print("Converted fee: " + fee);
PreviousSignatureNextTransactions

Last updated 11 months ago

Was this helpful?

🛠️