oasisprotocol / sapphire-paratime

Oasis Sapphire - the confidential EVM-compatible ParaTime for the Oasis Network
https://oasisprotocol.org/sapphire
Apache License 2.0
39 stars 27 forks source link

vite packing of sapphire-ethers-v6 fails #395

Closed CedarMist closed 2 months ago

CedarMist commented 2 months ago

Discovered this while migrating dapp-sidedao to the 2.x client

error during build:
../node_modules/.pnpm/@oasisprotocol+sapphire-ethers-v6@6.0.0_ethers@6.10.0_typescript@5.3.3/node_modules/@oasisprotocol/sapphire-ethers-v6/dist/_esm/index.js (3:9): "fillOptions" is not exported by "../node_modules/.pnpm/@oasisprotocol+sapphire-paratime@1.3.2/node_modules/@oasisprotocol/sapphire-paratime/lib/esm/index.js", imported by "../node_modules/.pnpm/@oasisprotocol+sapphire-ethers-v6@6.0.0_ethers@6.10.0_typescript@5.3.3/node_modules/@oasisprotocol/sapphire-ethers-v6/dist/_esm/index.js".
file: /src/dapp-sidedao/node_modules/.pnpm/@oasisprotocol+sapphire-ethers-v6@6.0.0_ethers@6.10.0_typescript@5.3.3/node_modules/@oasisprotocol/sapphire-ethers-v6/dist/_esm/index.js:3:9

file: /src/dapp-sidedao/node_modules/.pnpm/@oasisprotocol+sapphire-ethers-v6@6.0.0_ethers@6.10.0_typescript@5.3.3/node_modules/@oasisprotocol/sapphire-ethers-v6/dist/_esm/index.js:3:9

1: // SPDX-License-Identifier: Apache-2.0 2: import { AbstractSigner, hexlify } from "ethers"; 3: import { fillOptions, isCalldataEnveloped, makeTaggedProxyObject, } from "@oasisprotocol/sapphire-paratime";

CedarMist commented 2 months ago

Adding this as a dependency seems to fix:

$ pnpm add '@oasisprotocol/sapphire-paratime@^2.x'

So, problem with peer dependency?

In package.json we have:

    "dependencies": {
        "@oasisprotocol/sapphire-paratime": "workspace:^",
        "ethers": "6.x"
    },
    "peerDependencies": {
        "@oasisprotocol/sapphire-paratime": "workspace:^",
        "ethers": "6.x",
        "typescript": ">=5.0.4"
    },
    "peerDependenciesMeta": {
        "typescript": {
            "optional": true
        },
        "@oasisprotocol/sapphire-paratime": {
            "optional": true
        }
    },

Is it the optional thing that's the problem for sapphire-paratime? So by default it will not be installed by default. So we should release a new package without the optional