UXLINK
CommunityMediumGithub
UXLINK
UXLINK
  • Introduction
  • UXLINK Social Growth Layer
  • TECHNOLOGY
    • 🦝One Account (Account Abstraction)
    • β›½One Gas (Universal Gas: $UXLINK)
    • Social Growth Protocols
    • πŸ’±Coming Soon: Chain Abstraction
  • API & SDK
    • πŸ›ΊUXLINK Auth
      • Basic authentication
      • UXLINK OAuth 2.0
      • Ingestion API
    • UXLINK Account (Coming Soon)
      • Quick start
      • Ingestion API
    • πŸ₯‚Social Growth Protocols
    • 🩰Smart Contracts & Security
      • UXLINK Official Wallet Addresses
      • Contracts
      • Contracts-Audit-Report
  • UXLINK Ecosystem
    • ✈️AIRDROP 2049
    • πŸ₯‚INVITE mini app
    • πŸ—ΊοΈRoadmap
  • White Paper
    • πŸ“°White Paper
  • Tutorial
    • UXLINK Terms and Conditions of Use
      • List of Prohibited Countries and Regions
    • UXLINK Task Tutorial
      • UXLINK Task Tutorial on Binance Web3 Wallet
      • Binance Web3 Wallet x UXLINK Airdrop Campaign FAQ
      • UXLINK Airdrop CS Channel
      • How to clear Binance App’s cache?
      • How to check UXLINK NFTs in my wallet?
    • Find CEX UID and Deposit address
      • How to Find OKX UID & Deposit Address
      • How to Find GATE UID & Deposit Address
      • How to Find GATE UID & Deposit Address - Ton Network
      • How to Find bitget UID & Deposit Address
  • Changelog
    • πŸ’¬Changelog
  • Troubleshooting
    • ⁉️FAQ
  • Announcement
    • Announcements
    • UXLINK Supply Distribution
Powered by GitBook
On this page

Was this helpful?

  1. API & SDK
  2. UXLINK Account (Coming Soon)

Quick start

PreviousUXLINK Account (Coming Soon)NextIngestion API

Last updated 6 months ago

Was this helpful?

Submitting Transaction Data

Using the UXLINK Account, you can invoke other contracts to execute custom business logic.

The process for initiating a transaction is as follows:

  1. Submit Execute Data.

  2. Redirect to the user password verification page, where the user enters their password. Upon successful verification, the transaction is sent to the blockchain.

  3. After the transaction is executed, callback to replaceUrl and query the transaction result through the order query interface.

1. Submitting an Order

The interface for submitting an order is as follows: POST /oneAccount/v1/sendExecuteData

Request Body:

{
  executeData: {
      to: "0x.....", // Address of the business contract to be called
      data: "...", // Encoded string containing the function name to be executed in the contract and the arguments passed to this function. Method for creating executeData will be provided below.
  },
}

Response:

{
    orderId: "...", // ID of this transaction, which can be used to query the transaction result.
}

1.1 Generating executeData

Creating executeData requires the ABI of the corresponding business contract. As this file is too large to be conveniently passed through the interface, it needs to be generated by the project side. Here is a function for generating it:

import { ethers } from "ethers";

const rpc = ""; // TODO: Modify the RPC link used here
const provider = new ethers.providers.JsonRpcProvider(rpc);

/**
 * @param contractAddress Contract address
 * @param contractABI ABI of the contract
 * @param executeFunctionName Name of the function to be executed
 * @param executeFunctionArgs Arguments to be passed to the function
 */
createExecuteData(contractAddress: string, contractABI: any[], executeFunctionName: string, executeFunctionArgs: any[]) {
  const contract = new ethers.Contract(contractAddress, contractABI, provider);
  return {
    to: contractAddress,
    data: contract.interface.encodeFunctionData(executeFunctionName, executeFunctionArgs),
  };
}

2. Redirecting to the User Password Verification Page

After obtaining the orderId, redirect to:

https://oneAccount.uxlink.io/confirmExecuteData?orderId=ORDER_ID&replaceUrl=YOUR_REDIRECT_URI

Upon the user entering the password on the verification page and successful validation by the server, the transaction data corresponding to this orderId will be submitted to the blockchain for execution of the relevant business logic.

3. Querying Transaction Results

Upon successful execution of the transaction after the user enters the password on the verification page, the page will redirect to replaceUrl with the orderId.

To query the execution result, use the transaction status query interface:

Interface: /aaWallet/v1/getTransactionResult

Request Body:

{
    orderId: "...",
}

Response:

// Success:
{
    orderId: "",
    transactionHash: "",
}

// Failure:
{
    orderId: "",
    error: "", // Error message
}