Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

chore: rename page-retrieval count to limit #1013

Merged
merged 1 commit into from
May 17, 2023
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
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Retrieve the first 10 entries from a storage map of Polkadot.
```ts
import { polkadot } from "@capi/polkadot"

const accounts = await polkadot.System.Account.entries({ count: 10 }).run()
const accounts = await polkadot.System.Account.entries({ limit: 10 }).run()
```

## Development Networks
Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Account = System.storage("Account")

/// Read the first ten entries of the `Account` storage map.
/// Note how the lack of partial key is communicated via `null`.
const entries = await Account.entries({ count: 10 }).run()
const entries = await Account.entries({ limit: 10 }).run()

/// The result should contain a `[Uint8Array, AccountInfo]` tuple of length 10.
console.log("Entries page:", entries)
Expand Down
4 changes: 2 additions & 2 deletions examples/paginate.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { $accountInfo, polkadotDev } from "@capi/polkadot-dev"
import { $ } from "capi"

// Reference the first 10 keys of a polkadot dev chain's system account map.
const accountKeys = await polkadotDev.System.Account.keys({ count: 10 }).run()
const accountKeys = await polkadotDev.System.Account.keys({ limit: 10 }).run()

/// Each key should be of type `Uint8Array`.
console.log("Account keys:", accountKeys)
$.assert($.sizedArray($.uint8Array, 10), accountKeys)

// Reference the first 10 key-value pairs of a polkadot dev chain's system account map.
const accountEntries = await polkadotDev.System.Account.entries({ count: 10 }).run()
const accountEntries = await polkadotDev.System.Account.entries({ limit: 10 }).run()

/// Each entry should be of type `[Uint8Array, AccountInfo]`
console.log("Account entries:", accountEntries)
Expand Down
4 changes: 2 additions & 2 deletions fluent/StorageRune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class StorageRune<
return this.chain.connection.call(
"state_getKeysPaged",
storageKey,
Rune.resolve(props.count).handle(undefined, () => Rune.constant(100)),
Rune.resolve(props.limit).handle(undefined, () => Rune.constant(100)),
startKey,
this.chain.blockHash(blockHash),
)
Expand All @@ -127,7 +127,7 @@ export interface StoragePageProps<
out P extends Chain.PalletName<C>,
out S extends Chain.StorageName<C, P>,
> {
count?: number
limit?: number
partialKey?: Chain.Storage.PartialKey<C, P, S>
start?: Chain.Storage.Key<C, P, S>
}
4 changes: 2 additions & 2 deletions patterns/multisig/MultisigRune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ export class MultisigRune<out C extends Chain, out U> extends PatternRune<Multis

// TODO: why the type errors?
proposals<X>(
...[count, blockHash]: RunicArgs<X, [count: number, blockHash?: string]>
...[limit, blockHash]: RunicArgs<X, [limit: number, blockHash?: string]>
): ValueRune<Chain.Storage.Key<C, "Multisig", "multisigs">[], RunicArgs.U<X> | U> {
const partialKey = Rune.tuple([this.accountId])
return this.storage.keys({
count,
limit,
partialKey: partialKey as never,
}, blockHash) as never
}
Expand Down