Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performing a transaction #29

Closed
wants to merge 1 commit into from
Closed
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
47 changes: 47 additions & 0 deletions test/tests/session.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {makeClient, mockSession} from '@wharfkit/mock-data'

import ContractKit, {Contract} from '$lib'
import {Action} from '@greymass/eosio'
import {TransactABIDef} from '@wharfkit/session'

const mockClient = makeClient('https://jungle4.greymass.com')

suite('Session', () => {
let mockKit: ContractKit
let tokenContract: Contract

setup(async function () {
mockKit = new ContractKit({
client: mockClient,
})
tokenContract = await mockKit.load('eosio.token')
})

suite('transact', function () {
test('passes abi data', async function () {
// Action to perform
const action: Action = tokenContract.action('transfer', {
from: 'foo',
to: 'bar',
quantity: '10.0000 EOS',
memo: '',
})
// ABIs to perform the transaction
const abis: TransactABIDef[] = [
{
account: tokenContract.account,
abi: tokenContract.abi,
},
]
// Passing data to transact
await mockSession.transact(
{
action,
},
{
abis,
}
)
})
})
})