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
{{ message }}
This repository was archived by the owner on Nov 22, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+34-8Lines changed: 34 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,9 @@ pip install kin-sdk-v2
14
14
## Overview
15
15
The SDK contains two main components: the `Client` and the `WebhookHandler`. The `Client` is used for blockchain
16
16
actions, such as creating accounts sending payments, while the `WebhookHandler` is meant for developers who wish to make
17
-
use of Agora Webhooks. For a high-level overview of how to integrate Kin and make use of Agora, please refer to the [website documentation](https://docs.kin.org).
17
+
use of Agora Webhooks. It is recommended that developers read the [website documentation](https://docs.kin.org) prior to using this SDK.
18
+
19
+
18
20
19
21
## Client
20
22
The main component of this library is the `Client` class, which facilitates access to the Kin blockchain.
-`whitelist_key`: The private key of an account that will be used to co-sign all transactions.
41
+
-`whitelist_key`: The private key of an account that will be used to co-sign all transactions. Should only be set for Kin 3.
40
42
-`grpc_channel`: A specific `grpc.Channel` to use. Cannot be set if `endpoint` is set.
41
43
-`endpoint`: A specific endpoint to use in the client. Cannot be set if `grpc_channel` is set.
42
44
-`retry_config`: A custom `agora.client.RetryConfig` to configure how the client retries requests.
45
+
-`kin_version`: The version of Kin to use. Defaults to 3.
46
+
-`default_commitment`: (Kin 4 only) The commitment requirement to use by default for Kin 4 Agora requests. See the [website documentation](https://docs.kin.org/solana#commitment) for more information.
43
47
44
48
### Usage
45
49
#### Create an Account
@@ -57,13 +61,21 @@ Next, submit it using `create_account`:
57
61
client.create_account(private_key)
58
62
```
59
63
64
+
In addition to the mandatory `private_key` parameter, `create_account` has the following optional parameters:
65
+
-`commitment`: (Kin 4 only) Indicates to Solana which bank state to query. See the [website documentation](https://docs.kin.org/solana#commitment) for more details.
66
+
-`subsidizer`: (Kin 4 only) The private key of an account to use as the funder of the transaction instead of the subsidizer configured on Agora.
67
+
60
68
#### Get a Transaction
61
-
The `get_transaction` method gets transaction data by transaction hash.
69
+
The `get_transaction` method gets transaction data by transaction id.
# tx_id is either a 32-byte Stellar transaction hash or a 64-byte Solana transaction signature
72
+
tx_id =b'<txid>'
73
+
transaction_data = client.get_transaction(tx_id)
65
74
```
66
75
76
+
In addition to the mandatory `tx_id` parameter, `get_transaction` has the following optional parameters:
77
+
-`commitment`: (Kin 4 only) Indicates to Solana which bank state to query. See the [website documentation](https://docs.kin.org/solana#commitment) for more details.
78
+
67
79
#### Get an Account Balance
68
80
The `get_balance` method gets the balance of the provided account, in [quarks](https://docs.kin.org/terms-and-concepts#quark).
In addition to the mandatory `public_key` parameter, `get_balance` has the following optional parameters:
91
+
-`commitment`: (Kin 4 only) Indicates to Solana which bank state to query. See the [website documentation](https://docs.kin.org/solana#commitment) for more details.
92
+
78
93
#### Submit a Payment
79
94
The `submit_payment` method submits the provided payment to Agora.
80
95
```python
@@ -97,9 +112,15 @@ A `Payment` has the following required properties:
97
112
-`quarks`: The amount of the payment, in [quarks](https://docs.kin.org/terms-and-concepts#quark).
98
113
99
114
Additionally, it has some optional properties:
100
-
-`channel`: The private key of a [channel](https://docs.kin.org/how-it-works#channels) account to use as the source of the transaction. If unset, `sender` will be used as the transaction source.
115
+
-`channel`: (Kin 2 and Kin 3 only) The private key of a [channel](https://docs.kin.org/how-it-works#channels) account to use as the source of the transaction. If unset, `sender` will be used as the transaction source.
101
116
-`invoice`: An [Invoice](https://docs.kin.org/how-it-works#invoices) to associate with this payment. Cannot be set if `memo` is set.
102
117
-`memo` A text memo to include in the transaction. Cannot be set if `invoice` is set.
118
+
-`subsidizer`: (Kin 4 only) The private key of an account to use as the funder of the transaction instead of the subsidizer configured on Agora.
119
+
120
+
`submit_payment` also has the following optional properties:
121
+
-`commitment`: (Kin 4 only) Indicates to Solana which bank state to query. See the [website documentation](https://docs.kin.org/solana#commitment) for more details.
122
+
-`sender_resolution`: (Kin 4 only) Indicates which type of account resolution to use for the payment sender.
123
+
-`dest_resolution`: (Kin 4 only) Indicates which type of account resolution to use for the payment destination.
103
124
104
125
#### Submit an Earn Batch
105
126
The `submit_earn_batch` method submits a batch of earns to Agora from a single account. It batches the earns into fewer
@@ -132,8 +153,11 @@ A single `Earn` has the following properties:
132
153
The `submit_earn_batch` method has the following parameters:
133
154
-`sender`: The private key of the account from which the earns will be sent.
134
155
-`earns`: The list of earns to send.
135
-
-`channel`: (optional): The private key of a [channel](https://docs.kin.org/how-it-works#channels) account to use as the transaction source. If not set, `sender` will be used as the source.
156
+
-`channel`: (optional, Kin 2 and Kin 3 only) The private key of a [channel](https://docs.kin.org/how-it-works#channels) account to use as the transaction source. If not set, `sender` will be used as the source.
136
157
-`memo`: (optional) A text memo to include in the transaction. Cannot be used if the earns have invoices associated with them.
158
+
-`commitment`: (Kin 4 only) Indicates to Solana which bank state to query. See the [website documentation](https://docs.kin.org/solana#commitment) for more details.
159
+
-`sender_resolution`: (Kin 4 only) Indicates which type of account resolution to use for the payment sender.
160
+
-`dest_resolution`: (Kin 4 only) Indicates which type of account resolution to use for the payment destination.
137
161
138
162
### Examples
139
163
A few examples for creating an account and different ways of submitting payments and batched earns can be found in `examples/client`.
The sign transaction webhook is used to sign Kin 3 transactions with a whitelisted Kin 3 account to remove fees. On Kin 4, the webhook can be used to simply approve or reject transactions submitted by mobile clients.
229
+
204
230
To use the `WebhookHandler` with the Sign Transaction webhook, developers should define a function that accepts a sign transaction request and response object and verifies the request in some way and modifies the response object as needed:
205
231
```python
206
232
from agora.webhook.sign_transaction import SignTransactionRequest, SignTransactionResponse
@@ -218,7 +244,7 @@ from agora.webhook.sign_transaction import SignTransactionRequest, SignTransacti
0 commit comments