datai-sdk 1.0.0 → 1.0.2

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.
@@ -1,7 +1,7 @@
1
1
  import '../common/eager_offset';
2
2
  import { Bytes, Wrapped } from '../common/collections';
3
3
  import { Address, BigInt } from '../common/numbers';
4
- import * as API from '../../../API'
4
+ import * as API from '../../../../API'
5
5
 
6
6
  export namespace ethereum {
7
7
  export const call = API.ethereum.call
@@ -1,3 +1,3 @@
1
1
  import './eager_offset';
2
2
 
3
- export { typeConversion } from '../../../API';
3
+ export { typeConversion } from '../../../../API';
@@ -1,7 +1,7 @@
1
1
  import './eager_offset';
2
2
  import { ByteArray, Bytes } from './collections';
3
3
  import { typeConversion } from './conversion';
4
- import { bigInt, bigDecimal } from '../../../API'
4
+ import { bigInt, bigDecimal } from '../../../../API'
5
5
 
6
6
  export type Int8 = i64;
7
7
  export type Timestamp = i64;
@@ -20,8 +20,8 @@ export * from './common/datasource';
20
20
  export * from './common/json';
21
21
  export * from './common/numbers';
22
22
  export * from './common/value';
23
- import * as API from '../../API'
24
- export { store, crypto } from '../../API';
23
+ import * as API from '../../../API'
24
+ export { store, crypto } from '../../../API';
25
25
 
26
26
 
27
27
  // /** Host IPFS interface */
@@ -1,4 +1,4 @@
1
- import { Address, BigInt } from '../../../@graphprotocol/graph-ts'
1
+ import { Address, BigInt } from '@graphprotocol/graph-ts'
2
2
  import { Timestamp } from '../proto/google/protobuf/Timestamp'
3
3
  import { ActivePositionsResultPb } from '../proto/activePositions/ActivePositionsResultPb'
4
4
  import { TokenBalancePb } from '../proto/activePositions/TokenBalancePb'
@@ -1,4 +1,4 @@
1
- import { Address, BigInt } from '../../../@graphprotocol/graph-ts'
1
+ import { Address, BigInt } from '@graphprotocol/graph-ts'
2
2
  import { TokenBalancePb } from '../proto/activePositions/TokenBalancePb'
3
3
 
4
4
  export class TokenBalance extends TokenBalancePb {
@@ -1,4 +1,4 @@
1
- import { Entity } from '../../../@graphprotocol/graph-ts'
1
+ import { Entity } from '@graphprotocol/graph-ts'
2
2
 
3
3
  export class WatcherInput {
4
4
  position: Entity
@@ -3,7 +3,7 @@ import { WatcherResultPb } from '../proto/watcher/WatcherResultPb'
3
3
  import { Any } from '../proto/google/protobuf/Any'
4
4
  import { Host } from '@extism/as-pdk'
5
5
  import { WatcherInput } from './WatcherInput'
6
- import { Entity } from '../../../@graphprotocol/graph-ts'
6
+ import { Entity } from '@graphprotocol/graph-ts'
7
7
  import { EntityPb } from '../store/EntityPb'
8
8
 
9
9
  export namespace watcher {
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Description
2
+
3
+ This is the datai-sdk npm package which contains libraries for utilities like constants, math utilities and scripts to compile or deploy subgraphs. This SDK is a tool to be used in a context of building a projection within the Datai Network.
4
+
5
+ # Utils
6
+
7
+ This contains many utility libraries which will help developers to build their projections smoothly. To put some example, it includes some math utils like square-root, power operations or transform bytes to address.
8
+
9
+ # API
10
+
11
+ It includes classes which are used to build a projection, being useful for both subgraph and watcher.
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './utils/constants'
2
- export * from './utils/mathUtils'
3
- export * from './utils/pdk'
4
- export * from './utils/subgraphUtils'
5
- export * from './API'
1
+ export * from "./utils/constants";
2
+ export * from "./utils/mathUtils";
3
+ export * from "./utils/pdk";
4
+ export * from "./utils/subgraphUtils";
5
+ export * from "./API";
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "datai-sdk",
3
3
  "main": "index.ts",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "Datai SDK which has useful libraries to help building projections",
6
+ "scripts": {
7
+ "postinstall": "node postinstall-script.js"
8
+ },
6
9
  "dependencies": {
7
10
  "@extism/as-pdk": "^1.0.0",
8
- "as-proto": "^1.3.0",
9
- "@graphprotocol/graph-ts": "^0.34.0"
11
+ "as-proto": "^1.3.0"
10
12
  }
11
13
  }
@@ -0,0 +1,34 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ // Define the source and destination paths
5
+ const sourceFolder = path.resolve(__dirname, "@graphprotocol");
6
+ const destinationFolder = path.resolve(
7
+ __dirname,
8
+ "node_modules/@graphprotocol"
9
+ );
10
+
11
+ // Check if the source folder exists
12
+ if (!fs.existsSync(sourceFolder)) {
13
+ console.error(`Source folder "${sourceFolder}" does not exist.`);
14
+ process.exit(1);
15
+ }
16
+
17
+ // Create node_modules folder if it doesn't exist
18
+ const nodeModulesPath = path.resolve(__dirname, "node_modules");
19
+ if (!fs.existsSync(nodeModulesPath)) {
20
+ fs.mkdirSync(nodeModulesPath);
21
+ }
22
+
23
+ // Check if the destination folder already exists
24
+ if (fs.existsSync(destinationFolder)) {
25
+ console.log(
26
+ `Destination folder "${destinationFolder}" already exists. Removing it...`
27
+ );
28
+ fs.rmSync(destinationFolder, { recursive: true, force: true });
29
+ }
30
+
31
+ // Move the source folder to node_modules
32
+ fs.renameSync(sourceFolder, destinationFolder);
33
+
34
+ console.log(`Folder "${sourceFolder}" moved to "${destinationFolder}".`);
@@ -1,4 +1,4 @@
1
- import { BigDecimal, BigInt } from '../@graphprotocol/graph-ts'
1
+ import { BigDecimal, BigInt } from '@graphprotocol/graph-ts'
2
2
 
3
3
  // Zero Address
4
4
  export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'
@@ -1,4 +1,4 @@
1
- import { BigDecimal, BigInt, Bytes, Address } from '../@graphprotocol/graph-ts'
1
+ import { BigDecimal, BigInt, Bytes, Address } from '@graphprotocol/graph-ts'
2
2
  import { BD_0, BD_1 } from './constants'
3
3
 
4
4
  const MAX_DECIMALS = 77 // max decimals in decimal128 IEEE 754 standard (limitation of thegraph host)