Buy Fan Tokens On Behalf Of Others
Pre-requisites
Install the ethers
package into your project:
- npm
- yarn
- pnpm
- bun
npm install ethers
yarn add ethers
pnpm add ethers
bun install ethers
Step 1: Add Contract Call To Your Code
- TypeScript
- JavaScript
index.ts
import { ethers } from "ethers";
import { abi } from "./MoxieBondingCurve.json";
try {
const contract = new ethers.Contract(
"0x373065e66B32a1C428aa14698dFa99BA7199B55E",
abi,
signer
);
const tx = await contract.buySharesFor();
await tx.wait();
} catch (e) {
console.error(e);
}
index.js
const { ethers } = require("ethers");
const { abi } = require("./MoxieBondingCurve.json");
try {
const contract = new ethers.Contract(
"0x373065e66B32a1C428aa14698dFa99BA7199B55E",
abi,
signer
);
const tx = await contract.buySharesFor();
await tx.wait();
} catch (e) {
console.error(e);
}
Step 2: Execute The Contract Call
Once you have your code ready, you can execute it by running the following command:
- TypeScript
- JavaScript
ts-node index.ts
node index.js
Developer Support
If you have any questions or need help with other use cases, feel free to join the /airstack Warpcast channel and ask your questions there.
Our team is always ready to help you with any questions you may have.