Send Metrics On-Chain
Log Player Metrics & Automate On-Chain Signing.
import { Kinora } from "kinora-sdk";
const kinora = Kinora.getInstance(apolloClient, {
uploadEndpoint: "https://api.pinata.cloud/pinning/pinJSONToIPFS",
gateway: "https://gateway.pinata.cloud",
headers: {
Authorization: "Bearer YOUR_PINATA_JWT"
}
});
const collectAndSendMetrics = async () => {
// signer object of the Player
await (window as any).ethereum.request({ method: "eth_requestAccounts" });
const provider = new ethers.providers.Web3Provider(
(window as any).ethereum,
232
);
const signer = provider.getSigner();
// send metrics on-chain
const { txHash, error, errorMessage } = await kinora.sendPlayerMetricsOnChain(
"0x79-0x06",
"0x31",
signer as ethers.Wallet,
kinoraMetricsContractAddress,
kinoraQuestDataContractAddress,
);
}Last updated