metafab-javascript v1.5.1
metafab-javascript
MetafabJavascript - JavaScript client for metafab-javascript Complete MetaFab API references and guides can be found at: https://trymetafab.com This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.5.1
- Package version: 1.5.1
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://trymetafab.com
Installation
For Node.js
npm
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install metafab-javascript --save
Finally, you need to build the module:
npm run build
Local development
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
To use the link you just defined in your project, switch to the directory you want to use your metafab-javascript from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
Finally, you need to build the module:
npm run build
git
If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
var MetafabJavascript = require('metafab-javascript');
var api = new MetafabJavascript.ContractsApi()
var xAuthorization = game_sk_02z4Mv3c85Ig0gNowY9Dq0N2kjb1xwzr27ArLE0669RrRI6dLf822iPO26K1p1FP; // {String} The `secretKey` of the authenticating game.
var createContractRequest = new MetafabJavascript.CreateContractRequest(); // {CreateContractRequest}
api.createContract(xAuthorization, createContractRequest).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Documentation for API Endpoints
All URIs are relative to https://api.trymetafab.com
Class | Method | HTTP request | Description |
---|---|---|---|
MetafabJavascript.ContractsApi | createContract | POST /v1/contracts | Create custom contract |
MetafabJavascript.ContractsApi | getContracts | GET /v1/contracts | Get contracts |
MetafabJavascript.ContractsApi | readContract | GET /v1/contracts/{contractId}/reads | Read contract data |
MetafabJavascript.ContractsApi | transferContractOwnership | POST /v1/contracts/{contractId}/owners | Transfer contract ownership |
MetafabJavascript.ContractsApi | upgradeContractTrustedForwarder | POST /v1/contracts/{contractId}/forwarders | Upgrade contract trusted forwarder |
MetafabJavascript.ContractsApi | writeContract | POST /v1/contracts/{contractId}/writes | Write contract data |
MetafabJavascript.CurrenciesApi | batchTransferCurrency | POST /v1/currencies/{currencyId}/batchTransfers | Batch transfer currency |
MetafabJavascript.CurrenciesApi | burnCurrency | POST /v1/currencies/{currencyId}/burns | Burn currency |
MetafabJavascript.CurrenciesApi | createCurrency | POST /v1/currencies | Create currency |
MetafabJavascript.CurrenciesApi | getCurrencies | GET /v1/currencies | Get currencies |
MetafabJavascript.CurrenciesApi | getCurrencyBalance | GET /v1/currencies/{currencyId}/balances | Get currency balance |
MetafabJavascript.CurrenciesApi | getCurrencyFees | GET /v1/currencies/{currencyId}/fees | Get currency fees |
MetafabJavascript.CurrenciesApi | getCurrencyRole | GET /v1/currencies/{currencyId}/roles | Get currency role |
MetafabJavascript.CurrenciesApi | grantCurrencyRole | POST /v1/currencies/{currencyId}/roles | Grant currency role |
MetafabJavascript.CurrenciesApi | mintCurrency | POST /v1/currencies/{currencyId}/mints | Mint currency |
MetafabJavascript.CurrenciesApi | revokeCurrencyRole | DELETE /v1/currencies/{currencyId}/roles | Revoke currency role |
MetafabJavascript.CurrenciesApi | setCurrencyFees | POST /v1/currencies/{currencyId}/fees | Set currency fees |
MetafabJavascript.CurrenciesApi | transferCurrency | POST /v1/currencies/{currencyId}/transfers | Transfer currency |
MetafabJavascript.EcosystemsApi | approveEcosystemGame | POST /v1/ecosystems/{ecosystemId}/games | Approve ecosystem game |
MetafabJavascript.EcosystemsApi | authEcosystem | GET /v1/ecosystems/auth | Authenticate ecosystem |
MetafabJavascript.EcosystemsApi | authProfile | GET /v1/profiles/auth | Authenticate profile |
MetafabJavascript.EcosystemsApi | authProfilePlayer | GET /v1/profiles/{profileId}/games/{gameId}/players/auth | Authenticate profile player |
MetafabJavascript.EcosystemsApi | createEcosystem | POST /v1/ecosystems | Create ecosystem |
MetafabJavascript.EcosystemsApi | createProfile | POST /v1/profiles | Create profile |
MetafabJavascript.EcosystemsApi | createProfilePlayer | POST /v1/profiles/{profileId}/games/{gameId}/players | Create profile player |
MetafabJavascript.EcosystemsApi | getEcosystem | GET /v1/ecosystems/{ecosystemId} | Get ecosystem |
MetafabJavascript.EcosystemsApi | getEcosystemGame | GET /v1/ecosystems/{ecosystemId}/games/{gameId} | Get ecosystem game |
MetafabJavascript.EcosystemsApi | getEcosystemGames | GET /v1/ecosystems/{ecosystemId}/games | Get ecosystem games |
MetafabJavascript.EcosystemsApi | getProfileGame | GET /v1/profiles/{profileId}/games/{gameId} | Get profile game |
MetafabJavascript.EcosystemsApi | getProfileGames | GET /v1/profiles/{profileId}/games | Get profile games |
MetafabJavascript.EcosystemsApi | unapproveEcosystemGame | DELETE /v1/ecosystems/{ecosystemId}/games/{gameId} | Unapprove ecosystem game |
MetafabJavascript.EcosystemsApi | updateEcosystem | PATCH /v1/ecosystems/{ecosystemId} | Update ecosystem |
MetafabJavascript.EcosystemsApi | updateProfile | PATCH /v1/profiles/{profileId} | Update profile |
MetafabJavascript.EcosystemsApi | updateProfilePlayer | PATCH /v1/profiles/{profileId}/games/{gameId}/players/{playerId} | Update profile player |
MetafabJavascript.GamesApi | authGame | GET /v1/games/auth | Authenticate game |
MetafabJavascript.GamesApi | createGame | POST /v1/games | Create game |
MetafabJavascript.GamesApi | getGame | GET /v1/games/{gameId} | Get game |
MetafabJavascript.GamesApi | updateGame | PATCH /v1/games/{gameId} | Update game |
MetafabJavascript.ItemsApi | batchMintCollectionItems | POST /v1/collections/{collectionId}/batchMints | Batch mint collection items |
MetafabJavascript.ItemsApi | batchTransferCollectionItems | POST /v1/collections/{collectionId}/batchTransfers | Batch transfer collection items |
MetafabJavascript.ItemsApi | burnCollectionItem | POST /v1/collections/{collectionId}/items/{collectionItemId}/burns | Burn collection item |
MetafabJavascript.ItemsApi | createCollection | POST /v1/collections | Create collection |
MetafabJavascript.ItemsApi | createCollectionItem | POST /v1/collections/{collectionId}/items | Create collection item |
MetafabJavascript.ItemsApi | getCollectionApproval | GET /v1/collections/{collectionId}/approvals | Get collection approval |
MetafabJavascript.ItemsApi | getCollectionItem | GET /v1/collections/{collectionId}/items/{collectionItemId} | Get collection item |
MetafabJavascript.ItemsApi | getCollectionItemBalance | GET /v1/collections/{collectionId}/items/{collectionItemId}/balances | Get collection item balance |
MetafabJavascript.ItemsApi | getCollectionItemBalances | GET /v1/collections/{collectionId}/balances | Get collection item balances |
MetafabJavascript.ItemsApi | getCollectionItemSupplies | GET /v1/collections/{collectionId}/supplies | Get collection item supplies |
MetafabJavascript.ItemsApi | getCollectionItemSupply | GET /v1/collections/{collectionId}/items/{collectionItemId}/supplies | Get collection item supply |
MetafabJavascript.ItemsApi | getCollectionItemTimelock | GET /v1/collections/{collectionId}/items/{collectionItemId}/timelocks | Get collection item timelock |
MetafabJavascript.ItemsApi | getCollectionItems | GET /v1/collections/{collectionId}/items | Get collection items |
MetafabJavascript.ItemsApi | getCollectionRole | GET /v1/collections/{collectionId}/roles | Get collection role |
MetafabJavascript.ItemsApi | getCollections | GET /v1/collections | Get collections |
MetafabJavascript.ItemsApi | grantCollectionRole | POST /v1/collections/{collectionId}/roles | Grant collection role |
MetafabJavascript.ItemsApi | mintCollectionItem | POST /v1/collections/{collectionId}/items/{collectionItemId}/mints | Mint collection item |
MetafabJavascript.ItemsApi | revokeCollectionRole | DELETE /v1/collections/{collectionId}/roles | Revoke collection role |
MetafabJavascript.ItemsApi | setCollectionApproval | POST /v1/collections/{collectionId}/approvals | Set collection approval |
MetafabJavascript.ItemsApi | setCollectionItemTimelock | POST /v1/collections/{collectionId}/items/{collectionItemId}/timelocks | Set collection item timelock |
MetafabJavascript.ItemsApi | transferCollectionItem | POST /v1/collections/{collectionId}/items/{collectionItemId}/transfers | Transfer collection item |
MetafabJavascript.LootboxesApi | createLootboxManager | POST /v1/lootboxManagers | Create lootbox manager |
MetafabJavascript.LootboxesApi | getLootboxManagerLootbox | GET /v1/lootboxManagers/{lootboxManagerId}/lootboxes/{lootboxManagerLootboxId} | Get lootbox manager lootbox |
MetafabJavascript.LootboxesApi | getLootboxManagerLootboxes | GET /v1/lootboxManagers/{lootboxManagerId}/lootboxes | Get lootbox manager lootboxes |
MetafabJavascript.LootboxesApi | getLootboxManagers | GET /v1/lootboxManagers | Get lootbox managers |
MetafabJavascript.LootboxesApi | openLootboxManagerLootbox | POST /v1/lootboxManagers/{lootboxManagerId}/lootboxes/{lootboxManagerLootboxId}/opens | Open lootbox manager lootbox |
MetafabJavascript.LootboxesApi | removeLootboxManagerLootbox | DELETE /v1/lootboxManagers/{lootboxManagerId}/lootboxes/{lootboxManagerLootboxId} | Remove lootbox manager lootbox |
MetafabJavascript.LootboxesApi | setLootboxManagerLootbox | POST /v1/lootboxManagers/{lootboxManagerId}/lootboxes | Set lootbox manager lootbox |
MetafabJavascript.PlayersApi | authPlayer | GET /v1/players/auth | Authenticate player |
MetafabJavascript.PlayersApi | createPlayer | POST /v1/players | Create player |
MetafabJavascript.PlayersApi | getPlayer | GET /v1/players/{playerId} | Get player |
MetafabJavascript.PlayersApi | getPlayerData | GET /v1/players/{playerId}/data | Get player data |
MetafabJavascript.PlayersApi | getPlayers | GET /v1/players | Get players |
MetafabJavascript.PlayersApi | removePlayerConnectedWallet | DELETE /v1/players/{playerId}/wallets/{playerWalletId} | Remove player connected wallet |
MetafabJavascript.PlayersApi | setPlayerConnectedWallet | POST /v1/players/{playerId}/wallets | Set player connected wallet |
MetafabJavascript.PlayersApi | setPlayerData | POST /v1/players/{playerId}/data | Set player data |
MetafabJavascript.PlayersApi | updatePlayer | PATCH /v1/players/{playerId} | Update player |
MetafabJavascript.ShopsApi | createShop | POST /v1/shops | Create shop |
MetafabJavascript.ShopsApi | getShopOffer | GET /v1/shops/{shopId}/offers/{shopOfferId} | Get shop offer |
MetafabJavascript.ShopsApi | getShopOffers | GET /v1/shops/{shopId}/offers | Get shop offers |
MetafabJavascript.ShopsApi | getShops | GET /v1/shops | Get shops |
MetafabJavascript.ShopsApi | removeShopOffer | DELETE /v1/shops/{shopId}/offers/{shopOfferId} | Remove shop offer |
MetafabJavascript.ShopsApi | setShopOffer | POST /v1/shops/{shopId}/offers | Set shop offer |
MetafabJavascript.ShopsApi | useShopOffer | POST /v1/shops/{shopId}/offers/{shopOfferId}/uses | Use shop offer |
MetafabJavascript.ShopsApi | withdrawFromShop | POST /v1/shops/{shopId}/withdrawals | Withdraw from shop |
MetafabJavascript.TransactionsApi | getTransaction | GET /v1/transactions/{transactionId} | Get transaction |
MetafabJavascript.WalletsApi | createWalletSignature | POST /v1/wallets/{walletId}/signatures | Create wallet signature |
MetafabJavascript.WalletsApi | getWallet | GET /v1/wallets/{walletId} | Get wallet |
MetafabJavascript.WalletsApi | getWalletBalances | GET /v1/wallets/{walletId}/balances | Get wallet balances |
MetafabJavascript.WalletsApi | getWalletTransactions | GET /v1/wallets/{walletId}/transactions | Get wallet transactions |
Documentation for Models
- MetafabJavascript.ApproveEcosystemGameRequest
- MetafabJavascript.AuthGame200Response
- MetafabJavascript.AuthGame200ResponseAllOf
- MetafabJavascript.AuthPlayer200Response
- MetafabJavascript.AuthPlayer200ResponseAllOf
- MetafabJavascript.AuthProfile200Response
- MetafabJavascript.BatchMintCollectionItemsRequest
- MetafabJavascript.BatchTransferCollectionItemsRequest
- MetafabJavascript.BatchTransferCurrencyRequest
- MetafabJavascript.BurnCollectionItemRequest
- MetafabJavascript.BurnCurrencyRequest
- MetafabJavascript.CollectionItem
- MetafabJavascript.CollectionItemAttributesInner
- MetafabJavascript.CollectionItemAttributesInnerValue
- MetafabJavascript.CollectionModel
- MetafabJavascript.ContractModel
- MetafabJavascript.CreateCollection200Response
- MetafabJavascript.CreateCollection200ResponseAllOf
- MetafabJavascript.CreateCollection200ResponseAllOfContract
- MetafabJavascript.CreateCollection200ResponseAllOfContractAllOf
- MetafabJavascript.CreateCollectionItemRequest
- MetafabJavascript.CreateCollectionItemRequestAttributesInner
- MetafabJavascript.CreateCollectionRequest
- MetafabJavascript.CreateContractRequest
- MetafabJavascript.CreateCurrency200Response
- MetafabJavascript.CreateCurrencyRequest
- MetafabJavascript.CreateEcosystemRequest
- MetafabJavascript.CreateGameRequest
- MetafabJavascript.CreateLootboxManager200Response
- MetafabJavascript.CreateLootboxManagerRequest
- MetafabJavascript.CreatePlayerRequest
- MetafabJavascript.CreateProfilePlayerRequest
- MetafabJavascript.CreateProfileRequest
- MetafabJavascript.CreateShop200Response
- MetafabJavascript.CreateShopRequest
- MetafabJavascript.CreateWalletSignatureRequest
- MetafabJavascript.CurrencyModel
- MetafabJavascript.EcosystemGameModel
- MetafabJavascript.EcosystemModel
- MetafabJavascript.GameModel
- MetafabJavascript.GetCollections200ResponseInner
- MetafabJavascript.GetCollections200ResponseInnerAllOf
- MetafabJavascript.GetCurrencies200ResponseInner
- MetafabJavascript.GetCurrencyFees200Response
- MetafabJavascript.GetLootboxManagers200ResponseInner
- MetafabJavascript.GetPlayerData200Response
- MetafabJavascript.GetProfileGames200ResponseInner
- MetafabJavascript.GetShops200ResponseInner
- MetafabJavascript.GrantCollectionRoleRequest
- MetafabJavascript.GrantCurrencyRoleRequest
- MetafabJavascript.LootboxManagerLootbox
- MetafabJavascript.LootboxManagerModel
- MetafabJavascript.MintCollectionItemRequest
- MetafabJavascript.MintCurrencyRequest
- MetafabJavascript.PlayerModel
- MetafabJavascript.ProfileModel
- MetafabJavascript.ProfilePermissionsValue
- MetafabJavascript.PublicEcosystem
- MetafabJavascript.PublicGame
- MetafabJavascript.PublicPlayer
- MetafabJavascript.PublicPlayerCustodialWallet
- MetafabJavascript.PublicProfile
- MetafabJavascript.RemovePlayerConnectedWalletRequest
- MetafabJavascript.RevokeCollectionRoleRequest
- MetafabJavascript.SetCollectionApprovalRequest
- MetafabJavascript.SetCollectionItemTimelockRequest
- MetafabJavascript.SetCurrencyFeesRequest
- MetafabJavascript.SetLootboxManagerLootboxRequest
- MetafabJavascript.SetPlayerConnectedWallet200Response
- MetafabJavascript.SetPlayerConnectedWalletRequest
- MetafabJavascript.SetPlayerDataRequest
- MetafabJavascript.SetShopOfferRequest
- MetafabJavascript.ShopModel
- MetafabJavascript.ShopOffer
- MetafabJavascript.TransactionModel
- MetafabJavascript.TransferCollectionItemRequest
- MetafabJavascript.TransferContractOwnershipRequest
- MetafabJavascript.TransferCurrencyRequest
- MetafabJavascript.UpdateEcosystemRequest
- MetafabJavascript.UpdateGame200Response
- MetafabJavascript.UpdateGame200ResponseAllOf
- MetafabJavascript.UpdateGameRequest
- MetafabJavascript.UpdatePlayer200Response
- MetafabJavascript.UpdatePlayerRequest
- MetafabJavascript.UpdateProfilePlayer200Response
- MetafabJavascript.UpdateProfilePlayer200ResponseAllOf
- MetafabJavascript.UpdateProfilePlayerRequest
- MetafabJavascript.UpdateProfileRequest
- MetafabJavascript.UpgradeContractTrustedForwarderRequest
- MetafabJavascript.WalletModel
- MetafabJavascript.WithdrawFromShopRequest
- MetafabJavascript.WriteContractRequest
- MetafabJavascript.WriteContractRequestArgsInner
Documentation for Authorization
basicAuth
- Type: HTTP basic authentication