Lib9c is a library that contains key implementations of Nine Chronicles, a decentralized RPG developed with Libplanet. Lib9c includes Nine Chronicle's key features like in-game decisions and data models, which can be used to implement game core capabilities.
It suggests to provide helper method, makeTx with NetworkProvider interface. It expects to implement NineChronicles.Headless implement NetworkProvider.
import { Account, Address } from '@planetarium/account';
import { UnsignedTx } from '@planetarium/tx';
interface NetworkProvider {
getNextNonce(address: Address): Promise<bigint>,
getGenesisHash(): Promise<string>,
}
function makeTx(account: Account, provider: NetworkProvider, action: PolymorphicAction): Promise<UnsignedTx>;
Expected code:
import { HeadlessNetworkProvider } from "@planetarium/headless-network-provider"; // Temporary name
import { RawPrivateKey, Address } from "@planetarium/account";
import { makeTx, ClaimStakeReward } from "@planetarium/lib9c";
const networkProvider = new HeadlessNetworkProvider("https://9c-main-full-state.nine-chronicles.com/graphql");
const account = RawPrivateKey.generate(); // Temporary private key key.
const unsignedTx = await makeTx(account, networkProvider, new ClaimStakeReward({
avatarAddress: Address.fromHex('<ADDRESS>'),
}));
unsignedTx
It suggests to provide helper method,
makeTx
withNetworkProvider
interface. It expects to implementNineChronicles.Headless
implementNetworkProvider
.Expected code: