hive-stream 2.0.3 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -2
- package/.travis.yml +11 -11
- package/LICENSE +21 -21
- package/README.md +238 -236
- package/dist/actions.d.ts +10 -9
- package/dist/actions.js +23 -15
- package/dist/actions.js.map +1 -1
- package/dist/adapters/base.adapter.d.ts +25 -21
- package/dist/adapters/base.adapter.js +49 -63
- package/dist/adapters/base.adapter.js.map +1 -1
- package/dist/adapters/mongodb.adapter.d.ts +37 -29
- package/dist/adapters/mongodb.adapter.js +158 -113
- package/dist/adapters/mongodb.adapter.js.map +1 -1
- package/dist/adapters/sqlite.adapter.d.ts +41 -23
- package/dist/adapters/sqlite.adapter.js +397 -121
- package/dist/adapters/sqlite.adapter.js.map +1 -1
- package/dist/api.d.ts +6 -0
- package/dist/api.js +56 -0
- package/dist/api.js.map +1 -0
- package/dist/config.d.ts +16 -14
- package/dist/config.js +18 -15
- package/dist/config.js.map +1 -1
- package/dist/contracts/coinflip.contract.d.ts +14 -0
- package/dist/contracts/coinflip.contract.js +95 -0
- package/dist/contracts/coinflip.contract.js.map +1 -0
- package/dist/contracts/dice.contract.d.ts +29 -29
- package/dist/contracts/dice.contract.js +155 -157
- package/dist/contracts/dice.contract.js.map +1 -1
- package/dist/contracts/lotto.contract.d.ts +20 -16
- package/dist/contracts/lotto.contract.js +246 -107
- package/dist/contracts/lotto.contract.js.map +1 -1
- package/dist/exchanges/bittrex.d.ts +6 -0
- package/dist/exchanges/bittrex.js +35 -0
- package/dist/exchanges/bittrex.js.map +1 -0
- package/dist/exchanges/exchange.d.ts +9 -0
- package/dist/exchanges/exchange.js +27 -0
- package/dist/exchanges/exchange.js.map +1 -0
- package/dist/hive-rates.d.ts +9 -0
- package/dist/hive-rates.js +76 -0
- package/dist/hive-rates.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +32 -15
- package/dist/index.js.map +1 -1
- package/dist/streamer.d.ts +93 -70
- package/dist/streamer.js +545 -439
- package/dist/streamer.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.js +25 -27
- package/dist/test.js.map +1 -1
- package/dist/types/hive-stream.d.ts +6 -6
- package/dist/types/hive-stream.js +2 -2
- package/dist/utils.d.ts +27 -14
- package/dist/utils.js +261 -85
- package/dist/utils.js.map +1 -1
- package/ecosystem.config.js +17 -17
- package/jest.config.js +8 -13
- package/package.json +48 -44
- package/test-contract-block.md +18 -18
- package/tests/adapters/sqlite.adapter.spec.ts +43 -0
- package/tests/contracts/coinflip.contract.spec.ts +132 -0
- package/tests/contracts/dice.contract.spec.ts +159 -156
- package/tests/contracts/entrants.json +728 -728
- package/tests/contracts/lotto.contract.spec.ts +323 -372
- package/tests/setup.ts +18 -20
- package/tests/streamer.spec.ts +151 -151
- package/tests/utils.spec.ts +94 -99
- package/tsconfig.build.json +22 -20
- package/tslint.json +20 -20
- package/wallaby.js +26 -0
- package/.env +0 -1
- package/dist/adapters/file.adapter.d.ts +0 -8
- package/dist/adapters/file.adapter.js +0 -70
- package/dist/adapters/file.adapter.js.map +0 -1
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/setup.js +0 -9
- package/dist/test/setup.js.map +0 -1
- package/dist/test/streamer.spec.d.ts +0 -1
- package/dist/test/streamer.spec.js +0 -145
- package/dist/test/streamer.spec.js.map +0 -1
- package/dist/test/utils.spec.d.ts +0 -1
- package/dist/test/utils.spec.js +0 -11
- package/dist/test/utils.spec.js.map +0 -1
- package/dist/tests/contracts/dice.contract.spec.d.ts +0 -1
- package/dist/tests/contracts/dice.contract.spec.js +0 -130
- package/dist/tests/contracts/dice.contract.spec.js.map +0 -1
- package/dist/tests/contracts/entrants.json +0 -729
- package/dist/tests/contracts/lotto.contract.spec.d.ts +0 -1
- package/dist/tests/contracts/lotto.contract.spec.js +0 -300
- package/dist/tests/contracts/lotto.contract.spec.js.map +0 -1
- package/dist/tests/setup.d.ts +0 -1
- package/dist/tests/setup.js +0 -19
- package/dist/tests/setup.js.map +0 -1
- package/dist/tests/streamer.spec.d.ts +0 -1
- package/dist/tests/streamer.spec.js +0 -123
- package/dist/tests/streamer.spec.js.map +0 -1
- package/dist/tests/utils.spec.d.ts +0 -1
- package/dist/tests/utils.spec.js +0 -87
- package/dist/tests/utils.spec.js.map +0 -1
- package/hive-stream.json +0 -1
package/ecosystem.config.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// PM2 configuration
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
apps: [
|
|
5
|
-
{
|
|
6
|
-
name: 'steem-stream',
|
|
7
|
-
script: 'index.js',
|
|
8
|
-
ignore_watch: ['node_modules'],
|
|
9
|
-
env: {
|
|
10
|
-
NODE_ENV: 'development'
|
|
11
|
-
},
|
|
12
|
-
env_production: {
|
|
13
|
-
NODE_ENV: 'production'
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
};
|
|
1
|
+
// PM2 configuration
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
apps: [
|
|
5
|
+
{
|
|
6
|
+
name: 'steem-stream',
|
|
7
|
+
script: 'index.js',
|
|
8
|
+
ignore_watch: ['node_modules'],
|
|
9
|
+
env: {
|
|
10
|
+
NODE_ENV: 'development'
|
|
11
|
+
},
|
|
12
|
+
env_production: {
|
|
13
|
+
NODE_ENV: 'production'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
package/jest.config.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
transform: {
|
|
10
|
-
'^.+\\.(ts|tsx)$': 'ts-jest'
|
|
11
|
-
},
|
|
12
|
-
testMatch: ['**/tests/**/*.spec.(ts)'],
|
|
13
|
-
testEnvironment: 'node'
|
|
1
|
+
module.exports = {
|
|
2
|
+
setupFilesAfterEnv: ["<rootDir>/tests/setup.ts"],
|
|
3
|
+
moduleFileExtensions: ['ts', 'js'],
|
|
4
|
+
transform: {
|
|
5
|
+
'^.+\\.(ts|tsx)$': 'ts-jest'
|
|
6
|
+
},
|
|
7
|
+
testMatch: ['**/tests/**/*.spec.(ts)'],
|
|
8
|
+
testEnvironment: 'node'
|
|
14
9
|
};
|
package/package.json
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hive-stream",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "A layer for streaming actions on the Hive blockchain and reacting to them.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"repository": "git@github.com:Vheissu/hive-stream.git",
|
|
8
|
-
"author": "Dwayne Charrington <dwaynecharrington@gmail.com>",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"private": false,
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc --project tsconfig.build.json",
|
|
13
|
-
"start": "npx ts-node src/test.ts",
|
|
14
|
-
"watch": "tsc -w",
|
|
15
|
-
"test": "jest --verbose",
|
|
16
|
-
"clean-tests": "jest --clearCache"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"bignumber.js": "^9.
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"@types/
|
|
34
|
-
"@types/
|
|
35
|
-
"@types/
|
|
36
|
-
"@types/
|
|
37
|
-
"@types/
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "hive-stream",
|
|
3
|
+
"version": "2.0.6",
|
|
4
|
+
"description": "A layer for streaming actions on the Hive blockchain and reacting to them.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": "git@github.com:Vheissu/hive-stream.git",
|
|
8
|
+
"author": "Dwayne Charrington <dwaynecharrington@gmail.com>",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"private": false,
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc --project tsconfig.build.json",
|
|
13
|
+
"start": "npx ts-node src/test.ts",
|
|
14
|
+
"watch": "tsc -w",
|
|
15
|
+
"test": "jest --verbose",
|
|
16
|
+
"clean-tests": "jest --clearCache"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@hiveio/dhive": "^1.2.4",
|
|
20
|
+
"bignumber.js": "^9.1.0",
|
|
21
|
+
"cors": "^2.8.5",
|
|
22
|
+
"dotenv": "^16.0.3",
|
|
23
|
+
"express": "^4.18.2",
|
|
24
|
+
"moment": "^2.29.4",
|
|
25
|
+
"mongodb": "^4.11.0",
|
|
26
|
+
"node-fetch": "^3.2.10",
|
|
27
|
+
"seedrandom": "^3.0.5",
|
|
28
|
+
"sqlite3": "^5.1.2",
|
|
29
|
+
"sscjs": "^0.0.9",
|
|
30
|
+
"uuid": "^9.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/bytebuffer": "^5.0.44",
|
|
34
|
+
"@types/dotenv": "^8.2.0",
|
|
35
|
+
"@types/jest": "^29.2.3",
|
|
36
|
+
"@types/mongodb": "^4.0.7",
|
|
37
|
+
"@types/node": "^18.11.9",
|
|
38
|
+
"@types/node-cron": "^3.0.5",
|
|
39
|
+
"@types/seedrandom": "^3.0.2",
|
|
40
|
+
"jest": "^29.3.1",
|
|
41
|
+
"jest-cli": "^29.3.1",
|
|
42
|
+
"jest-fetch-mock": "^3.0.3",
|
|
43
|
+
"mongodb-memory-server": "^8.9.5",
|
|
44
|
+
"ts-jest": "^29.0.3",
|
|
45
|
+
"ts-node": "^10.9.1",
|
|
46
|
+
"typescript": "^4.9.3"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/test-contract-block.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
42189228
|
|
2
|
-
|
|
3
|
-
hive_keychain.requestCustomJson('beggars', 'hivedice', 'active', JSON.stringify({ hiveContract: { name: 'hivedice', action: 'roll', payload: { roll: 22, direction: 'lesserThan'} } }), 'Test', function(response) {
|
|
4
|
-
console.log(response);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
42203941
|
|
8
|
-
Transfer memo payload
|
|
9
|
-
|
|
10
|
-
{"hiveContract":{"id":"testdice", "name":"hivedice","action":"roll","payload":{"roll":95,"direction":"greaterThan"}}}
|
|
11
|
-
|
|
12
|
-
42208330
|
|
13
|
-
Transfer memo, amount higher than max
|
|
14
|
-
|
|
15
|
-
42209768
|
|
16
|
-
Transfer memo, valid bet
|
|
17
|
-
|
|
18
|
-
42210252
|
|
1
|
+
42189228
|
|
2
|
+
|
|
3
|
+
hive_keychain.requestCustomJson('beggars', 'hivedice', 'active', JSON.stringify({ hiveContract: { name: 'hivedice', action: 'roll', payload: { roll: 22, direction: 'lesserThan'} } }), 'Test', function(response) {
|
|
4
|
+
console.log(response);
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
42203941
|
|
8
|
+
Transfer memo payload
|
|
9
|
+
|
|
10
|
+
{"hiveContract":{"id":"testdice", "name":"hivedice","action":"roll","payload":{"roll":95,"direction":"greaterThan"}}}
|
|
11
|
+
|
|
12
|
+
42208330
|
|
13
|
+
Transfer memo, amount higher than max
|
|
14
|
+
|
|
15
|
+
42209768
|
|
16
|
+
Transfer memo, valid bet
|
|
17
|
+
|
|
18
|
+
42210252
|
|
19
19
|
Transfer memo, valid bet and greater than
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SqliteAdapter } from "../../src/adapters/sqlite.adapter";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
describe('SQLite Adapter', () => {
|
|
5
|
+
let sut: SqliteAdapter;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
sut = new SqliteAdapter();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('find method returns values', async () => {
|
|
12
|
+
jest.spyOn(sut.db, 'all').mockImplementation((query: any, callback: any) => {
|
|
13
|
+
return callback(null, [{ id: 1, name: 'John' }]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const result = await sut.find('USERS', { id: 1, name: 'John' });
|
|
17
|
+
|
|
18
|
+
expect(result).toEqual([{ id: 1, name: 'John' }]);
|
|
19
|
+
expect(sut.db.all).toHaveBeenCalledWith('SELECT * FROM USERS WHERE id = 1 AND name = John', expect.any(Function));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('findOne method returns value', async () => {
|
|
23
|
+
jest.spyOn(sut.db, 'get').mockImplementation((query: any, callback: any) => {
|
|
24
|
+
return callback(null, { id: 1, name: 'John' });
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const result = await sut.findOne('USERS', { id: 1, name: 'John', email: 'john@hotmail.com' });
|
|
28
|
+
|
|
29
|
+
expect(result).toEqual({ id: 1, name: 'John' });
|
|
30
|
+
expect(sut.db.get).toHaveBeenCalledWith('SELECT * FROM USERS WHERE id = 1 AND name = John AND email = john@hotmail.com', expect.any(Function));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('replace method replaces value', async () => {
|
|
34
|
+
jest.spyOn(sut.db, 'run').mockImplementation((query: any, callback: any) => {
|
|
35
|
+
return callback(null, { id: 1, name: 'John' });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const result = await sut.replace('USERS', { id: 1, name: 'John' }, { id: 2, name: 'Johnny' });
|
|
39
|
+
|
|
40
|
+
expect(result).toEqual({ id: 2, name: 'Johnny' });
|
|
41
|
+
expect(sut.db.run).toHaveBeenCalledWith(`REPLACE INTO USERS id = 1 AND name = John VALUES ([object Object])`, expect.any(Function));
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as uuid from 'uuid';
|
|
2
|
+
import { CoinflipContract } from '../../src/contracts/coinflip.contract';
|
|
3
|
+
import { sleep } from '@hiveio/dhive/lib/utils';
|
|
4
|
+
import { Streamer } from '../../src/streamer';
|
|
5
|
+
|
|
6
|
+
describe('Coinflip Contract', () => {
|
|
7
|
+
let sut: Streamer;
|
|
8
|
+
let contract: CoinflipContract;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
sut = new Streamer();
|
|
12
|
+
contract = new CoinflipContract();
|
|
13
|
+
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
sut.api = jest.fn();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
sut.stop();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterAll(() => {
|
|
23
|
+
jest.restoreAllMocks();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Registers the contract', () => {
|
|
27
|
+
sut.registerContract('coinflip', contract);
|
|
28
|
+
|
|
29
|
+
const findContract = sut['contracts'].find(c => c.name === 'coinflip');
|
|
30
|
+
|
|
31
|
+
expect(findContract).not.toBeUndefined();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('User wins a flip', async () => {
|
|
35
|
+
sut.registerContract('coinflip', contract);
|
|
36
|
+
|
|
37
|
+
contract['_instance'] = sut;
|
|
38
|
+
|
|
39
|
+
jest.spyOn(contract as any, 'flip');
|
|
40
|
+
|
|
41
|
+
jest.spyOn(sut, 'getTransaction').mockResolvedValue({test: 123} as any);
|
|
42
|
+
jest.spyOn(sut, 'verifyTransfer').mockResolvedValue(true as any);
|
|
43
|
+
jest.spyOn(sut, 'transferHiveTokens').mockResolvedValue(true as any);
|
|
44
|
+
|
|
45
|
+
const memo = JSON.stringify({
|
|
46
|
+
hivePayload: {
|
|
47
|
+
id: 'hivestream',
|
|
48
|
+
name: 'coinflip',
|
|
49
|
+
action: 'flip',
|
|
50
|
+
payload: {
|
|
51
|
+
guess: 'heads',
|
|
52
|
+
seed: 'hj879879g7686876'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
jest.spyOn(uuid, 'v4').mockReturnValue('j93jgsjghjdhgjfhgkfdhgkj34872394723');
|
|
58
|
+
|
|
59
|
+
sut.processOperation(['transfer', { from: 'testuser', amount: '9.000 HIVE', memo }], 778782, 'dfjfsdfsdfs4hfkj88787', 'fkjs7878dkfj', 'fhkjsdhfkjsdf', '2019-06-23' as any);
|
|
60
|
+
|
|
61
|
+
await sleep(100);
|
|
62
|
+
|
|
63
|
+
expect(contract['flip']).toBeCalled();
|
|
64
|
+
expect(contract['_instance'].getTransaction).toBeCalledWith(778782, 'fhkjsdhfkjsdf');
|
|
65
|
+
expect(contract['_instance'].transferHiveTokens).toBeCalledWith('beggars', 'testuser', '18.000', 'HIVE', '[Winner] | Guess: heads | Server Roll: heads | Previous block id: fkjs7878dkfj | BlockID: dfjfsdfsdfs4hfkj88787 | Trx ID: fhkjsdhfkjsdf | Server Seed: j93jgsjghjdhgjfhgkfdhgkj34872394723');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('User loses a flip', async () => {
|
|
69
|
+
sut.registerContract('coinflip', contract);
|
|
70
|
+
|
|
71
|
+
contract['_instance'] = sut;
|
|
72
|
+
|
|
73
|
+
jest.spyOn(contract as any, 'flip');
|
|
74
|
+
|
|
75
|
+
jest.spyOn(sut, 'getTransaction').mockResolvedValue({test: 123} as any);
|
|
76
|
+
jest.spyOn(sut, 'verifyTransfer').mockResolvedValue(true as any);
|
|
77
|
+
jest.spyOn(sut, 'transferHiveTokens').mockResolvedValue(true as any);
|
|
78
|
+
|
|
79
|
+
const memo = JSON.stringify({
|
|
80
|
+
hivePayload: {
|
|
81
|
+
id: 'hivestream',
|
|
82
|
+
name: 'coinflip',
|
|
83
|
+
action: 'flip',
|
|
84
|
+
payload: {
|
|
85
|
+
guess: 'heads',
|
|
86
|
+
seed: 'tulips'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
jest.spyOn(uuid, 'v4').mockReturnValue('j93jgsjghjdhgjfhgkfdhgkj34872394723');
|
|
92
|
+
|
|
93
|
+
sut.processOperation(['transfer', { from: 'testuser', amount: '9.000 HIVE', memo }], 778782, 'dfjfsdfsdfs4hfkj88787', 'fkjs7878dkfj', 'fhkjsdhfkjsdf', '2019-06-23' as any);
|
|
94
|
+
|
|
95
|
+
await sleep(100);
|
|
96
|
+
|
|
97
|
+
expect(contract['flip']).toBeCalled();
|
|
98
|
+
expect(contract['_instance'].getTransaction).toBeCalledWith(778782, 'fhkjsdhfkjsdf');
|
|
99
|
+
expect(contract['_instance'].transferHiveTokens).toBeCalledWith('beggars', 'testuser', '0.001', 'HIVE', '[Lost] | Guess: heads | Server Roll: tails | Previous block id: fkjs7878dkfj | BlockID: dfjfsdfsdfs4hfkj88787 | Trx ID: fhkjsdhfkjsdf | Server Seed: j93jgsjghjdhgjfhgkfdhgkj34872394723');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('User sent an unsupported currency, refund them', async () => {
|
|
103
|
+
sut.registerContract('coinflip', contract);
|
|
104
|
+
|
|
105
|
+
contract['_instance'] = sut;
|
|
106
|
+
|
|
107
|
+
jest.spyOn(contract as any, 'flip');
|
|
108
|
+
|
|
109
|
+
jest.spyOn(sut, 'getTransaction').mockResolvedValue({test: 123} as any);
|
|
110
|
+
jest.spyOn(sut, 'verifyTransfer').mockResolvedValue(true as any);
|
|
111
|
+
jest.spyOn(sut, 'transferHiveTokens').mockResolvedValue(true as any);
|
|
112
|
+
|
|
113
|
+
const memo = JSON.stringify({
|
|
114
|
+
hivePayload: {
|
|
115
|
+
id: 'hivestream',
|
|
116
|
+
name: 'coinflip',
|
|
117
|
+
action: 'flip',
|
|
118
|
+
payload: {
|
|
119
|
+
guess: 'heads'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
sut.processOperation(['transfer', { from: 'testuser', amount: '10.000 HBD', memo }], 778782, 'dfjfsdfsdfs4hfkj88787', 'fkjsdkfj', 'fhkjsdhfkjsdf', '2019-06-23' as any);
|
|
125
|
+
|
|
126
|
+
await sleep(100);
|
|
127
|
+
|
|
128
|
+
expect(contract['flip']).toBeCalled();
|
|
129
|
+
expect(sut.getTransaction).toBeCalledWith(778782, 'fhkjsdhfkjsdf');
|
|
130
|
+
expect(sut.transferHiveTokens).toBeCalledWith('beggars', 'testuser', '10.000', 'HBD', '[Refund] You sent an invalid currency.');
|
|
131
|
+
});
|
|
132
|
+
});
|