Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solone-sdk

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solone-sdk - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

src/types.ts

2

package.json
{
"name": "solone-sdk",
"version": "1.0.0",
"version": "1.0.1",
"description": "javascript sdk for solona",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,3 +8,3 @@ import {

TransactionResponse,
} from '@solana/web3.js';
} from "@solana/web3.js";

@@ -20,3 +20,3 @@ const {

sendAndConfirmTransaction,
} = require('@solana/web3.js');
} = require("@solana/web3.js");

@@ -26,8 +26,12 @@ class Solone {

public connection: ConnectionType;
public network: string = 'testnet';
public network: string = "testnet";
constructor(network: string) {
this.connection = new Connection(clusterApiUrl(network), 'confirmed');
this.connection = new Connection(clusterApiUrl(network), "confirmed");
this.network = network;
}
updateConnection = async (network: string) => {
this.connection = new Connection(clusterApiUrl(network), "confirmed");
};
getBalance = async (address: string): Promise<Object> => {

@@ -56,5 +60,38 @@ const publicKey = new PublicKey(address);

getTransactions = async (address: string): Promise<Object> => {
const publicKey = new PublicKey(address);
const transSignatures =
await this.connection.getConfirmedSignaturesForAddress2(publicKey, {
limit: 10,
});
const transactions = new Array();
for (let i = 0; i < transSignatures.length; i++) {
const signature = transSignatures[i].signature;
const confirmedTransaction =
await this.connection.getConfirmedTransaction(signature);
console.log(confirmedTransaction?.meta);
if (confirmedTransaction) {
const { meta } = confirmedTransaction;
if (meta) {
const oldBalance = meta.preBalances;
const newBalance = meta.postBalances;
const amount = oldBalance[0] - newBalance[0];
const transWithSignature = {
signature,
...confirmedTransaction,
fees: meta?.fee,
amount,
};
transactions.push(transWithSignature);
}
}
}
return transactions;
};
fundAccount = async (
address: string,
valueInLamports: string,
valueInLamports: string
): Promise<Object> => {

@@ -64,3 +101,3 @@ const publicKey = new PublicKey(address);

publicKey,
valueInLamports ? valueInLamports : LAMPORTS_PER_SOL,
valueInLamports ? valueInLamports : LAMPORTS_PER_SOL
);

@@ -74,3 +111,3 @@ return hash;

amount: string,
secretKey: Uint8Array,
secretKey: Uint8Array
): Promise<Object> => {

@@ -94,3 +131,3 @@ const instructions: SystemProgramType = SystemProgram.transfer({

const transaction: TransactionResponse = new Transaction().add(
instructions,
instructions
);

@@ -103,3 +140,3 @@

transaction,
signers,
signers
);

@@ -113,4 +150,4 @@

const solone = new Solone('testnet');
const solone = new Solone("testnet");
module.exports = { solone };
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc