-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from LinkdropHQ/2.1.3_branch
2.1.3 branch
- Loading branch information
Showing
12 changed files
with
96 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,14 @@ import LinkdropSDK from 'linkdrop-sdk' | |
To use SDK on a tesnet: | ||
```ts | ||
// initializing Linkdrop SDK on a testnet (Goerli or Mumbai) | ||
const sdk = new LinkdropSDK({ mode: 'testnets' }); | ||
const apiKey = /* to request an API key, please contact us at [email protected] */ | ||
const sdk = new LinkdropSDK({ mode: 'testnets', apiKey }); | ||
``` | ||
To use SDK on a production network (Ethereum Mainnet or Polygon): | ||
```ts | ||
// initializing Linkdrop SDK on a production network | ||
const sdk = new LinkdropSDK(); | ||
const apiKey = /* to request an API key, please contact us at [email protected] */ | ||
const sdk = new LinkdropSDK({ apiKey }); | ||
``` | ||
|
||
## Claim methods (Can be used on Front-end & Back-end) | ||
|
@@ -248,6 +250,16 @@ To fetch all links created for that batch, use the `batch.getLinks` method: | |
const links = await batch.getLinks() | ||
``` | ||
|
||
Response data includes claim links in format `https://claim.linkdrop.io/#/...` | ||
If you need links in custom format please provide optional parameter to `getLinks` method | ||
```ts | ||
const links = await batch.getLinks('https://wallet.coinbase.com/claim?tk=code&k=<CODE>&c=<CHAIN_ID>&v=3') | ||
``` | ||
|
||
As a result you will get claim links with actual claim code (`<CODE>`) and chain id (`<CHAIN_ID>`) | ||
|
||
|
||
|
||
### Deactivating / reactivating links | ||
|
||
#### Deactivate Link | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { claimHostUrl, testnetsClaimHostUrl } from '../configs' | ||
import { TMode } from '../types' | ||
|
||
type TDefineClaimHostUrl = ( | ||
mode: TMode | ||
) => string | ||
|
||
const defineClaimHostUrl: TDefineClaimHostUrl = ( | ||
chainId | ||
) => { | ||
switch (chainId) { | ||
case 'testnets': | ||
return testnetsClaimHostUrl | ||
case 'mainnets': | ||
default: | ||
return claimHostUrl | ||
} | ||
} | ||
|
||
export default defineClaimHostUrl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type TMode = 'testnets' | 'mainnets' | ||
|
||
export default TMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { TLinkParsed } from '../../../' | ||
type TGetLinks = () => TLinkParsed[] | ||
type TGetLinks = ( | ||
linkPattern?: string | ||
) => TLinkParsed[] | ||
|
||
export default TGetLinks |