Skip to content

Instantly share code, notes, and snippets.

View guillemcordoba's full-sized avatar

Guillem Córdoba guillemcordoba

View GitHub Profile
fn get_entry_type_index(entry_type: String) -> ExternResult<EntryDefIndex> {
match entry_type.as_str() {
"association" => Ok(EntryDefIndex::from(0)),
"encrypted_data_wrapper" => Ok(EntryDefIndex::from(1)),
"bid_commitment" => Ok(EntryDefIndex::from(2)),
"market_plan" => Ok(EntryDefIndex::from(3)),
_ => Err(crate::err("Wrong entry type")),
}
}
[[agents]]
id = "test_agent"
name = "HoloTester2"
public_address = "<PUBLIC ADDRESS>"
keystore_file = "/home/ubuntu/.config/holochain/keys/<NAME OF KEYSTORE FILE>"
[[dnas]]
id = "<APP NAME>"
file = "/home/ubuntu/app.dna.json"
#!/bin/bash
APP_NAME=$1
MODULE_NAME=$2
ENTITY_NAME=$3
ng new $APP_NAME
cd $APP_NAME
@guillemcordoba
guillemcordoba / holochain.service.ts
Last active November 11, 2018 13:13
Holochain websocket's wrapper as an Angular service (original code in https://github.com/holochain/hc-web-client)
import { Injectable } from '@angular/core';
import { Client } from 'rpc-websockets';
export const connect = url =>
new Promise((fulfill, reject) => {
const ws = new Client(url);
ws.on('open', () => {
const call = (dnaHash, zome, capability, func) => params => {
return ws.call(`${dnaHash}/${zome}/${capability}/${func}`, params);
};
@guillemcordoba
guillemcordoba / overlay.menu.ts
Created July 12, 2018 09:19
Angular generic overlay menu abstract class
import { TransactionListComponent } from './web3-transaction-list/web3-transaction-list.component';
import { Directive, ElementRef, HostListener } from '@angular/core';
import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
import { Portal } from '@angular/cdk/portal';
import { Store } from '@ngrx/store';
import { TransactionStateService } from '../services/transaction-state.service';
export abstract class OverlayMenu {
constructor(
private elementRef: ElementRef,
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install golang-go -y
RUN wget https://dist.ipfs.io/go-ipfs/v0.4.10/go-ipfs_v0.4.10_linux-386.tar.gz
RUN tar xvfz go-ipfs_v0.4.10_linux-386.tar.gz
RUN sh go-ipfs/install.sh
RUN go get -d -v github.com/holochain/holochain-proto
RUN cd $GOPATH/src/github.com/holochain/holochain-proto