Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.5.2](https://github.com/etherdata-blockchain/etherdata-sdk/compare/v1.5.1...v1.5.2) (2022-02-09)

### [1.5.1](https://github.com/etherdata-blockchain/etherdata-sdk/compare/v1.4.14...v1.5.1) (2021-12-13)

### [1.4.14](https://github.com/etherdata-blockchain/etherdata-sdk/compare/v1.4.13...v1.4.14) (2021-12-09)
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etherdata-sdk",
"version": "1.5.1",
"version": "1.5.2",
"main": "index.js",
"repository": "https://github.com/etherdata-blockchain/etherdata-sdk",
"author": "sirily11 <sirily1997@gmail.com>",
Expand All @@ -11,8 +11,11 @@
"docs": "typedoc --out docs/js /Users/sirily11/Desktop/etd/etherdata-sdk/sdk-dist/typescript"
},
"dependencies": {
"ethereumjs-common": "^1.5.2",
"ethereumjs-tx": "^2.1.2",
"prettier": "^2.4.1",
"standard-version": "^9.3.1"
"standard-version": "^9.3.1",
"web3": "^1.7.0"
},
"devDependencies": {
"typescript": "^4.4.3"
Expand Down
2 changes: 1 addition & 1 deletion sdk-dist/etd-react-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etherdata-react-ui",
"version": "1.5.1",
"version": "1.5.2",
"description": "Made with create-react-library",
"author": "sirily11",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion sdk-dist/kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}
archivesBaseName = 'etd-sdk'
group = 'etd'
version = 'v1.5.1'
version = 'v1.5.2'
repositories {
mavenCentral()
}
Expand Down
42 changes: 42 additions & 0 deletions sdk-dist/typescript/lib/GetContractSign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//import { createRequire } from 'module';
//const require = createRequire(import.meta.url);
var Tx = require('ethereumjs-tx').Transaction
const Common = require('ethereumjs-common').default;
const Web3 = require('web3')
const web3 = new Web3('http://127.0.0.1:8545')

function getSign(){
const customCommon = Common.forCustomChain(
'mainnet',
{
name: 'etdchain',
networkId: 3101,
chainId: 3101,
},
'petersburg',
)

this.Sign=function(account, pk1, data, nonce){
const privateKey1 = Buffer.from(pk1, 'hex');
const txObject = {
from: account,
gasLimit: web3.utils.toHex(3000000),
gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')),
data: data,
nonce: web3.utils.toHex(nonce)
}
// 签署交易
const tx = new Tx(txObject,{ common: customCommon },)
tx.sign(privateKey1)

const serializedTx = tx.serialize()
const raw = '0x' + serializedTx.toString('hex')
console.log('raw:', raw)
}
this.print=function(account, pk1, data, nonce){
const privateKey1 = Buffer.from(pk1, 'hex');
console.log(privateKey1);
}
}

module.exports = getSign;
2 changes: 1 addition & 1 deletion sdk-dist/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etherdata-typescript",
"version": "1.5.1",
"version": "1.5.2",
"main": "dist/index.js",
"license": "MIT",
"private": false,
Expand Down
Loading