You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+35-10
Original file line number
Diff line number
Diff line change
@@ -24,14 +24,14 @@ communicate with BuyCoins Graphql api easily. Integrates easily with vanilla js
24
24
```js
25
25
const { setupBCoins } =require("bcoins");
26
26
27
-
//second parameter is supposed to the browser fetch, by default it uses node-fetch
27
+
//second parameter is supposed to be the browser fetch, by default it uses node-fetch
28
28
constbcoins=setupBCoins({
29
29
publicKey:"pass_public_key",
30
30
secretKey:"pass_secret_key",
31
31
}, fetch);
32
32
33
33
//call an endpoint
34
-
//bcoins returns several other methods see documentation down
34
+
//bcoins returns several other methods, see documentation below
35
35
bcoins
36
36
.getDynamicPriceExpiry({ status:"open" })
37
37
.then((res) =>console.log(res));
@@ -40,7 +40,7 @@ bcoins
40
40
41
41
## In React with @apollo/client
42
42
43
-
###In your root component
43
+
###In your root component
44
44
```js
45
45
importReactfrom'react';
46
46
import { render } from'react-dom';
@@ -56,7 +56,7 @@ function App() {
56
56
return (
57
57
<ApolloProvider client={bcoins.client}>
58
58
<div>
59
-
<h2>My first Apollo app 🚀</h2>
59
+
<h2>My first BuyCoins Apollo app 🚀</h2>
60
60
</div>
61
61
</ApolloProvider>
62
62
);
@@ -115,11 +115,11 @@ function AddTodo() {
115
115
###
116
116
```
117
117
118
-
Also Integates seamlesslly with Vue and Apollo Client
118
+
Also Integates seamlessly with Vue and Apollo Client
119
119
120
120
# Documentation
121
121
122
-
You can check out the official BuyCoins Documentation on their [website](https://developers.buycoins.africa/) for more detailed explanations of how each query/mutuation works. This library implements all the possible queries and mutuations in the BuyCoins docs except for webhook section.
122
+
You can check out the official BuyCoins Documentation on their [website](https://developers.buycoins.africa/) for more detailed explanations of how each query/mutuation works. This library implements all the possible queries and mutuations in the BuyCoins docs except the webhook section.
123
123
124
124
In order to support both usage in vanilla js and easy integration with Apollo client and other Js frameworks, the library export a setupBCoins function, which is used for the initial authorization setup and in addition exports all the methods which calls the different graphql queries and mutuations api calls
the client object returned from creating an Apolloclient instance (whcich contains our uri and authorization header is also returned from the setup client function and can be accessed thus:
@@ -144,6 +159,8 @@ the client object returned from creating an Apolloclient instance (whcich contai
144
159
bcoins.client
145
160
```
146
161
162
+
## Calling The API
163
+
147
164
```js
148
165
//pass in objects with the field specied in each call as keys and with the appropriate values (please refer to the official docs)
149
166
@@ -196,9 +213,17 @@ import {
196
213
} from'bcoins';
197
214
```
198
215
199
-
for the queries call them with the needed arguments and pass result to the useQuery hooks from Apollo client as shown in the React - Apollo section, while for the mutuations just call them without any arguments and pass the result into the useMutation hook, then the resulting function (the first argument returned from the useMutation hook) will now be usedto pass in a variables object. (also refer to the React - Apollo section to see an example.
216
+
for the queries call them with the needed arguments and pass result to the useQuery hooks from Apollo client as shown in the React - Apollo section above, while for the mutuations just call them without any arguments and pass the result into the useMutation hook, then the resulting function (the first argument returned from the useMutation hook) will now be used to pass in a variables object. (also refer to the React - Apollo section to see an example.
217
+
218
+
# Contributing
219
+
220
+
Bugs? Comments? Features? PRs and Issues happily welcomed!
0 commit comments