antelopeql 2.0.0-rc.0 → 2.0.0-rc.1
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.
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GraphQLError,
|
|
3
|
+
GraphQLNonNull,
|
|
4
|
+
GraphQLObjectType,
|
|
5
|
+
GraphQLString
|
|
6
|
+
} from "graphql";
|
|
7
|
+
|
|
8
|
+
import name_type from "../eosio_types/name_type.mjs";
|
|
9
|
+
|
|
10
|
+
const smart_contract_type = new GraphQLObjectType({
|
|
11
|
+
name: "smart_contract_type",
|
|
12
|
+
fields: () => ({
|
|
13
|
+
wasm: {
|
|
14
|
+
type: GraphQLString,
|
|
15
|
+
description: "base64 encoded contract WASM"
|
|
16
|
+
},
|
|
17
|
+
abi: {
|
|
18
|
+
description: "base64 encoded contract ABI",
|
|
19
|
+
type: GraphQLString
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const get_smart_contract = {
|
|
25
|
+
description: "Retrieve a smart contract from the blockchain.",
|
|
26
|
+
type: smart_contract_type,
|
|
27
|
+
args: {
|
|
28
|
+
account_name: {
|
|
29
|
+
description: "The account holding the `smart contract`.",
|
|
30
|
+
type: new GraphQLNonNull(name_type)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async resolve(
|
|
34
|
+
_,
|
|
35
|
+
{ account_name },
|
|
36
|
+
{ network: { fetch, rpc_url, ...fetchOptions } }
|
|
37
|
+
) {
|
|
38
|
+
const uri = `${rpc_url}/v1/chain/get_raw_code_and_abi`;
|
|
39
|
+
const data = await fetch(uri, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
...fetchOptions,
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
account_name,
|
|
44
|
+
code_as_wasm: 1
|
|
45
|
+
})
|
|
46
|
+
}).then((req) => req.json());
|
|
47
|
+
|
|
48
|
+
if (data.error) throw new GraphQLError(data.message, { extensions: data });
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default get_smart_contract;
|
|
@@ -10,6 +10,7 @@ import get_currency_stats from "./blockchain/get_currency_stats.mjs";
|
|
|
10
10
|
import get_info from "./blockchain/get_info.mjs";
|
|
11
11
|
import get_producers from "./blockchain/get_producers.mjs";
|
|
12
12
|
import get_ram_price from "./blockchain/get_ram_price.mjs";
|
|
13
|
+
import get_smart_contract from "./blockchain/get_smart_contract.mjs";
|
|
13
14
|
import get_table from "./blockchain/get_table_by_scope.mjs";
|
|
14
15
|
|
|
15
16
|
const blockchain_query_field = {
|
|
@@ -21,6 +22,7 @@ const blockchain_query_field = {
|
|
|
21
22
|
get_abi,
|
|
22
23
|
get_accounts_by_authorizers,
|
|
23
24
|
get_block,
|
|
25
|
+
get_smart_contract,
|
|
24
26
|
get_currency_balance,
|
|
25
27
|
get_currency_stats,
|
|
26
28
|
get_info,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antelopeql",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "A GraphQL implementation for interacting with Antelope based blockchains.",
|
|
5
5
|
"repository": "github:pur3miish/antelopeql",
|
|
6
6
|
"bugs": "https://github.com/pur3miish/antelopeql/issues",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"base58-js": "^2.0.0",
|
|
95
|
-
"eosio-wasm-js": "^4.1.
|
|
95
|
+
"eosio-wasm-js": "^4.1.1",
|
|
96
96
|
"ripemd160-js": "*",
|
|
97
97
|
"universal-sha256-js": "^2.0.0"
|
|
98
98
|
}
|
package/push_transaction_rpc.mjs
CHANGED
|
@@ -18,8 +18,6 @@ export default async function push_transaction_rpc(
|
|
|
18
18
|
) {
|
|
19
19
|
const { fetch, rpc_url, ...fetchOptions } = network;
|
|
20
20
|
|
|
21
|
-
console.log(transaction_body);
|
|
22
|
-
|
|
23
21
|
const pushed_txn_req = await fetch(`${rpc_url}/v1/chain/push_transaction`, {
|
|
24
22
|
method: "POST",
|
|
25
23
|
...fetchOptions,
|