I tried with substituting your "distributor"think it is a feature with account1NodeJS. They don't go deep to reveal every detail down an object.
Note the difference at console.log: offerResult.records VS offerResult
var request = require('request');
var StellarSdk = require('stellar-sdk');
var server = new StellarSdk.Serveroffers('https://horizon-testnet.stellar'accounts', distributor.org'publicKey);
StellarSdk.Network.useTestNetworkcall();
//account1
pub1='GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT'
sec1='SB44SZ5IQCK72ELARVZ53BLSPO4NFCKH7H6ZBVGIFZ47CWLD5O2ADCOD'
kp1=StellarSdk.Keypair.fromSecretthen(sec1)
//account2
pub2='GDNICVTW44YSI7BD6XB6GKPGCO6H367XT3JUFXG3XAFW46SOVKCBMPAI'
sec2='SDIC6OCFXYLEBCJQIEDN5LN2KNVW4VZYY6FEGTIQ5CCSU7KLCPHRGIH4'
kp2=StellarSdk.Keypair.fromSecretfunction (sec2offerResult)
var distributor=new Object //just create Obj
distributor.publicKey=pub1
distributorKeyPair=kp1
{
var MCoin = new StellarSdkconsole.Assetlog('MCoin', pub1);
var XLM = StellarSdk.Asset**offerResult.native(records** );
server.loadAccount(distributor.publicKey).then(function(account}){
gives
> [ { _links: { varself: transaction[Object], =offer_maker: new[Object] StellarSdk.TransactionBuilder(account)},
id: 234710,
paging_token: '234710',
seller: .addOperation(StellarSdk.Operation.manageOffer({'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT',
selling:
{ asset_type: 'credit_alphanum12',
sellingasset_code: MCoin 'MCoin',
asset_issuer: 'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT' },
buying: { asset_type: 'native' },
buyingamount: XLM'200.0000000',
price_r: { n: 2, d: 1 },
price: '2.0000000',
amount self: '200'[Function],
offer_maker: [Function] },
{ _links: { self: [Object], offer_maker: [Object] },
priceid: 2235067,
paging_token: '235067',
seller: 'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT',
selling:
{ offerIdasset_type: 0'credit_alphanum12',
asset_code: 'MCoin',
asset_issuer: 'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT' })),
buying: { asset_type: 'native' },
amount: '200.build();0000000',
price_r: { n: transaction.sign(distributorKeyPair);
2, d: 1 },
price: //console.log(transaction.toEnvelope()'2.toXDR('base64'));
0000000',
self: server.submitTransaction(transaction)[Function],
offer_maker: [Function] } ]
WHEREAS
server.offers('accounts', distributor.publicKey).call().then(function (transactionResultofferResult) {
console.log(transactionResult **offerResult** );
})
gives
{ records:
[ { console.log('\n_links: Success!')[Object],
id: })234710,
paging_token: .catch(function(err){'234710',
seller: 'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT',
console.log('An error hasselling: occured');[Object],
buying: [Object],
amount: console'200.log(err);0000000',
})
price_r: }).catch(function(e){[Object],
price: console'2.log(e);0000000',
})
No problem spotted. Maybe could you verify if your distributor.publicKey
gives a string of publickey & distributorKeyPair
is an account object?
> distributorKeyPair
Keypair {
typeself: 'ed25519'[Function],
_secretSeed: <Buffer 79 c9 67 a8 80 95 fdoffer_maker: 11[Function] 60},
8d 73 dd 85 72{ 7b_links: b8[Object],
d2 89 47 f9 fd 90 d4id: c8235067,
2e 79 f1 59 63 eb b4paging_token: 01>'235067',
_secretKey: <Buffer 79 c9 67 a8 80 95 fd 11 60 8dseller: 73'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT',
dd 85 72 7b b8 d2 89selling: 47[Object],
f9 fd 90 d4 c8 2e 79buying: f1[Object],
59 63 eb b4 01 82 29amount: 95'200.0000000',
d1 d1 89 2d a5 1d 92price_r: 85[Object],
89 0d ff cc 50 1e ebprice: ..'2. >0000000',
_publicKey: <Buffer 82 29 95 d1 d1 89 2d a5 1d 92 85 89 0d ff cc 50 1eself: eb[Function],
76 85 f3 d8 0b a5 b5offer_maker: e4[Function] ad} 14],
8c 2bnext: 16[Function: 9a>next],
publicKeyprev: 'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT'[Function: }
>
>
>prev] distributor.publicKey
'GCBCTFOR2GES3JI5SKCYSDP7ZRIB523WQXZ5QC5FWXSK2FEMFMLJULIT'}
p.s. I am using NodeJS v7. What version are you using btw?