-
Notifications
You must be signed in to change notification settings - Fork 1
/
serialize_transaction.mjs
35 lines (30 loc) · 1.07 KB
/
serialize_transaction.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { GraphQLList, GraphQLNonNull } from "graphql";
import public_key_type from "./eosio_types/public_key_type.mjs";
import configuration_type from "./graphql_input_types/configuration.mjs";
import packed_transaction_type from "./graphql_object_types/packed_transaction.mjs";
import mutation_resolver from "./mutation_resolver.mjs";
const serialize_transaction = (actions, ast_list) => ({
description: "Serialize a list of actions into an atomic binary instruction.",
type: new GraphQLNonNull(packed_transaction_type),
args: {
actions: {
type: actions
},
configuration: {
type: configuration_type
},
available_keys: {
type: new GraphQLList(public_key_type)
}
},
async resolve(root, { available_keys, ...args }, getContext, info) {
const { network } = getContext(root, { available_keys, ...args }, info);
const { transaction, ...serialized_txn } = await mutation_resolver(
args,
network,
ast_list
);
return { ...serialized_txn, available_keys, transaction };
}
});
export default serialize_transaction;