You can see and test the example queries and mutations below. Click the "Run" button to run the query above it and see the response. Click the "TypeScript", "Apollo Client", or "urql" buttons to see code examples.
1query Balance($address: Address, $assetId: AssetId) {
2 balance(owner: $address, assetId: $assetId) {
3 owner
4 amount
5 assetId
6 }
7}
Variables:
1{
2 "address": "0xf65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871",
3 "assetId": "0x0000000000000000000000000000000000000000000000000000000000000000"
4}
1query Balances($filter: BalanceFilterInput) {
2 balances(filter: $filter, first: 5) {
3 nodes {
4 amount
5 assetId
6 }
7 }
8}
Variables:
1{
2 "filter": {
3 "owner": "0xf65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871"
4 }
5}
1query Transactions($address: Address) {
2 transactionsByOwner(owner: $address, first: 5) {
3 nodes {
4 id
5 inputs {
6 __typename
7 ... on InputCoin {
8 owner
9 utxoId
10 amount
11 assetId
12 }
13 ... on InputContract {
14 utxoId
15 contract {
16 id
17 }
18 }
19 ... on InputMessage {
20 messageId
21 sender
22 recipient
23 amount
24 data
25 }
26 }
27 outputs {
28 __typename
29 ... on CoinOutput {
30 to
31 amount
32 assetId
33 }
34 ... on ContractOutput {
35 inputIndex
36 balanceRoot
37 stateRoot
38 }
39 ... on MessageOutput {
40 recipient
41 amount
42 }
43 ... on ChangeOutput {
44 to
45 amount
46 assetId
47 }
48 ... on VariableOutput {
49 to
50 amount
51 assetId
52 }
53 ... on ContractCreated {
54 contract {
55 id
56 }
57 stateRoot
58 }
59 }
60 status {
61 __typename
62 ... on FailureStatus {
63 reason
64 programState {
65 returnType
66 }
67 }
68 }
69 }
70 }
71}
Variables:
1{
2 "address": "0xf65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871"
3}
1query LatestTransactions {
2 transactions(last: 5) {
3 nodes {
4 id
5 inputs {
6 __typename
7 ... on InputCoin {
8 owner
9 utxoId
10 amount
11 assetId
12 }
13 ... on InputContract {
14 utxoId
15 contract {
16 id
17 }
18 }
19 ... on InputMessage {
20 messageId
21 sender
22 recipient
23 amount
24 data
25 }
26 }
27 outputs {
28 __typename
29 ... on CoinOutput {
30 to
31 amount
32 assetId
33 }
34 ... on ContractOutput {
35 inputIndex
36 balanceRoot
37 stateRoot
38 }
39 ... on MessageOutput {
40 recipient
41 amount
42 }
43 ... on ChangeOutput {
44 to
45 amount
46 assetId
47 }
48 ... on VariableOutput {
49 to
50 amount
51 assetId
52 }
53 ... on ContractCreated {
54 contract {
55 id
56 }
57 stateRoot
58 }
59 }
60 status {
61 __typename
62 ... on FailureStatus {
63 reason
64 programState {
65 returnType
66 }
67 }
68 }
69 }
70 }
71}
1query ContractBalance($contract: ContractId, $asset: AssetId) {
2 contractBalance(contract: $contract, asset: $asset) {
3 contract
4 amount
5 assetId
6 }
7}
Variables:
1{
2 "contract": "0xc9a5366c269438d294ef942bc962dd2e6c86121e3bca00192723eb7eb58fa87d",
3 "asset": "0x0000000000000000000000000000000000000000000000000000000000000000"
4}
1query ContractBalances($filter: ContractBalanceFilterInput!) {
2 contractBalances(filter: $filter, first: 5) {
3 nodes {
4 amount
5 assetId
6 }
7 }
8}
Variables:
1{
2 "filter": {
3 "contract": "0x0a98320d39c03337401a4e46263972a9af6ce69ec2f35a5420b1bd35784c74b1"
4 }
5}
1query LatestBlocks {
2 blocks(last: 5) {
3 nodes {
4 id
5 transactions {
6 id
7 inputAssetIds
8 inputs {
9 __typename
10 ... on InputCoin {
11 owner
12 utxoId
13 amount
14 assetId
15 }
16 ... on InputContract {
17 utxoId
18 contract {
19 id
20 }
21 }
22 ... on InputMessage {
23 messageId
24 sender
25 recipient
26 amount
27 data
28 }
29 }
30 outputs {
31 __typename
32 ... on CoinOutput {
33 to
34 amount
35 assetId
36 }
37 ... on ContractOutput {
38 inputIndex
39 balanceRoot
40 stateRoot
41 }
42 ... on MessageOutput {
43 recipient
44 amount
45 }
46 ... on ChangeOutput {
47 to
48 amount
49 assetId
50 }
51 ... on VariableOutput {
52 to
53 amount
54 assetId
55 }
56 ... on ContractCreated {
57 contract {
58 id
59 }
60 stateRoot
61 }
62 }
63 gasPrice
64 }
65 }
66 }
67}
1query Block($height: U64) {
2 block(height: $height) {
3 id
4 }
5}
Variables:
1{
2 "height": "378485"
3}
1query MessageInfo($address: Address) {
2 messages(owner: $address, first: 5) {
3 nodes {
4 amount
5 sender
6 recipient
7 nonce
8 data
9 daHeight
10 }
11 }
12}
Variables:
1{
2 "address": "0xf65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871"
3}
1mutation DryRun($encodedTransaction: HexString!, $utxoValidation: Boolean) {
2 dryRun(tx: $encodedTransaction, utxoValidation: $utxoValidation) {
3 receiptType
4 data
5 rawPayload
6 }
7}
1mutation submit($encodedTransaction: HexString!) {
2 submit(tx: $encodedTransaction) {
3 id
4 }
5}
You can find more examples of how we use this API in our GitHub: