New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@chainsafe/gopher-sdk

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chainsafe/gopher-sdk

Gopher SDK is a powerful library for interacting with blockchain networks, allowing you to retrieve information about fungible tokens, supported chains, and user balances, as well as finding solutions for asset transfers.

latest
npmnpm
Version
0.0.1
Version published
Weekly downloads
2
-33.33%
Maintainers
2
Weekly downloads
 
Created
Source

Gopher SDK

Gopher SDK is a powerful library for interacting with blockchain networks, allowing you to retrieve information about fungible tokens, supported chains, and user balances, as well as finding solutions for asset transfers.

Installation

Install the library using npm or yarn:

npm install gopher-sdk
# or
yarn add gopher-sdk

Usage

You have two approaches: using the Gopher class or calling API endpoints directly through the SDK.

Using the Gopher Class

The Gopher class provides a convenient interface for interacting with the blockchain using an EIP1193 provider (e.g., MetaMask).

Example

import { Gopher } from 'gopher-sdk';

const gopher = new Gopher(window.ethereum);

gopher.getUserBalances().then(console.log);

Calling API Endpoints Directly

Alternatively, you can call the API endpoints directly using the provided SDK functions.

Example

import { api } from 'gopher-sdk';

const ownerAddress = "0x3E101Ec02e7A48D16DADE204C96bFF842E7E2519";
const tokenSymbol = "USDC";

api.getUserFungibleTokens(ownerAddress, tokenSymbol).then(console.log);

Environment Variables

The SDK uses environment variables to configure the base URL GOPHER_URL. You can set this variable in your environment configuration or directly in your code.

Setting Environment Variables in Code

import { setBaseUrl } from 'gopher-sdk';

setBaseUrl("http://localhost:8080");

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.

FAQs

Package last updated on 03 Jul 2024

Related posts