Skip to content

Support embedding wraps in JS via polywrap embed for app/ projects #1703

Closed

Description

@dOrgJelli

Manifest:

format: 0.3.0
project:
  name: uniswap-v3-js
  type: app/typescript
source:
  schema: ./schema.graphql

Schema:

#import * into UniswapV3 from "ens/uniswap.wraps.eth:v3@1.0.0"

CLI:

polywrap codegen
polywrap embed

Example: https://github.com/polywrap/toolchain/blob/origin-dev/packages/js/client-config-builder/src/bundles/embeds/async-ipfs-resolver/wrap.ts

SDK Developer (psuedo code, subject to change):
index.ts

import { Uniswap } from "./wrap";
import { embeds } from "./wrap/embeds";

import {
  ClientConfigBuilder,
  PolywrapClient
} from "@polywrap/client-js";

// create default client configuration w/ embeds
const config = new ClientConfigBuilder()
  .addDefaults()
  .addPackages(embeds)
  // configure ethereum provider?
  .build();
  
const client = new PolywrapClient(config);

// set default client
Uniswap.setDefaultClient(client);

export * from "./wrap";

App Developer:
npm install --save @polywrap/uniswap-v3-js

import { Uniswap } from "@polywrap/uniswap-v3-js";

const uniswap = new Uniswap(
  // optionally add client, if nothing then default
);

uniswap.someFunction({
  ...args
});

uniswap.someFunction({
  ...args
}/*, optional client */);

Activity

  1. added this to the golden-path milestone on Apr 18, 2023
  2. changed the title [-]Support embedding wraps in JS via `polywrap codegen` for `app/` projects[/-] [+]Support embedding wraps in JS via `polywrap embed` for `app/` projects[/+] on Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions