@galacticcouncil/sdk-next 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/aave/AaveLog.d.ts +4 -0
- package/build/aave/index.cjs +1 -1
- package/build/aave/index.d.ts +2 -0
- package/build/aave/index.mjs +1 -1
- package/build/aave/types.d.ts +7 -0
- package/build/evm/adapter.d.ts +3 -1
- package/build/evm/client.d.ts +3 -1
- package/build/evm/index.cjs +1 -1
- package/build/evm/index.mjs +1 -1
- package/build/gho/GhoTokenLog.d.ts +4 -0
- package/build/gho/index.d.ts +4 -2
- package/build/{pool/hsm → gho}/types.d.ts +1 -1
- package/build/index.cjs +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.mjs +1 -1
- package/build/indexer/BlockFetcher.d.ts +10 -0
- package/build/indexer/Indexer.d.ts +19 -0
- package/build/indexer/IndexerStats.d.ts +33 -0
- package/build/indexer/RpcPool.d.ts +12 -0
- package/build/indexer/Semaphore.d.ts +9 -0
- package/build/indexer/index.cjs +1 -0
- package/build/indexer/index.d.ts +9 -0
- package/build/indexer/index.mjs +1 -0
- package/build/indexer/scale.d.ts +1 -0
- package/build/indexer/types.d.ts +17 -0
- package/build/oracle/MmOracleClient.d.ts +1 -1
- package/build/oracle/MmOracleLog.d.ts +4 -0
- package/build/oracle/abi.d.ts +11 -84
- package/build/oracle/index.d.ts +2 -0
- package/build/oracle/mappings.d.ts +25 -0
- package/build/oracle/types.d.ts +11 -0
- package/build/pool/aave/AavePoolClient.d.ts +0 -1
- package/build/pool/aave/types.d.ts +0 -6
- package/build/pool/hsm/HsmPoolClient.d.ts +0 -1
- package/build/pool/index.cjs +1 -1
- package/build/pool/index.mjs +1 -1
- package/build/pool/stable/StableSwap.d.ts +1 -1
- package/build/pool/stable/StableSwapClient.d.ts +12 -3
- package/build/pool/stable/StableSwapPeg.d.ts +7 -0
- package/build/pool/stable/types.d.ts +12 -1
- package/build/sor/index.cjs +1 -1
- package/build/sor/index.mjs +1 -1
- package/build/tx/TxBuilder.d.ts +2 -2
- package/build/tx/TxBuilderFactory.d.ts +3 -1
- package/build/tx/index.cjs +1 -1
- package/build/tx/index.mjs +1 -1
- package/package.json +6 -1
- package/build/pool/aave/AaveAbi.d.ts +0 -126
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
import { ClientSelector, FetchBlockOptions, RawBlock } from './types';
|
|
3
|
+
export declare class BlockFetcher {
|
|
4
|
+
private readonly select;
|
|
5
|
+
constructor(select: ClientSelector);
|
|
6
|
+
static withClient(client: PolkadotClient): BlockFetcher;
|
|
7
|
+
getHash(number: number): Promise<string | null>;
|
|
8
|
+
getBlock(number: number, opts?: FetchBlockOptions): Promise<RawBlock | null>;
|
|
9
|
+
getBlockAt(number: number, hash: string, opts?: FetchBlockOptions): Promise<RawBlock>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IndexerStats } from './IndexerStats';
|
|
2
|
+
import { RpcPool } from './RpcPool';
|
|
3
|
+
import { BlockHandler } from './types';
|
|
4
|
+
export interface IndexBlocksOptions {
|
|
5
|
+
pool: RpcPool;
|
|
6
|
+
fromBlock: number;
|
|
7
|
+
blockCount: number;
|
|
8
|
+
concurrency?: number;
|
|
9
|
+
batchSize?: number;
|
|
10
|
+
withBlock?: boolean;
|
|
11
|
+
withEvents?: boolean;
|
|
12
|
+
onBlock?: BlockHandler;
|
|
13
|
+
onError?: (err: unknown, blockNumber: number) => void;
|
|
14
|
+
stats?: IndexerStats;
|
|
15
|
+
}
|
|
16
|
+
export interface IndexBlocksResult {
|
|
17
|
+
stats: IndexerStats;
|
|
18
|
+
}
|
|
19
|
+
export declare function indexBlocks(opts: IndexBlocksOptions): Promise<IndexBlocksResult>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface IndexerSnapshot {
|
|
2
|
+
blocks: number;
|
|
3
|
+
events: number;
|
|
4
|
+
extrinsics: number;
|
|
5
|
+
bytes: number;
|
|
6
|
+
errors: number;
|
|
7
|
+
elapsedMs: number;
|
|
8
|
+
blocksPerSec: number;
|
|
9
|
+
eventsPerSec: number;
|
|
10
|
+
batchP50Ms: number;
|
|
11
|
+
batchP95Ms: number;
|
|
12
|
+
batchP99Ms: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class IndexerStats {
|
|
15
|
+
blocks: number;
|
|
16
|
+
events: number;
|
|
17
|
+
extrinsics: number;
|
|
18
|
+
bytes: number;
|
|
19
|
+
errors: number;
|
|
20
|
+
private startedAt;
|
|
21
|
+
private readonly batchTimes;
|
|
22
|
+
start(): void;
|
|
23
|
+
recordBlock(opts?: {
|
|
24
|
+
events?: number;
|
|
25
|
+
extrinsics?: number;
|
|
26
|
+
bytes?: number;
|
|
27
|
+
}): void;
|
|
28
|
+
recordBatch(durationMs: number): void;
|
|
29
|
+
recordError(): void;
|
|
30
|
+
elapsedMs(): number;
|
|
31
|
+
percentile(p: number): number;
|
|
32
|
+
snapshot(): IndexerSnapshot;
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
export declare class RpcPool {
|
|
3
|
+
private readonly clients;
|
|
4
|
+
private readonly owned;
|
|
5
|
+
private idx;
|
|
6
|
+
private constructor();
|
|
7
|
+
static fromEndpoints(endpoints: string | string[]): RpcPool;
|
|
8
|
+
static fromClients(clients: PolkadotClient[]): RpcPool;
|
|
9
|
+
size(): number;
|
|
10
|
+
next(): PolkadotClient;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var H=(r,e)=>{for(var t in e)B(r,t,{get:e[t],enumerable:!0})},N=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _(e))!$.call(r,o)&&o!==t&&B(r,o,{get:()=>e[o],enumerable:!(n=W(e,o))||n.enumerable});return r};var F=r=>N(B({},"__esModule",{value:!0}),r);var L={};H(L,{BlockFetcher:()=>d,IndexerStats:()=>h,RpcPool:()=>w,SYSTEM_EVENTS_KEY:()=>P,Semaphore:()=>u,decodeCompactLength:()=>x,indexBlocks:()=>O});module.exports=F(L);function x(r){let e=r.startsWith("0x")?r.slice(2):r;if(e.length<2)return 0;let t=parseInt(e.slice(0,2),16);switch(t&3){case 0:return t>>2;case 1:{if(e.length<4)return 0;let o=t;return(parseInt(e.slice(2,4),16)<<8|o)>>2}case 2:{if(e.length<8)return 0;let o=t,s=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16);return(parseInt(e.slice(6,8),16)<<24|i<<16|s<<8|o)>>>2}default:return 0}}var P="0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7";var d=class r{constructor(e){this.select=e}static withClient(e){return new r(()=>e)}async getHash(e){let n=await this.select()._request("chain_getBlockHash",[e]);return n&&n.length===66?n:null}async getBlock(e,t={}){let n=await this.getHash(e);return n?this.getBlockAt(e,n,t):null}async getBlockAt(e,t,n={}){let o=this.select(),[s,i]=await Promise.all([n.withBlock?o._request("chain_getBlock",[t]):Promise.resolve(null),n.withEvents?o._request("state_getStorage",[P,t]):Promise.resolve(null)]),b=s?.block?.extrinsics??[],f=s?.block?.header,k=s?JSON.stringify(s).length:0,c=i?i.length/2:0;return{number:e,hash:t,header:f,extrinsics:b,eventsHex:i??void 0,eventsCount:i?x(i):0,bytes:k+c}}};var h=class{blocks=0;events=0;extrinsics=0;bytes=0;errors=0;startedAt=0;batchTimes=[];start(){this.startedAt=performance.now()}recordBlock(e={}){this.blocks++,e.events&&(this.events+=e.events),e.extrinsics&&(this.extrinsics+=e.extrinsics),e.bytes&&(this.bytes+=e.bytes)}recordBatch(e){this.batchTimes.push(e)}recordError(){this.errors++}elapsedMs(){return this.startedAt===0?0:performance.now()-this.startedAt}percentile(e){if(this.batchTimes.length===0)return 0;let t=[...this.batchTimes].sort((o,s)=>o-s),n=Math.floor(e/100*t.length);return t[Math.min(n,t.length-1)]}snapshot(){let e=this.elapsedMs(),t=e/1e3;return{blocks:this.blocks,events:this.events,extrinsics:this.extrinsics,bytes:this.bytes,errors:this.errors,elapsedMs:e,blocksPerSec:t>0?this.blocks/t:0,eventsPerSec:t>0?this.events/t:0,batchP50Ms:this.percentile(50),batchP95Ms:this.percentile(95),batchP99Ms:this.percentile(99)}}};var A=require("polkadot-api");var S=require("@galacticcouncil/descriptors");var E=require("@galacticcouncil/common"),C=require("rxjs");var g=require("rxjs"),p=require("rxjs/operators");var{logger:oe}=E.log;var T=require("polkadot-api/ws"),M=require("polkadot-api/logs-provider"),R=(r,e={})=>{let t=typeof r=="string"?r.split(","):r,n=(0,T.getWsProvider)(t,e);return(0,M.withLogsRecorder)(o=>console.log(o),n),n};var w=class r{clients=[];owned;idx=0;constructor(e,t){if(e.length===0)throw new Error("RpcPool requires at least one client");this.clients=e,this.owned=t}static fromEndpoints(e){let n=(typeof e=="string"?e.split(","):e).map(o=>(0,A.createClient)(R(o)));return new r(n,!0)}static fromClients(e){return new r(e,!1)}size(){return this.clients.length}next(){let e=this.clients[this.idx%this.clients.length];return this.idx++,e}destroy(){if(this.owned)for(let e of this.clients)e.destroy()}};var u=class{constructor(e){this.max=e;if(e<1)throw new Error("Semaphore max must be >= 1")}queue=[];running=0;async acquire(){if(this.running<this.max){this.running++;return}return new Promise(e=>{this.queue.push(()=>{this.running++,e()})})}release(){this.running--;let e=this.queue.shift();e&&e()}async run(e){await this.acquire();try{return await e()}finally{this.release()}}};async function O(r){let{pool:e,fromBlock:t,blockCount:n,concurrency:o=100,batchSize:s=50,withBlock:i=!1,withEvents:b=!1,onBlock:f,onError:k}=r;if(n<=0){let a=r.stats??new h;return a.start(),{stats:a}}let c=r.stats??new h,q=new u(o),z=new d(()=>e.next()),I=[];for(let a=0;a<n;a+=s){let y=[];for(let l=0;l<s&&a+l<n;l++)y.push(t+a+l);I.push(y)}return c.start(),await Promise.all(I.map(a=>q.run(async()=>{let y=performance.now();await Promise.all(a.map(async l=>{let m=null;try{m=await z.getBlock(l,{withBlock:i,withEvents:b})}catch(v){c.recordError(),k?.(v,l);return}if(!m){c.recordError();return}if(c.recordBlock({events:m.eventsCount,extrinsics:m.extrinsics.length,bytes:m.bytes}),f)try{await f(m)}catch(v){c.recordError(),k?.(v,l)}})),c.recordBatch(performance.now()-y)}))),{stats:c}}0&&(module.exports={BlockFetcher,IndexerStats,RpcPool,SYSTEM_EVENTS_KEY,Semaphore,decodeCompactLength,indexBlocks});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { BlockFetcher } from './BlockFetcher';
|
|
2
|
+
export { IndexerStats } from './IndexerStats';
|
|
3
|
+
export { RpcPool } from './RpcPool';
|
|
4
|
+
export { Semaphore } from './Semaphore';
|
|
5
|
+
export { indexBlocks } from './Indexer';
|
|
6
|
+
export { decodeCompactLength } from './scale';
|
|
7
|
+
export type { IndexerSnapshot } from './IndexerStats';
|
|
8
|
+
export type { IndexBlocksOptions, IndexBlocksResult } from './Indexer';
|
|
9
|
+
export * from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import S from"buffer";typeof window<"u"&&(window.Buffer=S.Buffer);function x(o){let e=o.startsWith("0x")?o.slice(2):o;if(e.length<2)return 0;let t=parseInt(e.slice(0,2),16);switch(t&3){case 0:return t>>2;case 1:{if(e.length<4)return 0;let n=t;return(parseInt(e.slice(2,4),16)<<8|n)>>2}case 2:{if(e.length<8)return 0;let n=t,s=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16);return(parseInt(e.slice(6,8),16)<<24|i<<16|s<<8|n)>>>2}default:return 0}}var v="0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7";var m=class o{constructor(e){this.select=e}static withClient(e){return new o(()=>e)}async getHash(e){let r=await this.select()._request("chain_getBlockHash",[e]);return r&&r.length===66?r:null}async getBlock(e,t={}){let r=await this.getHash(e);return r?this.getBlockAt(e,r,t):null}async getBlockAt(e,t,r={}){let n=this.select(),[s,i]=await Promise.all([r.withBlock?n._request("chain_getBlock",[t]):Promise.resolve(null),r.withEvents?n._request("state_getStorage",[v,t]):Promise.resolve(null)]),u=s?.block?.extrinsics??[],b=s?.block?.header,f=s?JSON.stringify(s).length:0,c=i?i.length/2:0;return{number:e,hash:t,header:b,extrinsics:u,eventsHex:i??void 0,eventsCount:i?x(i):0,bytes:f+c}}};var h=class{blocks=0;events=0;extrinsics=0;bytes=0;errors=0;startedAt=0;batchTimes=[];start(){this.startedAt=performance.now()}recordBlock(e={}){this.blocks++,e.events&&(this.events+=e.events),e.extrinsics&&(this.extrinsics+=e.extrinsics),e.bytes&&(this.bytes+=e.bytes)}recordBatch(e){this.batchTimes.push(e)}recordError(){this.errors++}elapsedMs(){return this.startedAt===0?0:performance.now()-this.startedAt}percentile(e){if(this.batchTimes.length===0)return 0;let t=[...this.batchTimes].sort((n,s)=>n-s),r=Math.floor(e/100*t.length);return t[Math.min(r,t.length-1)]}snapshot(){let e=this.elapsedMs(),t=e/1e3;return{blocks:this.blocks,events:this.events,extrinsics:this.extrinsics,bytes:this.bytes,errors:this.errors,elapsedMs:e,blocksPerSec:t>0?this.blocks/t:0,eventsPerSec:t>0?this.events/t:0,batchP50Ms:this.percentile(50),batchP95Ms:this.percentile(95),batchP99Ms:this.percentile(99)}}};import{createClient as M}from"polkadot-api";import{hydration as ve,hydrationNext as Be,hydrationIce as Pe}from"@galacticcouncil/descriptors";import{log as I}from"@galacticcouncil/common";import{map as de,shareReplay as ue,tap as be}from"rxjs";import{defer as D,from as G,of as Q,timer as U}from"rxjs";import{catchError as Z,distinctUntilChanged as ee,expand as te,map as re,shareReplay as oe,skip as ne,switchMap as se,timeout as ie}from"rxjs/operators";var{logger:ke}=I;import{getWsProvider as E}from"polkadot-api/ws";import{withLogsRecorder as T}from"polkadot-api/logs-provider";var B=(o,e={})=>{let t=typeof o=="string"?o.split(","):o,r=E(t,e);return T(n=>console.log(n),r),r};var g=class o{clients=[];owned;idx=0;constructor(e,t){if(e.length===0)throw new Error("RpcPool requires at least one client");this.clients=e,this.owned=t}static fromEndpoints(e){let r=(typeof e=="string"?e.split(","):e).map(n=>M(B(n)));return new o(r,!0)}static fromClients(e){return new o(e,!1)}size(){return this.clients.length}next(){let e=this.clients[this.idx%this.clients.length];return this.idx++,e}destroy(){if(this.owned)for(let e of this.clients)e.destroy()}};var d=class{constructor(e){this.max=e;if(e<1)throw new Error("Semaphore max must be >= 1")}queue=[];running=0;async acquire(){if(this.running<this.max){this.running++;return}return new Promise(e=>{this.queue.push(()=>{this.running++,e()})})}release(){this.running--;let e=this.queue.shift();e&&e()}async run(e){await this.acquire();try{return await e()}finally{this.release()}}};async function R(o){let{pool:e,fromBlock:t,blockCount:r,concurrency:n=100,batchSize:s=50,withBlock:i=!1,withEvents:u=!1,onBlock:b,onError:f}=o;if(r<=0){let a=o.stats??new h;return a.start(),{stats:a}}let c=o.stats??new h,P=new d(n),C=new m(()=>e.next()),w=[];for(let a=0;a<r;a+=s){let k=[];for(let l=0;l<s&&a+l<r;l++)k.push(t+a+l);w.push(k)}return c.start(),await Promise.all(w.map(a=>P.run(async()=>{let k=performance.now();await Promise.all(a.map(async l=>{let p=null;try{p=await C.getBlock(l,{withBlock:i,withEvents:u})}catch(y){c.recordError(),f?.(y,l);return}if(!p){c.recordError();return}if(c.recordBlock({events:p.eventsCount,extrinsics:p.extrinsics.length,bytes:p.bytes}),b)try{await b(p)}catch(y){c.recordError(),f?.(y,l)}})),c.recordBatch(performance.now()-k)}))),{stats:c}}export{m as BlockFetcher,h as IndexerStats,g as RpcPool,v as SYSTEM_EVENTS_KEY,d as Semaphore,x as decodeCompactLength,R as indexBlocks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function decodeCompactLength(hex: string): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
export declare const SYSTEM_EVENTS_KEY = "0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7";
|
|
3
|
+
export interface RawBlock {
|
|
4
|
+
number: number;
|
|
5
|
+
hash: string;
|
|
6
|
+
header?: unknown;
|
|
7
|
+
extrinsics: string[];
|
|
8
|
+
eventsHex?: string;
|
|
9
|
+
eventsCount: number;
|
|
10
|
+
bytes: number;
|
|
11
|
+
}
|
|
12
|
+
export interface FetchBlockOptions {
|
|
13
|
+
withBlock?: boolean;
|
|
14
|
+
withEvents?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type BlockHandler = (block: RawBlock) => void | Promise<void>;
|
|
17
|
+
export type ClientSelector = () => PolkadotClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EvmClient } from '../evm';
|
|
2
2
|
import { MmOracleEntry } from './types';
|
|
3
3
|
export declare class MmOracleClient {
|
|
4
|
-
private
|
|
4
|
+
private adapter;
|
|
5
5
|
constructor(evm: EvmClient);
|
|
6
6
|
getData(address: string, blockTimeInSec?: number): Promise<MmOracleEntry>;
|
|
7
7
|
}
|
package/build/oracle/abi.d.ts
CHANGED
|
@@ -86,111 +86,38 @@ export declare const AGGREGATOR_V3_ABI: readonly [{
|
|
|
86
86
|
readonly type: "function";
|
|
87
87
|
}];
|
|
88
88
|
export declare const DIA_ORACLE_ABI: readonly [{
|
|
89
|
-
readonly inputs: readonly [];
|
|
90
|
-
readonly stateMutability: "nonpayable";
|
|
91
|
-
readonly type: "constructor";
|
|
92
|
-
}, {
|
|
93
89
|
readonly anonymous: false;
|
|
94
90
|
readonly inputs: readonly [{
|
|
95
91
|
readonly indexed: false;
|
|
96
|
-
readonly internalType: "string";
|
|
97
92
|
readonly name: "key";
|
|
98
93
|
readonly type: "string";
|
|
99
94
|
}, {
|
|
100
95
|
readonly indexed: false;
|
|
101
|
-
readonly internalType: "uint128";
|
|
102
96
|
readonly name: "value";
|
|
103
97
|
readonly type: "uint128";
|
|
104
98
|
}, {
|
|
105
99
|
readonly indexed: false;
|
|
106
|
-
readonly internalType: "uint128";
|
|
107
100
|
readonly name: "timestamp";
|
|
108
101
|
readonly type: "uint128";
|
|
109
102
|
}];
|
|
110
103
|
readonly name: "OracleUpdate";
|
|
111
104
|
readonly type: "event";
|
|
112
|
-
}
|
|
105
|
+
}];
|
|
106
|
+
export declare const MANAGED_ORACLE_ABI: readonly [{
|
|
113
107
|
readonly anonymous: false;
|
|
114
108
|
readonly inputs: readonly [{
|
|
115
|
-
readonly indexed:
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
118
|
-
readonly type: "address";
|
|
119
|
-
}];
|
|
120
|
-
readonly name: "UpdaterAddressChange";
|
|
121
|
-
readonly type: "event";
|
|
122
|
-
}, {
|
|
123
|
-
readonly inputs: readonly [{
|
|
124
|
-
readonly internalType: "string";
|
|
125
|
-
readonly name: "key";
|
|
126
|
-
readonly type: "string";
|
|
127
|
-
}];
|
|
128
|
-
readonly name: "getValue";
|
|
129
|
-
readonly outputs: readonly [{
|
|
130
|
-
readonly internalType: "uint128";
|
|
131
|
-
readonly name: "";
|
|
132
|
-
readonly type: "uint128";
|
|
133
|
-
}, {
|
|
134
|
-
readonly internalType: "uint128";
|
|
135
|
-
readonly name: "";
|
|
136
|
-
readonly type: "uint128";
|
|
137
|
-
}];
|
|
138
|
-
readonly stateMutability: "view";
|
|
139
|
-
readonly type: "function";
|
|
140
|
-
}, {
|
|
141
|
-
readonly inputs: readonly [{
|
|
142
|
-
readonly internalType: "string[]";
|
|
143
|
-
readonly name: "keys";
|
|
144
|
-
readonly type: "string[]";
|
|
145
|
-
}, {
|
|
146
|
-
readonly internalType: "uint256[]";
|
|
147
|
-
readonly name: "compressedValues";
|
|
148
|
-
readonly type: "uint256[]";
|
|
149
|
-
}];
|
|
150
|
-
readonly name: "setMultipleValues";
|
|
151
|
-
readonly outputs: readonly [];
|
|
152
|
-
readonly stateMutability: "nonpayable";
|
|
153
|
-
readonly type: "function";
|
|
154
|
-
}, {
|
|
155
|
-
readonly inputs: readonly [{
|
|
156
|
-
readonly internalType: "string";
|
|
157
|
-
readonly name: "key";
|
|
158
|
-
readonly type: "string";
|
|
109
|
+
readonly indexed: true;
|
|
110
|
+
readonly name: "roundId";
|
|
111
|
+
readonly type: "uint80";
|
|
159
112
|
}, {
|
|
160
|
-
readonly
|
|
161
|
-
readonly name: "
|
|
162
|
-
readonly type: "
|
|
113
|
+
readonly indexed: false;
|
|
114
|
+
readonly name: "answer";
|
|
115
|
+
readonly type: "int256";
|
|
163
116
|
}, {
|
|
164
|
-
readonly
|
|
117
|
+
readonly indexed: false;
|
|
165
118
|
readonly name: "timestamp";
|
|
166
|
-
readonly type: "uint128";
|
|
167
|
-
}];
|
|
168
|
-
readonly name: "setValue";
|
|
169
|
-
readonly outputs: readonly [];
|
|
170
|
-
readonly stateMutability: "nonpayable";
|
|
171
|
-
readonly type: "function";
|
|
172
|
-
}, {
|
|
173
|
-
readonly inputs: readonly [{
|
|
174
|
-
readonly internalType: "address";
|
|
175
|
-
readonly name: "newOracleUpdaterAddress";
|
|
176
|
-
readonly type: "address";
|
|
177
|
-
}];
|
|
178
|
-
readonly name: "updateOracleUpdaterAddress";
|
|
179
|
-
readonly outputs: readonly [];
|
|
180
|
-
readonly stateMutability: "nonpayable";
|
|
181
|
-
readonly type: "function";
|
|
182
|
-
}, {
|
|
183
|
-
readonly inputs: readonly [{
|
|
184
|
-
readonly internalType: "string";
|
|
185
|
-
readonly name: "";
|
|
186
|
-
readonly type: "string";
|
|
187
|
-
}];
|
|
188
|
-
readonly name: "values";
|
|
189
|
-
readonly outputs: readonly [{
|
|
190
|
-
readonly internalType: "uint256";
|
|
191
|
-
readonly name: "";
|
|
192
119
|
readonly type: "uint256";
|
|
193
120
|
}];
|
|
194
|
-
readonly
|
|
195
|
-
readonly type: "
|
|
121
|
+
readonly name: "PriceUpdated";
|
|
122
|
+
readonly type: "event";
|
|
196
123
|
}];
|
package/build/oracle/index.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** DIA `OracleUpdate` `key` → mmAddress that wraps that feed. */
|
|
2
|
+
export declare const DIA_MM_BY_KEY: Record<string, string>;
|
|
3
|
+
/** Wrapped Managed emitter address → hybrid mmAddress to refresh. */
|
|
4
|
+
export declare const HYBRID_MM_BY_EMITTER: Record<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
* EMA-driven hybrid refresh: `${source}:${pairA}:${pairB}:${period}` (pair
|
|
7
|
+
* sorted ascending) → hybrid mmAddress to refresh when *that exact slot*
|
|
8
|
+
* updates.
|
|
9
|
+
*
|
|
10
|
+
* - `source` is the 8-byte EmaOracle source tag as ASCII, null-trimmed.
|
|
11
|
+
* - `period` matches the hybrid contract's period byte (see ORACLE_SPEC §2.5);
|
|
12
|
+
* `update_bifrost_oracle` writes all three persisted periods on every push,
|
|
13
|
+
* so pinning the period here avoids 3× redundant refreshes per keeper call.
|
|
14
|
+
*/
|
|
15
|
+
export declare const HYBRID_MM_BY_EMA: Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Build the canonical routing key for `HYBRID_MM_BY_EMA`.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors the EmaOracle.Oracles storage key shape:
|
|
20
|
+
* - `sourceHex`: SizedHex<8> from runtime (`0x` + 16 hex chars), decoded to
|
|
21
|
+
* ASCII source tag with trailing nulls trimmed.
|
|
22
|
+
* - `pair`: sorted ascending (`[min, max]`) to match pallet normalisation.
|
|
23
|
+
* - `period`: the OraclePeriod variant name (`LastBlock` / `Short` / …).
|
|
24
|
+
*/
|
|
25
|
+
export declare function emaRouteKey(sourceHex: string, pair: ArrayLike<number>, period: string): string;
|
package/build/oracle/types.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { HydrationEvents } from '@galacticcouncil/descriptors';
|
|
2
|
+
export type TEvmPayload = HydrationEvents['EVM']['Log'];
|
|
1
3
|
export type MmOracleEntry = {
|
|
2
4
|
price: bigint;
|
|
3
5
|
decimals: number;
|
|
4
6
|
updatedAt: number;
|
|
5
7
|
};
|
|
8
|
+
export type MmOracleEvent = {
|
|
9
|
+
eventName: string;
|
|
10
|
+
/** Lowercase H160 of the contract that emitted the log. */
|
|
11
|
+
emitter: string;
|
|
12
|
+
/** Decoded `key` arg — present only for DIA `OracleUpdate`. */
|
|
13
|
+
key?: string;
|
|
14
|
+
value: bigint;
|
|
15
|
+
timestamp: bigint;
|
|
16
|
+
};
|
|
@@ -11,7 +11,6 @@ export declare class AavePoolClient extends PoolClient<PoolBase> {
|
|
|
11
11
|
getPoolFees(): Promise<PoolFees>;
|
|
12
12
|
private getReserveH160Id;
|
|
13
13
|
private parseRouterLog;
|
|
14
|
-
private parseEvmLog;
|
|
15
14
|
private subscribeRouterExecuted;
|
|
16
15
|
private subscribeEvmLog;
|
|
17
16
|
protected subscribeBalances(): Subscription;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { HydrationEvents } from '@galacticcouncil/descriptors';
|
|
2
|
-
export type TEvmPayload = HydrationEvents['EVM']['Log'];
|
|
3
|
-
export type TEvmEvent = {
|
|
4
|
-
eventName: string;
|
|
5
|
-
reserve: string;
|
|
6
|
-
key: string;
|
|
7
|
-
};
|
|
8
2
|
export type TRouterExecutedPayload = HydrationEvents['Router']['Executed'];
|
|
9
3
|
export type TRouterEvent = {
|
|
10
4
|
assetIn: number;
|
|
@@ -18,7 +18,6 @@ export declare class HsmPoolClient extends PoolClient<HsmPoolBase> {
|
|
|
18
18
|
isSupported(): Promise<boolean>;
|
|
19
19
|
loadPools(): Promise<HsmPoolBase[]>;
|
|
20
20
|
getPoolFees(): Promise<PoolFees>;
|
|
21
|
-
private parseEvmLog;
|
|
22
21
|
private subscribeEvmLog;
|
|
23
22
|
private subscribeCollateralBalance;
|
|
24
23
|
private subscribeStableswapUpdates;
|