A TypeScript library for EVVM blockchain interactions, signature building, and transaction execution. Includes payments, staking, NameService, and utilities for EVVM contracts.
- EIP-191 Signatures for payments, staking, and NameService
 - Single and multiple (disperse) payments
 - Staking: golden, presale, public, service
 - NameService: registration, offers, metadata
 - Integration with wagmi/viem
 - Modular and fully typed
 
npm install @evvm/viem-signature-library viem wagminpm install viem@^2.0.0 wagmi@^2.0.0- Node.js >= 18
 - npm >= 8
 
src/
├── abi/            # EVVM contract ABIs
├── signatures/     # Signature builder classes (EVVM, NameService, Staking)
├── types/          # TypeScript types for payments, staking, NameService
├── utils/          # Utilities: hash, message construction
├── __tests__/      # Unit tests
├── index.ts        # Main export
examples/
└── basic-usage.ts  # Basic usage example
import { EVVMSignatureBuilder, PayInputData } from '@evvm/viem-signature-library';
const mockAccount = {
  address: '0x742d35Cc6634C0532925a3b8D138068fd4C1B7a1' as `0x${string}`
};
const mockWalletClient = {
  signMessage: async ({ message }: { message: string }) => {
    return '0x1234567890abcdef...' as `0x${string}`;
  }
};
const signatureBuilder = new EVVMSignatureBuilder(mockWalletClient as any, mockAccount as any);
const signature = await signatureBuilder.signPay(
  1n,
  '0x742d35Cc92d8A4bbCD07E9d4aC8b2E4c7BE7C7E3',
  '0x0000000000000000000000000000000000000000',
  1000000000000000000n,
  50000000000000000n,
  1n,
  false,
  mockAccount.address
);
const payInputData: PayInputData = {
  from: mockAccount.address,
  to_address: '0x742d35Cc92d8A4bbCD07E9d4aC8b2E4c7BE7C7E3',
  to_identity: '',
  token: '0x0000000000000000000000000000000000000000',
  amount: 1000000000000000000n,
  priorityFee: 50000000000000000n,
  nonce: 1n,
  priority: false,
  executor: mockAccount.address,
  signature,
};This repository includes a GitHub Actions workflow to automatically publish to npm on every push to main. The version is bumped automatically using the short commit hash:
name: Publish to npm
permissions:
  contents: write
on:
  push:
    branches:
      - main
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Use Node.js 20.x
        uses: actions/setup-node@v4
        with:
          node-version: 20
          registry-url: 'https://registry.npmjs.org/'
      - name: Install dependencies
        run: npm ci
      - name: Build package
        run: npm run build
      - name: Get short commit hash
        id: vars
        run: echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
      - name: Bump version (prerelease with commit hash)
        run: npm version prerelease --preid ${{ env.commit_hash }} --no-git-tag-version
      - name: Publish to npm
        run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
      - name: Create GitHub Release (optional)
        if: success()
        uses: softprops/action-gh-release@v2
        with:
          tag_name: v${{ github.run_number }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- Go to https://www.npmjs.com/ and log in.
 - In your profile, go to "Access Tokens" and generate a new "Automation" token.
 - Copy the token and add it as a secret in your GitHub repo (
NPM_TOKEN). 
viem>= 2.0.0wagmi>= 2.0.0
npm run build— Build the packagenpm test— Run testsnpm run lint— Lintingnpm run typecheck— Type checkingnpm run example— Run the basic example
- Fork the repository
 - Create your feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add new feature') - Push (
git push origin feature/new-feature) - Open a Pull Request
 
MIT — see LICENSE
- Email: support@evvm.org
 - Documentation: docs.evvm.org
 
import { createConfig } from 'wagmi';
import { EVVMTransactionExecutor, PayInputData } from '@evvm/ts-library';
const config = createConfig({
  // your wagmi config
});
const executor = new EVVMTransactionExecutor(config);
const paymentData: PayInputData = {
  from: '0x742d35Cc6634C0532925a3b8D138068fd4C1B7a1',
  to_address: '0x456...',
  to_identity: 'username.evvm',
  token: '0x0000000000000000000000000000000000000000',
  amount: 1000000000000000000n,
  priorityFee: 50000000000000000n,
  nonce: 1n,
  priority: true,
  executor: '0x742d35Cc6634C0532925a3b8D138068fd4C1B7a1',
  signature: signature,
};
const txHash = await executor.executePay(
  paymentData,
  '0xEVVMContractAddress' as `0x${string}`
);Handles EVVM payment signatures:
signPay()- Single payment signaturesignDispersePay()- Multiple recipient payment signaturesignERC191Message()- Generic EIP-191 message signing
Handles name service operations:
signPreRegistrationUsername()- Pre-register usernamesignRegistrationUsername()- Register usernamesignMakeOffer()- Make offer for usernamesignWithdrawOffer()- Withdraw offersignAcceptOffer()- Accept offersignRenewUsername()- Renew usernamesignAddCustomMetadata()- Add custom metadatasignRemoveCustomMetadata()- Remove custom metadatasignFlushCustomMetadata()- Flush all metadatasignFlushUsername()- Flush username
Handles staking operations:
signGoldenStaking()- Golden staking (single signature)signPresaleStaking()- Presale staking (dual signature)signPublicStaking()- Public staking (dual signature)
Execute EVVM transactions:
executePay()- Execute single paymentexecuteDispersePay()- Execute multiple recipient paymentexecutePayMultiple()- Execute multiple payments in one call
Execute name service transactions:
executePreRegistrationUsername()executeRegistrationUsername()- And more...
 
Execute staking transactions:
executeGoldenStaking()executePresaleStaking()executePublicStaking()executePublicServiceStaking()
hashDispersePaymentUsersToPay()- Hash payment data for multiple recipientshashPreRegisteredUsername()- Hash username with clown number
buildMessageSignedForPay()- Build payment messagebuildMessageSignedForDispersePay()- Build disperse payment messagebuildMessageSignedForPublicStaking()- Build staking message- And many more message builders for different contract functions...
 
The library provides comprehensive TypeScript types:
PayInputData- Single payment data structureDispersePayInputData- Multiple payment data structureDispersePayMetadata- Individual recipient dataGoldenStakingInputData- Golden staking dataPresaleStakingInputData- Presale staking dataPublicStakingInputData- Public staking dataPublicServiceStakingInputData- Service staking data- Name service types: 
PreRegistrationUsernameInputData,RegistrationUsernameInputData, etc. 
import { DispersePayMetadata } from '@evvm/ts-library';
const recipients: DispersePayMetadata[] = [
  {
    amount: 500000000000000000n, // 0.5 ETH
    to_address: '0x123...',
    to_identity: 'alice.evvm'
  },
  {
    amount: 500000000000000000n, // 0.5 ETH
    to_address: '0x456...',
    to_identity: 'bob.evvm'
  }
];
const signature = await signatureBuilder.signDispersePay(
  1n, // evvmID
  recipients,
  '0x0000000000000000000000000000000000000000', // native token
  1000000000000000000n, // total amount (1 ETH)
  50000000000000000n, // priority fee
  1n, // nonce
  true, // priority flag
  executor
);const { paySignature, actionSignature } = await nameServiceBuilder.signRegistrationUsername(
  1n, // evvmID
  '0xNameServiceAddress' as `0x${string}`,
  'myusername', // username
  12345n, // clown number
  1n, // nonce
  100000000000000000n, // priority fee (0.1 ETH)
  2n, // EVVM nonce
  true // priority flag
);// Golden staking (single signature)
const goldenSignature = await stakingBuilder.signGoldenStaking(
  1n, // evvmID
  '0xStakingAddress' as `0x${string}`,
  5083000000000000000000n, // 5083 EVVM
  1n, // nonce
  true // priority flag
);
// Public staking (dual signature)
const { paySignature, stakingSignature } = await stakingBuilder.signPublicStaking(
  1n, // evvmID
  '0xStakingAddress' as `0x${string}`,
  true, // is staking
  1000000000000000000n, // staking amount
  1n, // staking nonce
  1000000000000000000n, // total price
  50000000000000000n, // priority fee
  2n, // EVVM nonce
  true // priority flag
);npm run buildnpm test
npm run test:watchnpm run lint
npm run lint:fixnpm run typechecksrc/
├── types/           # TypeScript type definitions
│   ├── evvm.ts     # EVVM payment types
│   ├── nameService.ts # Name service types
│   ├── staking.ts  # Staking types
│   └── index.ts    # Type exports
├── utils/          # Utility functions
│   ├── hashTools.ts # Hashing utilities
│   ├── constructMessage.ts # Message builders
│   └── index.ts    # Utility exports
├── signatures/     # Signature building classes
│   ├── evvm.ts     # EVVM signature builder
│   ├── nameService.ts # Name service signature builder
│   ├── staking.ts  # Staking signature builder
│   └── index.ts    # Signature exports
├── executors/      # Transaction execution classes
│   ├── evvm.ts     # EVVM transaction executor
│   ├── nameService.ts # Name service transaction executor
│   ├── staking.ts  # Staking transaction executor
│   └── index.ts    # Executor exports
└── index.ts        # Main library export
- Fork the repository
 - Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
 
This project is licensed under the MIT License - see the LICENSE file for details.
- 📧 Email: support@evvm.org
 - 💬 Discord: EVVM Community
 - 📖 Documentation: docs.evvm.org
 - 🐛 Issues: GitHub Issues
 
- Initial release with complete EVVM ecosystem support
 - Signature building for payments, staking, and name service
 - Transaction execution utilities
 - Comprehensive TypeScript support
 - Full test coverage and documentation