# @passon-io/core-sdk

> Pass On's Core SDK provides JS/TS abstractions which make it easy to integrate into other applications.

Latest version **0.1.9** (published 2024-04-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install @passon-io/core-sdk
pnpm add @passon-io/core-sdk
yarn add @passon-io/core-sdk
bun add @passon-io/core-sdk
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2024-04-27 |
| First published | 2023-07-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 57.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dennis Furrer |
| Maintainers | bigerjot, dfurrer-passon |

## Links

- npm: https://www.npmjs.com/package/@passon-io/core-sdk
- Repository: https://github.com/passon-io/core-sdk
- Homepage: https://github.com/passon-io/core-sdk#readme
- Issues: https://github.com/passon-io/core-sdk/issues
- npm.io page: https://npm.io/package/@passon-io/core-sdk

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^1.6.8
- [dotenv](https://npm.io/package/dotenv.md) ^16.3.1
- [ethers](https://npm.io/package/ethers.md) ^5
- [@gelatonetwork/relay-sdk](https://npm.io/package/@gelatonetwork/relay-sdk.md) 4.0.0

## Recent versions

- 0.1.9 (latest) — 2024-04-27
- 0.1.1-alpha.4 (alpha) — 2023-12-08
- 0.1.8 — 2024-04-16
- 0.1.7 — 2024-04-04
- 0.1.6 — 2024-04-04
- 0.1.5 — 2024-02-21
- 0.1.4 — 2024-02-20
- 0.1.1-alpha.3 — 2023-12-06
- 0.1.1-alpha.2 — 2023-08-17
- 0.1.1-alpha.1 — 2023-07-19

## README

![Banner Image](/assets/banner.png)

# **Pass On Core SDK**

Pass On's Core SDK provides JS/TS abstractions which make it easy to integrate into other applications.

## Usage

Add the dependency to your project and instantiate the SDK by passing your signer object.

```js
import { CoreSDK } from '@passon/core-sdk';

const signer = useSigner();

const coreSdk = new CoreSDK({
  signer,
  chainId,
});
```

```js
import { Signer, providers } from "ethers5";
import { useChainId, useWalletClient } from "wagmi";

export function useSigner() {
  const { data: walletClient } = useWalletClient();
  const chainId = useChainId();
  if (!walletClient) return undefined;

  const { account, transport } = walletClient;

  const provider = new providers.Web3Provider(transport, chainId);
  return provider.getSigner(account.address) as Signer;
}
```

You can now execute the various functions provided by the SDK, for example:

```js
// Generate Referral Code for Campaign
const tx = await coreSdk.generateReferralCode(campaignId);
// Wait for a transaction to finish to get created referral code
const { referralCode } = await coreSdk.generateReferralCodeTx(tx);
```

## Gasless

The SDK also provides a gasless abstraction to allow users to interact with the blockchain without needing to pay gas fees. This is done by using a relayer service to pay for the gas fees on behalf of the user.

```js
import { CoreSDK } from '@passon/core-sdk';

const signer = useSigner();

const coreSdk = new CoreSDK({
  signer,
  chainId,
  gelatoKey: YOUR_GELATO_API_KEY,
});
```

## Helpers

The SDK also provides a set of helper functions to make it easier to interact with the blockchain.

```js
// Has Affiliate/Referee registered for specific Campaign
await coreSdk.hasAffiliateRegistered(affiliateAddress, campaignId);
await coreSdk.hasRefereeRegistered(affiliateAddress, campaignId);
```

## Development

### **Repository & Prerequisites**

To work with this project you must have NodeJS (`>= v18.12.1`) & Yarn installed before cloning the repository. Assuming you have already done this, run the following in your terminal:

```bash
  git clone https://github.com/passon-io/core-sdk.git
```

### **Dependencies & Build**

To install the project's dependencies & build the code, run the following command:

```bash
  yarn install && yarn build
```

---
_Source: https://npm.io/package/@passon-io/core-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
