warp-contracts / warp

An implementation of the Arweave SmartWeave smart contracts protocol.
MIT License
159 stars 44 forks source link

[FEATURE] contract registration for bundled transactions created with arbundles #458

Closed wkolod closed 1 year ago

wkolod commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, we can create an Atomic Asset in the following way:

// upload to Bundlr node
const tx = await bundlr.upload(data, { tags: nftTags });

// register bundled contract on warp
const warp = WarpFactory.forMainnet().use(new DeployPlugin());
const { contractTxId } = await warp.register(tx.id, "node2"); 

It would be great to be able to do the same when creating contracts using arbundles.

Describe the solution you'd like

First, we’d create a data item containing our contract transaction & post it to Arweave:

 const signer = new ArweaveSigner(wallet);
 const dataItem = createData(JSON.stringify(data), signer, { tags: nftTags });
 await dataItem.sign(signer);
 const bundle = await bundleAndSignData([dataItem], signer);
 const transaction = await bundle.toTransaction({}, arweave, wallet);
 await arweave.transactions.sign(transaction, wallet);
 const res = await arweave.transactions.post(transaction);

Then, once the data item has been indexed in arweave gql or the parent transaction has been confirmed on arweave, we would call:

const { contractTxId } = await warp.register(dataItem.id); 

Describe alternatives you've considered

At the moment, we could also use warp.deployFromSourceTx() method, but there is a data size limit, or in the proposed solution, the user is free to put in as much data as they like.

asiaziola commented 1 year ago

solved https://github.com/warp-contracts/warp/releases/tag/v1.4.23