Skip to content

Commit

Permalink
feat: register contracts based on Arweave gql metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
asiaziola committed Nov 13, 2023
1 parent 49688e8 commit a86dea9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions src/contract/deploy/CreateContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export type EvaluationManifest = {
plugins?: WarpPluginType[];
};

export const BUNDLR_NODES = ['node1', 'node2'] as const;
export type BundlrNodeType = (typeof BUNDLR_NODES)[number];
export const REGISTER_PROVIDER = ['node1', 'node2', 'arweave'] as const;
export type RegisterProviderType = (typeof REGISTER_PROVIDER)[number];

export interface CommonContractData {
wallet: ArWallet | CustomSignature | Signer;
Expand Down Expand Up @@ -92,10 +92,12 @@ export interface CreateContract extends Source {
deployBundled(rawDataItem: Buffer): Promise<ContractDeploy>;

/**
* Registers Bundlr transaction in Warp Gateway. One needs to upload contract transaction to Bundlr and pass its id in the method along
* with {@link BundlrNodeType}. For now, only AtomicNFTs contracts are accepted (dedicated tags are verified in the gateway).
* @param id - Bunldr's id of the uploaded contract transaction
* @param bundlrNode - {@link BundlrNodeType}
* Registers contract transaction in Warp Gateway. One needs to upload contract transaction using e.g. Irys, Turbo or arbundles and pass
* its id in the method along with {@link RegisterProviderType} - 'node1' and 'node2' for contracts deployed using Irys and 'arweave'
* for contracts deployed through other providers (contracts metadata is then queried from Arweave gql).
* Contract dedicated tags are verified in the gateway.
* @param id - id of the uploaded contract transaction
* @param registerProvider - {@link RegisterProviderType}
*/
register(id: string, bundlrNode: BundlrNodeType): Promise<ContractDeploy>;
register(id: string, registerProvider: RegisterProviderType): Promise<ContractDeploy>;
}
6 changes: 3 additions & 3 deletions src/core/Warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Arweave from 'arweave';
import { Contract, InnerCallData } from '../contract/Contract';
import {
ArWallet,
BundlrNodeType,
RegisterProviderType,
ContractData,
ContractDeploy,
CreateContract,
Expand Down Expand Up @@ -117,8 +117,8 @@ export class Warp {
return await this.createContract.deployBundled(rawDataItem);
}

async register(id: string, bundlrNode: BundlrNodeType): Promise<ContractDeploy> {
return await this.createContract.register(id, bundlrNode);
async register(id: string, registerProvider: RegisterProviderType): Promise<ContractDeploy> {
return await this.createContract.register(id, registerProvider);
}

async createSource(
Expand Down

0 comments on commit a86dea9

Please sign in to comment.