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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Typecheck files
run: yarn typecheck

- name: Run unit tests
run: yarn test

- name: Typecheck Expo example
run: npm --prefix examples/expo-example run typecheck

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/quick-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ jobs:
- name: Typecheck files
run: yarn typecheck

- name: Run unit tests
run: yarn test

- name: Typecheck Expo example
run: npm --prefix examples/expo-example run typecheck
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ plan for when automated tests are added.
first; leave full native builds to CI.
- The `resolutions` block in `package.json` pins `0xtrails` / `@0xtrails/*` — update all three
entries together when bumping the trails version.
- Pre-release versions use the `0.x.y-alpha.N` scheme. Publishing steps are in `README.md`.
- Pre-release versions use the `0.x.y-alpha.N` scheme. Publishing steps are in `PUBLISHING.md`.

## CI/CD

Expand Down
91 changes: 85 additions & 6 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This document describes the public TypeScript API for external consumers of
npm install @0xsequence/oms-react-native-sdk
```

Android resolves `io.github.0xsequence:oms-client-kotlin-sdk:0.1.0-alpha.1`.
iOS resolves `oms-client-swift-sdk` `0.1.0-alpha.1`.
Android resolves `io.github.0xsequence:oms-client-kotlin-sdk:0.1.0-alpha.2`.
iOS resolves `oms-client-swift-sdk` `0.1.0-alpha.2`.

## Configure

Expand All @@ -35,6 +35,9 @@ APIs. `publishableKey` is sent to the native SDKs as the OMS publishable key, an
```ts
getWalletAddress(): Promise<string | null>
getSession(): Promise<OmsClientSessionState>
onSessionExpired(
listener: (event: OmsClientSessionExpiredEvent) => void
): EventSubscription
signOut(): Promise<void>
```

Expand All @@ -45,10 +48,17 @@ type OmsClientSessionState = {
loginType: 'Email' | 'GoogleAuth' | 'Oidc' | null;
sessionEmail: string | null;
};

type OmsClientSessionExpiredEvent = {
session: OmsClientSessionState;
expiredAt: string;
};
```

`getSession` reports completed wallet-session metadata only. Pending OTP,
redirect verifier state, and signer details are native SDK internals.
`onSessionExpired` emits when the native wallet session expires; use the expired
session snapshot to route users back to sign-in or prefill re-authentication UI.

## Email Auth

Expand All @@ -59,6 +69,7 @@ completeEmailAuth({
code: string;
walletSelection?: 'automatic' | 'manual';
walletType?: 'ethereum';
sessionLifetimeSeconds?: number | null;
}): Promise<OmsCompleteAuthResult>
```

Expand All @@ -71,6 +82,7 @@ signInWithOidcIdToken({
audience: string;
walletSelection?: 'automatic' | 'manual';
walletType?: 'ethereum';
sessionLifetimeSeconds?: number | null;
}): Promise<OmsCompleteAuthResult>
```

