Skip to content
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ await fragment.PostUserFundsAccount({
```

The SDK handles different naming conventions:

- Hyphenated: `user-funds-account` → `PostUserFundsAccount`
- CamelCase: `fundingSettlement` → `PostFundingSettlement`
- Underscore: `payment_processing` → `PostPaymentProcessing`
Expand All @@ -105,6 +106,7 @@ The SDK handles different naming conventions:
When your schema defines multiple versions of the same entry type using `typeVersion`, the SDK generates separate methods for each version. Version 1 uses the base method name, and subsequent versions append `_v2`, `_v3`, etc.

For example, an entry type `user-funds-account` with `typeVersion: 1` and `typeVersion: 2` generates:

- `PostUserFundsAccount` for version 1
- `PostUserFundsAccount_v2` for version 2

Expand Down Expand Up @@ -132,7 +134,7 @@ Each version can have different parameters and line structures, and the generate
To [post](https://fragment.dev/guides/post-ledger-entries#batch-ledger-entries) a batch of Ledger Entries atomically:

```typescript
import { userFundsAccountV1 } from './src/fragment-client.ts';
import { userFundsAccountV1 } from "./src/fragment-client.ts";

await fragment.addLedgerEntries({
entries: [
Expand Down Expand Up @@ -327,7 +329,7 @@ While the SDK comes with GraphQL queries out of the box, you may want to customi

1. Define your custom GraphQL queries in a GraphQL file. For example, in `custom-queries.graphql`:

``` graphql
```graphql
mutation getSchemaName($key: SafeString!) {
schema(schema: { key: $key }) {
key
Expand All @@ -339,19 +341,20 @@ mutation getSchemaName($key: SafeString!) {
2. Run `fragment-node-client-codegen` to generate the client for your custom queries.

Using `npx`:
``` bash

```bash
npx fragment-node-client-codegen -i custom-queries.graphql -o src/fragment-client.ts
```

Using `yarn`:

``` bash
```bash
yarn fragment-node-client-codegen -i custom-queries.graphql -o src/fragment-client.ts
```

3. Pass the `getSdk` function from the generated file to `createFragmentClient` to use your custom query!

``` typescript
```typescript
import { createFragmentClient } from "@fragment-dev/node-client";

import { getSdk } from './src/fragment-client.ts';
Expand Down
179 changes: 83 additions & 96 deletions dist/cjs/src/client.js

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

2 changes: 1 addition & 1 deletion dist/cjs/types/src/client.d.ts.map

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

12 changes: 10 additions & 2 deletions dist/cjs/types/src/errors.d.ts

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

2 changes: 1 addition & 1 deletion dist/cjs/types/src/errors.d.ts.map

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

Loading
Loading