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

@vechain/sdk-provider

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vechain/sdk-provider - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

10

package.json
{
"name": "@vechain/sdk-provider",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "This module is dedicated to managing the compatibility with ethers and EVM world",

@@ -34,7 +34,7 @@ "author": "vechain Foundation",

"dependencies": {
"@vechain/sdk-network": "1.0.0-beta.1",
"@vechain/sdk-wallet": "1.0.0-beta.1",
"@vechain/sdk-core": "1.0.0-beta.1",
"@vechain/sdk-logging": "1.0.0-beta.1"
"@vechain/sdk-network": "1.0.0-beta.2",
"@vechain/sdk-wallet": "1.0.0-beta.2",
"@vechain/sdk-core": "1.0.0-beta.2",
"@vechain/sdk-logging": "1.0.0-beta.2"
}
}

@@ -29,9 +29,9 @@ import { EventEmitter } from 'events';

clauseBuilder,
dataUtils,
Hex0x,
Hex,
type TransactionClause,
vechain_sdk_core_ethers
Quantity,
secp256k1,
type TransactionClause
} from '@vechain/sdk-core';
import type { TransactionObjectInput } from '../../utils/rpc-mapper/methods-map/methods/eth_sendTransaction/types';
import { randomBytes } from 'crypto';

@@ -215,3 +215,3 @@ /**

).map(async ([subscriptionId, subscriptionDetails]) => {
const currentBlock = vechain_sdk_core_ethers.toQuantity(
const currentBlock = Quantity.of(
this.subscriptionManager.currentBlockNumber

@@ -319,3 +319,3 @@ );

const { nonce, ...transactionBodyWithoutNonce } = transactionBody;
const newNonce = `0x${dataUtils.toHexString(randomBytes(6))}`;
const newNonce = Hex0x.of(secp256k1.randomBytes(6));

@@ -343,3 +343,3 @@ // At least, a signer private key is required

return Hex.of0x(signedTransaction.encoded);
return Hex0x.of(signedTransaction.encoded);
}

@@ -346,0 +346,0 @@ }

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

import { type BlocksRPC } from './types';
import {
dataUtils,
vechain_sdk_core_ethers,
ZERO_BUFFER
} from '@vechain/sdk-core';
import { Hex0x, Quantity, ZERO_BUFFER } from '@vechain/sdk-core';
import { transactionsFormatter } from '../transactions';

@@ -44,10 +39,10 @@

parentHash: block.parentID,
number: vechain_sdk_core_ethers.toQuantity(block.number),
size: vechain_sdk_core_ethers.toQuantity(block.size),
number: Quantity.of(block.number),
size: Quantity.of(block.size),
stateRoot: block.stateRoot,
receiptsRoot: block.receiptsRoot,
transactionsRoot: block.txsRoot,
timestamp: vechain_sdk_core_ethers.toQuantity(block.timestamp),
gasLimit: vechain_sdk_core_ethers.toQuantity(block.gasLimit),
gasUsed: vechain_sdk_core_ethers.toQuantity(block.gasUsed),
timestamp: Quantity.of(block.timestamp),
gasLimit: Quantity.of(block.gasLimit),
gasUsed: Quantity.of(block.gasUsed),
transactions,

@@ -60,16 +55,8 @@ miner: block.beneficiary,

uncles: [],
sha3Uncles: dataUtils.toHexString(ZERO_BUFFER(32), {
withPrefix: true
}),
nonce: dataUtils.toHexString(ZERO_BUFFER(8), {
withPrefix: true
}),
logsBloom: dataUtils.toHexString(ZERO_BUFFER(256), {
withPrefix: true
}),
sha3Uncles: Hex0x.of(ZERO_BUFFER(32)),
nonce: Hex0x.of(ZERO_BUFFER(8)),
logsBloom: Hex0x.of(ZERO_BUFFER(256)),
extraData: '0x0',
baseFeePerGas: '0x0',
mixHash: dataUtils.toHexString(ZERO_BUFFER(32), {
withPrefix: true
})
mixHash: Hex0x.of(ZERO_BUFFER(32))
};

@@ -76,0 +63,0 @@ };

import { type EventCriteria, type EventLogs } from '@vechain/sdk-network';
import { type LogsRPC } from './types';
import { vechain_sdk_core_ethers } from '@vechain/sdk-core';
import { Quantity } from '@vechain/sdk-core/dist';

@@ -17,6 +17,3 @@ /**

blockHash: eventLog.meta.blockID,
blockNumber: vechain_sdk_core_ethers.toQuantity(
eventLog.meta.blockNumber
),
blockNumber: Quantity.of(eventLog.meta.blockNumber),
data: eventLog.data,

@@ -26,3 +23,2 @@ logIndex: '0x0',

removed: false,
topics: eventLog.topics,

@@ -29,0 +25,0 @@ transactionHash: eventLog.meta.txID,

@@ -13,3 +13,3 @@ import {

} from './types';
import { Hex, vechain_sdk_core_ethers, ZERO_BUFFER } from '@vechain/sdk-core';
import { Hex0x, Quantity, ZERO_BUFFER } from '@vechain/sdk-core';
import {

@@ -42,9 +42,9 @@ getNumberOfLogsAheadOfTransactionIntoBlockExpanded,

blockHash,
blockNumber: vechain_sdk_core_ethers.toQuantity(blockNumber),
blockNumber: Quantity.of(blockNumber),
from: tx.origin,
gas: vechain_sdk_core_ethers.toQuantity(tx.gas),
gas: Quantity.of(tx.gas),
chainId,
hash: tx.id,
nonce: tx.nonce as string,
transactionIndex: vechain_sdk_core_ethers.toQuantity(txIndex),
transactionIndex: Quantity.of(txIndex),

@@ -58,3 +58,3 @@ /**

to: tx.clauses[0].to,
value: vechain_sdk_core_ethers.toQuantity(tx.clauses[0].value),
value: Quantity.of(tx.clauses[0].value),

@@ -158,33 +158,24 @@ // Unsupported fields

const logIndexes: string[] = filledLogIndexes.map((i) =>
vechain_sdk_core_ethers.toQuantity(i)
);
const logIndexes: string[] = filledLogIndexes.map((i) => Quantity.of(i));
const logs: TransactionReceiptLogsRPC[] =
receipt.outputs.length > 0 && receipt.outputs[0].events.length > 0
? receipt.outputs[0].events.map((event, index) => {
return {
blockHash: receipt.meta.blockID,
blockNumber: vechain_sdk_core_ethers.toQuantity(
receipt.meta.blockNumber
),
transactionHash: receipt.meta.txID as string,
address: event.address,
topics: event.topics.map((topic) => topic),
data: event.data,
const logs: TransactionReceiptLogsRPC[] = [];
receipt.outputs.forEach((output) => {
output.events.forEach((event, index) => {
logs.push({
blockHash: receipt.meta.blockID,
blockNumber: Quantity.of(receipt.meta.blockNumber),
transactionHash: receipt.meta.txID as string,
address: event.address,
topics: event.topics.map((topic) => topic),
data: event.data,
removed: false,
transactionIndex: Quantity.of(transactionIndex),
logIndex: logIndexes[index]
});
});
});
removed: false,
transactionIndex:
vechain_sdk_core_ethers.toQuantity(transactionIndex),
logIndex: logIndexes[index]
};
})
: [];
return {
blockHash: receipt.meta.blockID,
blockNumber: vechain_sdk_core_ethers.toQuantity(
receipt.meta.blockNumber
),
blockNumber: Quantity.of(receipt.meta.blockNumber),
contractAddress:

@@ -195,3 +186,3 @@ receipt.outputs.length > 0

from: transaction.origin,
gasUsed: vechain_sdk_core_ethers.toQuantity(receipt.gasUsed),
gasUsed: Quantity.of(receipt.gasUsed),
logs,

@@ -201,6 +192,6 @@ status: receipt.reverted ? '0x0' : '0x1',

transactionHash: receipt.meta.txID as string,
transactionIndex: vechain_sdk_core_ethers.toQuantity(transactionIndex),
transactionIndex: Quantity.of(transactionIndex),
// Incompatible fields
logsBloom: Hex.of0x(ZERO_BUFFER(256)),
logsBloom: Hex0x.of(ZERO_BUFFER(256)),
cumulativeGasUsed: '0x0',

@@ -207,0 +198,0 @@ effectiveGasPrice: '0x0',

import { type ThorClient } from '@vechain/sdk-network';
import { assert, buildProviderError, DATA, JSONRPC } from '@vechain/sdk-errors';
import { type BlocksRPC } from '../../../../formatter';
import { dataUtils } from '@vechain/sdk-core';
import { Hex0x } from '@vechain/sdk-core';
import { ethGetBlockByNumber } from '../eth_getBlockByNumber';

@@ -29,3 +29,4 @@

typeof params[0] === 'string' &&
dataUtils.isThorId(params[0], true) &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
Boolean(Hex0x.isThorId(params[0])) &&
typeof params[1] === 'boolean',

@@ -32,0 +33,0 @@ DATA.INVALID_DATA_TYPE,

@@ -1,2 +0,2 @@

import { dataUtils } from '@vechain/sdk-core';
import { Hex0x } from '@vechain/sdk-core';
import { assert, buildProviderError, DATA, JSONRPC } from '@vechain/sdk-errors';

@@ -48,3 +48,3 @@ import { type ThorClient } from '@vechain/sdk-network';

address,
dataUtils.padHexString(storagePosition),
Hex0x.canon(storagePosition, 32),
{

@@ -51,0 +51,0 @@ revision: blockNumber

import { assert, DATA } from '@vechain/sdk-errors';
import { randomBytes } from 'crypto';
import { addressUtils, Hex } from '@vechain/sdk-core';
import { addressUtils, Hex0x, secp256k1 } from '@vechain/sdk-core';

@@ -39,5 +38,5 @@ /**

// Return a random number
return await Promise.resolve(Hex.of0x(randomBytes(6)));
return await Promise.resolve(Hex0x.of(secp256k1.randomBytes(6)));
};
export { ethGetTransactionCount };
import { type ThorClient } from '@vechain/sdk-network';
import { assert, buildProviderError, DATA, JSONRPC } from '@vechain/sdk-errors';
import { dataUtils } from '@vechain/sdk-core';
import { Hex0x } from '@vechain/sdk-core';
import { transactionsFormatter } from '../../../../formatter';

@@ -28,3 +28,3 @@

typeof params[0] === 'string' &&
dataUtils.isHexString(params[0]),
Hex0x.isValid(params[0]),
DATA.INVALID_DATA_TYPE,

@@ -31,0 +31,0 @@ 'Invalid params, expected 1.\nThe param should be [signedTransactionData: string (hex string)]'

@@ -7,3 +7,3 @@ import { type ThorClient } from '@vechain/sdk-network';

import { buildProviderError, JSONRPC } from '@vechain/sdk-errors';
import { dataUtils } from '@vechain/sdk-core';
import { Hex } from '@vechain/sdk-core';

@@ -102,3 +102,3 @@ /**

}
const subscriptionId = dataUtils.generateRandomHexOfLength(32);
const subscriptionId: string = Hex.random(16);

@@ -105,0 +105,0 @@ if (params.includes(SUBSCRIPTION_TYPE.NEW_HEADS)) {

@@ -12,3 +12,3 @@ import {

import { buildProviderError, JSONRPC } from '@vechain/sdk-errors';
import { vechain_sdk_core_ethers } from '@vechain/sdk-core';
import { Quantity } from '@vechain/sdk-core';

@@ -47,3 +47,3 @@ /**

genesisBlock !== null
? vechain_sdk_core_ethers.toQuantity(
? Quantity.of(
Math.floor((Date.now() - genesisBlock.timestamp) / 10000)

@@ -50,0 +50,0 @@ )

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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