Catalog npm
PACKAGE EXPLORERView in registry

@0xobelisk/sov-client

npm

Sovereign Typescript SDK

Versions collected26
Direct dependencies30From release 0.2.8
Last observed21 Oct, 09:20 UTC

README

Current package documentation

@0xobelisk/sov-client

This is an early experimental client used to communicate with the sequencer

Install (TODO: Need release to npmjs)

pnpm i @0xobelisk/sov-client

How to use

Account

import {Ed25519Keypair, getFullnodeUrl, SovereignClient} from "@0xobelisk/sov-client"

const main = async () => {
	// import an Ed25519 account
	const test_private_key: Uint8Array = new Uint8Array([
		117, 251, 248, 217, 135, 70, 194, 105, 46, 80, 41, 66, 185, 56, 200, 35,
		121, 253, 9, 234, 159, 91, 96, 212, 211, 158, 135, 225, 180, 36, 104,
		253,
	]);
	const importKeypair = Ed25519Keypair.fromSecretKey(test_private_key, {
		skipValidation: true,
	});
  
	// generate a new Ed25519 account
	const keypair = new Ed25519Keypair();

	console.log(keypair.getPublicKey());
	console.log(keypair.getSecretKey());
	console.log(keypair.toAddress());

	console.log();

	// generate a new Secp256k1 account
	const ethKey = new Secp256k1Keypair();
	console.log(ethKey.getPublicKey());
	console.log(ethKey.getSecretKey());
};

main();

Submit Transaction

dev in localnet tips: don't forget start the local sov node.

import { Ed25519Keypair, Secp256k1Keypair, SovereignClient, getFullnodeUrl } from '@0xobelisk/sov-client';

const main = async () => {
  const nodeApi = getFullnodeUrl('localnet');
  const client = new SovereignClient(nodeApi);

	// call bank.Freeze func
  	const callPayload: any = {
		bank: {
			Freeze: {
				token_id:
					'token_1rwrh8gn2py0dl4vv65twgctmlwck6esm2as9dftumcw89kqqn3nqrduss6',
			},
		},
	};

	// sign and submit tx
  	await client.signAndExecuteTransaction({
		callPayload,
		signer: keypair
	})
};

main();

Call RPC

dev in localnet tips: don't forget start the local sov node.

import { Ed25519Keypair, Secp256k1Keypair, SovereignClient, getFullnodeUrl } from '@0xobelisk/sov-client';

const main = async () => {
  const nodeApi = getFullnodeUrl('localnet');
  const client = new SovereignClient(nodeApi);

	const params = {
    	user_address:
    		'sov15vspj48hpttzyvxu8kzq5klhvaczcpyxn6z6k0hwpwtzs4a6wkvqwr57gc',
    	token_id:
    		'token_1zdwj8thgev2u3yyrrlekmvtsz4av4tp3m7dm5mx5peejnesga27ss0lusz',
    };
    const balance = await client.query('bank_balanceOf', params);
    console.log(balance);
};

main();

Query Module State

dev in localnet tips: don't forget start the local sov node.

import { Ed25519Keypair, Secp256k1Keypair, SovereignClient, getFullnodeUrl } from '@0xobelisk/sov-client';

const main = async () => {
  const nodeApi = getFullnodeUrl('localnet');
  const client = new SovereignClient(nodeApi);


	const state = await client.get('/xxxx', []);
    console.log(state);
};

main();

How to build sov-client

Clone sov-clone repo

git clone https://github.com/Sovereign-Labs/sov-client

cd sov-client

compile sov-client

pnpm i
ts-node scripts/index.ts

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 26

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.8Registry latest5 Sept 202430
0.2.75 Sept 202430
0.2.63 Sept 202430
0.2.53 Sept 202430
0.2.42 Sept 202430
0.2.32 Sept 202430
0.2.22 Sept 202430
0.2.12 Sept 202430
0.2.030 Aug 202430
0.1.929 Aug 202430
0.1.829 Aug 202430
0.1.729 Aug 202430
0.1.526 Aug 202429
0.1.426 Aug 202428
0.1.226 Aug 202428
0.1.126 Aug 202428
0.1.026 Aug 202428
0.0.926 Aug 202428
0.0.826 Aug 202428
0.0.726 Aug 202428

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:20 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f68c7082615965389817b3b1e1259771c0a0b380c175d619536db056ca100190