Skip to content

Commit

Permalink
Merge pull request #175 from ardriveapp/PE-6721-pol-uploads-and-top-ups
Browse files Browse the repository at this point in the history
feat(pol): add support for matic/pol token uploads and top ups PE-6721
  • Loading branch information
fedellen authored Sep 13, 2024
2 parents 37c11c0 + 032db83 commit 7d2692c
Show file tree
Hide file tree
Showing 22 changed files with 471 additions and 269 deletions.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
- [ArconnectSigner](#arconnectsigner)
- [EthereumSigner](#ethereumsigner)
- [Ethereum Private Key](#ethereum-private-key)
- [POL (MATIC) Private Key](#pol-matic-private-key)
- [HexSolanaSigner](#hexsolanasigner)
- [Solana Secret Key](#solana-secret-key)
- [KYVE Private Key](#kyve-private-key)
Expand All @@ -46,6 +47,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
- [Arweave (AR) Fiat Top Up](#arweave-ar-fiat-top-up)
- [Ethereum (ETH) Fiat Top Up](#ethereum-eth-fiat-top-up)
- [Solana (SOL) Fiat Top Up](#solana-sol-fiat-top-up)
- [Polygon (POL / MATIC) Fiat Top Up](#polygon-pol--matic-fiat-top-up)
- [KYVE Fiat Top Up](#kyve-fiat-top-up)
- [`submitFundTransaction({ txId })`](#submitfundtransaction-txid-)
- [TurboAuthenticatedClient](#turboauthenticatedclient)
Expand All @@ -60,6 +62,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
- [`topUpWithTokens({ tokenAmount, feeMultiplier })`](#topupwithtokens-tokenamount-feemultiplier-)
- [Arweave (AR) Crypto Top Up](#arweave-ar-crypto-top-up)
- [Ethereum (ETH) Crypto Top Up](#ethereum-eth-crypto-top-up)
- [Polygon (POL / MATIC) Crypto Top Up](#polygon-pol--matic-crypto-top-up)
- [Solana (SOL) Crypto Top Up](#solana-sol-crypto-top-up)
- [KYVE Crypto Top Up](#kyve-crypto-top-up)
- [CLI](#cli)
Expand Down Expand Up @@ -269,6 +272,15 @@ const turbo = TurboFactory.authenticated({
});
```

##### POL (MATIC) Private Key

```typescript
const turbo = TurboFactory.authenticated({
privateKey: ethHexadecimalPrivateKey,
token: 'pol',
});
```

##### HexSolanaSigner

```typescript
Expand Down Expand Up @@ -433,6 +445,17 @@ const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
});
```

##### Polygon (POL / MATIC) Fiat Top Up

```ts
const turbo = TurboFactory.unauthenticated({ token: 'pol' });

const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
amount: USD(10.0), // $10.00 USD
owner: publicPolygonAddress,
});
```

##### KYVE Fiat Top Up

```ts
Expand Down Expand Up @@ -623,6 +646,16 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
});
```

##### Polygon (POL / MATIC) Crypto Top Up

```ts
const turbo = TurboFactory.authenticated({ signer, token: 'pol' });

const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
tokenAmount: POLToTokenAmount(0.00001), // 0.00001 POL
});
```

##### Solana (SOL) Crypto Top Up

```ts
Expand Down Expand Up @@ -695,7 +728,7 @@ npx turbo --help
- `-g, --gateway <url>` - Set a custom crypto gateway URL
- `-t, --token <token>` - Token type for the command or connected wallet (default: "arweave")

- `-w, --wallet-file <filePath>` - Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array
- `-w, --wallet-file <filePath>` - Wallet file to use with the action. Formats accepted: JWK.json, KYVE, ETH, or POL private key as a string, or SOL Secret Key as a Uint8Array
- `-m, --mnemonic <phrase>` - Mnemonic to use with the action (KYVE only)
- `-p, --private-key <key>` - Private key to use with the action

Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ coverage:
threshold: 1%
ignore:
- 'src/cli/*'
- 'src/common/token/*'
6 changes: 3 additions & 3 deletions src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import { Command, program } from 'commander';

import { version } from '../version.js';
import {
balance,
cryptoFund,
getBalance,
topUp,
uploadFile,
uploadFolder,
} from './commands.js';
} from './commands/index.js';
import {
globalOptions,
optionMap,
Expand All @@ -50,7 +50,7 @@ applyOptions(
program.command('balance').description('Get balance of a Turbo address'),
[optionMap.address, ...walletOptions],
).action(async (_commandOptions, command: Command) => {
await runCommand(command, getBalance);
await runCommand(command, balance);
});

applyOptions(
Expand Down
260 changes: 0 additions & 260 deletions src/cli/commands.ts

This file was deleted.

Loading

0 comments on commit 7d2692c

Please sign in to comment.