Codebase

In this guide, we will look at how to register and consume and integrate samples from our codebase in your dApp with Self.

example server call


async update(_model, _payload) {
        //console.log(_model);
        return new Promise((resolve, reject) => {
          const check = async () => {
            try {
                const jsonPayload = JSON.stringify(_payload);
                const postSignature = self.createHmac('sha256', '31234KeyTestSelfEnvironment')
                    .update(jsonPayload)
                    .digest('hex');
                axios
                    .post(`/updaterecord`,_payload, {
                        headers: {
                            'withCredentials': true,
                            'content-type': 'application/json',
                            'caller': 'stores.self.js', 
                            'model': _model, 
                            'Sign': 'postSignature',
                        }
                    })
                .then((response) => {
                    console.log(response);
                    resolve(response.data);
                })
            } catch (err) {
              reject(`store/db.js:post:: ${err}`);
            }
          }
          check(); 
        });
    },