@ocap/client 1.6.3 → 1.6.10
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.
- package/README.md +1 -1
- package/dist/base.js +36 -22
- package/dist/base.js.map +1 -1
- package/dist/browser.d.ts +997 -590
- package/dist/browser.js +1 -8
- package/dist/browser.js.map +1 -1
- package/dist/bundle.js +3 -3
- package/dist/client.js +11 -7
- package/dist/client.js.map +1 -1
- package/dist/extension.js +502 -462
- package/dist/extension.js.map +1 -1
- package/dist/methods.js +0 -142
- package/dist/methods.js.map +1 -1
- package/dist/report.html +2 -2
- package/dist/schema/graphql.json +9048 -4442
- package/dist/schema/graphql.txt +2 -2
- package/dist/types.js +2143 -1924
- package/dist/types.js.map +1 -1
- package/docs/QUERIES.md +1547 -1494
- package/docs/README.md +3269 -3138
- package/examples/asset.js +7 -7
- package/examples/create-secondary-token.js +44 -0
- package/examples/declare.js +9 -9
- package/examples/{delegate_exchange_both.js → delegate-exchange-both.js} +12 -8
- package/examples/{delegate_exchange.js → delegate-exchange.js} +11 -7
- package/examples/{delegate_transfer.js → delegate-transfer.js} +12 -6
- package/examples/exchange-secondary-token.js +100 -0
- package/examples/exchange.js +9 -9
- package/examples/{migrate_account.js → migrate-account.js} +5 -5
- package/examples/run-no-debug.sh +8 -8
- package/examples/run.sh +8 -8
- package/examples/subscribe.js +16 -0
- package/examples/{transfer_asset.js → transfer-asset.js} +11 -11
- package/examples/{transfer_token.js → transfer-primary-token.js} +10 -10
- package/examples/transfer-secondary-token.js +62 -0
- package/lib/base.js +36 -22
- package/lib/base.js.map +1 -1
- package/lib/client.js +11 -7
- package/lib/client.js.map +1 -1
- package/lib/extension.js +502 -462
- package/lib/extension.js.map +1 -1
- package/lib/methods.js +0 -142
- package/lib/methods.js.map +1 -1
- package/lib/node.d.ts +997 -590
- package/lib/node.js +0 -6
- package/lib/node.js.map +1 -1
- package/lib/schema/graphql.json +9048 -4442
- package/lib/schema/graphql.txt +2 -2
- package/lib/types.js +2143 -1924
- package/lib/types.js.map +1 -1
- package/package.json +30 -32
- package/examples/atomic_swap.js +0 -145
- package/examples/consume_asset_gatekeeper.js +0 -105
- package/examples/consume_asset_simple.js +0 -91
- package/examples/declare_forgeweb.js +0 -60
- package/examples/declare_restricted.js +0 -47
- package/examples/delegate_atomic_swap.js +0 -177
- package/examples/get_free_token.js +0 -33
- package/examples/subscribe_new_block.js +0 -36
- package/examples/subscribe_transfer.js +0 -80
package/dist/client.js
CHANGED
|
@@ -10,8 +10,7 @@ const GraphQLClientBase = require('./base');
|
|
|
10
10
|
* @example
|
|
11
11
|
* const GraphQLClient = require('@ocap/client');
|
|
12
12
|
*
|
|
13
|
-
* const client = new GraphQLClient('https://
|
|
14
|
-
* // const client = new GraphQLClient({ endpoint: 'https://argon.abtnetwork.io/api' });
|
|
13
|
+
* const client = new GraphQLClient('https://beta.abtnetwork.io/api');
|
|
15
14
|
*
|
|
16
15
|
* const res = await client.getChainInfo();
|
|
17
16
|
*/
|
|
@@ -20,18 +19,23 @@ class GraphQLClient extends GraphQLClientBase {
|
|
|
20
19
|
* Create an instance of GraphQLClient
|
|
21
20
|
*
|
|
22
21
|
* @constructor
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {string} [config.endpoint='http://localhost:8210/api'] - the graphql endpoint
|
|
25
|
-
* @param {string} [config.chainId=''] - the chainId of the network
|
|
22
|
+
* @param {string} [endpoint='http://localhost:8210/api'] - the graphql endpoint
|
|
26
23
|
* @see GraphQLClient#getQueries
|
|
27
24
|
* @see GraphQLClient#getMutations
|
|
28
25
|
* @see GraphQLClient#getSubscriptions
|
|
29
26
|
* @see GraphQLClient#getTxSendMethods
|
|
30
27
|
* @see GraphQLClient#getTxEncodeMethods
|
|
31
28
|
*/
|
|
32
|
-
constructor(
|
|
33
|
-
super(
|
|
29
|
+
constructor(endpoint = 'http://localhost:8210/api/gql', autoInit = true) {
|
|
30
|
+
super(endpoint);
|
|
34
31
|
createExtensionMethods(this, { encodeTxAsBase64: true });
|
|
32
|
+
|
|
33
|
+
// warmup the context
|
|
34
|
+
if (autoInit) {
|
|
35
|
+
this.getContext().catch(err => {
|
|
36
|
+
console.warn('failed to warmup context', err.message);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.js"],"names":["createExtensionMethods","require","GraphQLClientBase","GraphQLClient","constructor","
|
|
1
|
+
{"version":3,"sources":["../src/client.js"],"names":["createExtensionMethods","require","GraphQLClientBase","GraphQLClient","constructor","endpoint","autoInit","encodeTxAsBase64","getContext","catch","err","console","warn","message","module","exports"],"mappings":"AAAA,MAAM,EAAEA,sBAAF,KAA6BC,QAAQ,aAAR,CAAnC;AACA,MAAMC,oBAAoBD,QAAQ,QAAR,CAA1B;;AAEA;;;;;;;;;;;;;AAaA,MAAME,aAAN,SAA4BD,iBAA5B,CAA8C;AAC5C;;;;;;;;;;;AAWAE,cAAYC,WAAW,+BAAvB,EAAwDC,WAAW,IAAnE,EAAyE;AACvE,UAAMD,QAAN;AACAL,2BAAuB,IAAvB,EAA6B,EAAEO,kBAAkB,IAApB,EAA7B;;AAEA;AACA,QAAID,QAAJ,EAAc;AACZ,WAAKE,UAAL,GAAkBC,KAAlB,CAAyBC,GAAD,IAAS;AAC/BC,gBAAQC,IAAR,CAAa,0BAAb,EAAyCF,IAAIG,OAA7C;AACD,OAFD;AAGD;AACF;AAtB2C;;AAyB9CC,OAAOC,OAAP,GAAiBZ,aAAjB","file":"client.js","sourcesContent":["const { createExtensionMethods } = require('./extension');\nconst GraphQLClientBase = require('./base');\n\n/**\n * An http client that can read/write data to a forge powered blockchain node, can be used in both node.js and browser.\n *\n * Please note that, due to internal implementation of google-protobuf, all `repeated fields` names are suffixed with `List`\n *\n * @class\n * @example\n * const GraphQLClient = require('@ocap/client');\n *\n * const client = new GraphQLClient('https://beta.abtnetwork.io/api');\n *\n * const res = await client.getChainInfo();\n */\nclass GraphQLClient extends GraphQLClientBase {\n /**\n * Create an instance of GraphQLClient\n *\n * @constructor\n * @param {string} [endpoint='http://localhost:8210/api'] - the graphql endpoint\n * @see GraphQLClient#getQueries\n * @see GraphQLClient#getMutations\n * @see GraphQLClient#getSubscriptions\n * @see GraphQLClient#getTxSendMethods\n * @see GraphQLClient#getTxEncodeMethods\n */\n constructor(endpoint = 'http://localhost:8210/api/gql', autoInit = true) {\n super(endpoint);\n createExtensionMethods(this, { encodeTxAsBase64: true });\n\n // warmup the context\n if (autoInit) {\n this.getContext().catch((err) => {\n console.warn('failed to warmup context', err.message);\n });\n }\n }\n}\n\nmodule.exports = GraphQLClient;\n"]}
|