mp-bucket
v1.0.5
Published
Easy to use library for Moneypot's bucket api.
Downloads
6
Readme
mp-bucket
Easy to use library for Moneypot's bucket api.
npm install mp-bucket --save
Usage:
const mp_bucket = require('mp-bucket');
mp_bucket.listBuckets({
params: {
auth_id: "Auth_ID_of_the_user_performing_the_request",
app_secret: process.env.APP_SECRET || "your_app_secret"
}
}, (err, res) => {
if(err){
console.error("Error:", err);
}else{
console.log("Res:", JSON.stringify(res));
}
});
mp_bucket.createBucket({
params: {
auth_id: "Auth_ID_of_the_user_performing_the_request",
app_secret: process.env.APP_SECRET || "your_app_secret"
},
fields: {
bucket_name: "my_bucket_name",
bucket_type: "strict", // Available types: ['closed', 'open', 'strict']
coin: "btc"
}
}, (err, res) => {
if(err){
console.error("Error:", err);
}else{
console.log("Res:", JSON.stringify(res));
}
});
Methods
listBuckets
: List all available buckets for the Auth. If not an app owner, closed buckets will NOT be listed.bucketInfo
: Get information about a single bucket.createBucket
: Create a bucket based on provided criteria.destroyBucket
: Destroy a bucket based on provided criteria. (Cannot be undone)creditBucket
: Create a credit transaction based on provided criteria. Credit transactions transfer funds into a bucket from the available auth balance of the specified user based on the coin type.debitBucket
: Create a debit transaction based on provided criteria. Debit transactions transfer funds from a bucket to the auth balance of the specified user based on the coin type.txInfo
: Get information about a specified transaction.
Bucket Types permissions
| Types | Owner Auth | Player Auth | |:----------:|:------------------------------------:|:------------------------------------:| | closed | Create, View, Destroy, Credit, Debit | | | open | Create, View, Destroy, Credit, Debit | Create, View, Destroy, Credit, Debit | | strict | Create, View, Destroy, Credit, Debit | View, Credit |