datai-sdk 1.0.6 → 1.1.1
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/API/v1/activePositions/ActivePositionsResult.ts +221 -3
- package/API/v1/activePositions/NftItem.ts +63 -0
- package/API/v1/activePositions/PerpPosition.ts +129 -0
- package/API/v1/activePositions/TokenBalance.ts +32 -1
- package/API/v1/activePositions/activePositions.ts +8 -1
- package/API/v1/index.ts +6 -0
- package/API/v1/proto/activePositions/activePositions/ActivePositionsResultPb.ts +159 -0
- package/API/v1/proto/activePositions/activePositions/NftItemPb.ts +71 -0
- package/API/v1/proto/activePositions/activePositions/PerpPositionPb.ts +142 -0
- package/API/v1/proto/activePositions/activePositions/PerpSide.ts +10 -0
- package/API/v1/proto/activePositions/activePositions/TokenBalancePb.ts +71 -0
- package/API/v1/proto/activePositions/google/protobuf/Timestamp.ts +48 -0
- package/API/v1/proto/watcher/WatcherInputPb.ts +121 -0
- package/API/v1/watcher/WatcherInput.ts +100 -2
- package/API/v1/watcher/watcher.ts +154 -4
- package/package.json +5 -2
- package/postinstall-script.js +4 -2
- package/@graphprotocol/graph-ts/README.md +0 -13
- package/@graphprotocol/graph-ts/chain/arweave.ts +0 -82
- package/@graphprotocol/graph-ts/chain/cosmos.ts +0 -426
- package/@graphprotocol/graph-ts/chain/ethereum.ts +0 -727
- package/@graphprotocol/graph-ts/chain/near.ts +0 -420
- package/@graphprotocol/graph-ts/chain/starknet.ts +0 -39
- package/@graphprotocol/graph-ts/common/collections.ts +0 -495
- package/@graphprotocol/graph-ts/common/conversion.ts +0 -3
- package/@graphprotocol/graph-ts/common/datasource.ts +0 -41
- package/@graphprotocol/graph-ts/common/eager_offset.ts +0 -42
- package/@graphprotocol/graph-ts/common/json.ts +0 -28
- package/@graphprotocol/graph-ts/common/numbers.ts +0 -407
- package/@graphprotocol/graph-ts/common/value.ts +0 -585
- package/@graphprotocol/graph-ts/global/global.ts +0 -4
- package/@graphprotocol/graph-ts/helper-functions.ts +0 -79
- package/@graphprotocol/graph-ts/index.ts +0 -156
- package/@graphprotocol/graph-ts/package.json +0 -3
- package/@graphprotocol/graph-ts/tsconfig.json +0 -4
- package/@graphprotocol/graph-ts/types/tsconfig.base.json +0 -3
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// Side-effect to evaluate eagerly the offset of stub AS runtime
|
|
2
|
-
import './common/eager_offset';
|
|
3
|
-
import { ByteArray, Bytes, Entity } from './common/collections';
|
|
4
|
-
import { Value } from './common/value';
|
|
5
|
-
|
|
6
|
-
// Arweave support
|
|
7
|
-
export * from './chain/arweave';
|
|
8
|
-
// Ethereum support
|
|
9
|
-
export * from './chain/ethereum';
|
|
10
|
-
// NEAR support
|
|
11
|
-
export * from './chain/near';
|
|
12
|
-
// Cosmos support
|
|
13
|
-
export * from './chain/cosmos';
|
|
14
|
-
// Starknet support
|
|
15
|
-
export * from './chain/starknet';
|
|
16
|
-
// Regular re-exports
|
|
17
|
-
export * from './common/collections';
|
|
18
|
-
export * from './common/conversion';
|
|
19
|
-
export * from './common/datasource';
|
|
20
|
-
export * from './common/json';
|
|
21
|
-
export * from './common/numbers';
|
|
22
|
-
export * from './common/value';
|
|
23
|
-
import * as API from '../../../API'
|
|
24
|
-
export { store, crypto } from '../../../API';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// /** Host IPFS interface */
|
|
28
|
-
// export declare namespace ipfs {
|
|
29
|
-
// function cat(hash: string): Bytes | null;
|
|
30
|
-
// function map(hash: string, callback: string, userData: Value, flags: string[]): void;
|
|
31
|
-
// }
|
|
32
|
-
|
|
33
|
-
// export namespace ipfs {
|
|
34
|
-
// export function mapJSON(hash: string, callback: string, userData: Value): void {
|
|
35
|
-
// ipfs.map(hash, callback, userData, ['json']);
|
|
36
|
-
// }
|
|
37
|
-
// }
|
|
38
|
-
|
|
39
|
-
// /**
|
|
40
|
-
// * Special function for ENS name lookups, not meant for general purpose use.
|
|
41
|
-
// * This function will only be useful if the graph-node instance has additional
|
|
42
|
-
// * data loaded **
|
|
43
|
-
// */
|
|
44
|
-
// export declare namespace ens {
|
|
45
|
-
// function nameByHash(hash: string): string | null;
|
|
46
|
-
// }
|
|
47
|
-
|
|
48
|
-
function format(fmt: string, args: string[]): string {
|
|
49
|
-
let out = '';
|
|
50
|
-
let argIndex = 0;
|
|
51
|
-
for (let i: i32 = 0, len: i32 = fmt.length; i < len; i++) {
|
|
52
|
-
if (
|
|
53
|
-
i < len - 1 &&
|
|
54
|
-
fmt.charCodeAt(i) == 0x7b /* '{' */ &&
|
|
55
|
-
fmt.charCodeAt(i + 1) == 0x7d /* '}' */
|
|
56
|
-
) {
|
|
57
|
-
if (argIndex >= args.length) {
|
|
58
|
-
throw new Error('Too few arguments for format string: ' + fmt);
|
|
59
|
-
} else {
|
|
60
|
-
out += args[argIndex++];
|
|
61
|
-
i++;
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
out += fmt.charAt(i);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export namespace log {
|
|
71
|
-
export const log = API.log.log;
|
|
72
|
-
|
|
73
|
-
export enum Level {
|
|
74
|
-
CRITICAL = 0,
|
|
75
|
-
ERROR = 1,
|
|
76
|
-
WARNING = 2,
|
|
77
|
-
INFO = 3,
|
|
78
|
-
DEBUG = 4,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Logs a critical message that terminates the subgraph.
|
|
83
|
-
*
|
|
84
|
-
* @param msg Format string a la "Value = {}, other = {}".
|
|
85
|
-
* @param args Format string arguments.
|
|
86
|
-
*/
|
|
87
|
-
export function critical(msg: string, args: Array<string>): void {
|
|
88
|
-
log(Level.CRITICAL, format(msg, args));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Logs an error message.
|
|
93
|
-
*
|
|
94
|
-
* @param msg Format string a la "Value = {}, other = {}".
|
|
95
|
-
* @param args Format string arguments.
|
|
96
|
-
*/
|
|
97
|
-
export function error(msg: string, args: Array<string>): void {
|
|
98
|
-
log(Level.ERROR, format(msg, args));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/** Logs a warning message.
|
|
102
|
-
*
|
|
103
|
-
* @param msg Format string a la "Value = {}, other = {}".
|
|
104
|
-
* @param args Format string arguments.
|
|
105
|
-
*/
|
|
106
|
-
export function warning(msg: string, args: Array<string>): void {
|
|
107
|
-
log(Level.WARNING, format(msg, args));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/** Logs an info message.
|
|
111
|
-
*
|
|
112
|
-
* @param msg Format string a la "Value = {}, other = {}".
|
|
113
|
-
* @param args Format string arguments.
|
|
114
|
-
*/
|
|
115
|
-
export function info(msg: string, args: Array<string>): void {
|
|
116
|
-
log(Level.INFO, format(msg, args));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** Logs a debug message.
|
|
120
|
-
*
|
|
121
|
-
* @param msg Format string a la "Value = {}, other = {}".
|
|
122
|
-
* @param args Format string arguments.
|
|
123
|
-
*/
|
|
124
|
-
export function debug(msg: string, args: Array<string>): void {
|
|
125
|
-
log(Level.DEBUG, format(msg, args));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Helper functions for Ethereum.
|
|
131
|
-
*/
|
|
132
|
-
export namespace EthereumUtils {
|
|
133
|
-
/**
|
|
134
|
-
* Returns the contract address that would result from the given CREATE2 call.
|
|
135
|
-
* @param from The Ethereum address of the account that is initiating the contract creation.
|
|
136
|
-
* @param salt A 32-byte value that is used to create a deterministic address for the contract. This can be any arbitrary value, but it should be unique to the contract being created.
|
|
137
|
-
* @param initCodeHash he compiled code that will be executed when the contract is created. This should be a hex-encoded string that represents the compiled bytecode.
|
|
138
|
-
* @returns Address of the contract that would be created.
|
|
139
|
-
*/
|
|
140
|
-
export function getCreate2Address(from: Bytes, salt: Bytes, initCodeHash: Bytes): Bytes {
|
|
141
|
-
return Bytes.fromHexString(
|
|
142
|
-
Bytes.fromByteArray(
|
|
143
|
-
API.crypto.keccak256(
|
|
144
|
-
Bytes.fromHexString(
|
|
145
|
-
'0xff' +
|
|
146
|
-
from.toHexString().slice(2) +
|
|
147
|
-
salt.toHexString().slice(2) +
|
|
148
|
-
initCodeHash.toHexString().slice(2),
|
|
149
|
-
),
|
|
150
|
-
),
|
|
151
|
-
)
|
|
152
|
-
.toHexString()
|
|
153
|
-
.slice(26),
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|