Expand Down Expand Up @@ -104,6 +116,7 @@ startOidcRedirectAuth({
walletType?: 'ethereum';
relayRedirectUri?: string | null;
authorizeParams?: Record<string, string> | null;
loginHint?: string | null;
}): Promise<{
authorizationUrl: string;
state: string;
Expand All @@ -113,6 +126,7 @@ startOidcRedirectAuth({
handleOidcRedirectCallback({
callbackUrl?: string | null;
walletSelection?: 'automatic' | 'manual';
sessionLifetimeSeconds?: number | null;
}): Promise<OmsOidcRedirectAuthResult>
```

Expand All @@ -122,6 +136,9 @@ pass the resulting app-link URL to `handleOidcRedirectCallback`.

When `relayRedirectUri` is omitted, the provider default is used. Pass
`relayRedirectUri: null` to explicitly use the app `redirectUri` directly.
For Google OIDC providers, `loginHint` is sent as OAuth `login_hint`; if omitted,
the native SDKs may reuse the previous session email during re-authentication.
Auth completion methods default to a one-week session lifetime.

## Auth Results

Expand Down Expand Up @@ -346,21 +363,84 @@ type OmsTokenBalance = {
accountAddress: string | null;
tokenId: string | null;
balance: string | null;
balanceUSD?: string | null;
priceUSD?: string | null;
priceUpdatedAt?: string | null;
blockHash: string | null;
blockNumber?: number | null;
chainId?: number | null;
uniqueCollectibles?: string | null;
isSummary?: boolean | null;
contractInfo?: OmsTokenContractInfo | null;
tokenMetadata?: OmsTokenMetadata | null;
};

type OmsTokenBalancesPage = {
page: number;
pageSize: number;
more: boolean;
};

type OmsTokenContractInfo = {
chainId?: number | null;
address?: string | null;
source?: string | null;
name?: string | null;
type?: string | null;
symbol?: string | null;
decimals?: number | null;
logoURI?: string | null;
deployed?: boolean | null;
bytecodeHash?: string | null;
extensions?: object | null;
updatedAt?: string | null;
queuedAt?: string | null;
status?: string | null;
};

type OmsTokenMetadata = {
chainId?: number | null;
contractAddress?: string | null;
tokenId?: string | null;
source?: string | null;
name?: string | null;
description?: string | null;
image?: string | null;
video?: string | null;
audio?: string | null;
properties?: object | null;
attributes?: object[] | null;
imageData?: string | null;
externalUrl?: string | null;
backgroundColor?: string | null;
animationUrl?: string | null;
decimals?: number | null;
updatedAt?: string | null;
assets?: OmsTokenMetadataAsset[] | null;
status?: string | null;
queuedAt?: string | null;
lastFetched?: string | null;
};

type OmsTokenMetadataAsset = {
id?: number | null;
collectionId?: number | null;
tokenId?: string | null;
url?: string | null;
metadataField?: string | null;
name?: string | null;
filesize?: number | null;
mimeType?: string | null;
width?: number | null;
height?: number | null;
updatedAt?: string | null;
};
```

Omit `contractAddress` to query balances across token contracts. Pass `page`
to request a later page or a custom page size. When `page` is undefined, the
request defaults to page `0` with up to `40` entries.
Pass `includeMetadata: true` to request `contractInfo` and `tokenMetadata`.

## Wallet ID Token

Expand Down Expand Up @@ -416,7 +496,6 @@ parseUnits(
formatUnits(value: string | bigint, decimals?: number): string
```

`parseUnits` defaults to `roundingMode: 'reject'`, matching Swift and common
JavaScript parseUnits behavior. Use `roundingMode: 'nearest'` to match the
Kotlin SDK helper, which rounds fractional precision beyond `decimals` to the
nearest base unit.
`parseUnits` defaults to `roundingMode: 'nearest'`, matching the native SDK
helpers by rounding fractional precision beyond `decimals` to the nearest base
unit. Use `roundingMode: 'reject'` to fail on non-zero excess precision.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ cd examples/expo-example && npm install && npm start

## Publishing (alpha)

Publishing steps are documented in `README.md` under the alpha publishing section. Only maintainers
with npm publish access should publish.
Publishing steps are documented in `PUBLISHING.md`. Only maintainers with npm publish access should
publish.

## Signed commits

Expand Down
2 changes: 1 addition & 1 deletion OmsClientReactNativeSdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
s.private_header_files = "ios/**/*.h"
s.swift_version = "6.0"
s.dependency "oms-client-swift-sdk", "0.1.0-alpha.1"
s.dependency "oms-client-swift-sdk", "0.1.0-alpha.2"
s.pod_target_xcconfig = {
"DEFINES_MODULE" => "YES"
}
Expand Down
87 changes: 87 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Publishing

Release process for `@0xsequence/oms-react-native-sdk`.

Only maintainers with npm publish access should publish. Publish from `master` after CI is green.

## 1. Choose The Version

Pre-release versions use `0.x.y-alpha.N`, for example `0.1.0-alpha.2`.

Check that the version is not already published:

```sh
npm view @0xsequence/oms-react-native-sdk@<version> version
```

An npm 404 means the version is available. If npm prints a version, choose a new version.

## 2. Prepare The Release Commit

Update:

- `package.json` `version`
- `CHANGELOG.md`
- native SDK references if they changed:
- `android/build.gradle`
- `OmsClientReactNativeSdk.podspec`
- `README.md`
- `API.md`

Install after editing package metadata:

```sh
yarn install
```

Commit the release changes before publishing.

## 3. Verify

Run the standard checks from a clean worktree:

```sh
git status --short
yarn lint
yarn typecheck
yarn test
yarn sdk-example build:android
yarn sdk-example build:ios
```

Do not publish if any command fails. If native SDK versions changed, confirm those versions are
already available from Maven Central and CocoaPods.

## 4. Dry Run

Build the package and inspect what npm would publish:

```sh
yarn prepare
yarn npm publish --dry-run --access public --tag alpha
```

The dry run should include `lib`, `src`, `android`, `ios`, and
`OmsClientReactNativeSdk.podspec`.

## 5. Publish

Confirm the npm account, then publish:

```sh
yarn npm whoami
yarn npm publish --access public --tag alpha
```

Use `--tag alpha` for alpha releases so prereleases do not become the default `latest` install.

## 6. Confirm

Verify npm sees the published version:

```sh
npm view @0xsequence/oms-react-native-sdk@<version> version
```

If the package should become the default install later, move the npm dist-tag deliberately in a
separate step.
48 changes: 10 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ transactions.
```ts
const raw = parseUnits('12.34', 6); // "12340000"
const formatted = formatUnits(raw, 6); // "12.34"
const rounded = parseUnits('1.235', 2, { roundingMode: 'nearest' }); // "124"
const rounded = parseUnits('1.235', 2); // "124"
```

By default `parseUnits` rejects fractional precision beyond `decimals`.
Pass `{ roundingMode: 'nearest' }` when you want Kotlin-compatible rounding.
By default `parseUnits` rounds fractional precision beyond `decimals` to the
nearest base unit, matching the native SDKs. Pass `{ roundingMode: 'reject' }`
to fail on non-zero excess precision.

## API Reference

Expand All @@ -133,8 +134,8 @@ See [API.md](./API.md) for the public API surface and TypeScript shapes.
## Native SDK Dependencies

The React Native SDK owns its native SDK dependencies. Android resolves
`io.github.0xsequence:oms-client-kotlin-sdk:0.1.0-alpha.1` from Maven, and
iOS resolves `oms-client-swift-sdk` `0.1.0-alpha.1` from CocoaPods.
`io.github.0xsequence:oms-client-kotlin-sdk:0.1.0-alpha.2` from Maven, and
iOS resolves `oms-client-swift-sdk` `0.1.0-alpha.2` from CocoaPods.

The React Native wrapper itself is distributed through npm. React Native
autolinking consumes the wrapper podspec and Android project from
Expand Down Expand Up @@ -164,43 +165,14 @@ on the underlying native SDKs.
excluded from the root Yarn workspace so it is not linked to the local SDK
source.

## Publishing

See [PUBLISHING.md](./PUBLISHING.md) for the release process.

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)

## Publishing (for `alpha`)

Publish from a clean worktree. The Android and iOS native SDK dependencies are
resolved from Maven Central and CocoaPods by Gradle and CocoaPods; the React
Native wrapper podspec is shipped in the npm package and consumed from
`node_modules` by React Native autolinking.

Before publishing a new release, update `package.json` with the target npm
version and make sure that exact version has not already been published:

```sh
npm view @0xsequence/oms-react-native-sdk@<version> version
```

An npm 404 means that version is available. If npm prints a version, choose a
new version before publishing.

Then verify and publish:

```sh
git status --short
yarn typecheck
yarn lint
yarn prepare
yarn sdk-example build:android
yarn sdk-example build:ios
yarn npm publish --dry-run --access public --tag alpha
yarn npm publish --access public --tag alpha
```

The dry-run should include `lib`, `src`, `android`, `ios`, and
`OmsClientReactNativeSdk.podspec`.
Loading
Loading