Skip to content

Commit

Permalink
Merge branch 'versioning' of github.com:bcnmy/biconomy-client-sdk int…
Browse files Browse the repository at this point in the history
…o versioning
  • Loading branch information
talha committed Aug 17, 2022
2 parents 0469cc1 + 631f187 commit c0dd27f
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 8 deletions.
3 changes: 3 additions & 0 deletions packages/core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"prettier": "^2.6.2",
"typescript": "^4.6.3"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@ethersproject/bignumber": "^5.6.0",
"@ethersproject/contracts": "^5.6.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/ethers-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
"typechain": "^7.0.0",
"typescript": "^4.6.3"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@biconomy-sdk/core-types": "*",
"@biconomy-sdk/core-types": "^1.0.0",
"@gnosis.pm/safe-core-sdk-utils": "^1.1.0",
"@openzeppelin/contracts": "^4.6.0",
"scw-contracts-v1.0.0": "npm:scw-contracts@^1.0.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/node-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@
"pre-commit": "lint-staged"
}
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@biconomy-sdk/core-types": "*",
"@biconomy-sdk/core-types": "^1.0.0",
"@ethersproject/abstract-signer": "^5.6.0",
"@gnosis.pm/safe-core-sdk": "^2.1.0",
"node-fetch": "^2.6.6"
Expand Down
5 changes: 4 additions & 1 deletion packages/relayer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
"lint": "tslint -p tsconfig.json"
},
"dependencies": {
"@biconomy-sdk/core-types": "*",
"@biconomy-sdk/core-types": "^1.0.0",
"@ethersproject/providers": "^5.6.8",
"ethers": "^5.6.9"
},
"devDependencies": {
"@biconomy-sdk/core-types": "*"
},
"publishConfig": {
"access": "public"
},
"bugs": {
"url": "https://github.com/bcnmy/biconomy-client-sdk/issues"
}
Expand Down
13 changes: 8 additions & 5 deletions packages/smart-account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@biconomy-sdk/core-types": "*",
"@biconomy-sdk/ethers-lib": "*",
Expand All @@ -51,11 +54,11 @@
"typescript": "^4.7.4"
},
"dependencies": {
"@biconomy-sdk/core-types": "*",
"@biconomy-sdk/ethers-lib": "*",
"@biconomy-sdk/node-client": "*",
"@biconomy-sdk/relayer": "*",
"@biconomy-sdk/transactions": "*",
"@biconomy-sdk/core-types": "^1.0.0",
"@biconomy-sdk/ethers-lib": "^1.0.0",
"@biconomy-sdk/node-client": "^1.0.0",
"@biconomy-sdk/relayer": "^1.0.0",
"@biconomy-sdk/transactions": "^1.0.0",
"@ethersproject/bignumber": "^5.6.0",
"@ethersproject/contracts": "^5.6.0",
"@ethersproject/providers": "^5.6.8",
Expand Down
74 changes: 74 additions & 0 deletions packages/smart-account/tests/smartaccount.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { deployWalletContracts } from './utils/deploy'
import { BytesLike, Interface } from 'ethers/lib/utils'
import { Transaction } from '../src/types'
import { WalletTransaction } from '@biconomy-sdk/core-types'
import { textSpanContainsPosition } from 'typescript'

type EthereumInstance = {
chainId?: number
Expand Down Expand Up @@ -776,5 +777,78 @@ describe('Wallet integration', function () {
)
}
})

it('Should be able to send batch of transactions', async () => {
const userAddress = (await ethnode.signer?.getAddress()) || ''
const eoaSigner = ethnode.provider?.getSigner()

const wallet = new SmartAccount(ethnode.provider, {
activeNetworkId: ChainId.GANACHE,
supportedNetworksIds: [ChainId.GOERLI ,ChainId.GANACHE] // has to be consisttent providers and network names
})

const smartAccount = await wallet.init()

const signerAddress = await smartAccount.ethersAdapter().getSignerAddress()

const smartAccountAddress = smartAccount.address

// Wallet would have been deployed already
const isDeployed = await smartAccount.isDeployed() /// can pass chainId here
expect(isDeployed).to.be.equal(true)

console.log('balance before ', await ethnode.provider?.getBalance(smartAccountAddress))

await ethnode.signer?.sendTransaction({
from: signerAddress,
to: smartAccountAddress,
value: ethers.utils.parseEther('1')
})

console.log('balance after ', await ethnode.provider?.getBalance(smartAccountAddress))

const txs: Transaction[] = []

const tx1: Transaction = {
to: signerAddress,
data: '0x',
value: ethers.utils.parseEther('0.5')
}

txs.push(tx1)

console.log('receiver 1 ', signerAddress);
console.log('receiver 2 ', (await ethnode.provider?.getSigner(1).getAddress()));

const tx2: Transaction = {
to: (await ethnode.provider?.getSigner(1).getAddress()) || signerAddress,
data: '0x',
value: ethers.utils.parseEther('0.5')
}

txs.push(tx2)

const smartAccountTransaction: WalletTransaction =
await smartAccount.createSmartAccountTransactionBatch(txs)

// Attach relayer before sending a transaction

const signer = await smartAccount.ethersAdapter().getSignerAddress()
if (eoaSigner) {
const relayer = new LocalRelayer(eoaSigner)
smartAccount.setRelayer(relayer)
expect(smartAccount.relayer).to.be.equal(relayer)
const response: TransactionResponse = await smartAccount.sendTransaction(
smartAccountTransaction
)

const receipt: TransactionReceipt = await response.wait(1)
expect(receipt.status).to.be.equal(1)
console.log('balance after ', await ethnode.provider?.getBalance(smartAccountAddress))
expect((await ethnode.provider?.getBalance(smartAccountAddress))?.toString()).to.be.equal(
ethers.utils.parseEther('0.5').toString()
)
}
})
})
})
3 changes: 3 additions & 0 deletions packages/transactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
"bugs": {
"url": "https://github.com/bcnmy/biconomy-client-sdk/issues"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@ethersproject/abstract-signer": "^5.6.2",
"@ethersproject/constants": "^5.6.1",
Expand Down

0 comments on commit c0dd27f

Please sign in to comment.