Skip to content

Instantly share code, notes, and snippets.

// Card Adoption example
{
data: {
type: 'cards',
id: '@foobar/events-are-us::event-cards::emberconf-2020',
attributes: {
// no need to define templates and components if we have not changed it
// when hub instantiates this card it will traverse the "adopts" graph to get the template and components for this card
// when there is more than 1 adopted card, then you must define your card's templates and components here
// Also use similar approach as ember in terms of not having a component js, where the component is just a glimmer comnponent of the outer HTML of the template,
// Sample Ticket card
// A card can represent both its schema and its data in a single document
{
data: {
type: 'cards'
id: '@acme/ticket-tools::ticket-card:123',
attributes: {
'suggested-name': 'ticket',
'edit-template': `
Hash: 9f15c0ba888ac28f502e
Version: webpack 4.28.4
Time: 4128ms
Built at: 06/11/2019 1:17:21 PM
Asset Size Chunks Chunk Names
chunk.6883e640768ab70a156f.js 11.2 KiB app [emitted] app
chunk.883b861f92d811371f14.js 3.78 MiB vendors~app [emitted] [big] vendors~app
chunk.b03e24aebf9ba2caa9ce.js 7.27 KiB tests [emitted] tests
Entrypoint app [big] = chunk.883b861f92d811371f14.js chunk.6883e640768ab70a156f.js
Entrypoint tests = chunk.b03e24aebf9ba2caa9ce.js
const abi = require('./erc-20-abi');
const JSONAPIFactory = require('@cardstack/test-support/jsonapi-factory');
module.exports = function () {
let factory = new JSONAPIFactory();
const tokens = {
card: '0x031Dda7900C5D1B480EB84a374E6cb5b3466A15F',
dai: '0x5077696357b065D36a9564da24193ae69a7687D3',
usdt: '0x4C644e38A7F4e6017f8501dd6049591bD1B64ee1'
[
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "value",
module.exports = [
{
"constant": true,
"inputs": [],
"name": "totalAdminsMapping",
"outputs": [
{
"name": "",
"type": "uint256"
}
module.exports = {
root: true,
extends: '@cardstack/eslint-config/browser'
};
const JSONAPIFactory = require('@cardstack/test-support/jsonapi-factory');
const tokenAbi = require("../token-abi");
let factory = new JSONAPIFactory();
factory.addResource('data-sources', 'card-token')
.withAttributes({
'source-type': '@cardstack/ethereum',
params: {
branches: {
master: { jsonRpcUrl: "ws:localhost:8546" }
},
{
"data": [
{
"id": "0x99e23c2ea424ac5be9c2468b98ba9bb973aa9720",
"type": "card-token-vesting-schedules",
"attributes": {
"ethereum-address": "0x99e23C2Ea424ac5BE9C2468B98Ba9bB973aA9720",
"vesting-schedule-start-date": "1529954716",
"vesting-schedule-cliff-date": "1561490716",
"vesting-schedule-duration-sec": "31622400",
schema = await env.lookup('hub:searchers').get(env.session, 'master', 'content-types', 'sample-token-vesting-schedules');
expect(schema).to.deep.equal({
"data": {
"type": "content-types",
"id": "sample-token-vesting-schedules",
"relationships": {
"fields": {
"data": [
{
"type": "fields",