-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: use credit sharing in commands/methods/docs PE-6754 #198
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## alpha #198 +/- ##
==========================================
- Coverage 93.61% 93.60% -0.02%
==========================================
Files 25 25
Lines 3491 3485 -6
Branches 159 159
==========================================
- Hits 3268 3262 -6
Misses 223 223 ☔ View full report in Codecov by Sentry. |
🎉 This PR is included in version 1.20.0-alpha.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
``` | ||
|
||
## Turbo Credit Sharing | ||
|
||
Users can share their purchased Credits with other user's wallets by creating Credit Share Approvals. These approvals are created by uploading a signed data item with tags indicating the recipient's wallet address, the amount of Credits to share, and an optional amount of seconds that the approval will expire in. The recipient can then use the shared Credits to pay for their own uploads to Turbo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other user's wallets
-> other users' wallets
|
||
Users can share their purchased Credits with other user's wallets by creating Credit Share Approvals. These approvals are created by uploading a signed data item with tags indicating the recipient's wallet address, the amount of Credits to share, and an optional amount of seconds that the approval will expire in. The recipient can then use the shared Credits to pay for their own uploads to Turbo. | ||
|
||
Shared Credits cannot be re-shared by the recipient to other recipients. Only the owner of the Credits can share or revoke Credit Share Approvals. Credits that are shared to other wallets may not be used by the original owner of the Credits for sharing or uploading unless the Credit Share Approval is revoked or expired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the owner
-> Only the original owner
|
||
To use the shared Credits, recipient users must provide the wallet address of the user who shared the Credits with them in the `x-paid-by` HTTP header when uploading data. This tells Turbo services to look for and use Credit Share Approvals to pay for the upload before using the signer's balance. | ||
|
||
For user convenience, during upload the Turbo CLI will use any available Credit Share Approvals found for the connected wallet before using the signing wallet's balance. To instead ignore all Credit shares and only use the signer's balance, use the `--ignore-approvals` flag. To use the signer's balance first before using Credit shares, use the `--use-signer-balance-first` flag. The Turbo SDK layer does not provide this functionality and will always use the signer's balance unless `paidBy` is provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Turbo SDK layer does not provide this functionality and will always use the signer's balance unless
paidBy is provided.
This is a little confusing... are you saying it can do it (and what is "it" specifically?") or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specifically it does not provide any convenience of fetching approvals. it only uses the paidBy. I'll change up the wording
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> In contrast, the Turbo SDK layer does not provide this functionality and and will only use approvals when
paidBy is provided.
|
||
- `shareCredits`: Creates a Credit Share Approval for the specified wallet address and amount of Credits. | ||
- `revokeCredits`: Revokes all Credit Share Approvals for the specified wallet address. | ||
- `listShares`: Lists all Credit Share Approvals for the specified wallet address or connected wallet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have no APIs that can list ALL of the credit share approvals provided by the original credit holder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you mean approvals from single payer to a single signer, no not on the SDK level. the payment API does provide this for compatibility with the getApproval from ARx tooling. but this can be achieved by using the SDK and a simple filter: listShares(signerAddress).receivedApprovals.filter(a => a === payerAddress)
- `shareCredits`: Creates a Credit Share Approval for the specified wallet address and amount of Credits. | ||
- `revokeCredits`: Revokes all Credit Share Approvals for the specified wallet address. | ||
- `listShares`: Lists all Credit Share Approvals for the specified wallet address or connected wallet. | ||
- `dataItemOpts: { ...opts, paidBy: string[] }`: Upload methods now accept an array of wallet addresses to pay for the upload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upload methods now accept an array of wallet addresses to pay for the upload.
-> Upload methods now accept 'paidBy', an array of wallet addresses that have provided credit share approvals to the user from which to pay, in the order provided and as necessary, for the upload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of a mouthful, but perhaps GPT can clean it up
🎉 This PR is included in version 1.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.