Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphprotocol/graph-ts

Package Overview
Dependencies
Maintainers
2
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphprotocol/graph-ts - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

51

index.ts

@@ -5,3 +5,3 @@ /**

export declare namespace store {
function get(entity: String, id: string): Entity | null
function get(entity: string, id: string): Entity | null
function set(entity: string, id: string, data: Entity): void

@@ -18,3 +18,3 @@ function remove(entity: string, id: string): void

export declare namespace ipfs {
function cat(hash: String): Bytes
function cat(hash: string): Bytes
}

@@ -42,3 +42,3 @@

function bigIntToHex(bigInt: Uint8Array): string
function stringToH160(s: String): Bytes
function stringToH160(s: string): Bytes

@@ -50,2 +50,11 @@ //// Primitive to/from ethereum 256-bit number conversions.

/** Host interface for BigInt arithmetic */
declare namespace bigInt {
function plus(x: BigInt, y: BigInt): BigInt
function minus(x: BigInt, y: BigInt): BigInt
function times(x: BigInt, y: BigInt): BigInt
function dividedBy(x: BigInt, y: BigInt): BigInt
function mod(x: BigInt, y: BigInt): BigInt
}
/**

@@ -147,2 +156,27 @@ * TypedMap entry.

}
@operator('+')
plus(other: BigInt): BigInt {
return bigInt.plus(this, other)
}
@operator('-')
minus(other: BigInt): BigInt {
return bigInt.minus(this, other)
}
@operator('*')
times(other: BigInt): BigInt {
return bigInt.times(this, other)
}
@operator('/')
div(other: BigInt): BigInt {
return bigInt.dividedBy(this, other)
}
@operator('%')
mod(other: BigInt): BigInt {
return bigInt.mod(this, other)
}
}

@@ -669,2 +703,3 @@

totalDifficulty: BigInt
size: BigInt | null
}

@@ -677,5 +712,8 @@

hash: Bytes
blockHash: Bytes
blockNumber: BigInt
index: BigInt
from: Address
to: Address | null
value: BigInt
gasUsed: BigInt
gasPrice: BigInt
}

@@ -688,2 +726,5 @@

address: Address
logIndex: BigInt
transactionLogIndex: BigInt
logType: string | null
block: EthereumBlock

@@ -690,0 +731,0 @@ transaction: EthereumTransaction

2

package.json
{
"name": "@graphprotocol/graph-ts",
"description": "TypeScript/AssemblyScript library for writing subgraph mappings for The Graph",
"version": "0.4.0",
"version": "0.4.1",
"module": "index.ts",

@@ -6,0 +6,0 @@ "types": "index.ts",

@@ -31,20 +31,21 @@ # The Graph TypeScript Library (graph-ts)

```typescript
import { store, crypto, Entity } from '@graphprotocol/graph-ts'
import { store, crypto } from '@graphprotocol/graph-ts'
// This is just an example event type generated by `graph-cli`
// from an Ethereum smart contract ABI
import { NameRegistered } from './abis/SomeContract'
import { NameRegistered } from './types/abis/SomeContract'
// This is an example of an entity type generated from a
// subgraph's GraphQL schema
import { Domain } from './types/schema'
function handleNameRegistered(event: NameRegistered) {
let name = event.params.name
let owner = event.params.owner
// Example use of a crypto function
let id = crypto.keccak256(name).toHex()
// Example use of the `Entity` class
let entity = new Entity()
entity.setString('id', id)
entity.setBytes('name', name)
entity.setAddress('owner', address)
// Example use of the generated `Entry` class
let domain = new Domain()
domain.name = name
domain.owner = event.params.owner
domain.timeRegistered = event.block.timestamp

@@ -51,0 +52,0 @@ // Example use of the store API

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc