Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #1697
dOrgJelli opened this issue Apr 18, 2023 · 0 comments · Fixed by #1893
Closed
Tracked by #1697

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

dOrgJelli opened this issue Apr 18, 2023 · 0 comments · Fixed by #1893

Comments

@dOrgJelli
Copy link
Contributor

dOrgJelli commented Apr 18, 2023

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 */);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant