Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TxBuilder: Introduce TransactionBuilder.appTransfer #101

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

msmania
Copy link
Contributor

@msmania msmania commented Feb 19, 2024

This patch implements a new feature AppTransfer (PIP-35; introduced by pokt-network/pocket-core#1585).

@msmania msmania requested a review from kutoft February 19, 2024 18:26
@msmania msmania self-assigned this Feb 19, 2024
@msmania msmania added the enhancement New feature or request label Feb 19, 2024
@msmania msmania requested review from Olshansk and nodiesBlade and removed request for kutoft March 6, 2024 21:10
@nodiesBlade
Copy link
Contributor

nodiesBlade commented Mar 8, 2024

Hey @msmania , looks good overall. Can you provide evidence that this works via testnet? (I.E a snippet of the code and a transaction hash with success)

@msmania
Copy link
Contributor Author

msmania commented Mar 8, 2024

Hey @msmania , looks good overall. Can you provide evidence that this works via testnet? (I.E a snippet of the code and a transaction hash with success)

I was lazy enough not to run this on testnet. I did it now.

Tx is this.

import "dotenv/config";
import { JsonRpcProvider } from "@pokt-foundation/pocketjs-provider";
import { KeyManager } from "@pokt-foundation/pocketjs-signer";
import { TransactionBuilder } from "@pokt-foundation/pocketjs-transaction-builder";

const PoktEndpoint = process.env.POKT_ENDPOINT;
const TxSignerKey = process.env.SIGNER_PRIVATE_KEY;

async function main() {
  const provider = new JsonRpcProvider({
    rpcUrl: PoktEndpoint,
    dispatchers: [PoktEndpoint],
  });

  const height = await provider.getBlockNumber();
  console.log(height);

  const txSigner = await KeyManager.fromPrivateKey(TxSignerKey);
  const transactionBuilder = new TransactionBuilder({
    provider,
    signer: txSigner,
    chainID: "testnet",
  });
  const sendMsg = transactionBuilder.appTransfer({
    appPubKey: "f53b9120f4f18c09f883e82b5c1554eddb78cd56eb753eb2ae0dfdbc492cfaaf",
  });
  const txResponse = await transactionBuilder.submit({
    memo: "Transfer!",
    txMsg: sendMsg,
  });
  console.log(txResponse.txHash);
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

Copy link
Contributor

@nodiesBlade nodiesBlade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing it on testnet. I believe this is sufficient proof that the function works.

We should bump the version once the rev-share stake PR is complete.

LGTM

@msmania msmania merged commit dad4085 into pokt-network:main Mar 8, 2024
3 checks passed
@msmania msmania deleted the toshi/app-transfer branch March 8, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants