Skip to content

Commit

Permalink
chore: temporary patch polkadot-api to expose needed types
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Jun 11, 2024
1 parent 3dd719a commit a1be74b
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
.yarn
.yarn/*
!.yarn/patches
.nx/cache
.nx/workspace-data
.DS_Store
98 changes: 98 additions & 0 deletions .yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
diff --git a/dist/index.d.mts b/dist/index.d.mts
index e0f9bb0c3068ca6fa0672be77d03173eb429eb7f..a1b5f19a70513e724bfc3d9f9c80bce4f87342ab 100644
--- a/dist/index.d.mts
+++ b/dist/index.d.mts
@@ -129,7 +129,7 @@ declare const compatibilityHelper: (runtimeApi: RuntimeApi, getDescriptorChecksu
};
type CompatibilityHelper = ReturnType<typeof compatibilityHelper>;

-interface ConstantEntry<T> {
+export interface ConstantEntry<T> {
/**
* Constants are simple key-value structures found in the runtime metadata.
*
@@ -215,7 +215,7 @@ type CallOptions$1 = Partial<{
signal: AbortSignal;
}>;
type WithCallOptions$1<Args extends Array<any>> = Args["length"] extends 0 ? [options?: CallOptions$1] : [...args: Args, options?: CallOptions$1];
-interface RuntimeCall<Args extends Array<any>, Payload> {
+export interface RuntimeCall<Args extends Array<any>, Payload> {
/**
* Get `Payload` (Promise-based) for the runtime call.
*
@@ -248,7 +248,7 @@ type WithCallOptions<Args extends Array<any>> = [
options?: CallOptions
];
type PossibleParents<A extends Array<any>> = A extends [...infer Left, any] ? Left | PossibleParents<Left> : [];
-type StorageEntryWithoutKeys<Payload> = {
+export type StorageEntryWithoutKeys<Payload> = {
/**
* `isCompatible` enables you to check whether or not the call you're trying
* to make is compatible with the descriptors you generated on dev time.
@@ -269,7 +269,7 @@ type StorageEntryWithoutKeys<Payload> = {
*/
watchValue: (bestOrFinalized?: "best" | "finalized") => Observable<Payload>;
};
-type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
+export type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
/**
* `isCompatible` enables you to check whether or not the call you're trying
* to make is compatible with the descriptors you generated on dev time.
@@ -321,7 +321,7 @@ type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
value: NonNullable<Payload>;
}>>;
};
-type StorageEntry<Args extends Array<any>, Payload> = Args extends [] ? StorageEntryWithoutKeys<Payload> : StorageEntryWithKeys<Args, Payload>;
+export type StorageEntry<Args extends Array<any>, Payload> = Args extends [] ? StorageEntryWithoutKeys<Payload> : StorageEntryWithKeys<Args, Payload>;

type TxEvent = TxSigned | TxBroadcasted | TxBestBlocksState | TxFinalized;
type TxBroadcastEvent = TxSigned | TxBroadcasted | TxBestBlocksState | TxFinalized;
diff --git a/dist/index.d.ts b/dist/index.d.ts
index e0f9bb0c3068ca6fa0672be77d03173eb429eb7f..a1b5f19a70513e724bfc3d9f9c80bce4f87342ab 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -129,7 +129,7 @@ declare const compatibilityHelper: (runtimeApi: RuntimeApi, getDescriptorChecksu
};
type CompatibilityHelper = ReturnType<typeof compatibilityHelper>;

-interface ConstantEntry<T> {
+export interface ConstantEntry<T> {
/**
* Constants are simple key-value structures found in the runtime metadata.
*
@@ -215,7 +215,7 @@ type CallOptions$1 = Partial<{
signal: AbortSignal;
}>;
type WithCallOptions$1<Args extends Array<any>> = Args["length"] extends 0 ? [options?: CallOptions$1] : [...args: Args, options?: CallOptions$1];
-interface RuntimeCall<Args extends Array<any>, Payload> {
+export interface RuntimeCall<Args extends Array<any>, Payload> {
/**
* Get `Payload` (Promise-based) for the runtime call.
*
@@ -248,7 +248,7 @@ type WithCallOptions<Args extends Array<any>> = [
options?: CallOptions
];
type PossibleParents<A extends Array<any>> = A extends [...infer Left, any] ? Left | PossibleParents<Left> : [];
-type StorageEntryWithoutKeys<Payload> = {
+export type StorageEntryWithoutKeys<Payload> = {
/**
* `isCompatible` enables you to check whether or not the call you're trying
* to make is compatible with the descriptors you generated on dev time.
@@ -269,7 +269,7 @@ type StorageEntryWithoutKeys<Payload> = {
*/
watchValue: (bestOrFinalized?: "best" | "finalized") => Observable<Payload>;
};
-type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
+export type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
/**
* `isCompatible` enables you to check whether or not the call you're trying
* to make is compatible with the descriptors you generated on dev time.
@@ -321,7 +321,7 @@ type StorageEntryWithKeys<Args extends Array<any>, Payload> = {
value: NonNullable<Payload>;
}>>;
};
-type StorageEntry<Args extends Array<any>, Payload> = Args extends [] ? StorageEntryWithoutKeys<Payload> : StorageEntryWithKeys<Args, Payload>;
+export type StorageEntry<Args extends Array<any>, Payload> = Args extends [] ? StorageEntryWithoutKeys<Payload> : StorageEntryWithKeys<Args, Payload>;

type TxEvent = TxSigned | TxBroadcasted | TxBestBlocksState | TxFinalized;
type TxBroadcastEvent = TxSigned | TxBroadcasted | TxBestBlocksState | TxFinalized;
2 changes: 1 addition & 1 deletion apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@reactive-dot/react": "workspace:^",
"date-fns": "^3.6.0",
"polkadot-api": "^0.8.0",
"polkadot-api": "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@tsconfig/recommended": "^1.0.6",
"@tsconfig/strictest": "^2.0.5",
"eslint": "^9.4.0",
"polkadot-api": "^0.8.0",
"polkadot-api": "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch",
"typescript": "^5.4.5"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@tsconfig/strictest": "^2.0.5",
"@types/react": "^18.3.3",
"eslint": "^9.4.0",
"polkadot-api": "^0.8.0",
"polkadot-api": "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch",
"react": "^18.3.1",
"typescript": "^5.4.5"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@tsconfig/recommended": "^1.0.6",
"@tsconfig/strictest": "^2.0.5",
"eslint": "^9.4.0",
"polkadot-api": "^0.8.0",
"polkadot-api": "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch",
"typescript": "^5.4.5"
}
}
38 changes: 33 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3351,7 +3351,7 @@ __metadata:
"@tsconfig/recommended": "npm:^1.0.6"
"@tsconfig/strictest": "npm:^2.0.5"
eslint: "npm:^9.4.0"
polkadot-api: "npm:^0.8.0"
polkadot-api: "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch"
typescript: "npm:^5.4.5"
peerDependencies:
polkadot-api: ^0.8.0
Expand Down Expand Up @@ -3408,7 +3408,7 @@ __metadata:
"@vitejs/plugin-react": "npm:^4.2.1"
date-fns: "npm:^3.6.0"
eslint: "npm:^9.4.0"
polkadot-api: "npm:^0.8.0"
polkadot-api: "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
typescript: "npm:^5.4.5"
Expand All @@ -3428,7 +3428,7 @@ __metadata:
eslint: "npm:^9.4.0"
jotai: "npm:^2.8.3"
jotai-scope: "npm:^0.6.0"
polkadot-api: "npm:^0.8.0"
polkadot-api: "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch"
react: "npm:^18.3.1"
typescript: "npm:^5.4.5"
languageName: unknown
Expand All @@ -3442,7 +3442,7 @@ __metadata:
"@tsconfig/recommended": "npm:^1.0.6"
"@tsconfig/strictest": "npm:^2.0.5"
eslint: "npm:^9.4.0"
polkadot-api: "npm:^0.8.0"
polkadot-api: "patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch"
typescript: "npm:^5.4.5"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -12000,7 +12000,7 @@ __metadata:
languageName: node
linkType: hard

"polkadot-api@npm:^0.8.0":
"polkadot-api@npm:0.8.0":
version: 0.8.0
resolution: "polkadot-api@npm:0.8.0"
dependencies:
Expand Down Expand Up @@ -12028,6 +12028,34 @@ __metadata:
languageName: node
linkType: hard

"polkadot-api@patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch":
version: 0.8.0
resolution: "polkadot-api@patch:polkadot-api@npm%3A0.8.0#~/.yarn/patches/polkadot-api-npm-0.8.0-ef17b11e20.patch::version=0.8.0&hash=a53a35"
dependencies:
"@polkadot-api/cli": "npm:0.5.0"
"@polkadot-api/json-rpc-provider": "npm:0.0.1"
"@polkadot-api/known-chains": "npm:0.1.5"
"@polkadot-api/logs-provider": "npm:0.0.2"
"@polkadot-api/metadata-builders": "npm:0.3.0"
"@polkadot-api/observable-client": "npm:0.3.0"
"@polkadot-api/pjs-signer": "npm:0.2.0"
"@polkadot-api/polkadot-signer": "npm:0.0.1"
"@polkadot-api/signer": "npm:0.0.1"
"@polkadot-api/sm-provider": "npm:0.1.0"
"@polkadot-api/smoldot": "npm:0.2.4"
"@polkadot-api/substrate-bindings": "npm:0.5.0"
"@polkadot-api/substrate-client": "npm:0.1.2"
"@polkadot-api/utils": "npm:0.1.0"
"@polkadot-api/ws-provider": "npm:0.1.0"
peerDependencies:
rxjs: ">=7.8.0"
bin:
papi: bin/cli.mjs
polkadot-api: bin/cli.mjs
checksum: 10c0/a322bbffbdb4a7cc23edc7138b638ef0b53aa1e98d1a821981a00ed1cdb2e0faf1b1d3c7f4e28b0ee035e27d0fd87f4cfb5d22bb038ae5fa1eb35b394d6f736a
languageName: node
linkType: hard

"possible-typed-array-names@npm:^1.0.0":
version: 1.0.0
resolution: "possible-typed-array-names@npm:1.0.0"
Expand Down

0 comments on commit a1be74b

Please sign in to comment.