# transferFromAlgorand()

### Method Parameters

**client:** Algodv2

Algodv2 from algosdk

**tokenBridgeId:** bigint

Algorand bridge contract id

**bridgeId:** bigint

Algorand core contract id

**senderAddr:** string

Sender address

**assetId:** int

Asset id of the token to be bridged

**qty:** bigint

Amount to be bridged (whole number format)

**receiver:** string

Receiver address in hex

**chain:** ChainId | ChainName

Destination chain

**fee:** bigint

Arbiter fee

### Returns

This method returns a `Promise` which resolves with a `TransactionSignerPair[]` object:

Success: Returns non-empty `TransactionSignerPair[]` object

Fail: Returns empty `TransactionSignerPair[]` object

### Usage

```javascript
import { ethers } from "ethers";
import algosdk, { Account, Algodv2, assignGroupID, waitForConfirmation } from "algosdk";
import { transferFromAlgorand, nativeToHexString, CHAIN_ID_ETH } from "@algo-foundry/messina-sdk";
import { TransactionSignerPair } from "@algo-foundry/messina-sdk/lib/cjs/algorand";

const client: algosdk.Algodv2 = new Algodv2(<ALGO_TOKEN>, <ALGO_ADDRESS>, <ALGOD_PORT>);
const wallet: Account = algosdk.mnemonicToSecretKey(<ALGO_MNEMONIC>)

const provider = new ethers.providers.WebSocketProvider(<ETH_NODE_URL>) as any;   
const signer = new ethers.Wallet(<ETH_PRIVATE_KEY>, provider);

const hexStr = nativeToHexString(signer.address, CHAIN_ID_ETH);

if (!hexStr) {
   throw new Error("Failed to convert to hexStr");
}    

const transferTxs = await transferFromAlgorand(
      client,
      BigInt(114976173),
      BigInt(114976156),
      wallet.addr,
      BigInt(105449176),
      BigInt(10000000), // AMOUNT_TO_TRANSFER * (10 ^ ASSET_DECIMALS)
      hexStr,
      CHAIN_ID_ETH,
      BigInt(0)
    );

const transferResult = await signSendAndConfirmAlgorand(
      client,
      transferTxs,
      wallet,
      4
    );

async function signSendAndConfirmAlgorand(
  algodClient: Algodv2,
  txs: TransactionSignerPair[],
  wallet: Account,
  waitRounds = 1
) {
  assignGroupID(txs.map((tx) => tx.tx));
  const signedTxns: Uint8Array[] = [];
  for (const tx of txs) {
    if (tx.signer) {
      signedTxns.push(await tx.signer.signTxn(tx.tx));
    } else {
      signedTxns.push(tx.tx.signTxn(wallet.sk));
    }
  }
  await algodClient.sendRawTransaction(signedTxns).do();

  const result = await waitForConfirmation(
    algodClient,
    txs[txs.length - 1].tx.txID(),
    waitRounds
  );
  return result;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://messinaone.gitbook.io/messina-sdk/methods/algorand/transferfromalgorand.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
