Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
This package is for client applications to connect and work with the OASIS API Various oasis-api functions and services can be accessed with this API such as Authentication, Karma, Avatars.
Each function call you make returns a promise of an object which is in this form:
{error: boolean, data: object}
.
object values error: true when response from api fails data: response gotten from server.
To get started with this package run
npm install oasis-api
This installs the package to your project. To use it in the Application, it can be imported by
import oasis from "oasis-api"
The Auth class handles the authentication of the oasis-api. It can be imported by:
import { Auth } from "oasis-api"
To login use this code:
import { Auth } from "oasis-api";
const oasisAuth = new Auth();
oasisAuth.login({
username: "email@test.com",
password: "testpass",
}).then((res)=>{
if(res.error){
// Error
}
else // No error
}).catch((err)=>{
console.log(err)
})
For signup, use this code snippet:
import { Auth } from "oasis-api";
const oasisAuth = new Auth();
const data = await OasisAuth.signup({
firstName: "test",
lastName: "test",
email: "test@email.com",
password: "test",
confirmPassword: "test",
acceptTerms: true,
avatarType: "User",
title: "Mr",
});
This logs a user out and revokes his token
import { Auth } from "oasis-api";
const oasisAuth = new Auth();
const data = await OasisAuth.logout();
import { Auth } from "oasis-api";
const oasisAuth = new Auth();
const data = await OasisAuth.forgotPassword({ email: "test@test.com" });
This function is used when trying to get a currently logged in user. Code snippet:
import { Auth } from "oasis-api";
const oasisAuth = new Auth();
const data = await OasisAuth.getUser();
This class manages a user's avatar from adding Karma, deleting and updating avatar, etc,
import { Avatar } from "oasis-api"
This function gets an avatar when its ID is provided
import { Avatar } from "oasis-api";
const avatar = new Avatar();
const res = await avatar.get();
This function returns all registered avatars
import { Avatar } from "oasis-api";
const avatar = new Avatar();
const res = await avatar.getAll();
This updates the avatar with the given ID. User must be logged in & authenticated for this method to work.
avatar.update(data, id).then(()=>{
//pass
}).catch((err)=>{
// pass
})
the parameter data should be of this shape
"title": "string",
"firstName": "string",
"lastName": "string",
"avatarType": "string",
"email": "user@example.com",
"password": "string",
"confirmPassword": "string"
}
This updates the avatar with the given ID. User must be logged in & authenticated for this method to work.
avatar.delete(id).then(()=>{
//pass
}).catch((err)=>{
// pass
})
Adds karma to avatar. User must be logged in & authenticated for this method to work.
avatar.addKarma(id, data).then(()=>{
//pass
}).catch((err)=>{
// pass
})
params id: Avatar id data schema
"karmaType": "string",
"karmaSourceType": "string",
"karamSourceTitle": "string",
"karmaSourceDesc": "string"
}
Removes karma to avatar. User must be logged in & authenticated for this method to work.
avatar.removeKarma(id, data).then(()=>{
//pass
}).catch((err)=>{
// pass
})
params id: Avatar id data schema
"karmaType": "string",
"karmaSourceType": "string",
"karamSourceTitle": "string",
"karmaSourceDesc": "string"
}
Load's a holon data object for the given id.
const data = new oasis.Data()
data.loadHolon(id).then(()=>{
//pass
}).catch((err)=>{
// pass
})
params id: Holon id
Load's all holon data object for the given id.
const data = new oasis.Data()
data.loadAllHolons().then(()=>{
//pass
}).catch((err)=>{
// pass
})
saves holon data object.
const data = new oasis.Data()
data.saveHolon(data).then(()=>{
//pass
}).catch((err)=>{
// pass
})
deletes a holon data object for the given id.
const data = new oasis.Data()
data.deleteHolon(id).then(()=>{
//pass
}).catch((err)=>{
// pass
})
params id: Holon id
gets karma value of an avatar
const karma = new oasis.Karma()
karma.getKarmaForAvatar(id).then(()=>{
//pass
}).catch((err)=>{
// pass
})
params id: Avatar id
removes karma value of an avatar
const karma = new oasis.Karma()
karma.getKarmaForAvatar(id, data).then(()=>{
//pass
}).catch((err)=>{
// pass
})
params id: Avatar id data schema:
const data={
karmaType: string,
karmaSourceType: string,
karamSourceTitle: string,
karmaSourceDesc: string,
}
oasis.Karma.getKarmaAkashicRecordsForAvatar(id)
params
id: Avatar id
oasis.Holochain.getHolochainAgentIdForAvatar(id)
params
id: holochain id
oasis.Holochain.getHolochainAgentPrivateKeyForAvatar(id)
params
id: avatar id
oasis.Holochain.getAvatarIdForHolochainAgentId(id)
params
id: agent id
oasis.Holochain.getHoloFuelBalanceForAgentId(id)
params
id: agent id
oasis.Holochain.getHoloFuelBalanceForAvatar(id)
params
id: avatar id
oasis.Holochain.getHoloFuelBalanceForAvatar(data)
params
data schema: {agentId: string, avatarId: string}
oasis.NFT.createPurchase(data)
params
data schema
nftProvider: number,
solanaExchange: {
fromAccount: {
publicKey: string,
},
toAccount: {
publicKey: string,
},
memoText: string,
amount: number,
mintAccount: {
publicKey: string,
},
},
cargoExchange: {
saleId: string,
},
}
oasis.NFT.createPurchase(count, couponCode)
oasis.NFT.purchaseOLAND(data)
params
data schema
{
olandId: "",
avatarId: "",
avatarUsername: "",
tiles: "",
walletAddress: "",
cargoSaleId: "",
}
oasis.Solana.mint(data)
oasis.Solana.exchange(data)
params
data schema
{
fromAccount: {
publicKey: "",
},
toAccount: {
publicKey: "",
},
memoText: "",
amount: 0,
mintAccount: {
publicKey: "",
},
}
FAQs
A JavaScript proxy for the WEB4 OASIS API. To be used only in the browser.
The npm package oasis-api receives a total of 2 weekly downloads. As such, oasis-api popularity was classified as not popular.
We found that oasis-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.