Skip to content

zmovane/onescription

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

All-in-One inscription tool

https://npm.im/@scriptione/one

A multi-chain inscription tool that can function as a standalone inscription bot or seamlessly integrate into web applications. The tool also boasts concurrent request handling, secure wallet generation, and a range of other valuable features.

Packages

Package Version Security Installation
@scriptione/evm yarn add @scriptione/evm@latest
@scriptione/cosmos yarn add @scriptione/cosmos@latest

Features

  • Utility

    • inscription bot
    • can be integrated into web application
  • Multi-chain support

    • Evm-compatible chains
    • Cosmos Hub
  • Highly customizable

    • configurable gas options, with automatic estimation as the default.
    • selectively executed according to customized logic, such as writing execution logic based on block height or unix timestamp. INJS demo
    • configurable transaction type, including contract call or token transfer.
  • Concurrent requests

    • correct way to handle concurrent requests on nodejs, based on async-mutext / semaphore.
    • wait for each request until the user-defined status is reached.
  • Wallet

    • connect an existing signer from private key / mnemonic / secret csv file.
    • create a new wallet and export it to secret file (CSV format).
    • may be a better practice to encrypt the generated secret file using age encryption.

Examples

To use as an inscription bot

Evm:

opbrc

import { EvmConfig, Inscriber, Onescription, Strategy } from "@scriptione/evm";
const configuration: EvmConfig = {
  os: "evm",
  chainId: 204,
  isSelfTransaction: false,
  value: 0,
  recipient: "0x83b978Cf73ee1D571b1a2550c5570861285AF337",
};
const inscriber = Inscriber.from(configuration);
inscriber.connectSignerFromPrivateKey("YOUR PRIVATE");
// or
// inscriber.connectSignerFromMnemonic("YOUR MNEMONIC");
const strategy: Strategy = {
  maxConcurrentRequests: 3,
  statusToWait: "submitted",
};
const onescription = new Onescription(inscriber, strategy);
// const obrcInsc: InscriptionText = data:application/json,{"p":"opbrc","op":"mint","tick":"obrc"}
const opbnInsc: InscriptionText = `data:application/json,{"p":"opbrc","op":"mint","tick":"opbn"}`;
const concurrCb = ({ hash, err }: Tx) => console.log(hash || err);
for (; ;) {
  await onescription.inscribe(inscription, concurrCb);
}

Cosmos:

Injective

import {
  ChainInfoProvider,
  CosmosConfig,
  Inscriber,
  Onescription,
  Strategy,
} from "@scriptione/cosmos";

const configuration: CosmosConfig = {
  os: "cosmos",
  prefix: "inj",
  isSelfTransaction: true,
};
const inscriber = Inscriber.from(configuration);
inscriber.connectSignerFromMnemonic("YOUR MNEMONIC");
const strategy: Strategy = {
  maxConcurrentRequests: 2,
  statusToWait: "submitted",
  // The $INJS introduction is available in this link
  // https://docs.injs.ink/mint-injs
  predicate: async (provider: ChainInfoProvider) => {
    const blockHeight = await provider.getBlockHeight();
    console.log("current block height:", blockHeight);
    const rounds = [
      [55051600, 55053100],
      [55094800, 55096300],
      [55138000, 55139500],
      [55181200, 55182700],
      [55224400, 55225900],
      [55267600, 55269100],
      [55310800, 55312300],
      [55354000, 55355500],
    ];
    return (
      undefined !==
      rounds.find(([start, end]) => start <= blockHeight && blockHeight <= end)
    );
  },
};
const onescription = new Onescription(inscriber, strategy);
const inscription = { p: "injrc-20", op: "mint", tick: "INJS", amt: "1000" };
for (;;) {
  await onescription.inscribe(inscription);
}

To use in web application

import { EvmConfig, Inscriber } from "@scriptione/evm";
const configuration: EvmConfig = {
  os: "evm",
  chainId: 56,
  isSelfTransaction: true,
};
const inscriber = Inscriber.from(configuration);
const signer = new ethers.providers.Web3Provider(window.ethereum).getSigner();
inscriber.connectSigner(signer);
const inp: Inscription = { p: "bsc-20", op: "mint", tick: "bnbs", amt: "1000" };
await inscriber.inscribe(inp);