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
  • type ContractPrice
  • type SpotPriceInfo
  • type FundingInfo
  • type Parameter
  • type UpdateGlobalVarBuilder
  • type UpdateGlobalVar

Was this helpful?

  1. Developer
  2. SDK
  3. Js
  4. Transactions

UpdateGlobalVar

type ContractPrice

constructor

/**
* @param {number} pair_id
* @param {string} market_price
*/
ContractPrice(pair_id, market_price)

input:

  • pair_id: The contract pair id defined by zkLink.

  • market_price: The market price of the contract pair

type SpotPriceInfo

constructor

/**
* @param {number} token_id
* @param {string} price
*/
SpotPriceInfo(token_id, price)

input:

  • token_id: The token id defined by zkLink.

  • price: The spot price of the token.

type FundingInfo

constructor

/**
* @param {number} pair_id
* @param {number} funding_rate
* @param {string} price
*/
FundingInfo(pair_id, funding_rate, price)

type MarginInfo

constructor

/**
* @param {number} margin_id
* @param {number} token_id
* @param {number} ratio
*/
MarginInfo(margin_id, token_id, ratio)

type ContractInfo

constructor

/**
* @param {number} pair_id
* @param {string} symbol
* @param {number} initial_margin_rate
* @param {number} maintenance_margin_rate
*/
ContractInfo(pair_id, symbol, initial_margin_rate, maintenance_margin_rate)

type Parameter

constructor

/**
* @param {number} insurance_fund_account
*/
Parameter(ParameterType.InsuranceFundAccount, insurance_fund_account)

/**
* @param {number} fee_account
*/
Parameter(ParameterType.FeeAccount, fee_account)

/**
* @param {FundingInfo[]} funding_infos
*/
Parameter(ParameterType.FundingInfos, funding_infos)

/**
* @param {MarginInfo} margin_info
*/
Parameter(ParameterType.MarginInfo, margin_info)

/**
* @param {ContractInfo} contract_info
*/
Parameter(ParameterType.ContractInfo, contract_info)

type UpdateGlobalVarBuilder

constructor

/**
* @param {number} from_chain_id
* @param {number} sub_account_id
* @param {Parameter} parameter
* @param {number} serial_id
*/
UpdateGlobalVarBuilder(from_chain_id, sub_account_id, parameter, serial_id)

type UpdateGlobalVar

constructor

/**
* @param {UpdateGlobalVarBuilder} builder
*/
newUpdateGlobalVar(builder)

Example

const margin_info = new MarginInfo(2,17,10).jsValue();
const parameter = new Parameter(ParameterType.MarginInfo,margin_info)
console.log(parameter);

let tx_builder = new UpdateGlobalVarBuilder(1,8,parameter,1000);
console.log(tx_builder);
let tx = newUpdateGlobalVar(tx_builder);
console.log(tx.jsValue());
PreviousLiquidationNextDart

Last updated 1 year ago

Was this helpful?

The struct of .

transaction type.

🛠️
UpdateGlobalVar
Parameter
UpdateGlobalVar