forked from stellar/system-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stellar#40: add new scenario for diagnostic event tests on cli and js
- Loading branch information
Showing
16 changed files
with
386 additions
and
187 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
// example of how to debug and step through a system test feature using IDE | ||
// need to have a running instance of quickstart:soroban-dev for rpc url | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug Dapp Test", | ||
"type": "go", | ||
"request": "launch", | ||
"host": "127.0.0.1", | ||
"mode": "test", | ||
"program": "${workspaceFolder}/features/dapp_develop/dapp_develop_test.go", | ||
"cwd": "${workspaceFolder}", | ||
"env": { | ||
"SorobanExamplesGitHash": "v0.7.0", | ||
"SorobanExamplesRepoURL": "https://github.com/stellar/soroban-examples.git", | ||
"TargetNetworkPassPhrase": "Standalone Network ; February 2017", | ||
"TargetNetworkSecretKey": "SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L", | ||
"TargetNetworkPublicKey": "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI", | ||
"TargetNetworkRPCURL":"http://localhost:8000/soroban/rpc", | ||
"LocalCore": "true", | ||
"VerboseOutput": "true", | ||
"FeaturePath": "./features/dapp_develop" | ||
}, | ||
}, | ||
] | ||
} |
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
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
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,47 @@ | ||
#!/usr/bin/env ts-node-script | ||
|
||
import { ArgumentParser } from 'argparse'; | ||
import * as SorobanClient from 'soroban-client'; | ||
const xdr = SorobanClient.xdr; | ||
|
||
async function main() { | ||
const parser = new ArgumentParser({ description: 'Get contract events' }) | ||
parser.add_argument('--id', { dest: 'contractId', required: true, help: 'Contract ID' }); | ||
parser.add_argument('--rpc-url', { dest: 'rpcUrl', required: true, help: 'RPC URL' }); | ||
parser.add_argument('--size', { dest: 'size', required: true, help: 'Max Number of events to fetch' }); | ||
parser.add_argument('--ledgerFrom', { dest: 'ledgerFrom', help: 'Ledget Start' }); | ||
|
||
const { | ||
contractId, | ||
rpcUrl, | ||
size, | ||
ledgerFrom, | ||
} = parser.parse_args() as Record<string, string>; | ||
|
||
const server = new SorobanClient.Server(rpcUrl, { allowHttp: true }); | ||
|
||
let filters = []; | ||
|
||
if (contractId != null) { | ||
filters.push({ | ||
contractIds: [ contractId ] | ||
}); | ||
} | ||
|
||
let response = await server | ||
.getEvents({ | ||
startLedger: Number(ledgerFrom), | ||
filters: filters, | ||
limit: Number(size)}); | ||
|
||
if (!response.events) { | ||
throw new Error(`No events in response: ${JSON.stringify(response)}`); | ||
} | ||
|
||
console.log(JSON.stringify(response.events)); | ||
} | ||
|
||
main().catch(err => { | ||
console.error(JSON.stringify(err)); | ||
throw err; | ||
}); |
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
Oops, something went wrong.