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
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
Releases prior to `1.0.0` were published before this changelog was added and
are not documented here.

## [Unreleased]
## [1.1.0]

### Added

- `AddLedgerEntries` commits a batch of Ledger Entries in one atomic,
strongly-consistent transaction.
- `AddLedgerEntries` posts a batch of Ledger Entries atomically.
- Strongly-typed batch payloads. Codegen now emits a `typed_entries` module with
one model per Ledger Entry type, derived from the per-entry-type
`addLedgerEntry` operations in the codegen input directory. Because a batch
Expand Down
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ print(get_schema_result.schema_.json())

### Post a Ledger Entry

To [post](https://fragment.dev/docs#post-ledger-entries-post-to-the-api) a Ledger Entry defined in your Schema:
To [post](https://fragment.dev/guides/post-ledger-entries#post-to-the-api) a Ledger Entry defined in your Schema:

```python
await graphql_client.add_ledger_entry(
Expand All @@ -83,9 +83,38 @@ await graphql_client.add_ledger_entry(
)
```

### Post a batch of Ledger Entries

To [post](https://fragment.dev/guides/post-ledger-entries#batch-ledger-entries) a batch of Ledger Entries atomically:

```python
from fragment.sdk.typed_entries import UserFundsAccountV1

await graphql_client.add_ledger_entries(
entries=[
UserFundsAccountV1(
ik="some-ik-1",
ledger_ik="your-ledger-ik",
posted="1968-01-01T16:45:00Z",
user_id="user-1",
funding_amount="20000",
),
UserFundsAccountV1(
ik="some-ik-2",
ledger_ik="your-ledger-ik",
posted="1968-01-01T16:45:00Z",
user_id="user-2",
funding_amount="20000",
),
]
)
```

Construct the entries in the batch using the strongly-typed models for your Schema in the `typed_entries` module of your generated client.

### Read a Ledger Account's Balance

To read a Ledger Account's [balance](https://fragment.dev/docs#read-balances-latest):
To read a Ledger Account's [balance](https://fragment.dev/guides/read-balances#latest):

```python
from fragment.sdk.enums import CurrencyCode
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ target_package_name = "fragment_graphql_client"

[tool.poetry]
name = "fragment-python"
version = "1.0.0"
version = "1.1.0"
description = "Python SDK for https://fragment.dev/"
authors = ["Fragment Foundries Inc"]
license = "Apache 2.0"
Expand Down
Loading