-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* manual rpc test works Signed-off-by: Shumo Chu <[email protected]> * clean up Signed-off-by: Shumo Chu <[email protected]>
- Loading branch information
Showing
6 changed files
with
865 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Functional Tests for Manta | ||
========================== | ||
|
||
Get data from `mantaPay_pull` rpc methods: | ||
```bash | ||
yarn ts-node index.ts | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ApiPromise, WsProvider } from '@polkadot/api'; | ||
|
||
// Construct | ||
const wsProvider = new WsProvider('ws://127.0.0.1:9800'); | ||
async function main(){ | ||
const api = await ApiPromise.create({ | ||
provider: wsProvider, | ||
types: { | ||
Checkpoint: { | ||
receiver_index: '[u64; 256]', | ||
sender_index: 'u64' | ||
}, | ||
EncryptedNote: { | ||
ephemeral_public_key: '[u8; 32]', | ||
ciphertext: '[u8; 68]' | ||
}, | ||
PullResponse: { | ||
should_continue: 'bool', | ||
checkpoint: 'Checkpoint', | ||
receivers: 'Vec<([u8; 32], EncryptedNote)>', | ||
senders: 'Vec<[u8; 32]>', | ||
} | ||
}, | ||
rpc: { | ||
mantapay: { | ||
pull: { | ||
description: 'pull from mantaPay', | ||
params: [ | ||
{ | ||
name: 'checkpoint', | ||
type: 'Checkpoint' | ||
} | ||
], | ||
type: 'PullResponse' | ||
} | ||
} | ||
}}); | ||
const junk = await (api.rpc as any).mantapay.pull({receiver_index: new Array(256).fill(0), sender_index: 0}); | ||
console.log(junk); | ||
} | ||
|
||
main().catch(console.error).finally(() => process.exit()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "manta-tests", | ||
"version": "1.0.0", | ||
"description": "Functional Tests for Manta", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@polkadot/api": "^7.10.1", | ||
"@polkadot/types": "^7.10.1", | ||
"@types/yargs": "^17.0.0", | ||
"ts-node": "^10.8.0", | ||
"typescript": "4.6.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2016", | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true | ||
} | ||
} |
Oops, something went wrong.