Skip to content

Commit

Permalink
abi is not blockchain agnostic but api
Browse files Browse the repository at this point in the history
  • Loading branch information
10xSebastian committed Jun 22, 2021
1 parent d261e23 commit 5f80cef
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ async function ethereumProvider () {
return provider
}

async function callEthereum ({ blockchain, address, abi, method, params }) {
let contract = new ethers__default['default'].Contract(address, abi, await ethereumProvider());
async function callEthereum ({ blockchain, address, api, method, params }) {
let contract = new ethers__default['default'].Contract(address, api, await ethereumProvider());
let fragment = contract.interface.fragments.find((fragment) => {
return fragment.name == method
});
Expand All @@ -49,11 +49,11 @@ async function callEthereum ({ blockchain, address, abi, method, params }) {
return await contract[method](...args)
}

let call = function ({ blockchain, address, abi, method, params }) {
let call = function ({ blockchain, address, api, method, params }) {
return new Promise((resolve, reject) => {
switch (blockchain) {
case 'ethereum':
callEthereum({ blockchain, address, abi, method, params }).then((value) => resolve(value));
callEthereum({ blockchain, address, api, method, params }).then((value) => resolve(value));
break

default:
Expand Down
8 changes: 4 additions & 4 deletions dist/es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ async function ethereumProvider () {
return provider
}

async function callEthereum ({ blockchain, address, abi, method, params }) {
let contract = new ethers.Contract(address, abi, await ethereumProvider());
async function callEthereum ({ blockchain, address, api, method, params }) {
let contract = new ethers.Contract(address, api, await ethereumProvider());
let fragment = contract.interface.fragments.find((fragment) => {
return fragment.name == method
});
Expand All @@ -41,11 +41,11 @@ async function callEthereum ({ blockchain, address, abi, method, params }) {
return await contract[method](...args)
}

let call = function ({ blockchain, address, abi, method, params }) {
let call = function ({ blockchain, address, api, method, params }) {
return new Promise((resolve, reject) => {
switch (blockchain) {
case 'ethereum':
callEthereum({ blockchain, address, abi, method, params }).then((value) => resolve(value));
callEthereum({ blockchain, address, api, method, params }).then((value) => resolve(value));
break

default:
Expand Down
8 changes: 4 additions & 4 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
return provider
}

async function callEthereum ({ blockchain, address, abi, method, params }) {
let contract = new ethers__default['default'].Contract(address, abi, await ethereumProvider());
async function callEthereum ({ blockchain, address, api, method, params }) {
let contract = new ethers__default['default'].Contract(address, api, await ethereumProvider());
let fragment = contract.interface.fragments.find((fragment) => {
return fragment.name == method
});
Expand All @@ -49,11 +49,11 @@
return await contract[method](...args)
}

let call = function ({ blockchain, address, abi, method, params }) {
let call = function ({ blockchain, address, api, method, params }) {
return new Promise((resolve, reject) => {
switch (blockchain) {
case 'ethereum':
callEthereum({ blockchain, address, abi, method, params }).then((value) => resolve(value));
callEthereum({ blockchain, address, api, method, params }).then((value) => resolve(value));
break

default:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "depay-blockchain-call",
"moduleName": "BlockchainCall",
"version": "0.9.0",
"version": "0.10.0",
"description": "",
"main": "dist/cjs/index.js",
"module": "dist/es/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/call.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import callEthereum from './ethereum/call'

let call = function ({ blockchain, address, abi, method, params }) {
let call = function ({ blockchain, address, api, method, params }) {
return new Promise((resolve, reject) => {
switch (blockchain) {
case 'ethereum':
callEthereum({ blockchain, address, abi, method, params }).then((value) => resolve(value))
callEthereum({ blockchain, address, api, method, params }).then((value) => resolve(value))
break

default:
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/call.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import provider from './provider'
import ethers from 'ethers'

export default async function ({ blockchain, address, abi, method, params }) {
let contract = new ethers.Contract(address, abi, await provider())
export default async function ({ blockchain, address, api, method, params }) {
let contract = new ethers.Contract(address, api, await provider())
let fragment = contract.interface.fragments.find((fragment) => {
return fragment.name == method
})
Expand Down
8 changes: 4 additions & 4 deletions tests/units/call.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f80cef

Please sign in to comment.