Catalog npm
Back to packageRELEASE DETAILS

0.2.6

npm

@0xobelisk/sov-client

Sovereign Typescript SDK

Published3 Sept 2024
Direct dependencies30
Transitive dependenciesNot calculated

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.

Declared dependencies 30

Native requirements
30 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
bs58
Environment
{
  "local_name": "bs58",
  "alias": false,
  "peer_metadata": null
}
^6.0.0runtime
borsh
Environment
{
  "local_name": "borsh",
  "alias": false,
  "peer_metadata": null
}
^1.0.0runtime
bech32
Environment
{
  "local_name": "bech32",
  "alias": false,
  "peer_metadata": null
}
^2.0.0runtime
valibot
Environment
{
  "local_name": "valibot",
  "alias": false,
  "peer_metadata": null
}
^0.25.0runtime
gql.tada
Environment
{
  "local_name": "gql.tada",
  "alias": false,
  "peer_metadata": null
}
^1.7.0runtime
tweetnacl
Environment
{
  "local_name": "tweetnacl",
  "alias": false,
  "peer_metadata": null
}
^1.0.3runtime
@scure/base
Environment
{
  "local_name": "@scure/base",
  "alias": false,
  "peer_metadata": null
}
^1.1.7runtime
@scure/bip32
Environment
{
  "local_name": "@scure/bip32",
  "alias": false,
  "peer_metadata": null
}
^1.3.1runtime
@scure/bip39
Environment
{
  "local_name": "@scure/bip39",
  "alias": false,
  "peer_metadata": null
}
^1.2.1runtime
@noble/curves
Environment
{
  "local_name": "@noble/curves",
  "alias": false,
  "peer_metadata": null
}
^1.1.0runtime
@noble/hashes
Environment
{
  "local_name": "@noble/hashes",
  "alias": false,
  "peer_metadata": null
}
^1.3.1runtime
@suchipi/femver
Environment
{
  "local_name": "@suchipi/femver",
  "alias": false,
  "peer_metadata": null
}
^1.0.0runtime
@0xobelisk/sov-wasm
Environment
{
  "local_name": "@0xobelisk/sov-wasm",
  "alias": false,
  "peer_metadata": null
}
0.2.8runtime
ws
Environment
{
  "local_name": "ws",
  "alias": false,
  "peer_metadata": null
}
^8.14.2development
msw
Environment
{
  "local_name": "msw",
  "alias": false,
  "peer_metadata": null
}
^1.2.2development
tmp
Environment
{
  "local_name": "tmp",
  "alias": false,
  "peer_metadata": null
}
^0.2.1development
tsup
Environment
{
  "local_name": "tsup",
  "alias": false,
  "peer_metadata": null
}
^7.1.0development
vite
Environment
{
  "local_name": "vite",
  "alias": false,
  "peer_metadata": null
}
^4.4.4development
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^1.6.0development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^10.9.1development
typedoc
Environment
{
  "local_name": "typedoc",
  "alias": false,
  "peer_metadata": null
}
^0.24.8development
wait-on
Environment
{
  "local_name": "wait-on",
  "alias": false,
  "peer_metadata": null
}
^7.0.1development
@types/ws
Environment
{
  "local_name": "@types/ws",
  "alias": false,
  "peer_metadata": null
}
^8.5.9development
cross-env
Environment
{
  "local_name": "cross-env",
  "alias": false,
  "peer_metadata": null
}
^7.0.3development
@types/tmp
Environment
{
  "local_name": "@types/tmp",
  "alias": false,
  "peer_metadata": null
}
^0.2.3development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.3.3development
@iarna/toml
Environment
{
  "local_name": "@iarna/toml",
  "alias": false,
  "peer_metadata": null
}
^2.2.5development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^20.4.2development
tsconfig-paths
Environment
{
  "local_name": "tsconfig-paths",
  "alias": false,
  "peer_metadata": null
}
^4.2.0development
ts-retry-promise
Environment
{
  "local_name": "ts-retry-promise",
  "alias": false,
  "peer_metadata": null
}
^0.7.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "1ca5a61107534250f31a41ff9dc97dacb81f7e82",
  "tarball": "https://registry.npmjs.org/@0xobelisk/sov-client/-/sov-client-0.2.6.tgz",
  "fileCount": 100,
  "integrity": "sha512-e9jGTg62KL3GGhQnfv4KfUffBI+82567rnnRpUZftK16vXkFiE/h+fUCWH9ParsEra6KrGsrfkPcoX+BAiOlRw==",
  "signatures": [
    {
      "sig": "MEQCIGCAhqnLNqBzMXmCXkAXIbZS004aLGDDprp1RX+2tB/VAiBeitUS6qm3PEmB2FZiHDVDqxRonEFivOBULCGfpUf1Jw==",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 484405
}

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_version:19e661a33c17ab195aa930edfbe2faee41d33cadca879da8cd3bf1d5fa97c2c8

Other collected versions

0.2.85 Sept0.2.75 Sept0.2.53 Sept0.2.42 Sept0.2.32 Sept0.2.22 SeptView all collected versions →