Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const apiSidebar = JSON.parse(
"utf-8",
),
);
apiSidebar[0].text = "@loktin/sdk";

export default defineConfig({
title: "Loktin Docs",
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"check:snippets": "tsc -p tsconfig.snippets.json"
},
"devDependencies": {
"@loktin/sdk": "0.5.0",
"@stellar/stellar-sdk": "17.2.1",
"@loktin/sdk": "1.0.0",
"@stellar/stellar-sdk": "17.4.0",
"typedoc": "0.28.20",
"typedoc-plugin-markdown": "4.14.1",
"typedoc-vitepress-theme": "1.1.4",
Expand Down
4 changes: 2 additions & 2 deletions sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The SDK has its own contracts, separate from the Loktin app's for now.

## Status

This is the preview release, `0.5.0`. Its API may change before `1.0.0`. It works on Stellar testnet only.
This is `1.0.0`, the first stable release, so the API changes only in a new major version. It works on Stellar testnet only.

## Install

```sh
npm install @loktin/sdk@next @stellar/stellar-sdk
npm install @loktin/sdk @stellar/stellar-sdk
```

The package is on [npm](https://www.npmjs.com/package/@loktin/sdk). The code is in the [loktin-sdk repo](https://github.com/Lokt-In/loktin-sdk).
Expand Down
8 changes: 4 additions & 4 deletions sdk/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ This page takes you from install to a first goal and a first pay-and-save. The S
## Install

```sh
npm install @loktin/sdk@next @stellar/stellar-sdk
npm install @loktin/sdk @stellar/stellar-sdk
```

`@stellar/stellar-sdk` is a peer dependency. The SDK needs version 17.2.1 or a later 17.x.
`@stellar/stellar-sdk` is a peer dependency. The SDK needs version 17.4.0 or a later 17.x.

## Create the instance

Create one SDK instance for testnet with the user's address and a signer. The signer's `signTransaction` comes from the user's wallet. The SDK never sees a secret key.

<<< @/snippets/quickstart.ts#create

Here `userAddress` and `wallet` come from your app. Every write acts for `publicKey`. See [`createLoktin`](/sdk/api/index/functions/createLoktin).
Here `userAddress` and `wallet` come from your app. Every write acts for `publicKey`. See [`createLoktin`](/sdk/api/core/functions/createLoktin).

## Create the modules

Expand All @@ -32,7 +32,7 @@ Here `integratorAddress` comes from your app.

## Create a first goal

[`createGoal`](/sdk/api/target-savings/classes/TargetSavings#creategoal) creates a goal and gives you its id. Amounts are `bigint` base units. USDC has 7 decimals, and [`toBaseUnits`](/sdk/api/index/functions/toBaseUnits) converts from a decimal string.
[`createGoal`](/sdk/api/target-savings/classes/TargetSavings#creategoal) creates a goal and gives you its id. Amounts are `bigint` base units. USDC has 7 decimals, and [`toBaseUnits`](/sdk/api/core/functions/toBaseUnits) converts from a decimal string.

<<< @/snippets/quickstart.ts#first-goal

Expand Down
2 changes: 1 addition & 1 deletion sdk/spend-save.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For a spend made by other means, [`saveForSpend`](/sdk/api/spend-save/classes/Sp

The withdrawal window is the whole UTC day of the user's withdrawal day, every month. It can open up to 60 seconds early in real time.

[`nextWindow`](/sdk/api/spend-save/classes/SpendSave#nextwindow) gives the current window if one is open, otherwise the next one, in UTC. Its `end` is the first second after the window. [`windowInTimeZone`](/sdk/api/index/functions/windowInTimeZone) formats it in the device's time zone, or one you name.
[`nextWindow`](/sdk/api/spend-save/classes/SpendSave#nextwindow) gives the current window if one is open, otherwise the next one, in UTC. Its `end` is the first second after the window. [`windowInTimeZone`](/sdk/api/core/functions/windowInTimeZone) formats it in the device's time zone, or one you name.

<<< @/snippets/spend-save.ts#window

Expand Down
4 changes: 2 additions & 2 deletions sdk/target-savings.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Once the target is reached, or from the deadline second onwards, a withdrawal ca

## Amounts

Amounts are `bigint` base units. USDC has 7 decimals. [`toBaseUnits`](/sdk/api/index/functions/toBaseUnits) and [`fromBaseUnits`](/sdk/api/index/functions/fromBaseUnits) convert to and from decimal strings.
Amounts are `bigint` base units. USDC has 7 decimals. [`toBaseUnits`](/sdk/api/core/functions/toBaseUnits) and [`fromBaseUnits`](/sdk/api/core/functions/fromBaseUnits) convert to and from decimal strings.

## The allowance

Expand Down Expand Up @@ -78,7 +78,7 @@ Under a lock rule, a withdrawal before the target or deadline is refused while t

## Errors

Every error the SDK throws is a [`LoktinError`](/sdk/api/index/classes/LoktinError) with a stable `code`:
Every error the SDK throws is a [`LoktinError`](/sdk/api/core/classes/LoktinError) with a stable `code`:

| Code | Meaning |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
Loading