From 5874e459ba525616593364b46a28bea114c99939 Mon Sep 17 00:00:00 2001 From: Stepan Lavrentev <40560660+stepanLav@users.noreply.github.com> Date: Wed, 14 Aug 2024 09:40:59 +0300 Subject: [PATCH] adding bittensor (#14) * adding bittensor * fix name --- bittensor.yaml | 64 +++++++++++++++++++++++++++++++ chainTypes/bittensorChainTypes.ts | 36 +++++++++++++++++ package.json | 3 +- 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 bittensor.yaml create mode 100644 chainTypes/bittensorChainTypes.ts diff --git a/bittensor.yaml b/bittensor.yaml new file mode 100644 index 0000000..b418cf8 --- /dev/null +++ b/bittensor.yaml @@ -0,0 +1,64 @@ +specVersion: 1.0.0 +name: subquery-proxy-bittensor +version: 1.0.0 +runner: + node: + name: "@subql/node" + version: "*" + query: + name: "@subql/query" + version: v1.5.0 +description: Nova SubQuery project +repository: https://github.com/nova-wallet/subquery-proxy +schema: + file: ./schema.graphql +network: + chainId: "0x2f0555cc76fc2840a25a6ea3b9637146806f1f44b090c175ffde2a7e5ab36c03" + endpoint: wss://archive.chain.opentensor.ai:443 + chaintypes: + file: ./dist/bittensorChaintypes.js +dataSources: + - name: main + kind: substrate/Runtime + startBlock: 1 + mapping: + file: ./dist/index.js + handlers: + - handler: handlePureProxyEvent + kind: substrate/EventHandler + filter: + module: proxy + method: PureCreated + - handler: handlePureProxyEvent + kind: substrate/EventHandler + filter: + module: proxy + method: AnonymousCreated + - handler: handleMultisigCall + kind: substrate/CallHandler + filter: + module: multisig + method: asMulti + success: true + isSigned: true + - handler: handleMultisigCall + kind: substrate/CallHandler + filter: + module: multisig + method: approveAsMulti + success: true + isSigned: true + - handler: handleMultisigCall + kind: substrate/CallHandler + filter: + module: multisig + method: cancelAsMulti + success: true + isSigned: true + - handler: handleMultisigCall + kind: substrate/CallHandler + filter: + module: multisig + method: asMultiThreshold1 + success: true + isSigned: true diff --git a/chainTypes/bittensorChainTypes.ts b/chainTypes/bittensorChainTypes.ts new file mode 100644 index 0000000..9805c36 --- /dev/null +++ b/chainTypes/bittensorChainTypes.ts @@ -0,0 +1,36 @@ +const definitions = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Balance: "u64", + NeuronMetadata: { + version: "u32", + ip: "u128", + port: "u16", + ipType: "u8", + uid: "u32", + netuid: "u16", + modality: "u8", + hotkey: "AccountId", + coldkey: "AccountId", + active: "u32", + lastUpdate: "u64", + priority: "u64", + stake: "u64", + rank: "u64", + trust: "u64", + consensus: "u64", + incentive: "u64", + dividends: "u64", + emission: "u64", + bonds: "Vec<(u32, u64)>", + weights: "Vec<(u32, u32)>", + }, + }, + }, + ], +}; + +export default { typesBundle: { spec: { bittensor: definitions } } }; diff --git a/package.json b/package.json index 130d767..532cc88 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "tslib": "^2.6.2" }, "exports": { - "moonbeamChaintypes": "./chainTypes/moonbeamChaintypes.ts" + "moonbeamChaintypes": "./chainTypes/moonbeamChaintypes.ts", + "bittensorChaintypes": "./chainTypes/bittensorChainTypes.ts" } }